Skip to content

Commit a048f99

Browse files
authored
Removed unnecessary checks as is_callable would return false for literals other than strings anyway, fixed tests (#37700)
1 parent c550e09 commit a048f99

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

src/Illuminate/Validation/Rules/RequiredIf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class RequiredIf
2121
*/
2222
public function __construct($condition)
2323
{
24-
if (! is_string($condition) && (is_bool($condition) || is_callable($condition))) {
24+
if (! is_string($condition)) {
2525
$this->condition = $condition;
2626
} else {
2727
throw new InvalidArgumentException('The provided condition must be a callable or boolean.');

tests/Validation/ValidationRequiredIfTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ public function testItOnlyCallableAndBooleanAreAcceptableArgumentsOfTheRule()
3939
$this->expectException(\InvalidArgumentException::class);
4040

4141
$rule = new RequiredIf('phpinfo');
42-
43-
$rule = new RequiredIf(12.3);
44-
45-
$rule = new RequiredIf(new stdClass());
4642
}
4743

4844
public function testItReturnedRuleIsNotSerializable()
@@ -52,7 +48,5 @@ public function testItReturnedRuleIsNotSerializable()
5248
$rule = serialize(new RequiredIf(function () {
5349
return true;
5450
}));
55-
56-
$rule = serialize(new RequiredIf());
5751
}
5852
}

0 commit comments

Comments
 (0)