From a87b6288beca9df67a353287b6052c4b08b50e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 1 Mar 2022 16:33:02 +0800 Subject: [PATCH] modify plugin name --- EnumValidator.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/EnumValidator.php b/EnumValidator.php index 2ae7d87..f068a3e 100644 --- a/EnumValidator.php +++ b/EnumValidator.php @@ -20,11 +20,7 @@ class EnumValidator extends BaseValidator public function trigger(): bool { return $this->_validator($this->field, function ($field, $params, $values) { - $value = $params[$field] ?? null; - if (is_null($value) || $value === '') { - return $this->addError($field,'The param :attribute is null'); - } - if (!in_array($value, $values)) { + if (!in_array($params[$field] ?? null, $values)) { return $this->addError($field,'The param :attribute value only in ' . implode(',', $values)); } return true;