Fix existing tests
parent
d66cc763bc
commit
8f30819a17
|
@ -56,19 +56,16 @@ class CompletionProvider
|
|||
|| $node instanceof Node\Expr\StaticPropertyFetch
|
||||
|| $node instanceof Node\Expr\ClassConstFetch
|
||||
) {
|
||||
$nodeToResolve = $node;
|
||||
if (!is_string($node->name)) {
|
||||
// If the name is an Error node, just filter by the class
|
||||
if ($node instanceof Node\Expr\MethodCall || $node instanceof Node\Expr\PropertyFetch) {
|
||||
$nodeToResolve = $node->var;
|
||||
} else {
|
||||
$nodeToResolve = $node->class;
|
||||
}
|
||||
}
|
||||
// For instances, resolve the variable type
|
||||
$prefixes = DefinitionResolver::getFqnsFromType(
|
||||
$this->definitionResolver->resolveExpressionNodeToType($nodeToResolve)
|
||||
$this->definitionResolver->resolveExpressionNodeToType($node->var)
|
||||
);
|
||||
if (!is_string($node->name)) {
|
||||
} else {
|
||||
$prefixes = [is_string($node->class) ? $node->class : ''];
|
||||
}
|
||||
// If we are just filtering by the class, add the appropiate operator to the prefix
|
||||
// to filter the type of symbol
|
||||
foreach ($prefixes as &$prefix) {
|
||||
|
@ -80,7 +77,10 @@ class CompletionProvider
|
|||
$prefix .= '::$';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$prefixes = [$this->definitionResolver->resolveReferenceNodeToFqn($node)];
|
||||
}
|
||||
|
||||
foreach ($this->project->getDefinitions() as $fqn => $def) {
|
||||
foreach ($prefixes as $prefix) {
|
||||
if (substr($fqn, 0, strlen($prefix)) === $prefix && !$def->isGlobal) {
|
||||
|
|
Loading…
Reference in New Issue