-
-
Notifications
You must be signed in to change notification settings - Fork 409
[TypedPropertyRector] Remove private property only, to keep other rules work separately #1496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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() |
Yes, that is also dangerous 👍 |
e59cd80
to
fb3d8d7
Compare
Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>
@samsonasik Feel free to review & merge. I'm going out for a bit |
Thank you @TomasVotruba |
Ref rectorphp/rector#6762