MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / enrichment_plain

Function enrichment_plain

src/completion/phpdoc/generation.rs:1195–1204  ·  view source on GitHub ↗

Plain-text version of `enrichment_snippet` (no tab stops). Also used by tag completion (`build_phpdoc_completions`) to enrich `@param`, `@return`, and `@var` type hints with template parameters. Callable types are wrapped in parentheses for PHPDoc notation: `(Closure(): mixed)`, `(callable(): mixed)`.

(
    type_hint: Option<&PhpType>,
    class_loader: &dyn Fn(&str) -> Option<Arc<ClassInfo>>,
)

Source from the content-addressed store, hash-verified

1193/// Callable types are wrapped in parentheses for PHPDoc notation:
1194/// `(Closure(): mixed)`, `(callable(): mixed)`.
1195pub(crate) fn enrichment_plain(
1196 type_hint: Option<&PhpType>,
1197 class_loader: &dyn Fn(&str) -> Option<Arc<ClassInfo>>,
1198) -> Option<String> {
1199 let typed = enrichment_plain_typed(type_hint, class_loader)?;
1200
1201 // Callable types need parentheses in PHPDoc notation, which
1202 // PhpType::Display does not add.
1203 Some(enrichment_type_to_plain(&typed))
1204}
1205
1206/// Format an enriched `PhpType` as a plain-text PHPDoc type string.
1207///

Callers 6

build_function_snippetFunction · 0.85
build_function_plainFunction · 0.85
build_phpdoc_completionsFunction · 0.85
check_needs_updateFunction · 0.85
build_updated_docblockFunction · 0.85

Calls 2

enrichment_plain_typedFunction · 0.85
enrichment_type_to_plainFunction · 0.85

Tested by

no test coverage detected