This commit is contained in:
2023-04-25 17:05:06 +08:00
parent 726742f66f
commit f368ff97ab
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -35,9 +35,9 @@ class LengthValidator extends BaseValidator
} }
} }
return match ($method) { return match ($method) {
self::MAX_LENGTH => $this->maxLength($field, $value), self::MAX_LENGTH => $this->maxLength($field, (string)$value),
self::MIN_LENGTH => $this->minLength($field, $value), self::MIN_LENGTH => $this->minLength($field, (string)$value),
default => $this->defaultLength($field, $value), default => $this->defaultLength($field, (string)$value),
}; };
}, $this->params, strtolower($this->method), $this->value); }, $this->params, strtolower($this->method), $this->value);
} }
+2 -2
View File
@@ -87,11 +87,11 @@ class Validator extends BaseValidator
'class' => 'validator\TypesOfValidator', 'class' => 'validator\TypesOfValidator',
'method' => TypesOfValidator::SERIALIZE, 'method' => TypesOfValidator::SERIALIZE,
], ],
'maxLength' => [ 'maxlength' => [
'class' => 'validator\LengthValidator', 'class' => 'validator\LengthValidator',
'method' => 'max', 'method' => 'max',
], ],
'minLength' => [ 'minlength' => [
'class' => 'validator\LengthValidator', 'class' => 'validator\LengthValidator',
'method' => 'min', 'method' => 'min',
], ],