This commit is contained in:
xl
2023-07-07 17:24:03 +08:00
parent 448b1a68fc
commit d18994fde2
11 changed files with 310 additions and 342 deletions
+4 -6
View File
@@ -19,16 +19,14 @@ class IntegerValidator extends BaseValidator
public ?int $value = null;
private string $type = '';
/**
* @return bool
*/
/**
* @return bool
* @throws \ReflectionException
*/
public function trigger(): bool
{
return $this->_validator($this->field, function ($field, $params, $origin, $type) {
$value = $params[$field] ?? null;
if (empty($value)) {
return true;
}
if ($type !== self::MIN && $value < $origin) {
return $this->addError($field,'The ' . $field . ' cannot be less than the default value.');
}