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

Function normalise_prefix

src/composer.rs:352–361  ·  view source on GitHub ↗

Normalise a PSR-4 namespace prefix: ensure it ends with `\` unless it is the empty root-namespace prefix.

(prefix: &str)

Source from the content-addressed store, hash-verified

350/// Normalise a PSR-4 namespace prefix: ensure it ends with `\` unless
351/// it is the empty root-namespace prefix.
352fn normalise_prefix(prefix: &str) -> String {
353 if prefix.ends_with('\\') {
354 prefix.to_string()
355 } else if prefix.is_empty() {
356 // Empty prefix means "fallback" / root namespace
357 String::new()
358 } else {
359 format!("{}\\", prefix)
360 }
361}
362
363/// Collect PSR-4 entries from any value that implements [`Psr4Paths`].
364fn collect_psr4_entries<P: Psr4Paths>(prefix: &str, paths: &P, mappings: &mut Vec<Psr4Mapping>) {

Callers 2

extract_scan_dirsFunction · 0.70
collect_psr4_entriesFunction · 0.70

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected