Add rule call constructor#1208
Conversation
|
Already pointed out how to define rules |
I'll split Rule |
There was a problem hiding this comment.
| : ['__construct should not be called outside constructor.']; | |
| : ['__construct() should not be called outside constructor.']; |
There was a problem hiding this comment.
LGTM
This message is written in other lines, so I changed those.
ondrejmirtes
left a comment
There was a problem hiding this comment.
Thank you. I'm gonna take over and bring it over the finish line 😊
|
[IMO] but since the number of use cases is expected to be small, it can be ignored. |
I think, above case is no need of using __construct(). Is this wrong understanding? |
Yep, it can be rewrite such of your example. |
Sorry. I misread your first comment. |
47828c4 to
6fa97ee
Compare
6fa97ee to
4daa27c
Compare
|
I've pushed some improvements, feel free to check out the commits :) |
535a03e to
18930cc
Compare
|
Thank you. |
|
Thank you, too. |
|
FYI I've moved these rules to phpstan-strict-rules (124b30f, phpstan/phpstan-strict-rules@0c82c96) because it's a better fit there. According to some opinions, these rules are too opinionated to be part of the "mainstream" PHPStan. Thanks for understanding. |
Implementation for phpstan/phpstan/issues/7022.
Notes
Because it is a bit difficult.