[TypedPropertyRector] Remove private property only, to keep other rules work separately#1496
[TypedPropertyRector] Remove private property only, to keep other rules work separately#1496samsonasik merged 10 commits intomainfrom
Conversation
|
@TomasVotruba any other rule that handle it? |
|
@TomasVotruba I think it is handy to update code like in |
|
This rule was grouping 7 type infererrers together. It's too complex operation to hold them together, so they'll be split to 1 responsibility each in https://github.com/rectorphp/rector-src/tree/main/rules/TypeDeclaration/Rector/Property
The 2 doctrine ones will be moved to https://github.com/rectorphp/rector-doctrine |
If possible, we should cover this behavior inside the rules itself, without having an option for it. |
|
If that needs to apply, then class A
{
protected array $data = [];
}
class B extends A
{
public function reset()
{
$this->data = null;
}
}
(new B())->reset();that will cause Fatal error: Fatal error: Uncaught TypeError: Cannot assign null to property A::$data of type array in /in/EDR6K:12
Stack trace:
#0 /in/EDR6K(16): B->reset()ref https://3v4l.org/EDR6K |
Yes, that is also dangerous 👍 |
e59cd80 to
fb3d8d7
Compare
Co-authored-by: Abdul Malik Ikhsan <[email protected]>
|
@samsonasik Feel free to review & merge. I'm going out for a bit |
|
Thank you @TomasVotruba |
Ref rectorphp/rector#6762