From 4ac84b3edfb13763d598b5c8d65b4b36c4e6c965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 2 Dec 2021 16:28:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BaseValidator.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/BaseValidator.php b/src/BaseValidator.php index bc8c044..23f8489 100644 --- a/src/BaseValidator.php +++ b/src/BaseValidator.php @@ -66,12 +66,12 @@ abstract class BaseValidator } /** - * @throws Exception * @return bool + * @throws Exception */ public function trigger(): bool { - throw new Exception('Child Class must define method of trigger'); + throw new Exception('Child Class must define method of trigger'); } /** @@ -83,11 +83,14 @@ abstract class BaseValidator } /** - * @param array $data + * @param array|null $data * @return $this */ - public function setParams(array $data): static + public function setParams(?array $data): static { + if (is_null($data)) { + $data = []; + } $this->params = $data; return $this; }