File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -266,7 +266,16 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
266266 return $ otherType ->isSuperTypeOf ($ this );
267267 }
268268
269- $ result = IsSuperTypeOfResult::maxMin (...array_map (static fn (Type $ innerType ) => $ otherType ->isSuperTypeOf ($ innerType ), $ this ->types ));
269+ $ results = [];
270+ foreach ($ this ->types as $ innerType ) {
271+ $ isSuperTypeOf = $ otherType ->isSuperTypeOf ($ innerType );
272+ if ($ isSuperTypeOf ->yes ()) {
273+ return IsSuperTypeOfResult::createYes ();
274+ }
275+ $ results [] = $ isSuperTypeOf ;
276+ }
277+ $ result = IsSuperTypeOfResult::maxMin (...$ results );
278+
270279 if (
271280 !$ result ->no ()
272281 && $ this ->isOversizedArray ()->yes ()
@@ -280,7 +289,16 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
280289
281290 public function isAcceptedBy (Type $ acceptingType , bool $ strictTypes ): AcceptsResult
282291 {
283- $ result = AcceptsResult::maxMin (...array_map (static fn (Type $ innerType ) => $ acceptingType ->accepts ($ innerType , $ strictTypes ), $ this ->types ));
292+ $ results = [];
293+ foreach ($ this ->types as $ innerType ) {
294+ $ isAcceptedBy = $ acceptingType ->isAcceptedBy ($ innerType , $ strictTypes );
295+
296+ if ($ isAcceptedBy ->yes ()) {
297+ return AcceptsResult::createYes ();
298+ }
299+ }
300+ $ result = AcceptsResult::maxMin (...$ results );
301+
284302 if ($ this ->isOversizedArray ()->yes ()) {
285303 if (!$ result ->no ()) {
286304 return AcceptsResult::createYes ();
You can’t perform that action at this time.
0 commit comments