eee
This commit is contained in:
@@ -10,8 +10,6 @@ declare(strict_types=1);
|
||||
namespace validator;
|
||||
|
||||
|
||||
use ReflectionException;
|
||||
|
||||
/**
|
||||
* Class ArrayValidator
|
||||
* @package validator
|
||||
@@ -23,7 +21,6 @@ class ArrayValidator extends BaseValidator
|
||||
* @return bool
|
||||
*
|
||||
* 检查
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function trigger(): bool
|
||||
{
|
||||
|
||||
@@ -7,6 +7,10 @@ namespace validator;
|
||||
use Database\Model;
|
||||
use Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Class \validator\BaseValidator
|
||||
*/
|
||||
abstract class BaseValidator
|
||||
{
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ class DateTimeValidator extends BaseValidator
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $value
|
||||
* @return bool
|
||||
*
|
||||
@@ -60,6 +61,7 @@ class DateTimeValidator extends BaseValidator
|
||||
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $value
|
||||
* @return bool
|
||||
*
|
||||
@@ -80,6 +82,7 @@ class DateTimeValidator extends BaseValidator
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $value
|
||||
* @return bool
|
||||
*
|
||||
@@ -99,6 +102,7 @@ class DateTimeValidator extends BaseValidator
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $value
|
||||
* @return bool
|
||||
*
|
||||
|
||||
+3
-2
@@ -9,14 +9,15 @@ declare(strict_types=1);
|
||||
|
||||
namespace validator;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class EmailValidator extends BaseValidator
|
||||
{
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* 检查是否存在
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function trigger(): bool
|
||||
{
|
||||
|
||||
+3
-3
@@ -12,8 +12,9 @@ declare(strict_types=1);
|
||||
namespace validator;
|
||||
|
||||
|
||||
use ReflectionException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class EmptyValidator extends BaseValidator
|
||||
{
|
||||
|
||||
@@ -29,7 +30,6 @@ class EmptyValidator extends BaseValidator
|
||||
* @return bool
|
||||
*
|
||||
* 检查参数是否为NULL
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function trigger(): bool
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@ class EnumValidator extends BaseValidator
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function trigger(): bool
|
||||
{
|
||||
|
||||
@@ -10,6 +10,9 @@ declare(strict_types=1);
|
||||
namespace validator;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class IntegerValidator extends BaseValidator
|
||||
{
|
||||
|
||||
@@ -21,7 +24,6 @@ class IntegerValidator extends BaseValidator
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function trigger(): bool
|
||||
{
|
||||
|
||||
@@ -10,8 +10,6 @@ declare(strict_types=1);
|
||||
namespace validator;
|
||||
|
||||
|
||||
use ReflectionException;
|
||||
|
||||
class LengthValidator extends BaseValidator
|
||||
{
|
||||
|
||||
@@ -24,7 +22,6 @@ class LengthValidator extends BaseValidator
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function trigger(): bool
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@ class RequiredValidator extends BaseValidator
|
||||
/**
|
||||
* @return bool
|
||||
* 检查是否存在
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function trigger(): bool
|
||||
{
|
||||
|
||||
+2
-2
@@ -112,10 +112,10 @@ class Validator extends BaseValidator
|
||||
|
||||
/**
|
||||
* @param BaseValidator|array|Closure $val
|
||||
* @return mixed
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
private function check(BaseValidator|array|Closure $val): mixed
|
||||
private function check(BaseValidator|array|Closure $val): array
|
||||
{
|
||||
if (is_callable($val, true)) {
|
||||
return [call_user_func($val, $this), $val];
|
||||
|
||||
Reference in New Issue
Block a user