Skip to content
Merged
Changes from 1 commit
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: 10 additions & 1 deletion src/Type/UnionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,16 @@ 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));
$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 ($result->yes()) {
Copy link
Member

Choose a reason for hiding this comment

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

It cannot be a yes after this, righr. It could be deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right

return $result;
}
Expand Down
Loading