fix name resolution for variable in static call

This commit is contained in:
Tomas Votruba 2019-01-26 01:47:56 +01:00
parent 874b27f5b2
commit cb9f3336a5

View File

@ -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;
}
}