Repository navigation
fix(static-calls): self::, static:: and parent:: return the static type of the calling class - #12643
Conversation
…pe of the calling class vimeo#7797 `parent::make()` and `parent::instance()` of a method returning `static` were `Core&static` in a non-final child, so `return parent::instance();` from a method declared `static` was LessSpecificReturnStatement. The calling class is now passed to the type expander as an object type, like a method call on $this does. Fixes vimeo#7797 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ktu9y737NuDDE88xCYTSix
|
Behaviour change: in a non-final class, |
…l-returns-called-static Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
✅ Performance: unchanged · Issues: decreased
How to read this table
✅ laravel: issues +2 −4Memory 1 821 → 1 821 MB (<0.1 %) · Wall 87.3 → 87.4 s (+0.1 %) Weighted 51 159 → 51 153 (−6, −0.01 %): L3 −2
Added (2)
Removed (4)
✅ symfony: issues +0 −16Memory 4 002 → 4 002 MB (<0.1 %) · Wall 134.7 → 139.4 s (+3.5 %) Weighted 101 104 → 101 056 (−48, −0.05 %): L3 −16
Removed (16)
✅ doctrine-orm: issues +0 −2Memory 428 → 428 MB (<0.1 %) · Wall 14.8 → 14.2 s (−3.8 %) Weighted 5 580 → 5 574 (−6, −0.11 %): L3 −2
Removed (2)
head a4c737d · base b0cb649 (merge-base) · workflow run |
…calling class vimeo#7797 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Behaviour change (addition)
|
|
The fix looks correct for the original issue, but it introduces a generic type regression. Using This explains the 8 new Laravel diagnostics in Could you preserve the generic type arguments and add an exact-type regression test? |
…nts of a static<...> return type vimeo#7797 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@orklah you were right: Behaviour change
|
# Conflicts: # tests/MethodCallTest.php
|
Thanks! I closed the two other as duplicate but I may have skipped some value, please reopen one if needed |
parent::method()of a method returningstaticwas typed as the parent class, not asstaticof the calling class.Before:
After: no issue,
parent::instance()isChild&static.Fixes #7797
🤖 Generated with Claude Code
https://claude.ai/code/session_01Ktu9y737NuDDE88xCYTSix