Skip to content

Commit 32914d8

Browse files
authored
Merge pull request #3 from szepeviktor/patch-1
Boolean condition only in ConditionalProxy
2 parents 2c1403a + c24261a commit 32914d8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/ConditionalProxy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ class ConditionalProxy
99

1010
/**
1111
* @param object $object
12-
* @param $condition
12+
* @param bool $condition
1313
*/
14-
public function __construct($object, $condition)
14+
public function __construct($object, bool $condition)
1515
{
1616
$this->object = $object;
1717
$this->condition = $condition;

src/HasConditionalCalls.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
trait HasConditionalCalls
88
{
99
/**
10-
* @param $condition
10+
* @param mixed $condition
1111
* @param Closure|null $callback
1212
*
1313
* @return static|ConditionalProxy
1414
*/
1515
public function when($condition, ?Closure $callback = null)
1616
{
17+
$condition = (bool)$condition;
1718
if ($callback === null) {
1819
return new ConditionalProxy($this, $condition);
1920
}

0 commit comments

Comments
 (0)