This commit is contained in:
2021-12-02 16:28:14 +08:00
parent 8e8bd0bd43
commit 4ac84b3edf
+7 -4
View File
@@ -66,12 +66,12 @@ abstract class BaseValidator
} }
/** /**
* @throws Exception
* @return bool * @return bool
* @throws Exception
*/ */
public function trigger(): bool 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 * @return $this
*/ */
public function setParams(array $data): static public function setParams(?array $data): static
{ {
if (is_null($data)) {
$data = [];
}
$this->params = $data; $this->params = $data;
return $this; return $this;
} }