diff --git a/src/Traits/ErrorMessageTrait.php b/src/Traits/ErrorMessageTrait.php index 97e612d..4bccbe8 100644 --- a/src/Traits/ErrorMessageTrait.php +++ b/src/Traits/ErrorMessageTrait.php @@ -304,7 +304,7 @@ public function setMessages(array $messages): static * * @return string */ - public function getMessage(callable|string $validator, string $field, array $args = [], array|string $message = null): string + public function getMessage(callable|string $validator, string $field, array $args = [], null|array|string $message = null): string { $rawName = is_string($validator) ? $validator : 'callback'; $params = [ diff --git a/src/Traits/ScopedValidatorsTrait.php b/src/Traits/ScopedValidatorsTrait.php index d7692cb..7b0c02e 100644 --- a/src/Traits/ScopedValidatorsTrait.php +++ b/src/Traits/ScopedValidatorsTrait.php @@ -342,7 +342,7 @@ public function requiredWithoutAll(string $field, mixed $fieldVal, array|string * * @return bool */ - public function fileValidator(string $field, array|string $suffixes = null): bool + public function fileValidator(string $field, null|array|string $suffixes = null): bool { if (!$file = $this->uploadedFiles[$field] ?? null) { return false; @@ -373,7 +373,7 @@ public function fileValidator(string $field, array|string $suffixes = null): boo * * @return bool */ - public function imageValidator(string $field, array|string $suffixes = null): bool + public function imageValidator(string $field, null|array|string $suffixes = null): bool { if (!$file = $this->uploadedFiles[$field] ?? null) { return false; @@ -452,7 +452,7 @@ public function mimeTypesValidator(string $field, array|string $types): bool * * @todo */ - public function mimesValidator(string $field, array|string $types = null): void + public function mimesValidator(string $field, null|array|string $types = null): void { } diff --git a/src/Validators.php b/src/Validators.php index f20ad97..2888fe1 100644 --- a/src/Validators.php +++ b/src/Validators.php @@ -197,7 +197,7 @@ public static function bool(mixed $val): bool * * @return bool */ - public static function float(mixed $val, float|string|int $min = null, string|float|int $max = null, string|int $flags = 0): bool + public static function float(mixed $val, null|float|string|int $min = null, null|string|float|int $max = null, string|int $flags = 0): bool { if (!is_numeric($val)) { return false; @@ -254,7 +254,7 @@ public static function float(mixed $val, float|string|int $min = null, string|fl * // 'default' => 3, // value to return if the filter fails * ] */ - public static function integer(mixed $val, int|string $min = null, int|string $max = null, int|string $flags = 0): bool + public static function integer(mixed $val, null|int|string $min = null, null|int|string $max = null, int|string $flags = 0): bool { if (!is_numeric($val)) { return false; @@ -298,7 +298,7 @@ public static function integer(mixed $val, int|string $min = null, int|string $m * @return bool * @see integer() */ - public static function int(mixed $val, float|int|string $min = null, float|int|string $max = null, string|int $flags = 0): bool + public static function int(mixed $val, null|float|int|string $min = null, null|float|int|string $max = null, string|int $flags = 0): bool { return self::integer($val, $min, $max, $flags); } @@ -313,7 +313,7 @@ public static function int(mixed $val, float|int|string $min = null, float|int|s * * @return bool */ - public static function number(mixed $val, float|int|string $min = null, float|int|string $max = null, string|int $flags = 0): bool + public static function number(mixed $val, null|float|int|string $min = null, null|float|int|string $max = null, string|int $flags = 0): bool { if (!is_numeric($val)) { return false; @@ -335,7 +335,7 @@ public static function number(mixed $val, float|int|string $min = null, float|in * @return bool * @see number() */ - public static function num(mixed $val, float|int|string $min = null, float|int|string $max = null, string|int $flags = 0): bool + public static function num(mixed $val, null|float|int|string $min = null, null|float|int|string $max = null, string|int $flags = 0): bool { return self::number($val, $min, $max, $flags); } @@ -349,7 +349,7 @@ public static function num(mixed $val, float|int|string $min = null, float|int|s * * @return bool */ - public static function string(mixed $val, float|int|string $minLen = 0, float|int|string $maxLen = null): bool + public static function string(mixed $val, float|int|string $minLen = 0, null|float|int|string $maxLen = null): bool { if (!is_string($val)) { return false; @@ -564,7 +564,7 @@ public static function max(array|int|string $val, int|string $maxRange): bool * * @return bool */ - public static function size(float|array|int|string $val, float|int|string $min = null, float|int|string $max = null): bool + public static function size(float|array|int|string $val, null|float|int|string $min = null, null|float|int|string $max = null): bool { if (!is_numeric($val)) { if (is_string($val)) { @@ -589,7 +589,7 @@ public static function size(float|array|int|string $val, float|int|string $min = * @return bool * @see Validators::size() */ - public static function between(float|array|int|string $val, int|string $min = null, int|string $max = null): bool + public static function between(float|array|int|string $val, null|int|string $min = null, null|int|string $max = null): bool { return self::size($val, $min, $max); } @@ -602,7 +602,7 @@ public static function between(float|array|int|string $val, int|string $min = nu * @return bool * @see Validators::size() */ - public static function range(float|array|int|string $val, int|string $min = null, int|string $max = null): bool + public static function range(float|array|int|string $val, null|int|string $min = null, null|int|string $max = null): bool { return self::size($val, $min, $max); } @@ -616,7 +616,7 @@ public static function range(float|array|int|string $val, int|string $min = null * * @return bool */ - public static function length(array|string $val, float|int|string $minLen = 0, float|int|string $maxLen = null): bool + public static function length(array|string $val, null|float|int|string $minLen = 0, null|float|int|string $maxLen = null): bool { if (!is_string($val) && !is_array($val)) { return false; @@ -712,7 +712,7 @@ public static function contains(mixed $val, array|int|string $needle): bool * * @return bool */ - public static function regexp(float|int|string $val, string $regexp, $default = null): bool + public static function regexp(float|int|string $val, string $regexp, null $default = null): bool { $options = [ 'regexp' => $regexp @@ -734,7 +734,7 @@ public static function regexp(float|int|string $val, string $regexp, $default = * * @return bool */ - public static function regex(float|int|string $val, string $regexp, $default = null): bool + public static function regex(float|int|string $val, string $regexp, null $default = null): bool { return self::regexp($val, $regexp, $default); }