Skip to content

Commit

Permalink
refactor: by rector
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Sep 15, 2023
1 parent d840fef commit fde80eb
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions system/Validation/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ protected function processRules(

foreach ($rules as $i => $rule) {
$isCallable = is_callable($rule);
$stringCallable = ($isCallable && is_string($rule)) ? true : false;
$arrayCallable = ($isCallable && is_array($rule)) ? true : false;
$stringCallable = $isCallable && is_string($rule);
$arrayCallable = $isCallable && is_array($rule);

$passed = false;
$param = false;
Expand All @@ -297,13 +297,7 @@ protected function processRules(
if ($this->isClosure($rule)) {
$passed = $rule($value, $data, $error, $field);
} elseif ($isCallable) {
if ($stringCallable) {
// The rule is a function.
$passed = $rule($value);
} else {
// The rule is an array.
$passed = $rule($value, $data, $error, $field);
}
$passed = $stringCallable ? $rule($value) : $rule($value, $data, $error, $field);
} else {
$found = false;

Expand Down

0 comments on commit fde80eb

Please sign in to comment.