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
[DeadCode] Do not remove parameter on RemoveUnusedPrivatePropertyRector on constructor only usage in the middle of parameter #1212
Conversation
879913c
to
71ae512
Compare
The constructor might be BC break in case of scalar values. But the removal of property assign and property seems legit. |
This is only effect if the removed parameter not in the last used parameter, as the caller which call: (new SkipConstructorOnlyInMiddleParameterUsed(1, new stdClass)); will got error: Uncaught TypeError: SkipConstructorOnlyInMiddleParameterUsed::__construct(): Argument #1 ($stdClass) must be of type stdClass, int given |
Ok, it seems the removal should be only for :
but keep the constructor parameter. |
@TomasVotruba I updated failing fixture to only remove property and assign ,but keep the constructor parameter as it happen not in last parameter |
Fixed 🎉 |
8ef0593
to
873a2ab
Compare
All checks have passed 🎉 @TomasVotruba it is ready for review. |
} No newline at end of file | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\DowngradePhp70\Rector\FuncCall\DowngradeDirnameLevelsRector; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, what has changed here? The file looks identical. EOLs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's seems spacing and eol
Thank you 👏 |
Given the following code:
It produce:
which can make the caller of the class error. It needs to be skipped.