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

Function apply_substitution_to_method

src/inheritance.rs:1204–1219  ·  view source on GitHub ↗

Apply generic type substitution to a method's return type and parameter type hints.

(
    method: &mut MethodInfo,
    subs: &HashMap<String, PhpType>,
)

Source from the content-addressed store, hash-verified

1202/// Apply generic type substitution to a method's return type and parameter
1203/// type hints.
1204pub(crate) fn apply_substitution_to_method(
1205 method: &mut MethodInfo,
1206 subs: &HashMap<String, PhpType>,
1207) {
1208 if let Some(ref mut ret) = method.return_type {
1209 *ret = ret.substitute(subs);
1210 }
1211 if let Some(ref mut cond) = method.conditional_return {
1212 apply_substitution_to_conditional(cond, subs);
1213 }
1214 for param in &mut method.parameters {
1215 if let Some(ref mut hint) = param.type_hint {
1216 *hint = hint.substitute(subs);
1217 }
1218 }
1219}
1220
1221/// Apply generic type substitution to a conditional return type tree.
1222///

Calls 2

substituteMethod · 0.80