Skip to content

Commit 3b4abf1

Browse files
authored
Avoid using ->isArray()->yes() usage on getKeyType() usage next (#247)
1 parent 22bdcd5 commit 3b4abf1

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
use PHPStan\Type\ArrayType;
1212
use PHPStan\Type\Constant\ConstantArrayType;
1313
use PHPStan\Type\IntegerType;
14-
use PHPStan\Type\IntersectionType;
15-
use PHPStan\Type\UnionType;
1614
use Rector\DowngradePhp81\NodeAnalyzer\ArraySpreadAnalyzer;
1715
use Rector\DowngradePhp81\NodeFactory\ArrayMergeFromArraySpreadFactory;
1816
use Rector\PHPStan\ScopeFetcher;
@@ -92,19 +90,10 @@ private function shouldSkipArray(Array_ $array): bool
9290
}
9391

9492
$type = $this->nodeTypeResolver->getType($item->value);
95-
if (! $type->isArray()->yes()) {
93+
if (! $type instanceof ArrayType && ! $type instanceof ConstantArrayType) {
9694
continue;
9795
}
9896

99-
if ($type instanceof UnionType) {
100-
continue;
101-
}
102-
103-
if ($type instanceof IntersectionType) {
104-
continue;
105-
}
106-
107-
/** @var ArrayType|ConstantArrayType $type */
10897
$keyType = $type->getKeyType();
10998
if ($keyType instanceof IntegerType) {
11099
return true;

0 commit comments

Comments
 (0)