Skip to content

Commit 916e2d7

Browse files
staabmondrejmirtes
authored andcommitted
TrinaryLogic: Prevent unnecessary work
1 parent 2caa832 commit 916e2d7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/TrinaryLogic.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ public function lazyAnd(
100100
callable $callback,
101101
): self
102102
{
103-
if ($this->no()) {
103+
if ($this->value === self::NO) {
104104
return $this;
105105
}
106106

107107
$results = [];
108108
foreach ($objects as $object) {
109109
$result = $callback($object);
110-
if ($result->no()) {
110+
if ($result->value === self::NO) {
111111
return $result;
112112
}
113113

@@ -140,14 +140,14 @@ public function lazyOr(
140140
callable $callback,
141141
): self
142142
{
143-
if ($this->yes()) {
143+
if ($this->value === self::YES) {
144144
return $this;
145145
}
146146

147147
$results = [];
148148
foreach ($objects as $object) {
149149
$result = $callback($object);
150-
if ($result->yes()) {
150+
if ($result->value === self::YES) {
151151
return $result;
152152
}
153153

@@ -221,7 +221,7 @@ public static function lazyMaxMin(
221221
$results = [];
222222
foreach ($objects as $object) {
223223
$result = $callback($object);
224-
if ($result->yes()) {
224+
if ($result->value === self::YES) {
225225
return $result;
226226
}
227227

0 commit comments

Comments
 (0)