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

Function namespace_line

src/hover/formatting.rs:105–114  ·  view source on GitHub ↗

Build a `namespace Foo;\n` line for use inside PHP code blocks. Returns an empty string when the namespace is global (None).

(namespace: Option<&str>)

Source from the content-addressed store, hash-verified

103/// Build a `namespace Foo;\n` line for use inside PHP code blocks.
104/// Returns an empty string when the namespace is global (None).
105pub(super) fn namespace_line(namespace: Option<&str>) -> String {
106 if let Some(ns) = namespace
107 && !ns.is_empty()
108 && !ns.starts_with("___")
109 {
110 format!("namespace {};\n", ns)
111 } else {
112 String::new()
113 }
114}
115
116/// Build a `@var` docblock annotation when the effective type differs from
117/// the native type. Returns `None` when they are identical or when there

Callers 7

hover_from_symbolMethod · 0.85
hover_variableMethod · 0.85
hover_for_class_infoMethod · 0.85
build_class_member_blockFunction · 0.85
hover_for_functionFunction · 0.85

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected