1
0
Fork 0

fix trait use and scoped call expressions

pull/357/head
Sara Itani 2017-04-20 01:33:45 -07:00
parent 223a2eac6c
commit ed6469219a
2 changed files with 11 additions and 1 deletions

View File

@ -294,6 +294,10 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
private function resolveQualifiedNameNodeToFqn(Tolerant\Node\QualifiedName $node) { private function resolveQualifiedNameNodeToFqn(Tolerant\Node\QualifiedName $node) {
$parent = $node->parent; $parent = $node->parent;
if ($parent instanceof Tolerant\Node\TraitSelectOrAliasClause) {
return null;
}
// Add use clause references // Add use clause references
if (($useClause = $parent) instanceof Tolerant\Node\NamespaceUseGroupClause if (($useClause = $parent) instanceof Tolerant\Node\NamespaceUseGroupClause
|| $useClause instanceof Tolerant\Node\NamespaceUseClause || $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 // For extends, implements, type hints and classes of classes of static calls use the name directly
$name = (string) ($node->getResolvedName() ?? $node->getNamespacedName()); $name = (string) ($node->getResolvedName() ?? $node->getNamespacedName());
if ($node->parent instanceof Tolerant\Node\Expression\CallExpression) { if ($node->parent instanceof Tolerant\Node\Expression\CallExpression) {
$name .= '()'; $name .= '()';
} }
@ -433,6 +437,9 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
$className = $scoped->scopeResolutionQualifier->getResolvedName(); $className = $scoped->scopeResolutionQualifier->getResolvedName();
} }
if ($scoped->memberName instanceof Tolerant\Node\Expression\Variable) { if ($scoped->memberName instanceof Tolerant\Node\Expression\Variable) {
if ($scoped->parent instanceof Tolerant\Node\Expression\CallExpression) {
return null;
}
$memberName = $scoped->memberName->getName(); $memberName = $scoped->memberName->getName();
if (empty($memberName)) { if (empty($memberName)) {
return null; return null;

View File

@ -0,0 +1,3 @@
<?php
A::$a();