Core\Validator: Fix addRules() method for array

This commit is contained in:
Visman 2023-10-14 22:28:16 +07:00
parent e42fc8d9f0
commit 0cf80df852

View file

@ -172,17 +172,17 @@ class Validator
}
}
if (
'array' === $name
&& ! \is_array($rule)
) {
$rule = [];
}
$rules[$name] = $rule ?? '';
}
if (isset($suffix)) {
if (
isset($this->rules[$field]['array'])
&& ! \is_array($this->rules[$field]['array'])
) {
$this->rules[$field]['array'] = [];
}
$this->rules[$field]['array'][$suffix] = $rules;
} else {
$this->rules[$field] = $rules;