This commit is contained in:
2020-10-30 10:38:31 +08:00
parent ab3ea24227
commit e26439a439
4 changed files with 11 additions and 11 deletions
+6 -6
View File
@@ -9,20 +9,20 @@ use Database\ActiveRecord;
abstract class BaseValidator abstract class BaseValidator
{ {
public $field; public string $field = '';
public $rules; public array $rules = [];
public string $method; public string $method;
protected $isFail = TRUE; protected bool $isFail = TRUE;
protected $message = ''; protected string $message = '';
protected $params = []; protected array $params = [];
/** @var ActiveRecord */ /** @var ActiveRecord */
protected $model; protected ActiveRecord $model;
public function setModel($model) public function setModel($model)
{ {
+1 -1
View File
@@ -18,7 +18,7 @@ class DateTimeValidator extends BaseValidator
const TIME = 'time'; const TIME = 'time';
const STR_TO_TIME = 'timestamp'; const STR_TO_TIME = 'timestamp';
public $method; public string $method;
/** /**
* @return bool * @return bool
+1 -1
View File
@@ -21,7 +21,7 @@ class EmptyValidator extends BaseValidator
/** @var string [可为空, 不能为null] */ /** @var string [可为空, 不能为null] */
const CAN_NOT_NULL = 'not null'; const CAN_NOT_NULL = 'not null';
public $method; public string $method;
/** /**
* @return bool * @return bool
+1 -1
View File
@@ -16,7 +16,7 @@ class LengthValidator extends BaseValidator
const MAX_LENGTH = 'max'; const MAX_LENGTH = 'max';
const MIN_LENGTH = 'min'; const MIN_LENGTH = 'min';
public $method; public string $method;
public int $value; public int $value;