mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-20 23:41:57 +02:00
fix name resolution for variable in static call
This commit is contained in:
parent
874b27f5b2
commit
cb9f3336a5
@ -6,6 +6,8 @@ use Nette\Utils\Strings;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Empty_;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\Param;
|
||||
@ -128,6 +130,14 @@ final class NameResolver
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($node instanceof Variable) {
|
||||
$parentNode = $node->getAttribute(Attribute::PARENT_NODE);
|
||||
// is $variable::method(), unable to resolve $variable->class name
|
||||
if ($parentNode instanceof StaticCall) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return (string) $node->name;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user