File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -28,22 +28,23 @@ private function __construct(private int $value)
28
28
29
29
public static function createYes (): self
30
30
{
31
- return self ::create (self ::YES );
31
+ return self ::$ registry [ self :: YES ] ??= new self (self ::YES );
32
32
}
33
33
34
34
public static function createNo (): self
35
35
{
36
- return self ::create (self ::NO );
36
+ return self ::$ registry [ self :: NO ] ??= new self (self ::NO );
37
37
}
38
38
39
39
public static function createMaybe (): self
40
40
{
41
- return self ::create (self ::MAYBE );
41
+ return self ::$ registry [ self :: MAYBE ] ??= new self (self ::MAYBE );
42
42
}
43
43
44
44
public static function createFromBoolean (bool $ value ): self
45
45
{
46
- return self ::create ($ value ? self ::YES : self ::NO );
46
+ $ yesNo = $ value ? self ::YES : self ::NO ;
47
+ return self ::$ registry [$ yesNo ] ??= new self ($ yesNo );
47
48
}
48
49
49
50
private static function create (int $ value ): self
You can’t perform that action at this time.
0 commit comments