diff --git a/rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php b/rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php index c362f8a2..991d668a 100644 --- a/rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php +++ b/rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php @@ -11,6 +11,8 @@ use PHPStan\Type\ArrayType; use PHPStan\Type\Constant\ConstantArrayType; use PHPStan\Type\IntegerType; +use PHPStan\Type\IntersectionType; +use PHPStan\Type\UnionType; use Rector\DowngradePhp81\NodeAnalyzer\ArraySpreadAnalyzer; use Rector\DowngradePhp81\NodeFactory\ArrayMergeFromArraySpreadFactory; use Rector\PHPStan\ScopeFetcher; @@ -94,6 +96,14 @@ private function shouldSkipArray(Array_ $array): bool continue; } + if ($type instanceof UnionType) { + continue; + } + + if ($type instanceof IntersectionType) { + continue; + } + /** @var ArrayType|ConstantArrayType $type */ $keyType = $type->getKeyType(); if ($keyType instanceof IntegerType) {