src/CompletionProvider.php
private function getCompletionsForFqnPrefix(
        string $prefix,
        bool $requireCanBeInstantiated,
        bool $insertFullyQualified
    ): \Generator {
        $namespace = nameGetParent($prefix);
        foreach ($this->index->getChildDefinitionsForFqn($namespace) as $fqn => $def) {
            if ($requireCanBeInstantiated && !$def->canBeInstantiated) {
                continue;
            }
            if (!nameStartsWith($fqn, $prefix)) {
                continue;
            }
            $completion = CompletionItemFactory::fromDefinition($def);
            if ($insertFullyQualified) {
                $completion->insertText =  '\\' . $fqn;
            }
            yield $fqn => $completion;
        }
    }
private function getCompletionsForFqnPrefix(
        string $prefix,
        bool $requireCanBeInstantiated,
        bool $insertFullyQualified
    ): \Generator {
        $namespace = nameGetParent($prefix);
        foreach ($this->index->getChildDefinitionsForFqn($namespace) as $fqn => $def) {
            if ($requireCanBeInstantiated && !$def->canBeInstantiated) {
                continue;
            }
            if (!nameStartsWith($fqn, $prefix)) {
                continue;
            }
            $completion = CompletionItemFactory::fromDefinition($def);
            if ($insertFullyQualified) {
                $completion->insertText =  '\\' . $fqn;
            }
            yield $fqn => $completion;
        }
    }
private function getCompletionsForFqnPrefix ( string $ prefix , bool $ requireCanBeInstantiated , bool $ insertFullyQualified ) : \ Generator { $ namespace = nameGetParent ( $ prefix ) ; foreach ( $ this -> index -> getChildDefinitionsForFqn ( $ namespace ) as $ fqn => $ def ) { if ( $ requireCanBeInstantiated && ! $ def -> canBeInstantiated ) { continue ; } if ( ! nameStartsWith ( $ fqn , $ prefix ) ) { continue ; } $ completion = CompletionItemFactory :: fromDefinition ( $ def ) ; if ( $ insertFullyQualified ) { $ completion -> insertText = '\\' . $ fqn ; } yield $ fqn => $ completion ; } }
Gets completions for prefixes of fully qualified names in their parent namespace.

@param string $prefix Prefix to complete for. Fully qualified.
@param bool $requireCanBeInstantiated If set, only return classes.
@param bool $insertFullyQualified If set, return completion with the leading \ inserted.
@return \Generator|CompletionItem[]
Yields CompletionItems.
Gets completions for prefixes of fully qualified names in their parent namespace .