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

Method resolve_through_prefix_keys

src/completion/array_shape.rs:483–497  ·  view source on GitHub ↗

Walk through `prefix_keys` to resolve the inner type of a nested array shape. Given a raw type like `array{meta: array{page: int, total: int}}` and prefix keys `["meta"]`, returns `Some(PhpType)` for `array{page: int, total: int}`.

(
        &self,
        raw_type: &PhpType,
        prefix_keys: &[String],
    )

Source from the content-addressed store, hash-verified

481 /// Given a raw type like `array{meta: array{page: int, total: int}}` and
482 /// prefix keys `["meta"]`, returns `Some(PhpType)` for `array{page: int, total: int}`.
483 fn resolve_through_prefix_keys(
484 &self,
485 raw_type: &PhpType,
486 prefix_keys: &[String],
487 ) -> Option<PhpType> {
488 if prefix_keys.is_empty() {
489 return Some(raw_type.clone());
490 }
491
492 let mut current = raw_type.clone();
493 for key in prefix_keys {
494 current = current.shape_value_type(key)?.clone();
495 }
496 Some(current)
497 }
498
499 /// Resolve the raw (uncleaned) type annotation for a variable.
500 ///

Callers 1

Calls 3

cloneMethod · 0.80
shape_value_typeMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected