Skip to content

Commit ca0da00

Browse files
committed
Merge remote-tracking branch 'origin/1.12.x' into 2.0.x
2 parents 14d2bed + 5efffc6 commit ca0da00

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Type/UnionType.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,15 @@ public function isSuperTypeOf(Type $otherType): IsSuperTypeOfResult
244244
return $otherType->isSubTypeOf($this);
245245
}
246246

247-
$result = IsSuperTypeOfResult::createNo()->or(...array_map(static fn (Type $innerType) => $innerType->isSuperTypeOf($otherType), $this->types));
248-
if ($result->yes()) {
249-
return $result;
247+
$results = [];
248+
foreach ($this->types as $innerType) {
249+
$result = $innerType->isSuperTypeOf($otherType);
250+
if ($result->yes()) {
251+
return $result;
252+
}
253+
$results[] = $result;
250254
}
255+
$result = IsSuperTypeOfResult::createNo()->or(...$results);
251256

252257
if ($otherType instanceof TemplateUnionType) {
253258
return $result->or($otherType->isSubTypeOf($this));

0 commit comments

Comments
 (0)