Skip to content

Conversation

@TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Oct 22, 2025

In some cases we're unable to resolve keys propperly, as relying on docblocks. This can lead to bugs as rectorphp/rector#9448

To safeguard this, Rector will always downgrade array spread to array_merge() if going down to PHP 8.1 or 7.4.

@TomasVotruba TomasVotruba force-pushed the tv-downgrade-array-spread branch from 09da4fc to 5d44079 Compare October 22, 2025 10:26
@TomasVotruba TomasVotruba force-pushed the tv-downgrade-array-spread branch from 5d44079 to f79dfe3 Compare October 22, 2025 10:28
@TomasVotruba TomasVotruba changed the title tv downgrade array spread Improve downgrade array spread stability Oct 22, 2025
@TomasVotruba TomasVotruba merged commit 8f7b411 into main Oct 22, 2025
7 checks passed
@TomasVotruba TomasVotruba deleted the tv-downgrade-array-spread branch October 22, 2025 10:29
@samsonasik
Copy link
Member

While this fix the issue, the possible bug is the updated IntersectionType -> AccessoryArrayListType cleaning on your PR:

for multiple data, a[]&b[]&c[], this should be directly array return instead, so should be something like:

if ($intersectionType instanceof AccessoryArrayListType) {
       return new ArrayType(new MixedType(), new MixedType());
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants