src/CompletionProvider.php
private function getUnqualifiedCompletions(
        string $prefix,
        string $currentNamespace,
        array $importTables,
        bool $requireCanBeInstantiated
    ): \Generator {
        // Aliases
        list($namespaceAliases,,) = $importTables;
        // use Foo\Bar
        yield from $this->getCompletionsForAliases(
            $prefix,
            $namespaceAliases,
            $requireCanBeInstantiated
        );

        // Completions from the current namespace
        yield from $this->getCompletionsForFqnPrefix(
            nameConcat($currentNamespace, $prefix),
            $requireCanBeInstantiated,
            false
        );

        if ($currentNamespace !== '' && $prefix === '') {
            // Get additional suggestions from the global namespace.
            // When completing e.g. for new |, suggest \DateTime
            yield from $this->getCompletionsForFqnPrefix('', $requireCanBeInstantiated, true);
        }

        if (!$requireCanBeInstantiated) {
            if ($currentNamespace !== '' && $prefix !== '') {
                // Roamed definitions (i.e. global constants and functions). The prefix is checked against '', since
                // in that case global completions have already been provided (including non-roamed definitions.)
                yield from $this->getRoamedCompletions($prefix);
            }

            // Lastly and least importantly, suggest keywords.
            yield from $this->getCompletionsForKeywords($prefix);
        }
    }
private function getUnqualifiedCompletions(
        string $prefix,
        string $currentNamespace,
        array $importTables,
        bool $requireCanBeInstantiated
    ): \Generator {
        // Aliases
        list($namespaceAliases,,) = $importTables;
        // use Foo\Bar
        yield from $this->getCompletionsForAliases(
            $prefix,
            $namespaceAliases,
            $requireCanBeInstantiated
        );

        // Completions from the current namespace
        yield from $this->getCompletionsForFqnPrefix(
            nameConcat($currentNamespace, $prefix),
            $requireCanBeInstantiated,
            false
        );

        if ($currentNamespace !== '' && $prefix === '') {
            // Get additional suggestions from the global namespace.
            // When completing e.g. for new |, suggest \DateTime
            yield from $this->getCompletionsForFqnPrefix('', $requireCanBeInstantiated, true);
        }

        if (!$requireCanBeInstantiated) {
            if ($currentNamespace !== '' && $prefix !== '') {
                // Roamed definitions (i.e. global constants and functions). The prefix is checked against '', since
                // in that case global completions have already been provided (including non-roamed definitions.)
                yield from $this->getRoamedCompletions($prefix);
            }

            // Lastly and least importantly, suggest keywords.
            yield from $this->getCompletionsForKeywords($prefix);
        }
    }
private function getUnqualifiedCompletions ( string $ prefix , string $ currentNamespace , array $ importTables , bool $ requireCanBeInstantiated ) : \ Generator { // Aliases list ( $ namespaceAliases , , ) = $ importTables ; // use Foo\Bar yield from $ this -> getCompletionsForAliases ( $ prefix , $ namespaceAliases , $ requireCanBeInstantiated ) ; // Completions from the current namespace yield from $ this -> getCompletionsForFqnPrefix ( nameConcat ( $ currentNamespace , $ prefix ) , $ requireCanBeInstantiated , false ) ; if ( $ currentNamespace !== '' && $ prefix === '' ) { // Get additional suggestions from the global namespace. // When completing e.g. for new |, suggest \DateTime yield from $ this -> getCompletionsForFqnPrefix ( '' , $ requireCanBeInstantiated , true ) ; } if ( ! $ requireCanBeInstantiated ) { if ( $ currentNamespace !== '' && $ prefix !== '' ) { // Roamed definitions (i.e. global constants and functions). The prefix is checked against '', since // in that case global completions have already been provided (including non-roamed definitions.) yield from $ this -> getRoamedCompletions ( $ prefix ) ; } // Lastly and least importantly, suggest keywords. yield from $ this -> getCompletionsForKeywords ( $ prefix ) ; } }
Yields completions for non-qualified global names.

Yields
- Aliased classes
- Completions from current namespace
- Roamed completions from the global namespace (when not creating and not already in root NS)
- PHP keywords (when not creating)

@return \Generator|CompletionItem[]
Yields CompletionItems
Yields completions for non - qualified global names .