diff --git a/ArrayValidator.php b/ArrayValidator.php index 239ac84..e741b9a 100644 --- a/ArrayValidator.php +++ b/ArrayValidator.php @@ -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 { diff --git a/BaseValidator.php b/BaseValidator.php index 3e17d2a..2772d09 100644 --- a/BaseValidator.php +++ b/BaseValidator.php @@ -7,6 +7,10 @@ namespace validator; use Database\Model; use Exception; + +/** + * Class \validator\BaseValidator + */ abstract class BaseValidator { diff --git a/DateTimeValidator.php b/DateTimeValidator.php index 3d015c5..0a57727 100644 --- a/DateTimeValidator.php +++ b/DateTimeValidator.php @@ -39,12 +39,13 @@ class DateTimeValidator extends BaseValidator } - /** - * @param $value - * @return bool - * - * 效验分秒 格式如 01:02 or 01-02 - */ + /** + * @param $field + * @param $value + * @return bool + * + * 效验分秒 格式如 01:02 or 01-02 + */ public function validatorTime($field, $value): bool { if (!is_string($value)) { @@ -59,12 +60,13 @@ class DateTimeValidator extends BaseValidator } - /** - * @param $value - * @return bool - * - * 效验分秒 格式如 2017-12-22 01:02 - */ + /** + * @param $field + * @param $value + * @return bool + * + * 效验分秒 格式如 2017-12-22 01:02 + */ public function validateDatetime($field, $value): bool { if (!is_string($value)) { @@ -79,12 +81,13 @@ class DateTimeValidator extends BaseValidator } } - /** - * @param $value - * @return bool - * - * 效验分秒 格式如 2017-12-22 - */ + /** + * @param $field + * @param $value + * @return bool + * + * 效验分秒 格式如 2017-12-22 + */ public function validatorDate($field, $value): bool { if (!is_string($value)) { @@ -98,12 +101,13 @@ class DateTimeValidator extends BaseValidator } } - /** - * @param $value - * @return bool - * - * 效验时间戳 格式如 1521452254 - */ + /** + * @param $field + * @param $value + * @return bool + * + * 效验时间戳 格式如 1521452254 + */ public function validatorTimestamp($field, $value): bool { if (!is_numeric($value)) { diff --git a/EmailValidator.php b/EmailValidator.php index 1b1007e..bd4d732 100644 --- a/EmailValidator.php +++ b/EmailValidator.php @@ -9,14 +9,15 @@ declare(strict_types=1); namespace validator; - +/** + * + */ class EmailValidator extends BaseValidator { /** * @return bool * 检查是否存在 - * @throws \ReflectionException */ public function trigger(): bool { diff --git a/EmptyValidator.php b/EmptyValidator.php index 52ade2f..4989543 100644 --- a/EmptyValidator.php +++ b/EmptyValidator.php @@ -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 { diff --git a/EnumValidator.php b/EnumValidator.php index 0d44317..fa2627a 100644 --- a/EnumValidator.php +++ b/EnumValidator.php @@ -16,7 +16,6 @@ class EnumValidator extends BaseValidator /** * @return bool - * @throws \ReflectionException */ public function trigger(): bool { diff --git a/IntegerValidator.php b/IntegerValidator.php index f4e175c..f8798b1 100644 --- a/IntegerValidator.php +++ b/IntegerValidator.php @@ -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 { diff --git a/LengthValidator.php b/LengthValidator.php index 554b1b8..f3c5008 100644 --- a/LengthValidator.php +++ b/LengthValidator.php @@ -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 { diff --git a/RequiredValidator.php b/RequiredValidator.php index a6c48ac..244e9a4 100644 --- a/RequiredValidator.php +++ b/RequiredValidator.php @@ -16,7 +16,6 @@ class RequiredValidator extends BaseValidator /** * @return bool * 检查是否存在 - * @throws \ReflectionException */ public function trigger(): bool { diff --git a/Validator.php b/Validator.php index a1b10eb..1de8605 100644 --- a/Validator.php +++ b/Validator.php @@ -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];