This commit is contained in:
2023-10-24 17:22:29 +08:00
parent f194684d4b
commit 26030fd148
10 changed files with 43 additions and 40 deletions
-3
View File
@@ -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
{
+4
View File
@@ -7,6 +7,10 @@ namespace validator;
use Database\Model;
use Exception;
/**
* Class \validator\BaseValidator
*/
abstract class BaseValidator
{
+4
View File
@@ -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
View File
@@ -9,14 +9,15 @@ declare(strict_types=1);
namespace validator;
/**
*
*/
class EmailValidator extends BaseValidator
{
/**
* @return bool
* 检查是否存在
* @throws \ReflectionException
*/
public function trigger(): bool
{
+3 -3
View File
@@ -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
{
-1
View File
@@ -16,7 +16,6 @@ class EnumValidator extends BaseValidator
/**
* @return bool
* @throws \ReflectionException
*/
public function trigger(): bool
{
+3 -1
View File
@@ -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
{
-3
View File
@@ -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
{
-1
View File
@@ -16,7 +16,6 @@ class RequiredValidator extends BaseValidator
/**
* @return bool
* 检查是否存在
* @throws \ReflectionException
*/
public function trigger(): bool
{
+2 -2
View File
@@ -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];