Skip to content

Add check for append in foreach items assignment#9588

Closed
solverat wants to merge 1 commit intorectorphp:mainfrom
solverat:patch-1
Closed

Add check for append in foreach items assignment#9588
solverat wants to merge 1 commit intorectorphp:mainfrom
solverat:patch-1

Conversation

@solverat
Copy link
Copy Markdown

@solverat solverat commented Jan 8, 2026

This PR fixes the rule ForeachItemsAssignToEmptyArrayToAssignRector, which currently ignores array modifications in skipped foreach loops, leading to incorrect direct assignments that overwrite previously collected data.

Fixes #9587 and probable #9534.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 8, 2026

This repository content is generated by rectorphp/rector-src. Please open pull request to rectorphp/rector-src.

@github-actions github-actions Bot closed this Jan 8, 2026
@solverat solverat deleted the patch-1 branch January 8, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect behavior of ForeachItemsAssignToEmptyArrayToAssignRector

1 participant