You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PHP use-import map 1/5: capture use FQN/alias metadata on imports edges #19
Spec: #18 (ticket 1/5). Fixes nothing user-visible on its own; foundation for #16's fix.
What to build
Enrich PHP imports edges with the facts today's capture throws away, mirroring _import_csharp (extract.py:577-605):
Extract the already-correct use-parser from _resolve_php_type_references (graphify/extractors/resolution.py:2476-2517: _record_use_clause + the namespace_use_declaration walk) into a shared helper.
Have both _resolve_php_type_references and the PHP import capture consume it. Replace the lossy raw.split("\\")[-1] in _import_php (extract.py:664-681).
Emit imports edge metadata: target_fqn, alias (when use X as Y;), use_kind.
Constraints
No behavior change to any resolver — metadata additions only. Existing suites must pass byte-identical except for the new metadata keys.
use function / use const must not enter the class-name map (parser already rejects, resolution.py:2479-2480 — keep that on extraction).
Do not widen _PHP_CONFIG.import_types (extract.py:926) to namespace_use_declaration: trait use inside a class body is a different node and must not become an import.
Keep the casefold convention from resolution.py.
Acceptance criteria
use A\B\C; → imports edge metadata target_fqn: "A\\B\\C", no alias
use A\B\C as D; → alias: "D", target_fqn: "A\\B\\C"
Group use use A\{B, C as X}; → two edges with correct FQNs and the alias on the right one
use function A\f; and use const A\K; produce no class-map entries
Trait use T; inside a class body produces no imports edge
Discovered while implementing this ticket and filed separately as #26: group-form use function A\{f, g}; / use const A\{K}; put the keyword on the declaration, not the clause, so _resolve_php_type_references never sees it and those names enter the class-name map as claimed class names.
Not fixed here — this ticket is metadata-only under a strict no-behavior-change-to-any-resolver constraint. The shared helper _php_use_declaration_facts reads the declaration-level keyword and reports the correct use_kind (the new imports-edge capture uses it that way today); _resolve_php_type_references is the sole caller passing apply_declaration_kind=False purely to preserve legacy behavior byte-for-byte. #26 is "drop that argument, delete the flag, cover it with a test".
Pre-existing, not a regression: the repro in #26 produces identical output at 102ae79 and at this ticket's commit. Worth landing before #21 — a wrongly claimed short name would become a wrongly decisive refusal there.
Closed by PR #29 (merge commit e188ff6). Orchestrator gate evidence: independent full-suite runs reproduced 4032/36 at branch head (pre-merge baseline 4024/36 + 8 new tests) and 4057/36 on the merged tree (post-#9/#15/#10 baseline 4049/36 + 8). No-behavior-change additionally evidenced by a byte-identical metadata-stripped extract() diff over an 8-form use-statement corpus, and the v8 merge was triple-verified against both parents. Discovery #26 filed and sequenced before #21. v8 baseline is now 4057/36. #20 and #26 are unblocked.
Activity
filipechagas commentedon Aug 5, 2026
Discovered while implementing this ticket and filed separately as #26: group-form
use function A\{f, g};/use const A\{K};put the keyword on the declaration, not the clause, so_resolve_php_type_referencesnever sees it and those names enter the class-name map as claimed class names.Not fixed here — this ticket is metadata-only under a strict no-behavior-change-to-any-resolver constraint. The shared helper
_php_use_declaration_factsreads the declaration-level keyword and reports the correctuse_kind(the newimports-edge capture uses it that way today);_resolve_php_type_referencesis the sole caller passingapply_declaration_kind=Falsepurely to preserve legacy behavior byte-for-byte. #26 is "drop that argument, delete the flag, cover it with a test".Pre-existing, not a regression: the repro in #26 produces identical output at
102ae79and at this ticket's commit. Worth landing before #21 — a wrongly claimed short name would become a wrongly decisive refusal there.Merge pull request #29 from lawnstarter/feat/php-use-import-capture-19
filipechagas commentedon Aug 5, 2026
Closed by PR #29 (merge commit e188ff6). Orchestrator gate evidence: independent full-suite runs reproduced 4032/36 at branch head (pre-merge baseline 4024/36 + 8 new tests) and 4057/36 on the merged tree (post-#9/#15/#10 baseline 4049/36 + 8). No-behavior-change additionally evidenced by a byte-identical metadata-stripped extract() diff over an 8-form use-statement corpus, and the v8 merge was triple-verified against both parents. Discovery #26 filed and sequenced before #21. v8 baseline is now 4057/36. #20 and #26 are unblocked.