Commit 70b43f2
Don't invalidate private property expressions of different classes
- When a method with side effects is called, private properties that the
method's declaring class cannot access should not be invalidated
- Added invalidatingClass parameter to invalidateExpression() and
shouldInvalidateExpression() in MutatingScope
- Added isPrivatePropertyOfDifferentClass() to check if a property
expression refers to a private property declared in a different class
than the one whose method triggered the invalidation
- New regression test in tests/PHPStan/Analyser/nsrt/bug-13736.php
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 9f86e84 commit 70b43f2
File tree
5 files changed
+85
-11
lines changed- src/Analyser
- tests/PHPStan/Analyser/nsrt
5 files changed
+85
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
239 | 243 | | |
240 | 244 | | |
241 | 245 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3460 | 3460 | | |
3461 | 3461 | | |
3462 | 3462 | | |
3463 | | - | |
| 3463 | + | |
3464 | 3464 | | |
3465 | 3465 | | |
3466 | 3466 | | |
| |||
3469 | 3469 | | |
3470 | 3470 | | |
3471 | 3471 | | |
3472 | | - | |
| 3472 | + | |
3473 | 3473 | | |
3474 | 3474 | | |
3475 | 3475 | | |
| |||
3484 | 3484 | | |
3485 | 3485 | | |
3486 | 3486 | | |
3487 | | - | |
| 3487 | + | |
3488 | 3488 | | |
3489 | 3489 | | |
3490 | 3490 | | |
3491 | 3491 | | |
3492 | 3492 | | |
3493 | 3493 | | |
3494 | | - | |
| 3494 | + | |
3495 | 3495 | | |
3496 | 3496 | | |
3497 | 3497 | | |
| |||
3524 | 3524 | | |
3525 | 3525 | | |
3526 | 3526 | | |
3527 | | - | |
| 3527 | + | |
3528 | 3528 | | |
3529 | 3529 | | |
3530 | 3530 | | |
| |||
3570 | 3570 | | |
3571 | 3571 | | |
3572 | 3572 | | |
| 3573 | + | |
| 3574 | + | |
| 3575 | + | |
| 3576 | + | |
| 3577 | + | |
| 3578 | + | |
| 3579 | + | |
| 3580 | + | |
3573 | 3581 | | |
3574 | 3582 | | |
3575 | 3583 | | |
| 3584 | + | |
| 3585 | + | |
| 3586 | + | |
| 3587 | + | |
| 3588 | + | |
| 3589 | + | |
| 3590 | + | |
| 3591 | + | |
| 3592 | + | |
| 3593 | + | |
| 3594 | + | |
| 3595 | + | |
| 3596 | + | |
| 3597 | + | |
| 3598 | + | |
| 3599 | + | |
3576 | 3600 | | |
3577 | 3601 | | |
3578 | 3602 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3185 | 3185 | | |
3186 | 3186 | | |
3187 | 3187 | | |
3188 | | - | |
| 3188 | + | |
3189 | 3189 | | |
3190 | 3190 | | |
3191 | 3191 | | |
| |||
3395 | 3395 | | |
3396 | 3396 | | |
3397 | 3397 | | |
3398 | | - | |
| 3398 | + | |
3399 | 3399 | | |
3400 | 3400 | | |
3401 | 3401 | | |
| |||
7615 | 7615 | | |
7616 | 7616 | | |
7617 | 7617 | | |
7618 | | - | |
7619 | | - | |
| 7618 | + | |
| 7619 | + | |
7620 | 7620 | | |
| 7621 | + | |
| 7622 | + | |
7621 | 7623 | | |
7622 | 7624 | | |
7623 | 7625 | | |
| |||
7627 | 7629 | | |
7628 | 7630 | | |
7629 | 7631 | | |
7630 | | - | |
| 7632 | + | |
7631 | 7633 | | |
7632 | 7634 | | |
7633 | 7635 | | |
7634 | 7636 | | |
7635 | 7637 | | |
7636 | | - | |
| 7638 | + | |
7637 | 7639 | | |
7638 | 7640 | | |
7639 | 7641 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
0 commit comments