Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Traits/ErrorMessageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
6 changes: 3 additions & 3 deletions src/Traits/ScopedValidatorsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
{
}

Expand Down
24 changes: 12 additions & 12 deletions src/Validators.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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;
Expand All @@ -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);
}
Expand All @@ -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;
Expand Down Expand Up @@ -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)) {
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
Expand Down
Loading