Skip to content

Commit e8c9100

Browse files
committed
fix downgrade skip array type
1 parent 984353f commit e8c9100

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Rector\DowngradePhp81\Rector\Array_;
66

7+
use PHPStan\Type\UnionType;
8+
use PHSPtan\Type\IntersectionType;
79
use PhpParser\Node;
810
use PhpParser\Node\ArrayItem;
911
use PhpParser\Node\Expr\Array_;
@@ -94,6 +96,14 @@ private function shouldSkipArray(Array_ $array): bool
9496
continue;
9597
}
9698

99+
if ($type instanceof UnionType) {
100+
continue;
101+
}
102+
103+
if ($type instanceof IntersectionType) {
104+
continue;
105+
}
106+
97107
/** @var ArrayType|ConstantArrayType $type */
98108
$keyType = $type->getKeyType();
99109
if ($keyType instanceof IntegerType) {

0 commit comments

Comments
 (0)