Skip to content

[CodeQuality] Skip deep append in if foreach before on ForeachItemsAssignToEmptyArrayToAssignRector#4053

Merged
samsonasik merged 1 commit intomainfrom
skip-deep-append-foreach
Jun 3, 2023
Merged

[CodeQuality] Skip deep append in if foreach before on ForeachItemsAssignToEmptyArrayToAssignRector#4053
samsonasik merged 1 commit intomainfrom
skip-deep-append-foreach

Conversation

@samsonasik
Copy link
Copy Markdown
Member

Continue of PR:

The following code should be skipped as well:

        $items2 = [];

        if (rand(0, 1)) {
            foreach (['foo', 'bar'] as $item) {
                $items2[] = $item;
            }
        }

        foreach ($items as $item) {
            $items2[] = $item;
        }

@samsonasik samsonasik requested a review from TomasVotruba as a code owner June 3, 2023 00:47
@samsonasik samsonasik enabled auto-merge (squash) June 3, 2023 00:47
@samsonasik samsonasik merged commit c9fc74b into main Jun 3, 2023
@samsonasik samsonasik deleted the skip-deep-append-foreach branch June 3, 2023 00:49
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.

1 participant