From ed6469219a7a247a8c6bf33b514fc81352f655ea Mon Sep 17 00:00:00 2001 From: Sara Itani Date: Thu, 20 Apr 2017 01:33:45 -0700 Subject: [PATCH] fix trait use and scoped call expressions --- src/TolerantDefinitionResolver.php | 9 ++++++++- validation/frameworks/broken/scopedPropertyAccess4.php | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 validation/frameworks/broken/scopedPropertyAccess4.php diff --git a/src/TolerantDefinitionResolver.php b/src/TolerantDefinitionResolver.php index f9fc341..6f1e1ca 100644 --- a/src/TolerantDefinitionResolver.php +++ b/src/TolerantDefinitionResolver.php @@ -294,6 +294,10 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface private function resolveQualifiedNameNodeToFqn(Tolerant\Node\QualifiedName $node) { $parent = $node->parent; + + if ($parent instanceof Tolerant\Node\TraitSelectOrAliasClause) { + return null; + } // Add use clause references if (($useClause = $parent) instanceof Tolerant\Node\NamespaceUseGroupClause || $useClause instanceof Tolerant\Node\NamespaceUseClause @@ -327,7 +331,7 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface // For extends, implements, type hints and classes of classes of static calls use the name directly $name = (string) ($node->getResolvedName() ?? $node->getNamespacedName()); - + if ($node->parent instanceof Tolerant\Node\Expression\CallExpression) { $name .= '()'; } @@ -433,6 +437,9 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface $className = $scoped->scopeResolutionQualifier->getResolvedName(); } if ($scoped->memberName instanceof Tolerant\Node\Expression\Variable) { + if ($scoped->parent instanceof Tolerant\Node\Expression\CallExpression) { + return null; + } $memberName = $scoped->memberName->getName(); if (empty($memberName)) { return null; diff --git a/validation/frameworks/broken/scopedPropertyAccess4.php b/validation/frameworks/broken/scopedPropertyAccess4.php new file mode 100644 index 0000000..c3d7633 --- /dev/null +++ b/validation/frameworks/broken/scopedPropertyAccess4.php @@ -0,0 +1,3 @@ +