(&mut self, node: Node<'t>)
| 1223 | } |
| 1224 | |
| 1225 | fn extract_instantiation(&mut self, node: Node<'t>) { |
| 1226 | if self.stack.is_empty() { |
| 1227 | return; |
| 1228 | } |
| 1229 | // php has no constructor/type/name FIELDS → namedChild(0). Backslashes |
| 1230 | // are NOT split by the suffix logic → `new \App\Models\User()` keeps |
| 1231 | // the full qualified text; `new $cls()` keeps the `$`; an |
| 1232 | // anonymous_class yields its whole source text through the shared |
| 1233 | // normalization (garbage, deterministic — preserve). |
| 1234 | let ctor = node |
| 1235 | .child_by_field_name("constructor") |
| 1236 | .or_else(|| node.child_by_field_name("type")) |
| 1237 | .or_else(|| node.child_by_field_name("name")) |
| 1238 | .or_else(|| node.named_child(0)); |
| 1239 | let Some(ctor) = ctor else { return }; |
| 1240 | let class_name = strip_generic_and_qualifier(self.text(ctor)); |
| 1241 | if !class_name.is_empty() { |
| 1242 | let from = self.top_row(); |
| 1243 | self.push_ref_at(from, &class_name, edge_kind_index("instantiates").unwrap(), node); |
| 1244 | } |
| 1245 | } |
| 1246 | |
| 1247 | /// extractAnonymousClass — unreachable on v0.24.2 (the declaration_list |
| 1248 | /// nests inside `anonymous_class`, so findAnonymousClassBody finds no |
no test coverage detected