mirror of
https://github.com/rectorphp/rector.git
synced 2025-03-14 04:19:44 +01:00
NodeTypeResolver - misc detail fixes
This commit is contained in:
parent
7231bfdc1a
commit
d11887436d
@ -98,13 +98,8 @@ final class AssignTypeResolver implements PerNodeTypeResolverInterface, NodeType
|
||||
return $this->processAssignVariableNode($assignNode);
|
||||
}
|
||||
|
||||
// $var = $this->someMethod();
|
||||
if ($assignNode->expr instanceof MethodCall) {
|
||||
return $this->nodeTypeResolver->resolve($assignNode->expr);
|
||||
}
|
||||
|
||||
// $var = new (...);
|
||||
if ($assignNode->expr instanceof New_) {
|
||||
// $var = $this->someMethod(); || $var = new (...);
|
||||
if ($assignNode->expr instanceof MethodCall || $assignNode->expr instanceof New_) {
|
||||
return $this->nodeTypeResolver->resolve($assignNode->expr);
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace Rector\NodeTypeResolver\PerNodeTypeResolver;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use Rector\Node\Attribute;
|
||||
use Rector\NodeTypeResolver\Contract\NodeTypeResolverAwareInterface;
|
||||
@ -60,6 +61,10 @@ final class VariableTypeResolver implements PerNodeTypeResolverInterface, NodeTy
|
||||
return $variableTypes;
|
||||
}
|
||||
|
||||
if ($variableNode->getAttribute(Attribute::PARENT_NODE) instanceof Assign) {
|
||||
return $this->nodeTypeResolver->resolve($variableNode->getAttribute(Attribute::PARENT_NODE));
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user