Skip to content
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

Incorrect behavior of Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector #5076

Closed
lulco opened this issue Jan 3, 2021 · 1 comment · Fixed by #5084
Closed
Labels

Comments

@lulco
Copy link
Contributor

lulco commented Jan 3, 2021

Bug Report

Subject Details
Rector version dev-master@900b60c
Installed as git clone

Parameter $packageName is removed from constructor as unused, but it is used in the next method. Maybe problem is it is in unset function?

unset($composerData[$section][$this->packageName]);

Minimal PHP Code Causing Issue

https://getrector.org/demo/2ae1ce38-7504-4fae-84f5-6f78a8988d69

Expected Behaviour

Do not remove private property from construct if it is in use

@lulco lulco added the bug label Jan 3, 2021
@lulco
Copy link
Contributor Author

lulco commented Jan 4, 2021

More minimalistic code https://getrector.org/demo/e53b2061-a7b8-4f30-9c54-06078824c358

There is an error in output: Can't handle this situation

samsonasik added a commit that referenced this issue Jan 4, 2021
TomasVotruba pushed a commit that referenced this issue Jan 4, 2021
…n unset (#5084)

* [DeadCode] Fixes #5076 Skip RemoveUnusedPrivatePropertyRector on property fetch in unset

* fixture

* phpstan
TomasVotruba added a commit that referenced this issue Sep 24, 2023
rectorphp/rector-src@4f19936 [AutoImport] Skip case insensitive conflict defined class name on $rectorConfig->importNames() (#5076)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant