Skip to content

Commit 86fd558

Browse files
committed
Remove redundant check
1 parent 5b604e1 commit 86fd558

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/Illuminate/Validation/Concerns/ValidatesAttributes.php

+2-17
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ protected function prepareValuesAndOther($parameters)
15161516
$values = $this->convertValuesToBoolean($values);
15171517
}
15181518

1519-
if ($this->shouldConvertToNull($parameters[0]) || is_null($other)) {
1519+
if (is_null($other)) {
15201520
$values = $this->convertValuesToNull($values);
15211521
}
15221522

@@ -1534,17 +1534,6 @@ protected function shouldConvertToBoolean($parameter)
15341534
return in_array('boolean', Arr::get($this->rules, $parameter, []));
15351535
}
15361536

1537-
/**
1538-
* Check if parameter should be converted to null.
1539-
*
1540-
* @param string $parameter
1541-
* @return bool
1542-
*/
1543-
protected function shouldConvertToNull($parameter)
1544-
{
1545-
return in_array('nullable', Arr::get($this->rules, $parameter, []));
1546-
}
1547-
15481537
/**
15491538
* Convert the given values to boolean if they are string "true" / "false".
15501539
*
@@ -1573,11 +1562,7 @@ protected function convertValuesToBoolean($values)
15731562
protected function convertValuesToNull($values)
15741563
{
15751564
return array_map(function ($value) {
1576-
if ($value === 'null') {
1577-
return null;
1578-
}
1579-
1580-
return $value;
1565+
return Str::lower($value) === 'null' ? null : $value;
15811566
}, $values);
15821567
}
15831568

0 commit comments

Comments
 (0)