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

Function apply_substitution_to_generics

src/inheritance.rs:1450–1462  ·  view source on GitHub ↗

Apply a substitution map to a list of generic annotations. Each entry is `(ClassName, [TypeArg1, TypeArg2, …])`. Only the type arguments are substituted; the class name is left unchanged.

(
    generics: &mut [(Atom, Vec<PhpType>)],
    subs: &HashMap<String, PhpType>,
)

Source from the content-addressed store, hash-verified

1448/// Each entry is `(ClassName, [TypeArg1, TypeArg2, …])`. Only the type
1449/// arguments are substituted; the class name is left unchanged.
1450fn apply_substitution_to_generics(
1451 generics: &mut [(Atom, Vec<PhpType>)],
1452 subs: &HashMap<String, PhpType>,
1453) {
1454 for (_class_name, type_args) in generics.iter_mut() {
1455 for arg in type_args.iter_mut() {
1456 let substituted = arg.substitute(subs);
1457 if substituted != *arg {
1458 *arg = substituted;
1459 }
1460 }
1461 }
1462}
1463
1464// ─── Tests ──────────────────────────────────────────────────────────────────
1465

Callers 1

apply_generic_argsFunction · 0.85

Calls 1

substituteMethod · 0.80

Tested by

no test coverage detected