Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/Type/UnionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,15 @@ public function isSuperTypeOfWithReason(Type $otherType): IsSuperTypeOfResult
return $otherType->isSubTypeOfWithReason($this);
}

$result = IsSuperTypeOfResult::createNo()->or(...array_map(static fn (Type $innerType) => $innerType->isSuperTypeOfWithReason($otherType), $this->types));
if ($result->yes()) {
return $result;
$results = [];
foreach ($this->types as $innerType) {
$result = $innerType->isSuperTypeOfWithReason($otherType);
if ($result->yes()) {
return $result;
}
$results[] = $result;
Comment on lines +249 to +254
Copy link
Contributor Author

@staabm staabm Nov 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic analog TrinaryLogic->lazyOr()

}
$result = IsSuperTypeOfResult::createNo()->or(...$results);

if ($otherType instanceof TemplateUnionType) {
return $result->or($otherType->isSubTypeOfWithReason($this));
Expand Down
Loading