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

UnusedForeachValueToArrayKeysRector removes values that are used #8753

Closed
sreichel opened this issue Jul 20, 2024 · 6 comments · Fixed by rectorphp/rector-src#6164
Closed
Labels

Comments

@sreichel
Copy link

sreichel commented Jul 20, 2024

Bug Report

Subject Details
Rector version v1.2.1
Rule UnusedForeachValueToArrayKeysRector

This rule also removes values that are later used in that method ...

Minimal PHP Code Causing Issue

Demo-page returns 500 error ...

See

Expected Behaviour

If the value is used lat,er it should be skipped.

@sreichel sreichel added the bug label Jul 20, 2024
@samsonasik
Copy link
Member

Demo page should be fixed now, could you retry?

@sreichel
Copy link
Author

sreichel commented Jul 20, 2024

@sreichel
Copy link
Author

Another one ... &$storeCode changed to &$storeId ... ?!?

$storeCode isnt used later. Did not test it, but this looks wrong ...

github3

@samsonasik
Copy link
Member

Could you create example at https://3v4l.org/ that show invalid result on reference?

@sreichel
Copy link
Author

Yes, i will do. But 2nd one is strange ... there is similiar code in the same file (unsed referernce) that is not changed. Gimme one or two days to test.

@samsonasik
Copy link
Member

No worries, we can fix one by one with new issue if needed

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.

2 participants