1
0
Fork 0

include traits and interfaces when retrieving fqn

pull/357/head
Sara Itani 2017-04-10 12:42:49 -07:00
parent 651e6be08a
commit 21cee77624
1 changed files with 4 additions and 2 deletions

View File

@ -1095,7 +1095,7 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
// } // }
else if ($node instanceof Tolerant\Node\MethodDeclaration) { else if ($node instanceof Tolerant\Node\MethodDeclaration) {
// Class method: use ClassName->methodName() as name // Class method: use ClassName->methodName() as name
$class = $node->getFirstAncestor(Tolerant\Node\Statement\ClassDeclaration::class); $class = $node->getFirstAncestor(Tolerant\Node\Statement\ClassDeclaration::class, Tolerant\Node\Statement\TraitDeclaration::class, Tolerant\Node\Statement\InterfaceDeclaration::class);
if (!isset($class->name)) { if (!isset($class->name)) {
// Ignore anonymous classes // Ignore anonymous classes
return null; return null;
@ -1116,7 +1116,9 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
else if ( else if (
$node instanceof Tolerant\Node\Expression\Variable && $node instanceof Tolerant\Node\Expression\Variable &&
($propertyDeclaration = $node->getFirstAncestor(Tolerant\Node\PropertyDeclaration::class)) !== null && ($propertyDeclaration = $node->getFirstAncestor(Tolerant\Node\PropertyDeclaration::class)) !== null &&
($classDeclaration = $node->getFirstAncestor(Tolerant\Node\Statement\ClassDeclaration::class)) !== null) ($classDeclaration =
$node->getFirstAncestor(Tolerant\Node\Statement\ClassDeclaration::class, Tolerant\Node\Statement\InterfaceDeclaration::class, Tolerant\Node\Statement\TraitDeclaration::class)
) !== null)
{ {
if ($propertyDeclaration->isStatic()) { if ($propertyDeclaration->isStatic()) {
// Static Property: use ClassName::$propertyName as name // Static Property: use ClassName::$propertyName as name