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

Method check_context_match

src/completion/context/class_completion.rs:2065–2073  ·  view source on GitHub ↗

Check whether a class matches the given `ClassNameContext`, or allow it through if not loaded. Returns `Some(true)` when the class is loaded and passes `context.matches()`, `Some(false)` when loaded but rejected, and `None` when the class could not be loaded at all. Callers should hard-exclude on `Some(false)`, pass through on `None` (with optional heuristic demotion via [`ClassNameContext::like

(&self, class_name: &str, context: ClassNameContext)

Source from the content-addressed store, hash-verified

2063 /// [`ClassNameContext::likely_mismatch`]), and include on
2064 /// `Some(true)` without demotion.
2065 fn check_context_match(&self, class_name: &str, context: ClassNameContext) -> Option<bool> {
2066 // load_stub_class checks uri_classes_index first, then parses in-memory
2067 // stubs if needed. No disk I/O.
2068 if let Some(cls) = self.load_stub_class(class_name) {
2069 return Some(context.matches(&cls));
2070 }
2071 // Truly unknown.
2072 None
2073 }
2074
2075 /// Check whether `class_name` exists in any class source (uri_classes_index,
2076 /// fqn_uri_index, or stub_index).

Callers 1

Calls 2

load_stub_classMethod · 0.80
matchesMethod · 0.80

Tested by

no test coverage detected