Skip to content

Commit

Permalink
return $this if the callback does not return anything #5
Browse files Browse the repository at this point in the history
  • Loading branch information
devmoath committed Dec 17, 2021
1 parent 6f912be commit cf7aaa1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Jql.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function when(mixed $value, callable $callback): self
$value = value($value, $this);

if ($value) {
return $callback($this, $value);
return $callback($this, $value) ?: $this;
}

return $this;
Expand All @@ -147,7 +147,7 @@ public function whenNot(mixed $value, callable $callback): self
$value = value($value, $this);

if (! $value) {
return $callback($this, $value);
return $callback($this, $value) ?: $this;
}

return $this;
Expand Down

0 comments on commit cf7aaa1

Please sign in to comment.