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

Function depends_on_any

src/virtual_members/mod.rs:248–287  ·  view source on GitHub ↗

Check whether `cls` directly depends on any FQN in `fqns` through its `parent_class`, `used_traits`, `interfaces`, `mixins`, or `casts_definitions`. Comparisons are done against both the raw field value and the short name of the evicted FQN, because the cached `ClassInfo` may store parent/trait/interface names as short names (same-file references) or as FQNs (cross-file, post-resolution). The `c

(cls: &ClassInfo, fqns: &[String])

Source from the content-addressed store, hash-verified

246/// changes), models referencing that cast class via `$casts` are
247/// transitively evicted from the resolved-class cache.
248fn depends_on_any(cls: &ClassInfo, fqns: &[String]) -> bool {
249 for fqn in fqns {
250 let short = crate::util::short_name(fqn);
251
252 // parent_class
253 if let Some(ref parent) = cls.parent_class
254 && (parent == fqn || parent == short)
255 {
256 return true;
257 }
258
259 // used_traits
260 if cls.used_traits.iter().any(|t| t == fqn || t == short) {
261 return true;
262 }
263
264 // interfaces
265 if cls.interfaces.iter().any(|i| i == fqn || i == short) {
266 return true;
267 }
268
269 // mixins
270 if cls.mixins.iter().any(|m| m == fqn || m == short) {
271 return true;
272 }
273
274 // casts_definitions — cast type values may reference class FQNs
275 // (e.g. `"App\\Casts\\DecimalCast"` or `"DecimalCast:8:2"`).
276 // Strip the `:argument` suffix before comparing.
277 if let Some(laravel) = cls.laravel()
278 && laravel.casts_definitions.iter().any(|(_, cast_type)| {
279 let class_part = cast_type.split(':').next().unwrap_or(cast_type);
280 class_part == fqn || class_part == short
281 })
282 {
283 return true;
284 }
285 }
286 false
287}
288
289/// Members synthesized by a provider.
290///

Callers 1

evict_fqnFunction · 0.85

Calls 4

iterMethod · 0.80
laravelMethod · 0.80
nextMethod · 0.80
short_nameFunction · 0.50

Tested by

no test coverage detected