Commit b67256c
Preserve PropertyInitializationExpr for properties with default values
When entering a set hook or a method called from the constructor,
only remove PropertyInitializationExpr for properties without default
values. Properties with defaults (e.g. `private int $bar = 1`) are
always initialized, so isset() should report "not nullable nor
uninitialized" rather than just "not nullable".
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent db70c6c commit b67256c
3 files changed
Lines changed: 17 additions & 4 deletions
File tree
- src/Analyser
- tests/PHPStan/Rules/Variables
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1608 | 1608 | | |
1609 | 1609 | | |
1610 | 1610 | | |
1611 | | - | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
1612 | 1618 | | |
1613 | 1619 | | |
1614 | 1620 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
724 | | - | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
725 | 732 | | |
726 | 733 | | |
727 | 734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
572 | | - | |
| 572 | + | |
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
| |||
581 | 581 | | |
582 | 582 | | |
583 | 583 | | |
584 | | - | |
| 584 | + | |
585 | 585 | | |
586 | 586 | | |
587 | 587 | | |
| |||
0 commit comments