File tree Expand file tree Collapse file tree 4 files changed +14
-14
lines changed
Expand file tree Collapse file tree 4 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -47,18 +47,6 @@ public static function createFromBoolean(bool $value): self
4747 return self ::$ registry [$ yesNo ] ??= new self ($ yesNo );
4848 }
4949
50- public static function createFromBooleanType (BooleanType $ type ): self
51- {
52- if ($ type ->isTrue ()->yes ()) {
53- return self ::createYes ();
54- }
55- if ($ type ->isFalse ()->yes ()) {
56- return self ::createNo ();
57- }
58-
59- return self ::createMaybe ();
60- }
61-
6250 private static function create (int $ value ): self
6351 {
6452 self ::$ registry [$ value ] ??= new self ($ value );
Original file line number Diff line number Diff line change @@ -163,4 +163,16 @@ public function toPhpDocNode(): TypeNode
163163 return new IdentifierTypeNode ('bool ' );
164164 }
165165
166+ public function toTrinaryLogic (): TrinaryLogic
167+ {
168+ if ($ this ->isTrue ()->yes ()) {
169+ return TrinaryLogic::createYes ();
170+ }
171+ if ($ this ->isFalse ()->yes ()) {
172+ return TrinaryLogic::createNo ();
173+ }
174+
175+ return TrinaryLogic::createMaybe ();
176+ }
177+
166178}
Original file line number Diff line number Diff line change @@ -717,7 +717,7 @@ public function isScalar(): TrinaryLogic
717717 public function looseCompare (Type $ type , PhpVersion $ phpVersion ): BooleanType
718718 {
719719 return $ this ->intersectResults (
720- static fn (Type $ innerType ): TrinaryLogic => TrinaryLogic:: createFromBooleanType ( $ innerType ->looseCompare ($ type , $ phpVersion ))
720+ static fn (Type $ innerType ): TrinaryLogic => $ innerType ->looseCompare ($ type , $ phpVersion )-> toTrinaryLogic ( )
721721 )->toBooleanType ();
722722 }
723723
Original file line number Diff line number Diff line change @@ -677,7 +677,7 @@ public function isScalar(): TrinaryLogic
677677 public function looseCompare (Type $ type , PhpVersion $ phpVersion ): BooleanType
678678 {
679679 return $ this ->unionResults (
680- static fn (Type $ innerType ): TrinaryLogic => TrinaryLogic:: createFromBooleanType ( $ innerType ->looseCompare ($ type , $ phpVersion ))
680+ static fn (Type $ innerType ): TrinaryLogic => $ innerType ->looseCompare ($ type , $ phpVersion )-> toTrinaryLogic ( )
681681 )->toBooleanType ();
682682 }
683683
You can’t perform that action at this time.
0 commit comments