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

Method resolve_attr_last_segment

src/parser/mod.rs:87–90  ·  view source on GitHub ↗

Resolve an attribute's short name through the file's use-map and return the last segment of the resolved FQN. For example, if the file has `use JetBrains\PhpStorm\Internal\PhpStormStubsElementAvailable as Available;` then `resolve_attr_last_segment("Available")` returns `"PhpStormStubsElementAvailable"`. When the name is not in the use-map, returns `None` (the caller should fall back to the orig

(&self, short_name: &str)

Source from the content-addressed store, hash-verified

85 /// When the name is not in the use-map, returns `None` (the caller
86 /// should fall back to the original name).
87 fn resolve_attr_last_segment(&self, short_name: &str) -> Option<&str> {
88 let fqn = self.use_map.get(short_name)?;
89 Some(fqn.rsplit('\\').next().unwrap_or(fqn))
90 }
91
92 /// Check whether `attr_short_name` resolves to `PhpStormStubsElementAvailable`.
93 pub(crate) fn is_element_available_attr(&self, attr_short_name: &str) -> bool {

Calls 2

nextMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected