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: docblock-typed property assigned in the constructor body binds no receiver type — missing calls edge (co-cause 2 of #37) #38
BalanceCustomerAccountService::handle() calls $this->chargeCustomerService->handle(...) (app/Services/Billing/BalanceCustomerAccountService.php:37 in api.lawnstarter.com @ d2d4bed7ae), yet the graph has no calls edge from it to ChargeCustomerService — measured 2026-08-06 on the pinned repro graph (48,529 nodes): the only inbound call-context edge on BalanceCustomerAccountService is CustomerController.update() → .handle().
Root cause
The receiver property is declared untyped with only a @var docblock, and assigned in the constructor body from a typed param:
_resolve_php_member_calls binds this.<prop> receivers only from "the class's typed properties and constructor-promoted params" (graphify/extract.py:3346). Docblock receivers were explicitly Out of Scope in #1's spec; constructor-body assignment of a typed param is not covered either. The two sibling callers resolve fine because they use the covered forms: ChargeCustomerCancellationFee (promoted protected readonly param) and BillingCharge (typed method param, #4).
Proposed enhancement
Bind a property's type from a constructor-body assignment $this->prop = $param; where $param is a typed constructor parameter (classic pre-promotion Laravel idiom, common in this corpus). Same refusal discipline as #4: poison on reassignment with a different/unknown type. Whether to also read @var docblocks is a separate, riskier decision (docblocks lie more often than signatures) — the ctor-assignment form alone covers this measured case without touching docblocks.
Context
Discovered as co-cause 2 in #37's step-through: it makes "Who calls ChargeCustomerService?" unable to reach 3/3 ground-truth callers by call-filtered traversal alone. #37's fix works around it via unfiltered fallback; this issue is the extraction-side fix.
Fully specified as written: the scope decision is already made in the body (bind from ctor-body assignment of a typed param only; @var docblocks explicitly out of scope), the refusal discipline mirrors PHP: typed locals and typed params resolve, with scope poisoning #4 (poison on reassignment with a different/unknown type), and the measured case gives a concrete red-first repro (BalanceCustomerAccountService.php:14–20, missing calls edge to ChargeCustomerService).
Fixed on the fork feature branch fix/stub-shadowing-46 (commit 293d57e, cherry-picked from fix/38-ctor-body-receiver), headed for the single PR into v8.
What landed: _php_ctor_assigned_field_types binds a property's receiver type from a constructor-body assignment $this->prop = $param; where $param is a typed constructor parameter (the classic pre-promotion Laravel idiom). Declared property types and promoted params keep precedence (setdefault). The refusal discipline is property-scoped, not just constructor-scoped: any write to the property from any non-constructor method of the class (plain/augmented/reference/list-destructuring/foreach targets, and deferred writes such as closures) poisons the binding — refusal over guessing, mirroring #4.
Acceptance criteria:
Red-first fixture mirroring the measured case (untyped property + @var docblock + ctor-body assignment from typed param + $this->prop->method()): no calls edge on base; INFERRED/0.8 edge to the param's type after.
Poison paths: 20+ refusal tests; review mutation-tested the battery twice — final round 8/8 mutations killed, including the cross-class over-refusal mutant (a write in another class does NOT poison).
Covered sibling forms regression-locked (promoted param, typed method param, declared typed property — the declared path correctly needs no sweep since PHP fatals on incompatible writes to typed properties).
Full suite green: 4371 passed / 3 skipped on the integrated branch.
Corpus-scale check (the missing BalanceCustomerAccountService.handle() → ChargeCustomerService edge) — deferred to Stub-shadow fix 4/4: release + acceptance grading on the pinned api corpus #50's grading rebuild; review grep-verified the ground-truth file writes the property exactly once (in the ctor), so the sweep leaves that binding standing.
Hard scope limit honored: no docblock parsing — verified structurally (no comment-node traversal in the diff) and empirically (a lying docblock changes nothing; signature wins). @var support remains a separate policy decision, as specced.
Review history: first round found a major — a setter reassigning the property to a different/untypable type left the ctor binding minting a confidently-wrong edge; the rework made refusal property-scoped, with controls proving no over-refusal (same-file second class, anonymous classes, read-only methods, other-property writes all unaffected). Deliberate documented trade: even a same-typed setter write refuses (can only suppress edges, never mint wrong ones). Final verdict: APPROVE.
Activity
filipechagas commentedon Aug 7, 2026
Triage (2026-08-07)
Labeling
ready-for-agent._resolve_php_member_calls— both endpoints (BalanceCustomerAccountService.handle(),ChargeCustomerService) have real sourced nodes; no stubs involved. None of Stub-shadow fix 1/4: PHP interface/trait/enum declarations mint canonical nodes (RC1 of #46) #47–Stub-shadow fix 3/4: find_node_ambiguity must not collapse sourceless rivals into one group (RC3 of #46) #49 will fix it.@vardocblocks explicitly out of scope), the refusal discipline mirrors PHP: typed locals and typed params resolve, with scope poisoning #4 (poison on reassignment with a different/unknown type), and the measured case gives a concrete red-first repro (BalanceCustomerAccountService.php:14–20, missingcallsedge toChargeCustomerService).references/importedges), so it sits behind the PHP node identity: interfaces/traits/enums get no declaration node — sourceless stubs shadow the real name, absorb its edges, and break lookup (failure mode #3, PE-78803) #46 slices in priority. No blocking dependency on anything.filipechagas commentedon Aug 7, 2026
Fixed on the fork feature branch
fix/stub-shadowing-46(commit 293d57e, cherry-picked fromfix/38-ctor-body-receiver), headed for the single PR into v8.What landed:
_php_ctor_assigned_field_typesbinds a property's receiver type from a constructor-body assignment$this->prop = $param;where$paramis a typed constructor parameter (the classic pre-promotion Laravel idiom). Declared property types and promoted params keep precedence (setdefault). The refusal discipline is property-scoped, not just constructor-scoped: any write to the property from any non-constructor method of the class (plain/augmented/reference/list-destructuring/foreach targets, and deferred writes such as closures) poisons the binding — refusal over guessing, mirroring #4.Acceptance criteria:
@vardocblock + ctor-body assignment from typed param +$this->prop->method()): nocallsedge on base; INFERRED/0.8 edge to the param's type after.BalanceCustomerAccountService.handle() → ChargeCustomerServiceedge) — deferred to Stub-shadow fix 4/4: release + acceptance grading on the pinned api corpus #50's grading rebuild; review grep-verified the ground-truth file writes the property exactly once (in the ctor), so the sweep leaves that binding standing.Hard scope limit honored: no docblock parsing — verified structurally (no comment-node traversal in the diff) and empirically (a lying docblock changes nothing; signature wins).
@varsupport remains a separate policy decision, as specced.Review history: first round found a major — a setter reassigning the property to a different/untypable type left the ctor binding minting a confidently-wrong edge; the rework made refusal property-scoped, with controls proving no over-refusal (same-file second class, anonymous classes, read-only methods, other-property writes all unaffected). Deliberate documented trade: even a same-typed setter write refuses (can only suppress edges, never mint wrong ones). Final verdict: APPROVE.