(&mut self, node: Node<'t>)
| 1055 | } |
| 1056 | |
| 1057 | fn extract_instantiation(&mut self, node: Node<'t>) { |
| 1058 | if self.stack.is_empty() { |
| 1059 | return; |
| 1060 | } |
| 1061 | // php has no constructor/type/name FIELDS → namedChild(0). Backslashes |
| 1062 | // are NOT split by the suffix logic → `new \App\Models\User()` keeps |
| 1063 | // the full qualified text; `new $cls()` keeps the `$`; an |
| 1064 | // anonymous_class yields its whole source text through the shared |
| 1065 | // normalization (garbage, deterministic — preserve). |
| 1066 | let ctor = node |
| 1067 | .child_by_field_name("constructor") |
| 1068 | .or_else(|| node.child_by_field_name("type")) |
| 1069 | .or_else(|| node.child_by_field_name("name")) |
| 1070 | .or_else(|| node.named_child(0)); |
| 1071 | let Some(ctor) = ctor else { return }; |
| 1072 | let class_name = strip_generic_and_qualifier(self.text(ctor)); |
| 1073 | if !class_name.is_empty() { |
| 1074 | let from = self.top_row(); |
| 1075 | self.push_ref_at(from, &class_name, edge_kind_index("instantiates").unwrap(), node); |
| 1076 | } |
| 1077 | } |
| 1078 | |
| 1079 | /// extractAnonymousClass — unreachable on v0.24.2 (the declaration_list |
| 1080 | /// nests inside `anonymous_class`, so findAnonymousClassBody finds no |
no test coverage detected