Repository navigation
Description
Split out from the review of upstream Graphify-Labs#2536, where an automated reviewer objected that #39's refusal drops information (thread). The objection to the proposed alternative was declined with measurements (below), but the underlying gap it points at is real and currently untracked.
Current behaviour (correct, but incomplete)
#39 / 075038e refuses parent, self and static as PHP scoped-call callee names (graphify/extractors/engine.py:4382-4394, gated on _PHP_RELATIVE_SCOPE_NAMES). Before it, the handler took the scope text as the callee, so every parent::setUp() emitted a raw call named parent, and the cross-file label pass bound them all to whatever ->parent() accessor existed — 1,698 fabricated calls edges onto ServiceCategory::parent() on the pinned 46.4k-node corpus.
The refusal removes the fabricated edges and invents no replacement. So parent::__construct(), parent::setUp(), self::helper() and static::make() currently produce no calls edge at all, with no diagnostic counter.
Why the obvious alternative does not work
Emitting the method name as an unqualified callee instead — the reviewer's suggestion — was implemented and measured against a PHPUnit-shaped corpus (base class out of corpus, one unrelated in-corpus setUp):
- baseline: 0 edges
- unqualified-callee variant: 1 fabricated INFERRED edge,
FooTest::prepare()→App\Models\ServiceCategory::setUp()
The raw call carries is_member_call=False, so it is skipped by neither the member-call guard nor the typed resolver, and reaches the shared normalized-label loop whose index keys .setUp() and setUp() identically → sole candidate → unconditional bind. #52's candidate filter does not cover it (verified by building a tree with #52 applied — still 1 edge): that filter is gated on the php_function_call marker, and #52's own comment explains it cannot be widened to scoped calls, because a scoped_call is also not a member call.
What the real fix needs
The rc_entry built for a raw call carries caller, callee, receiver, receiver type and language — no enclosing class and no base class. The information that would answer "which class does parent denote here" exists in the graph as inherits edges (minted by _php_emit_base), but the shared bare-label loop never consults them.
So a correct fix is a resolution-pass change, not an extractor tweak:
- Carry the enclosing class on the raw call (or recover it from
caller_nid). - For a relative scope, resolve it against the caller's own
inheritsedge —parent→ the resolved base class,self/static→ the enclosing class itself (late static binding meansstaticis strictly a guess for anything but the declaring class; refusingstaticwhile resolvingparent/selfis a defensible first cut). - Look the method up on that resolved type, and refuse when the base class is out of corpus (the PHPUnit case) rather than falling back to a name match.
Point 3 is the load-bearing one: an out-of-corpus base class must yield nothing, or this reintroduces exactly the fabricated-edge shape it replaces.
Notes
- Sequencing: composes with
#52's candidate-filtering, which lives onfix/resolution-gaps-52-53-54. Worth landing after that branch merges tov8. - Extraction-side, so it will need a version bump to roll the AST cache namespace.
- Blast radius if fixed:
parent::__construct()andparent::setUp()are ubiquitous in a Laravel/PHPUnit corpus, so this is recall left on the table, not a correctness bug.
Activity
filipechagas commentedon Aug 7, 2026
Triage decision (2026-08-07): valid, accepted — ready for the next fix cycle
The sequencing blocker named in the body is cleared:
fix/resolution-gaps-52-53-54merged tov8today (fork PR #57, 0.9.39). Fork-side anchors (the body cites upstream-PR-head line numbers): the #39 refusal lives in thescoped_call_expressionhandler atgraphify/extractors/engine.py:5058-5070, gated on_PHP_NON_CONCRETE_TYPE_NAMES(engine.py:752);inheritsedges are minted as described.Decided spec:
parent::andself::; keep refusingstatic::— late static binding makes it a guess for anything but the declaring class, and the refusal discipline (a wrong answer is worse than no answer) is repo-wide precedent.caller_nid— implementer's choice; note the enclosing-type map_resolve_php_member_callsalready builds).parentresolves through the enclosing class'sinheritsedge;selfis the enclosing class itself. Method lookup walks the in-corpusinheritschain (PHP resolves inherited methods up the hierarchy) and refuses at the first out-of-corpus, ambiguous, or missing hop. The load-bearing criterion stands as written: an out-of-corpus base (the PHPUnitTestCasecase) yields nothing — that is the exact fabricated-edge shape PHP: clearly-wrong calls edges in the repro neighborhood (.parent() --calls--> .setUp(); .handle() --calls--> test methods) — failure mode #3 evidence #39 killed and it must not return. Trait-provided methods (self::helper()viause SomeTrait): refuse in this cut; note it in the issue if measured recall makes it worth a follow-up.class B { protected function boot(): void {} } class A extends B { public function init(): void { parent::boot(); } }(two files) →callsedge ontoB::boot()(currently nothing — red first).self::helper()withhelper()on the enclosing class → edge to it.A extends B,B extends C,Acallsparent::foo(),foo()declared only onC→ edge toC::foo(); same fixture withCreplaced by an out-of-corpus name → no edge.class FooTest extends TestCase(vendor, out of corpus),parent::setUp(), plus an unrelated in-corpussetUp()decoy → no edge to the decoy (the body's measured refutation of the unqualified-callee variant becomes a pinned regression test).static::make()→ still refused._full_then_incrementalshape, with the base class arriving viaresolution_context_nodes/_edges.Relabeling
ready-for-agent. One heads-up for whoever picks it up: #59 (extract_php_member_receiver()out ofwalk_calls) is spec'd to ride along with the next slice that edits that region of engine.py — if this fix's step 1 toucheswalk_calls'rc_entryconstruction, take #59 as a rider in the same slice (separate commit not required; see #59's triage).