Skip to content

Commit 8728b8e

Browse files
committed
Bug fixes
1 parent 30788bc commit 8728b8e

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/Validator.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,14 @@ public static function isValidEnum(?string $enum, array $enums, bool $required =
341341
}
342342
}
343343

344-
#[Pure] public static function isValidBoolean($boolean): bool
344+
public static function isValidBoolean($boolean): bool
345345
{
346-
return self::validateBoolean($boolean);
346+
try {
347+
self::validateBoolean($boolean);
348+
return true;
349+
} catch (InvalidValidationException $e) {
350+
return false;
351+
}
347352
}
348353

349354
/**
@@ -1071,8 +1076,15 @@ public static function validateChar(?string $char, int $minLength = 1, int $maxL
10711076
return $char;
10721077
}
10731078

1079+
/**
1080+
* @throws InvalidValidationException
1081+
*/
10741082
static function validateBoolean($boolean): bool
10751083
{
1076-
return is_bool($boolean);
1084+
if (is_bool($boolean)) {
1085+
return $boolean;
1086+
} else {
1087+
throw new InvalidValidationException($boolean . ' is not a valid boolean');
1088+
}
10771089
}
10781090
}

0 commit comments

Comments
 (0)