src/CompletionProvider.php
private function getCompletionsForAliases(
        string $prefix,
        array $aliases,
        bool $requireCanBeInstantiated
    ): \Generator {
        foreach ($aliases as $alias => $aliasFqn) {
            if (!nameStartsWith($alias, $prefix)) {
                continue;
            }
            $definition = $this->index->getDefinition((string)$aliasFqn);
            if ($definition) {
                if ($requireCanBeInstantiated && !$definition->canBeInstantiated) {
                    continue;
                }
                $completionItem = CompletionItemFactory::fromDefinition($definition);
                $completionItem->insertText = $alias;
                yield (string)$aliasFqn => $completionItem;
            }
        }
    }
private function getCompletionsForAliases(
        string $prefix,
        array $aliases,
        bool $requireCanBeInstantiated
    ): \Generator {
        foreach ($aliases as $alias => $aliasFqn) {
            if (!nameStartsWith($alias, $prefix)) {
                continue;
            }
            $definition = $this->index->getDefinition((string)$aliasFqn);
            if ($definition) {
                if ($requireCanBeInstantiated && !$definition->canBeInstantiated) {
                    continue;
                }
                $completionItem = CompletionItemFactory::fromDefinition($definition);
                $completionItem->insertText = $alias;
                yield (string)$aliasFqn => $completionItem;
            }
        }
    }
private function getCompletionsForAliases ( string $ prefix , array $ aliases , bool $ requireCanBeInstantiated ) : \ Generator { foreach ( $ aliases as $ alias => $ aliasFqn ) { if ( ! nameStartsWith ( $ alias , $ prefix ) ) { continue ; } $ definition = $ this -> index -> getDefinition ( ( string ) $ aliasFqn ) ; if ( $ definition ) { if ( $ requireCanBeInstantiated && ! $ definition -> canBeInstantiated ) { continue ; } $ completionItem = CompletionItemFactory :: fromDefinition ( $ definition ) ; $ completionItem -> insertText = $ alias ; yield ( string ) $ aliasFqn => $ completionItem ; } } }
Gets completions for non-qualified names matching the start of an used class, function, or constant.

@param string $prefix Non-qualified name being completed for
@param QualifiedName[] $aliases Array of alias FQNs indexed by the alias.
@return \Generator|CompletionItem[]
Yields CompletionItems.
Gets completions for non - qualified names matching the start of an used class function or constant .