src/CompletionProvider.php
private function getCompletionsFromAliasedNamespace(
        string $prefix,
        string $alias,
        string $aliasFqn,
        bool $requireCanBeInstantiated
    ): \Generator {
        $prefixFirstPart = nameGetFirstPart($prefix);
        // Matched alias.
        $resolvedPrefix = nameConcat($aliasFqn, nameWithoutFirstPart($prefix));
        $completionItems = $this->getCompletionsForFqnPrefix(
            $resolvedPrefix,
            $requireCanBeInstantiated,
            false
        );
        // Convert FQNs in the CompletionItems so they are expressed in terms of the alias.
        foreach ($completionItems as $fqn => $completionItem) {
            /** @var string $fqn with the leading parts determined by the alias removed. Has the leading backslash. */
            $nameWithoutAliasedPart = substr($fqn, strlen($aliasFqn));
            $completionItem->insertText = $alias . $nameWithoutAliasedPart;
            yield $fqn => $completionItem;
        }
    }
private function getCompletionsFromAliasedNamespace(
        string $prefix,
        string $alias,
        string $aliasFqn,
        bool $requireCanBeInstantiated
    ): \Generator {
        $prefixFirstPart = nameGetFirstPart($prefix);
        // Matched alias.
        $resolvedPrefix = nameConcat($aliasFqn, nameWithoutFirstPart($prefix));
        $completionItems = $this->getCompletionsForFqnPrefix(
            $resolvedPrefix,
            $requireCanBeInstantiated,
            false
        );
        // Convert FQNs in the CompletionItems so they are expressed in terms of the alias.
        foreach ($completionItems as $fqn => $completionItem) {
            /** @var string $fqn with the leading parts determined by the alias removed. Has the leading backslash. */
            $nameWithoutAliasedPart = substr($fqn, strlen($aliasFqn));
            $completionItem->insertText = $alias . $nameWithoutAliasedPart;
            yield $fqn => $completionItem;
        }
    }
private function getCompletionsFromAliasedNamespace ( string $ prefix , string $ alias , string $ aliasFqn , bool $ requireCanBeInstantiated ) : \ Generator { $ prefixFirstPart = nameGetFirstPart ( $ prefix ) ; // Matched alias. $ resolvedPrefix = nameConcat ( $ aliasFqn , nameWithoutFirstPart ( $ prefix ) ) ; $ completionItems = $ this -> getCompletionsForFqnPrefix ( $ resolvedPrefix , $ requireCanBeInstantiated , false ) ; // Convert FQNs in the CompletionItems so they are expressed in terms of the alias. foreach ( $ completionItems as $ fqn => $ completionItem ) { /** @var string $fqn with the leading parts determined by the alias removed. Has the leading backslash. */ $ nameWithoutAliasedPart = substr ( $ fqn , strlen ( $ aliasFqn ) ) ; $ completionItem -> insertText = $ alias . $ nameWithoutAliasedPart ; yield $ fqn => $ completionItem ; } }
Gets completions for partially qualified names, where the first part is matched by an alias.

@return \Generator|CompletionItem[]
Yields CompletionItems.
Gets completions for partially qualified names where the first part is matched by an alias .