We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
UnionType->isSuperTypeOf()
1 parent 8d67d7a commit beec4e2Copy full SHA for beec4e2
src/Type/UnionType.php
@@ -245,7 +245,16 @@ public function isSuperTypeOfWithReason(Type $otherType): IsSuperTypeOfResult
245
return $otherType->isSubTypeOfWithReason($this);
246
}
247
248
- $result = IsSuperTypeOfResult::createNo()->or(...array_map(static fn (Type $innerType) => $innerType->isSuperTypeOfWithReason($otherType), $this->types));
+ $results = [];
249
+ foreach ($this->types as $innerType) {
250
+ $result = $innerType->isSuperTypeOfWithReason($otherType);
251
+ if ($result->yes()) {
252
+ return $result;
253
+ }
254
+ $results[] = $result;
255
256
+
257
+ $result = IsSuperTypeOfResult::createNo()->or(...$results);
258
if ($result->yes()) {
259
return $result;
260
0 commit comments