File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 3838 */
3939final class TrinaryLogic
4040{
41+
4142 private const YES = 3 ;
4243 private const MAYBE = 1 ;
4344 private const NO = 0 ;
4445
45-
4646 /** @var self[] */
4747 private static array $ registry = [];
4848
4949 private static self $ YES ;
50+
5051 private static self $ MAYBE ;
52+
5153 private static self $ NO ;
5254
5355 private function __construct (private int $ value )
@@ -119,8 +121,8 @@ public function toBooleanType(): BooleanType
119121 public function and (?self $ operand = null , self ...$ rest ): self
120122 {
121123 $ min = $ this ->value & ($ operand !== null ? $ operand ->value : self ::YES );
122- foreach ($ rest as $ operand ) {
123- $ min &= $ operand ->value ;
124+ foreach ($ rest as $ restOperand ) {
125+ $ min &= $ restOperand ->value ;
124126 }
125127 return self ::$ registry [$ min ] ??= new self ($ min );
126128 }
@@ -155,8 +157,8 @@ public function lazyAnd(
155157 public function or (?self $ operand = null , self ...$ rest ): self
156158 {
157159 $ max = $ this ->value | ($ operand !== null ? $ operand ->value : self ::NO );
158- foreach ($ rest as $ operand ) {
159- $ max |= $ operand ->value ;
160+ foreach ($ rest as $ restOperand ) {
161+ $ max |= $ restOperand ->value ;
160162 }
161163 return self ::$ registry [$ max ] ??= new self ($ max );
162164 }
You can’t perform that action at this time.
0 commit comments