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

[DowngradePhp81] Add DowngradeArraySpreadStringKeyRector #1369

Merged
merged 9 commits into from
Dec 3, 2021

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Dec 3, 2021

There is php 7.4's DowngradeArraySpreadRector, but downgrading array spread will only applied if user downgrade into php 7.4.

This PR add DowngradeArraySpreadStringKeyRector if user want to downgrade from php 8.1 into php 8.0 only, which php 8.0 doesn't support string key array spread yet, so it changed to array_merge.

The DowngradeArraySpreadStringKeyRector extends existing DowngradeArraySpreadRector which apply when key is string.

@samsonasik samsonasik force-pushed the add-downgrade-array-spread-string-key branch from fc81fc1 to e2cec40 Compare December 3, 2021 03:07
@samsonasik samsonasik force-pushed the add-downgrade-array-spread-string-key branch from ee6eef1 to b60597e Compare December 3, 2021 03:12
@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

@TomasVotruba TomasVotruba merged commit 81a50ac into main Dec 3, 2021
@TomasVotruba TomasVotruba deleted the add-downgrade-array-spread-string-key branch December 3, 2021 04:42
@TomasVotruba
Copy link
Member

Thank you

$parts = ['a' => 'b'];
$parts2 = ['c' => 'd'];

$result = [...$parts, ...$parts2];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, before and after is same, it should not, I will create new PR to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants