mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
fix: replace \TypeError with InvalidArgumentException
This commit is contained in:
parent
3a35769b19
commit
d33d3c7fd6
@ -25,7 +25,6 @@ use CodeIgniter\Validation\Exceptions\ValidationException;
|
|||||||
use CodeIgniter\View\RendererInterface;
|
use CodeIgniter\View\RendererInterface;
|
||||||
use Config\Services;
|
use Config\Services;
|
||||||
use Config\Validation as ValidationConfig;
|
use Config\Validation as ValidationConfig;
|
||||||
use TypeError;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validator
|
* Validator
|
||||||
@ -540,12 +539,12 @@ class Validation implements ValidationInterface
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*
|
*
|
||||||
* @throws TypeError
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function setRule(string $field, ?string $label, $rules, array $errors = [])
|
public function setRule(string $field, ?string $label, $rules, array $errors = [])
|
||||||
{
|
{
|
||||||
if (! is_array($rules) && ! is_string($rules)) {
|
if (! is_array($rules) && ! is_string($rules)) {
|
||||||
throw new TypeError('$rules must be of type string|array');
|
throw new InvalidArgumentException('$rules must be of type string|array');
|
||||||
}
|
}
|
||||||
|
|
||||||
$ruleSet = [
|
$ruleSet = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user