mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-11-01 08:12:59 +08:00
PHP ignored namespaces entirely: every class's qualified name was its bare simple name, so a framework's many same-named classes (Laravel has 7+ `Factory` interfaces, several `Dispatcher`s, across namespaces) collapsed into one arbitrary match, and `use` imports created nodes that never resolved to a definition. An interface imported and constructor-injected (the DI pattern) showed zero dependents. - Capture `namespace Foo\Bar;` as a file-level package (like a Java/Kotlin package) so each class is scoped to `Foo\Bar::Class` — same-named classes are now distinguishable. - Resolve `use Foo\Bar\Baz;` (single and grouped) to the namespace-qualified definition via an `imports` ref the resolver matches by exact qualified name — so an imported-but-DI-injected contract records a precise cross-file dependency. - Add `php` to the type-annotation languages with a PHP-aware walker: parameter / property / return type-hints are `named_type`/`union_type`/… wrapping `name`/`qualified_name` (never `type_identifier`), and `variable_name` ($x) param names are never mis-emitted. Measured (fair cross-file dependent coverage, symbol-bearing source files): guzzle 95.2% → 100.0%, laravel 80.5% → 94.9%. Node count grows only by the new namespace nodes (one per file, a real symbol — like JVM package nodes), not duplication; edges added precisely. laravel residual is genuine frontiers (service providers / controllers / middleware registered by class-string, console view components dispatched by magic `__call`, mixin traits for app consumption). Full suite green; non-PHP languages unaffected (changes gated to `language === 'php'`). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>