Commit 5955b7a
Fix: Only invalidate expressions for immediately-invoked callables, not later-invoked ones
The deferredInvalidateExpressions were being collected unconditionally
for all closures, regardless of whether the callable was marked with
@param-immediately-invoked-callable or @param-later-invoked-callable.
This caused property types to be incorrectly invalidated even for
later-invoked callables where the callback hasn't executed yet.
Gate deferredInvalidateExpressions behind callCallbackImmediately() and
update the bug-11417 test to assert that the later-invoked-callable case
correctly reports "If condition is always true" instead of just a comment.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 9fab5c0 commit 5955b7a
3 files changed
Lines changed: 12 additions & 4 deletions
File tree
- src/Analyser
- tests/PHPStan/Rules/Comparison
- data
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3370 | 3370 | | |
3371 | 3371 | | |
3372 | 3372 | | |
3373 | | - | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
3374 | 3376 | | |
3375 | 3377 | | |
3376 | 3378 | | |
| |||
3418 | 3420 | | |
3419 | 3421 | | |
3420 | 3422 | | |
3421 | | - | |
3422 | 3423 | | |
| 3424 | + | |
3423 | 3425 | | |
3424 | 3426 | | |
3425 | 3427 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
190 | 196 | | |
191 | 197 | | |
192 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
0 commit comments