Skip to content

fix(php): resolve method calls through $this-> property on its declared type - #139

Merged
sunerpy merged 1 commit into
mainfrom
feat/upstream-1.4.1-release-c-php-property-resolution
Jul 14, 2026
Merged

sunerpy merged 1 commit into
mainfrom
feat/upstream-1.4.1-release-c-php-property-resolution

Conversation

@sunerpy

@sunerpy sunerpy commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

Upstream-sync Release C — ports colby #1220 (70b1be6). $this->dep->method() (the dominant call shape in constructor-injection codebases — Symfony, Laravel) now resolves to the method on property $dep's declared type, so callers/impact see production call sites instead of reporting a DI-heavy method as uncalled or test-only.

  • Consults PROPERTY-shaped declarations only: typed property (private Foo $dep;), promoted ctor param, classic ctor assignment ($this->dep = $dep; with a typed param, multi-line signatures included), typed setter injection.
  • Interface-typed properties resolve to the interface method; inherited methods resolve through the type hierarchy (existing conformance pass, now with PHP $this->prop->method deferral wired in).
  • Precision: a same-named local/param can never mistype the property; an unrecoverable-type property stays unlinked (the PHP-property branch returns unconditionally, never falling through to fuzzy name strategies).
  • Resolve-side only — the extractor already emits the this->dep.method reference shape, so no extraction change, no new node kind.

Verification

  • 15 unit + 2 integration tests covering precision rules (a)-(g) + typed-setter injection; existing local_var_php_new / typed_param_php regressions still green.
  • make ci green (fmt + clippy + test + guardrail + equivalence).
  • Golden .schema + fixtures byte-identical, NO regen (corpus has no PHP; the resolve-side branch only fires on this->\w+.\w+ PHP refs).
  • Independent momus plan review: APPROVE.

Release C of the chosen 1.2.0→1.4.1 upstream PORT subset.

…ed type

Ports upstream colby #1220. A `$this->dep->method()` call — the dominant shape
in constructor-injection codebases (Symfony, Laravel) — now resolves to the
method on the property `$dep`'s declared type, so callers and impact analysis
see the production call sites instead of reporting a DI-heavy method as
uncalled or test-only.

Resolution consults PROPERTY-shaped declarations only: a typed property
(`private Foo $dep;`), a promoted constructor parameter
(`public function __construct(private Foo $dep)`), a classic constructor
assignment (`$this->dep = $dep;` with a typed parameter, multi-line signatures
included), and typed setter injection. Interface-typed properties resolve to
the interface method and inherited methods resolve through the type hierarchy
via the existing conformance pass. Because only property-shaped declarations
are consulted, a same-named local variable or parameter elsewhere can never
mistype the property, and a property whose type cannot be recovered statically
stays unlinked rather than guessed — the PHP-property branch returns
unconditionally instead of falling through to the fuzzy name strategies.

Resolve-side only: the extractor already emits the `this->dep.method` reference
shape, so no extraction change and no new node kind. Golden .schema and all
fixtures are unchanged (the corpus has no PHP; no regen).
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.07246% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/codegraph-resolve/src/name_matcher.rs 96.13% 13 Missing ⚠️
crates/codegraph-resolve/src/resolver.rs 55.55% 4 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #139      +/-   ##
==========================================
- Coverage   95.63%   95.63%   -0.01%     
==========================================
  Files         115      115              
  Lines       56095    56803     +708     
==========================================
+ Hits        53649    54325     +676     
- Misses       2446     2478      +32     
Files with missing lines Coverage Δ
crates/codegraph-resolve/src/resolver.rs 96.04% <55.55%> (-0.16%) ⬇️
crates/codegraph-resolve/src/name_matcher.rs 97.12% <96.13%> (-0.04%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sunerpy
sunerpy merged commit 9581bc2 into main Jul 14, 2026
10 of 12 checks passed
@sunerpy
sunerpy deleted the feat/upstream-1.4.1-release-c-php-property-resolution branch July 14, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant