From cbeb3698c6af026caf305bb7e29e85d9ab72f929 Mon Sep 17 00:00:00 2001 From: whwyy Date: Mon, 18 Dec 2023 02:09:27 +0800 Subject: [PATCH] eee --- src/Validator/BindForm.php | 2 +- src/Validator/Binding.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Validator/BindForm.php b/src/Validator/BindForm.php index 99a7564..d0b72fc 100644 --- a/src/Validator/BindForm.php +++ b/src/Validator/BindForm.php @@ -93,7 +93,7 @@ class BindForm implements InjectParameterInterface $validator->setAlias($property->getName(), $rule->field); } - $validator->addRule($property->getName(), [$this->_typeValidator($property), 'dispatch', false]); + $validator->addRule($property->getName(), [[$this->_typeValidator($property), 'dispatch', false]]); } diff --git a/src/Validator/Binding.php b/src/Validator/Binding.php index 08497f9..a1533c4 100644 --- a/src/Validator/Binding.php +++ b/src/Validator/Binding.php @@ -89,7 +89,11 @@ class Binding implements RequestFilterInterface */ protected function getValidator($key, $rule): array { - $class = array_merge(self::TYPES[$key], ['value' => $rule, 'field' => $key]); + if (is_numeric($key)) { + $class = self::TYPES[$key]; + } else { + $class = array_merge(self::TYPES[$key], ['value' => $rule, 'field' => $key]); + } $isFirst = false; if ($class['class'] === RequiredValidatorFilter::class) { $isFirst = true;