We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 03e629c commit 35af5a4Copy full SHA for 35af5a4
src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php
@@ -95,16 +95,12 @@ public function check(
95
$report = true;
96
break;
97
}
98
- if ($dimType instanceof UnionType) {
99
- foreach ($dimType->getTypes() as $subDimType) {
100
- if ($innerType->hasOffsetValueType($subDimType)->no()) {
101
- $report = true;
102
- break 2;
103
- }
104
105
- continue;
+ if ($dimType instanceof BenevolentUnionType) {
+ $flattenedInnerTypes = [$dimType];
+ } else {
+ $flattenedInnerTypes = TypeUtils::flattenTypes($dimType);
106
107
- foreach (TypeUtils::flattenTypes($dimType) as $innerDimType) {
+ foreach ($flattenedInnerTypes as $innerDimType) {
108
if ($innerType->hasOffsetValueType($innerDimType)->no()) {
109
110
break 2;
0 commit comments