Skip to content

Commit d2a88ff

Browse files
authored
Switch to null coalescing operator in Conditionable (#40888)
1 parent dfef6a1 commit d2a88ff

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Illuminate/Conditionable/Traits/Conditionable.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public function when($value, callable $callback = null, callable $default = null
2626
}
2727

2828
if ($value) {
29-
return $callback($this, $value) ?: $this;
29+
return $callback($this, $value) ?? $this;
3030
} elseif ($default) {
31-
return $default($this, $value) ?: $this;
31+
return $default($this, $value) ?? $this;
3232
}
3333

3434
return $this;
@@ -53,9 +53,9 @@ public function unless($value, callable $callback = null, callable $default = nu
5353
}
5454

5555
if (! $value) {
56-
return $callback($this, $value) ?: $this;
56+
return $callback($this, $value) ?? $this;
5757
} elseif ($default) {
58-
return $default($this, $value) ?: $this;
58+
return $default($this, $value) ?? $this;
5959
}
6060

6161
return $this;

0 commit comments

Comments
 (0)