Skip to content

Commit 6bdd527

Browse files
committed
[CodingStyle] Skip non-native array type on PHP 7.4 for ArraySpreadInsteadOfArrayMergeRector
1 parent 72190d5 commit 6bdd527

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

rules/CodingStyle/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private function shouldSkipArrayForInvalidKeys(Expr $expr): bool
135135
$type = $this->getType($expr);
136136

137137
if ($type->getIterableKeyType()->isInteger()->yes()) {
138-
if (! $this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::ARRAY_SPREAD_STRING_KEYS)) {
138+
if (! $this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::ARRAY_ON_ARRAY_MERGE)) {
139139
$nativeType = $this->nodeTypeResolver->getNativeType($expr);
140140
return ! $nativeType->isArray()->yes();
141141
}

src/ValueObject/PhpVersionFeature.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,12 @@ final class PhpVersionFeature
653653
*/
654654
public const MIXED_TYPE = PhpVersion::PHP_80;
655655

656+
/**
657+
* @see https://3v4l.org/OWtO5
658+
* @var int
659+
*/
660+
public const ARRAY_ON_ARRAY_MERGE = PhpVersion::PHP_80;
661+
656662
/**
657663
* @var int
658664
*/

0 commit comments

Comments
 (0)