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

Function build_class_member_block

src/hover/formatting.rs:245–264  ·  view source on GitHub ↗

Build a PHP code block wrapping a member inside its owning class. Produces a fenced `php` block containing: - `<?php` - `namespace Foo;` (omitted when global) - `class ShortName {` - ` public string $name;` - `}`

(
    owner_name: &str,
    owner_namespace: Option<&str>,
    kind_keyword: &str,
    name_suffix: &str,
    member_line: &str,
)

Source from the content-addressed store, hash-verified

243/// - ` public string $name;`
244/// - `}`
245pub(super) fn build_class_member_block(
246 owner_name: &str,
247 owner_namespace: Option<&str>,
248 kind_keyword: &str,
249 name_suffix: &str,
250 member_line: &str,
251) -> String {
252 let mut body = String::new();
253 let ns_line = namespace_line(owner_namespace);
254 body.push_str("```php\n<?php\n");
255 body.push_str(&ns_line);
256 body.push_str(kind_keyword);
257 body.push(' ');
258 body.push_str(owner_name);
259 body.push_str(name_suffix);
260 body.push_str(" {\n ");
261 body.push_str(member_line);
262 body.push_str("\n}\n```");
263 body
264}
265
266/// Return the PHP keyword for a class-like owner.
267///

Callers 2

hover_for_methodMethod · 0.85
hover_for_constantMethod · 0.85

Calls 2

namespace_lineFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected