Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Rector\Tests\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector\Fixture;

use DateTime;
use stdClass;

final class SkipNativeWithDocblockUnion
{
private $property;

public function run1()
{
$this->property = new stdClass;
}

/**
* @param stdClass|DateTime $property
*/
public function run2($property)
{
$this->property = $property;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ private function getAssignedExprTypes(ClassLike $classLike, string $propertyName
}

if ($this->exprAnalyzer->isNonTypedFromParam($node->expr)) {
return null;
$assignedExprTypes = [];
return NodeTraverser::STOP_TRAVERSAL;
}

$assignedExprTypes[] = $this->resolveExprStaticTypeIncludingDimFetch($node);
Expand Down