Skip to content

Commit 48347e5

Browse files
Use value() helper in 'when' method to simplify code (#55465)
1 parent 22f61b3 commit 48347e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Illuminate/Conditionable/Traits/Conditionable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ trait Conditionable
2020
*/
2121
public function when($value = null, ?callable $callback = null, ?callable $default = null)
2222
{
23-
$value = $value instanceof Closure ? $value($this) : $value;
23+
$value = value($value, $this);
2424

2525
if (func_num_args() === 0) {
2626
return new HigherOrderWhenProxy($this);

0 commit comments

Comments
 (0)