-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
SimplifyUselessVariableRector missing opportunity #8262
Comments
Since variable may be used in next call, the SideEffectNodeDetector and by-ref param may need to be used to verify. |
Alternativly maybe there should be a rector which tests all return expression whether they just return a constant type and replace the return expression with said constant? |
On method call or user defined function. it clearly should be skipped, as variable can be used via:
which change behavior, On native function, there is PureFunctionDetector service, that consumed by SideEffectNodeDetector |
we had |
I checked the code, it seems the rule is designed to cover Assign in Expression, then use after that, which your use case is out of scope. we had the on that reasoning, I am closing it :) |
Bug Report
I expected SimplifyUselessVariableRector to cleanup this code
vendor/bin/rector --version
)Minimal PHP Code Causing Issue
https://getrector.com/demo/b2fd9fbe-1209-4cbb-a317-fdd49ad2f2b1
Expected Behaviour
The text was updated successfully, but these errors were encountered: