-
-
Notifications
You must be signed in to change notification settings - Fork 686
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
RemoveUnusedVariableAssignRector: calls with side-effects should not be removed #8263
Comments
What the side effect of Unless it used along with |
one local side-effect is, that it spawns a another one: the call itself could trigger whatever side-effect at the remote system beeing called via the url. |
I see, that seems need to be registered to PureFunctionDetector service, could you add it? Thank you. |
After I re-check, it seems only spawn header when it called in singular process, not different process, because there is no next direct usage, after it is make
will get :
except, we have real repository to test real use case for re-used after removed. Could you create a simple repo use case for it which header can be re-used? |
it seems you missed the point of the code example. I just sent a php-docs improvement PR to make it more clear |
no, that on singular process, the process must be:
eg:
|
how did you came to this conclusion? I can't find anything in the docs which reads like what you describe the docs mention
which means it will be created in the local scope of the function triggering the http-call - in our example |
I see, I created PR rectorphp/rector-src#5162 for it. |
Bug Report
Minimal PHP Code Causing Issue
See https://getrector.com/demo/a56b4a20-48c9-4a49-8316-ba6873ba3c76
Responsible rules
RemoveUnusedVariableAssignRector
Expected Behavior
calling
file_get_contents
has side-effects and therefore this line should not be removed, but just the assigned variable (or just leave the line as is)The text was updated successfully, but these errors were encountered: