File tree Expand file tree Collapse file tree 4 files changed +11
-10
lines changed
src/Illuminate/Validation Expand file tree Collapse file tree 4 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ public static function notIn($values)
144
144
/**
145
145
* Get a required_if rule builder instance.
146
146
*
147
- * @param callable |bool $callback
147
+ * @param (\Closure(): bool) |bool $callback
148
148
* @return \Illuminate\Validation\Rules\RequiredIf
149
149
*/
150
150
public static function requiredIf ($ callback )
@@ -155,7 +155,7 @@ public static function requiredIf($callback)
155
155
/**
156
156
* Get a exclude_if rule builder instance.
157
157
*
158
- * @param callable |bool $callback
158
+ * @param (\Closure(): bool) |bool $callback
159
159
* @return \Illuminate\Validation\Rules\ExcludeIf
160
160
*/
161
161
public static function excludeIf ($ callback )
@@ -166,7 +166,7 @@ public static function excludeIf($callback)
166
166
/**
167
167
* Get a prohibited_if rule builder instance.
168
168
*
169
- * @param callable |bool $callback
169
+ * @param (\Closure(): bool) |bool $callback
170
170
* @return \Illuminate\Validation\Rules\ProhibitedIf
171
171
*/
172
172
public static function prohibitedIf ($ callback )
Original file line number Diff line number Diff line change @@ -11,14 +11,14 @@ class ExcludeIf implements Stringable
11
11
/**
12
12
* The condition that validates the attribute.
13
13
*
14
- * @var \Closure|bool
14
+ * @var ( \Closure(): bool) |bool
15
15
*/
16
16
public $ condition ;
17
17
18
18
/**
19
19
* Create a new exclude validation rule based on a condition.
20
20
*
21
- * @param \Closure|bool $condition
21
+ * @param ( \Closure(): bool) |bool $condition
22
22
*
23
23
* @throws \InvalidArgumentException
24
24
*/
Original file line number Diff line number Diff line change @@ -11,14 +11,14 @@ class ProhibitedIf implements Stringable
11
11
/**
12
12
* The condition that validates the attribute.
13
13
*
14
- * @var \Closure|bool
14
+ * @var ( \Closure(): bool) |bool
15
15
*/
16
16
public $ condition ;
17
17
18
18
/**
19
19
* Create a new prohibited validation rule based on a condition.
20
20
*
21
- * @param \Closure|bool $condition
21
+ * @param ( \Closure(): bool) |bool $condition
22
22
* @return void
23
23
*
24
24
* @throws \InvalidArgumentException
Original file line number Diff line number Diff line change 2
2
3
3
namespace Illuminate \Validation \Rules ;
4
4
5
+ use Closure ;
5
6
use InvalidArgumentException ;
6
7
use Stringable ;
7
8
@@ -10,18 +11,18 @@ class RequiredIf implements Stringable
10
11
/**
11
12
* The condition that validates the attribute.
12
13
*
13
- * @var callable |bool
14
+ * @var (\Closure(): bool) |bool
14
15
*/
15
16
public $ condition ;
16
17
17
18
/**
18
19
* Create a new required validation rule based on a condition.
19
20
*
20
- * @param callable |bool $condition
21
+ * @param (\Closure(): bool) |bool $condition
21
22
*/
22
23
public function __construct ($ condition )
23
24
{
24
- if (! is_string ($ condition )) {
25
+ if ($ condition instanceof Closure || is_bool ($ condition )) {
25
26
$ this ->condition = $ condition ;
26
27
} else {
27
28
throw new InvalidArgumentException ('The provided condition must be a callable or boolean. ' );
You can’t perform that action at this time.
0 commit comments