Skip to content

Commit 816d317

Browse files
Try
1 parent 051e0af commit 816d317

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ public function check(
7878

7979
$allowedArrayKeysTypes = AllowedArrayKeysTypes::getType();
8080
foreach ($flattenedTypes as $innerType) {
81+
if ($allowedArrayKeysTypes->isSuperTypeOf($innerType)->no()) {
82+
// Will be reported by InvalidKeyInArrayItemRule
83+
continue;
84+
}
85+
8186
if (
8287
$this->reportPossiblyNonexistentGeneralArrayOffset
8388
&& $innerType->isArray()->yes()
@@ -95,6 +100,7 @@ public function check(
95100
$report = true;
96101
break;
97102
}
103+
98104
if ($dimType instanceof BenevolentUnionType) {
99105
$flattenedInnerTypes = [$dimType];
100106
} else {

0 commit comments

Comments
 (0)