From d21e7e70087e119ef560d2ca03c82fa93f769aa0 Mon Sep 17 00:00:00 2001 From: Sara Itani Date: Mon, 6 Mar 2017 11:07:05 -0800 Subject: [PATCH] Fix qualified name resolution --- src/TolerantDefinitionResolver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TolerantDefinitionResolver.php b/src/TolerantDefinitionResolver.php index a9e51f4..e227ed1 100644 --- a/src/TolerantDefinitionResolver.php +++ b/src/TolerantDefinitionResolver.php @@ -251,7 +251,7 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface // TODO all name tokens should be a part of a node if ($node instanceof Tolerant\Node\QualifiedName) { // For extends, implements, type hints and classes of classes of static calls use the name directly - $name = (string)$node->getResolvedName() ?? $node->getText(); + $name = (string)($node->getResolvedName() ?? $node->getText()); if (($useClause = $node->getFirstAncestor(Tolerant\Node\NamespaceUseGroupClause::class, Tolerant\Node\Statement\NamespaceUseDeclaration::class)) !== null) { if ($useClause instanceof Tolerant\Node\NamespaceUseGroupClause) { $prefix = $useClause->parent->parent->namespaceName; @@ -269,7 +269,7 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface } } - if ($node->getFirstAncestor(Tolerant\Node\Expression\CallExpression::class) !== null) { + if ($node->parent instanceof Tolerant\Node\Expression\CallExpression) { $name .= '()'; } // does this work for function calls?