File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -195,4 +195,9 @@ public static function lazyMaxMin(
195195 );
196196 }
197197
198+ public function negate (): self
199+ {
200+ return new self ($ this ->result ->negate (), $ this ->reasons );
201+ }
202+
198203}
Original file line number Diff line number Diff line change @@ -281,10 +281,11 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
281281 return $ otherType ->isSuperTypeOf ($ this );
282282 }
283283
284+ // TODO: implement a lazyMinMax
284285 $ result = IsSuperTypeOfResult::lazyMaxMin (
285286 $ this ->types ,
286- static fn (Type $ innerType ) => $ otherType ->isSuperTypeOf ($ innerType ),
287- );
287+ static fn (Type $ innerType ) => $ otherType ->isSuperTypeOf ($ innerType )-> negate () ,
288+ )-> negate () ;
288289
289290 if (
290291 !$ result ->no ()
@@ -299,17 +300,11 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
299300
300301 public function isAcceptedBy (Type $ acceptingType , bool $ strictTypes ): AcceptsResult
301302 {
303+ // TODO: implement a lazyMinMax
302304 $ result = AcceptsResult::lazyMaxMin (
303305 $ this ->types ,
304- static fn (Type $ innerType ) => $ acceptingType ->accepts ($ innerType , $ strictTypes ),
305- );
306-
307- if ($ result ->yes ()) {
308- $ isSuperType = $ acceptingType ->isSuperTypeOf ($ this );
309- if ($ isSuperType ->no ()) {
310- return $ isSuperType ->toAcceptsResult ();
311- }
312- }
306+ static fn (Type $ innerType ) => $ acceptingType ->accepts ($ innerType , $ strictTypes )->negate (),
307+ )->negate ();
313308
314309 if ($ this ->isOversizedArray ()->yes ()) {
315310 if (!$ result ->no ()) {
You can’t perform that action at this time.
0 commit comments