Skip to content

Commit 9930790

Browse files
committed
Fix always-true detection in in_array with union type haystack
1 parent d9c6377 commit 9930790

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Rules/Comparison/ImpossibleCheckTypeHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ public function findSpecifiedType(
153153
foreach ($haystackArrayTypes as $haystackArrayType) {
154154
if ($haystackArrayType instanceof ConstantArrayType) {
155155
foreach ($haystackArrayType->getValueTypes() as $i => $haystackArrayValueType) {
156+
if ($haystackArrayValueType instanceof UnionType) {
157+
continue;
158+
}
159+
156160
if ($haystackArrayType->isOptionalKey($i)) {
157161
continue;
158162
}

0 commit comments

Comments
 (0)