Skip to content

Commit b4dca63

Browse files
committed
[NodeTypeResolver] Apply logic Mixed inside Union check on TypeFactory::uniquateTypes()
1 parent d945840 commit b4dca63

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/NodeTypeResolver/PHPStan/Type/TypeFactory.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ public function uniquateTypes(array $types, bool $keepConstant = false): array
6464
$hasFalse = false;
6565
$hasTrue = false;
6666
foreach ($types as $type) {
67+
// mixed only allowed to be standalone
6768
if ($type instanceof MixedType) {
68-
$type = new MixedType();
69+
return [new MixedType()];
6970
}
7071

7172
$type = $this->normalizeObjectType($totalTypes, $type);
@@ -168,12 +169,6 @@ private function createUnionOrSingleType(array $types): Type
168169
return $types[0];
169170
}
170171

171-
foreach ($types as $type) {
172-
if ($type instanceof MixedType) {
173-
return new MixedType();
174-
}
175-
}
176-
177172
return new UnionType($types);
178173
}
179174

0 commit comments

Comments
 (0)