From 7a2639533614e8789130408881a4459dc38b32f9 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 16 Dec 2025 21:34:59 +0100 Subject: [PATCH 1/7] Assertions will return the asserted value now --- src/Assert.php | 586 ++++++++++++++++++++++++------------------------- 1 file changed, 292 insertions(+), 294 deletions(-) diff --git a/src/Assert.php b/src/Assert.php index f7af980..abf33e0 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -30,300 +30,300 @@ * * @package simplesamlphp/assert * - * @method static void string(mixed $value, string $message = '', string $exception = '') - * @method static void stringNotEmpty(mixed $value, string $message = '', string $exception = '') - * @method static void integer(mixed $value, string $message = '', string $exception = '') - * @method static void integerish(mixed $value, string $message = '', string $exception = '') - * @method static void positiveInteger(mixed $value, string $message = '', string $exception = '') - * @method static void float(mixed $value, string $message = '', string $exception = '') - * @method static void numeric(mixed $value, string $message = '', string $exception = '') - * @method static void natural(mixed $value, string $message = '', string $exception = '') - * @method static void boolean(mixed $value, string $message = '', string $exception = '') - * @method static void scalar(mixed $value, string $message = '', string $exception = '') - * @method static void object(mixed $value, string $message = '', string $exception = '') - * @method static void resource(mixed $value, string|null $type, string $message = '', string $exception = '') - * @method static void isCallable(mixed $value, string $message = '', string $exception = '') - * @method static void isArray(mixed $value, string $message = '', string $exception = '') - * @method static void isTraversable(mixed $value, string $message = '', string $exception = '') - * @method static void isArrayAccessible(mixed $value, string $message = '', string $exception = '') - * @method static void isCountable(mixed $value, string $message = '', string $exception = '') - * @method static void isIterable(mixed $value, string $message = '', string $exception = '') - * @method static void isInstanceOf(mixed $value, string|object $class, string $message = '', string $exception = '') - * @method static void notInstanceOf(mixed $value, string|object $class, string $message = '', string $exception = '') - * @method static void isInstanceOfAny(mixed $value, array $classes, string $message = '', string $exception = '') - * @method static void isAOf(string|object $value, string $class, string $message = '', string $exception = '') - * @method static void isNotA(string|object $value, string $class, string $message = '', string $exception = '') - * @method static void isAnyOf(string|object $value, string[] $classes, string $message = '', string $exception = '') - * @method static void isEmpty(mixed $value, string $message = '', string $exception = '') - * @method static void notEmpty(mixed $value, string $message = '', string $exception = '') - * @method static void null(mixed $value, string $message = '', string $exception = '') - * @method static void notNull(mixed $value, string $message = '', string $exception = '') - * @method static void true(mixed $value, string $message = '', string $exception = '') - * @method static void false(mixed $value, string $message = '', string $exception = '') - * @method static void notFalse(mixed $value, string $message = '', string $exception = '') - * @method static void ip(mixed $value, string $message = '', string $exception = '') - * @method static void ipv4(mixed $value, string $message = '', string $exception = '') - * @method static void ipv6(mixed $value, string $message = '', string $exception = '') - * @method static void email(mixed $value, string $message = '', string $exception = '') - * @method static void uniqueValues(mixed[] $values, string $message = '', string $exception = '') - * @method static void eq(mixed $value, mixed $expect, string $message = '', string $exception = '') - * @method static void notEq(mixed $value, mixed $expect, string $message = '', string $exception = '') - * @method static void same(mixed $value, mixed $expect, string $message = '', string $exception = '') - * @method static void notSame(mixed $value, mixed $expect, string $message = '', string $exception = '') - * @method static void greaterThan(mixed $value, mixed $limit, string $message = '', string $exception = '') - * @method static void greaterThanEq(mixed $value, mixed $limit, string $message = '', string $exception = '') - * @method static void lessThan(mixed $value, mixed $limit, string $message = '', string $exception = '') - * @method static void lessThanEq(mixed $value, mixed $limit, string $message = '', string $exception = '') - * @method static void range(mixed $value, mixed $min, mixed $max, string $message = '', string $exception = '') - * @method static void oneOf(mixed $value, mixed[] $values, string $message = '', string $exception = '') - * @method static void inArray(mixed $value, mixed $values, string $message = '', string $exception = '') - * @method static void contains(string $value, string $subString, string $message = '', string $exception = '') - * @method static void notContains(string $value, string $subString, string $message = '', string $exception = '') - * @method static void notWhitespaceOnly($value, string $message = '', string $exception = '') - * @method static void startsWith(string $value, string $prefix, string $message = '', string $exception = '') - * @method static void notStartsWith(string $value, string $prefix, string $message = '', string $exception = '') - * @method static void startsWithLetter(mixed $value, string $message = '', string $exception = '') - * @method static void endsWith(string $value, string $suffix, string $message = '', string $exception = '') - * @method static void notEndsWith(string $value, string $suffix, string $message = '', string $exception = '') - * @method static void regex(string $value, string $pattern, string $message = '', string $exception = '') - * @method static void notRegex(string $value, string $pattern, string $message = '', string $exception = '') - * @method static void unicodeLetters(mixed $value, string $message = '', string $exception = '') - * @method static void alpha(mixed $value, string $message = '', string $exception = '') - * @method static void digits(string $value, string $message = '', string $exception = '') - * @method static void alnum(string $value, string $message = '', string $exception = '') - * @method static void lower(string $value, string $message = '', string $exception = '') - * @method static void upper(string $value, string $message = '', string $exception = '') - * @method static void length(string $value, int $length, string $message = '', string $exception = '') - * @method static void minLength(string $value, int|float $min, string $message = '', string $exception = '') - * @method static void maxLength(string $value, int|float $max, string $message = '', string $exception = '') - * @method static void lengthBetween(string $value, int|float $min, int|float $max, string $message = '', string $exception = '') - * @method static void fileExists(mixed $value, string $message = '', string $exception = '') - * @method static void file(mixed $value, string $message = '', string $exception = '') - * @method static void directory(mixed $value, string $message = '', string $exception = '') - * @method static void readable(string $value, string $message = '', string $exception = '') - * @method static void writable(string $value, string $message = '', string $exception = '') - * @method static void classExists(mixed $value, string $message = '', string $exception = '') - * @method static void subclassOf(mixed $value, string|object $class, string $message = '', string $exception = '') - * @method static void interfaceExists(mixed $value, string $message = '', string $exception = '') - * @method static void implementsInterface(mixed $value, mixed $interface, string $message = '', string $exception = '') - * @method static void propertyExists(string|object $classOrObject, mixed $property, string $message = '', string $exception = '') - * @method static void propertyNotExists(string|object $classOrObject, mixed $property, string $message = '', string $exception = '') - * @method static void methodExists(string|object $classOrObject, mixed $method, string $message = '', string $exception = '') - * @method static void methodNotExists(string|object $classOrObject, mixed $method, string $message = '', string $exception = '') - * @method static void keyExists(mixed[] $array, string|int $key, string $message = '', string $exception = '') - * @method static void keyNotExists(mixed[] $array, string|int $key, string $message = '', string $exception = '') - * @method static void validArrayKey($value, string $message = '', string $exception = '') - * @method static void count(\Countable|mixed[] $array, int $number, string $message = '', string $exception = '') - * @method static void minCount(\Countable|mixed[] $array, int|float $min, string $message = '', string $exception = '') - * @method static void maxCount(\Countable|mixed[] $array, int|float $max, string $message = '', string $exception = '') - * @method static void countBetween(\Countable|mixed[] $array, int|float $min, int|float $max, string $message = '', string $exception = '') - * @method static void isList(mixed $array, string $message = '', string $exception = '') - * @method static void isNonEmptyList(mixed $array, string $message = '', string $exception = '') - * @method static void isMap(mixed $array, string $message = '', string $exception = '') - * @method static void isNonEmptyMap(mixed $array, string $message = '', string $exception = '') - * @method static void uuid(string $value, string $message = '', string $exception = '') - * @method static void throws(\Closure $expression, string $class = 'Exception', string $message = '', string $exception = '') + * @method static mixed string(mixed $value, string $message = '', string $exception = '') + * @method static mixed stringNotEmpty(mixed $value, string $message = '', string $exception = '') + * @method static mixed integer(mixed $value, string $message = '', string $exception = '') + * @method static mixed integerish(mixed $value, string $message = '', string $exception = '') + * @method static mixed positiveInteger(mixed $value, string $message = '', string $exception = '') + * @method static mixed float(mixed $value, string $message = '', string $exception = '') + * @method static mixed numeric(mixed $value, string $message = '', string $exception = '') + * @method static mixed natural(mixed $value, string $message = '', string $exception = '') + * @method static mixed boolean(mixed $value, string $message = '', string $exception = '') + * @method static mixed scalar(mixed $value, string $message = '', string $exception = '') + * @method static mixed object(mixed $value, string $message = '', string $exception = '') + * @method static mixed resource(mixed $value, string|null $type, string $message = '', string $exception = '') + * @method static mixed isCallable(mixed $value, string $message = '', string $exception = '') + * @method static mixed isArray(mixed $value, string $message = '', string $exception = '') + * @method static mixed isTraversable(mixed $value, string $message = '', string $exception = '') + * @method static mixed isArrayAccessible(mixed $value, string $message = '', string $exception = '') + * @method static mixed isCountable(mixed $value, string $message = '', string $exception = '') + * @method static mixed isIterable(mixed $value, string $message = '', string $exception = '') + * @method static mixed isInstanceOf(mixed $value, string|object $class, string $message = '', string $exception = '') + * @method static mixed notInstanceOf(mixed $value, string|object $class, string $message = '', string $exception = '') + * @method static mixed isInstanceOfAny(mixed $value, array $classes, string $message = '', string $exception = '') + * @method static mixed isAOf(string|object $value, string $class, string $message = '', string $exception = '') + * @method static mixed isNotA(string|object $value, string $class, string $message = '', string $exception = '') + * @method static mixed isAnyOf(string|object $value, string[] $classes, string $message = '', string $exception = '') + * @method static mixed isEmpty(mixed $value, string $message = '', string $exception = '') + * @method static mixed notEmpty(mixed $value, string $message = '', string $exception = '') + * @method static mixed null(mixed $value, string $message = '', string $exception = '') + * @method static mixed notNull(mixed $value, string $message = '', string $exception = '') + * @method static mixed true(mixed $value, string $message = '', string $exception = '') + * @method static mixed false(mixed $value, string $message = '', string $exception = '') + * @method static mixed notFalse(mixed $value, string $message = '', string $exception = '') + * @method static mixed ip(mixed $value, string $message = '', string $exception = '') + * @method static mixed ipv4(mixed $value, string $message = '', string $exception = '') + * @method static mixed ipv6(mixed $value, string $message = '', string $exception = '') + * @method static mixed email(mixed $value, string $message = '', string $exception = '') + * @method static mixed uniqueValues(mixed[] $values, string $message = '', string $exception = '') + * @method static mixed eq(mixed $value, mixed $expect, string $message = '', string $exception = '') + * @method static mixed notEq(mixed $value, mixed $expect, string $message = '', string $exception = '') + * @method static mixed same(mixed $value, mixed $expect, string $message = '', string $exception = '') + * @method static mixed notSame(mixed $value, mixed $expect, string $message = '', string $exception = '') + * @method static mixed greaterThan(mixed $value, mixed $limit, string $message = '', string $exception = '') + * @method static mixed greaterThanEq(mixed $value, mixed $limit, string $message = '', string $exception = '') + * @method static mixed lessThan(mixed $value, mixed $limit, string $message = '', string $exception = '') + * @method static mixed lessThanEq(mixed $value, mixed $limit, string $message = '', string $exception = '') + * @method static mixed range(mixed $value, mixed $min, mixed $max, string $message = '', string $exception = '') + * @method static mixed oneOf(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed inArray(mixed $value, mixed $values, string $message = '', string $exception = '') + * @method static mixed contains(string $value, string $subString, string $message = '', string $exception = '') + * @method static mixed notContains(string $value, string $subString, string $message = '', string $exception = '') + * @method static mixed notWhitespaceOnly($value, string $message = '', string $exception = '') + * @method static mixed startsWith(string $value, string $prefix, string $message = '', string $exception = '') + * @method static mixed notStartsWith(string $value, string $prefix, string $message = '', string $exception = '') + * @method static mixed startsWithLetter(mixed $value, string $message = '', string $exception = '') + * @method static mixed endsWith(string $value, string $suffix, string $message = '', string $exception = '') + * @method static mixed notEndsWith(string $value, string $suffix, string $message = '', string $exception = '') + * @method static mixed regex(string $value, string $pattern, string $message = '', string $exception = '') + * @method static mixed notRegex(string $value, string $pattern, string $message = '', string $exception = '') + * @method static mixed unicodeLetters(mixed $value, string $message = '', string $exception = '') + * @method static mixed alpha(mixed $value, string $message = '', string $exception = '') + * @method static mixed digits(string $value, string $message = '', string $exception = '') + * @method static mixed alnum(string $value, string $message = '', string $exception = '') + * @method static mixed lower(string $value, string $message = '', string $exception = '') + * @method static mixed upper(string $value, string $message = '', string $exception = '') + * @method static mixed length(string $value, int $length, string $message = '', string $exception = '') + * @method static mixed minLength(string $value, int|float $min, string $message = '', string $exception = '') + * @method static mixed maxLength(string $value, int|float $max, string $message = '', string $exception = '') + * @method static mixed lengthBetween(string $value, int|float $min, int|float $max, string $message = '', string $exception = '') + * @method static mixed fileExists(mixed $value, string $message = '', string $exception = '') + * @method static mixed file(mixed $value, string $message = '', string $exception = '') + * @method static mixed directory(mixed $value, string $message = '', string $exception = '') + * @method static mixed readable(string $value, string $message = '', string $exception = '') + * @method static mixed writable(string $value, string $message = '', string $exception = '') + * @method static mixed classExists(mixed $value, string $message = '', string $exception = '') + * @method static mixed subclassOf(mixed $value, string|object $class, string $message = '', string $exception = '') + * @method static mixed interfaceExists(mixed $value, string $message = '', string $exception = '') + * @method static mixed implementsInterface(mixed $value, mixed $interface, string $message = '', string $exception = '') + * @method static mixed propertyExists(string|object $classOrObject, mixed $property, string $message = '', string $exception = '') + * @method static mixed propertyNotExists(string|object $classOrObject, mixed $property, string $message = '', string $exception = '') + * @method static mixed methodExists(string|object $classOrObject, mixed $method, string $message = '', string $exception = '') + * @method static mixed methodNotExists(string|object $classOrObject, mixed $method, string $message = '', string $exception = '') + * @method static mixed keyExists(mixed[] $array, string|int $key, string $message = '', string $exception = '') + * @method static mixed keyNotExists(mixed[] $array, string|int $key, string $message = '', string $exception = '') + * @method static mixed validArrayKey($value, string $message = '', string $exception = '') + * @method static mixed count(\Countable|mixed[] $array, int $number, string $message = '', string $exception = '') + * @method static mixed minCount(\Countable|mixed[] $array, int|float $min, string $message = '', string $exception = '') + * @method static mixed maxCount(\Countable|mixed[] $array, int|float $max, string $message = '', string $exception = '') + * @method static mixed countBetween(\Countable|mixed[] $array, int|float $min, int|float $max, string $message = '', string $exception = '') + * @method static mixed isList(mixed $array, string $message = '', string $exception = '') + * @method static mixed isNonEmptyList(mixed $array, string $message = '', string $exception = '') + * @method static mixed isMap(mixed $array, string $message = '', string $exception = '') + * @method static mixed isNonEmptyMap(mixed $array, string $message = '', string $exception = '') + * @method static mixed uuid(string $value, string $message = '', string $exception = '') + * @method static mixed throws(\Closure $expression, string $class = 'Exception', string $message = '', string $exception = '') * - * @method static void nullOrString(mixed $value, string $message = '', string $exception = '') - * @method static void allString(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrStringNotEmpty(mixed $value, string $message = '', string $exception = '') - * @method static void allStringNotEmpty(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrInteger(mixed $value, string $message = '', string $exception = '') - * @method static void allInteger(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrIntegerish(mixed $value, string $message = '', string $exception = '') - * @method static void allIntegerish(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrPositiveInteger(mixed $value, string $message = '', string $exception = '') - * @method static void allPositiveInteger(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrFloat(mixed $value, string $message = '', string $exception = '') - * @method static void allFloat(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrNumeric(mixed $value, string $message = '', string $exception = '') - * @method static void allNumeric(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrNatural(mixed $value, string $message = '', string $exception = '') - * @method static void allNatural(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrBoolean(mixed $value, string $message = '', string $exception = '') - * @method static void allBoolean(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrScalar(mixed $value, string $message = '', string $exception = '') - * @method static void allScalar(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrObject(mixed $value, string $message = '', string $exception = '') - * @method static void allObject(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrResource(mixed $value, string|null $type, string $message = '', string $exception = '') - * @method static void allResource(mixed $value, string|null $type, string $message = '', string $exception = '') - * @method static void nullOrIsCallable(mixed $value, string $message = '', string $exception = '') - * @method static void allIsCallable(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrIsArray(mixed $value, string $message = '', string $exception = '') - * @method static void allIsArray(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrIsTraversable(mixed $value, string $message = '', string $exception = '') - * @method static void allIsTraversable(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrIsArrayAccessible(mixed $value, string $message = '', string $exception = '') - * @method static void allIsArrayAccessible(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrIsCountable(mixed $value, string $message = '', string $exception = '') - * @method static void allIsCountable(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrIsIterable(mixed $value, string $message = '', string $exception = '') - * @method static void allIsIterable(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrIsInstanceOf(mixed $value, string|object $class, string $message = '', string $exception = '') - * @method static void allIsInstanceOf(mixed $value, string|object $class, string $message = '', string $exception = '') - * @method static void nullOrNotInstanceOf(mixed $value, string|object $class, string $message = '', string $exception = '') - * @method static void allNotInstanceOf(mixed $value, string|object $class, string $message = '', string $exception = '') - * @method static void nullOrIsInstanceOfAny(mixed $value, array $classes, string $message = '', string $exception = '') - * @method static void allIsInstanceOfAny(mixed $value, array $classes, string $message = '', string $exception = '') - * @method static void nullOrIsAOf(object|string|null $value, string $class, string $message = '', string $exception = '') - * @method static void allIsAOf(object|string|null $value, string $class, string $message = '', string $exception = '') - * @method static void nullOrIsNotA(object|string|null $value, string $class, string $message = '', string $exception = '') - * @method static void allIsNotA(iterable $value, string $class, string $message = '', string $exception = '') - * @method static void nullOrIsAnyOf(object|string|null $value, string[] $classes, string $message = '', string $exception = '') - * @method static void allIsAnyOf(iterable $value, string[] $classes, string $message = '', string $exception = '') - * @method static void nullOrIsEmpty(mixed $value, string $message = '', string $exception = '') - * @method static void allIsEmpty(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrNotEmpty(mixed $value, string $message = '', string $exception = '') - * @method static void allNotEmpty(mixed $value, string $message = '', string $exception = '') - * @method static void allNull(mixed $value, string $message = '', string $exception = '') - * @method static void allNotNull(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrTrue(mixed $value, string $message = '', string $exception = '') - * @method static void allTrue(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrFalse(mixed $value, string $message = '', string $exception = '') - * @method static void allFalse(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrNotFalse(mixed $value, string $message = '', string $exception = '') - * @method static void allNotFalse(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrIp(mixed $value, string $message = '', string $exception = '') - * @method static void allIp(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrIpv4(mixed $value, string $message = '', string $exception = '') - * @method static void allIpv4(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrIpv6(mixed $value, string $message = '', string $exception = '') - * @method static void allIpv6(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrEmail(mixed $value, string $message = '', string $exception = '') - * @method static void allEmail(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrUniqueValues(mixed[]|null $values, string $message = '', string $exception = '') - * @method static void allUniqueValues(iterable $values, string $message = '', string $exception = '') - * @method static void nullOrEq(mixed $value, mixed $expect, string $message = '', string $exception = '') - * @method static void allEq(mixed $value, mixed $expect, string $message = '', string $exception = '') - * @method static void nullOrNotEq(mixed $value, mixed $expect, string $message = '', string $exception = '') - * @method static void allNotEq(mixed $value, mixed $expect, string $message = '', string $exception = '') - * @method static void nullOrSame(mixed $value, mixed $expect, string $message = '', string $exception = '') - * @method static void allSame(mixed $value, mixed $expect, string $message = '', string $exception = '') - * @method static void nullOrNotSame(mixed $value, mixed $expect, string $message = '', string $exception = '') - * @method static void allNotSame(mixed $value, mixed $expect, string $message = '', string $exception = '') - * @method static void nullOrGreaterThan(mixed $value, mixed $limit, string $message = '', string $exception = '') - * @method static void allGreaterThan(mixed $value, mixed $limit, string $message = '', string $exception = '') - * @method static void nullOrGreaterThanEq(mixed $value, mixed $limit, string $message = '', string $exception = '') - * @method static void allGreaterThanEq(mixed $value, mixed $limit, string $message = '', string $exception = '') - * @method static void nullOrLessThan(mixed $value, mixed $limit, string $message = '', string $exception = '') - * @method static void allLessThan(mixed $value, mixed $limit, string $message = '', string $exception = '') - * @method static void nullOrLessThanEq(mixed $value, mixed $limit, string $message = '', string $exception = '') - * @method static void allLessThanEq(mixed $value, mixed $limit, string $message = '', string $exception = '') - * @method static void nullOrRange(mixed $value, mixed $min, mixed $max, string $message = '', string $exception = '') - * @method static void allRange(mixed $value, mixed $min, mixed $max, string $message = '', string $exception = '') - * @method static void nullOrOneOf(mixed $value, mixed[] $values, string $message = '', string $exception = '') - * @method static void allOneOf(mixed $value, mixed[] $values, string $message = '', string $exception = '') - * @method static void nullOrInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') - * @method static void allInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') - * @method static void nullOrContains(string|null $value, string $subString, string $message = '', string $exception = '') - * @method static void allContains(string[] $value, string $subString, string $message = '', string $exception = '') - * @method static void nullOrNotContains(string|null $value, string $subString, string $message = '', string $exception = '') - * @method static void allNotContains(string[] $value, string $subString, string $message = '', string $exception = '') - * @method static void nullOrNotWhitespaceOnly(string|null $value, string $message = '', string $exception = '') - * @method static void allNotWhitespaceOnly(string[] $value, string $message = '', string $exception = '') - * @method static void nullOrStartsWith(string|null $value, string $prefix, string $message = '', string $exception = '') - * @method static void allStartsWith(string[] $value, string $prefix, string $message = '', string $exception = '') - * @method static void nullOrNotStartsWith(string|null $value, string $prefix, string $message = '', string $exception = '') - * @method static void allNotStartsWith(string[] $value, string $prefix, string $message = '', string $exception = '') - * @method static void nullOrStartsWithLetter(mixed $value, string $message = '', string $exception = '') - * @method static void allStartsWithLetter(string[] $value, string $message = '', string $exception = '') - * @method static void nullOrEndsWith(string|null $value, string $suffix, string $message = '', string $exception = '') - * @method static void allEndsWith(string[] $value, string $suffix, string $message = '', string $exception = '') - * @method static void nullOrNotEndsWith(string|null $value, string $suffix, string $message = '', string $exception = '') - * @method static void allNotEndsWith(string[] $value, string $suffix, string $message = '', string $exception = '') - * @method static void nullOrRegex(string|null $value, string $prefix, string $message = '', string $exception = '') - * @method static void allRegex(string[] $value, string $prefix, string $message = '', string $exception = '') - * @method static void nullOrNotRegex(string|null $value, string $prefix, string $message = '', string $exception = '') - * @method static void allNotRegex(string[] $value, string $prefix, string $message = '', string $exception = '') - * @method static void nullOrUnicodeLetters(mixed $value, string $message = '', string $exception = '') - * @method static void allUnicodeLetters(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrAlpha(mixed $value, string $message = '', string $exception = '') - * @method static void allAlpha(string[] $value, string $message = '', string $exception = '') - * @method static void nullOrDigits(string|null $value, string $message = '', string $exception = '') - * @method static void allDigits(string[] $value, string $message = '', string $exception = '') - * @method static void nullOrAlnum(string|null $value, string $message = '', string $exception = '') - * @method static void allAlnum(string[] $value, string $message = '', string $exception = '') - * @method static void nullOrLower(string|null $value, string $message = '', string $exception = '') - * @method static void allLower(string[] $value, string $message = '', string $exception = '') - * @method static void nullOrUpper(string|null $value, string $message = '', string $exception = '') - * @method static void allUpper(string[] $value, string $message = '', string $exception = '') - * @method static void nullOrLength(string|null $value, int $length, string $message = '', string $exception = '') - * @method static void allLength(string[] $value, int $length, string $message = '', string $exception = '') - * @method static void nullOrMinLength(string|null $value, int|float $min, string $message = '', string $exception = '') - * @method static void allMinLength(string[] $value, int|float $min, string $message = '', string $exception = '') - * @method static void nullOrMaxLength(string|null $value, int|float $max, string $message = '', string $exception = '') - * @method static void allMaxLength(string[] $value, int|float $max, string $message = '', string $exception = '') - * @method static void nullOrLengthBetween(string|null $value, int|float $min, int|float $max, string $message = '', string $exception = '') - * @method static void allLengthBetween(string[] $value, int|float $min, int|float $max, string $message = '', string $exception = '') - * @method static void nullOrFileExists(mixed $value, string $message = '', string $exception = '') - * @method static void allFileExists(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrFile(mixed $value, string $message = '', string $exception = '') - * @method static void allFile(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrDirectory(mixed $value, string $message = '', string $exception = '') - * @method static void allDirectory(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrReadable(string|null $value, string $message = '', string $exception = '') - * @method static void allReadable(string[] $value, string $message = '', string $exception = '') - * @method static void nullOrWritable(string|null $value, string $message = '', string $exception = '') - * @method static void allWritable(string[] $value, string $message = '', string $exception = '') - * @method static void nullOrClassExists(mixed $value, string $message = '', string $exception = '') - * @method static void allClassExists(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrSubclassOf(mixed $value, string|object $class, string $message = '', string $exception = '') - * @method static void allSubclassOf(mixed $value, string|object $class, string $message = '', string $exception = '') - * @method static void nullOrInterfaceExists(mixed $value, string $message = '', string $exception = '') - * @method static void allInterfaceExists(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrImplementsInterface(mixed $value, mixed $interface, string $message = '', string $exception = '') - * @method static void allImplementsInterface(mixed $value, mixed $interface, string $message = '', string $exception = '') - * @method static void nullOrPropertyExists(string|object|null $classOrObject, mixed $property, string $message = '', string $exception = '') - * @method static void allPropertyExists(iterable $classOrObject, mixed $property, string $message = '', string $exception = '') - * @method static void nullOrPropertyNotExists(string|object|null $classOrObject, mixed $property, string $message = '', string $exception = '') - * @method static void allPropertyNotExists(iterable $classOrObject, mixed $property, string $message = '', string $exception = '') - * @method static void nullOrMethodExists(string|object|null $classOrObject, mixed $method, string $message = '', string $exception = '') - * @method static void allMethodExists(iterable $classOrObject, mixed $method, string $message = '', string $exception = '') - * @method static void nullOrMethodNotExists(string|object|null $classOrObject, mixed $method, string $message = '', string $exception = '') - * @method static void allMethodNotExists(iterable $classOrObject, mixed $method, string $message = '', string $exception = '') - * @method static void nullOrKeyExists(mixed[]|null $array, string|int $key, string $message = '', string $exception = '') - * @method static void allKeyExists(iterable $array, string|int $key, string $message = '', string $exception = '') - * @method static void nullOrKeyNotExists(mixed[]|null $array, string|int $key, string $message = '', string $exception = '') - * @method static void allKeyNotExists(iterable $array, string|int $key, string $message = '', string $exception = '') - * @method static void nullOrValidArrayKey(mixed $value, string $message = '', string $exception = '') - * @method static void allValidArrayKey(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrCount(\Countable|mixed[]|null $array, int $number, string $message = '', string $exception = '') - * @method static void allCount(iterable<\Countable|mixed[]> $array, int $number, string $message = '', string $exception = '') - * @method static void nullOrMinCount(\Countable|mixed[]|null $array, int|float $min, string $message = '', string $exception = '') - * @method static void allMinCount(iterable<\Countable|mixed[]> $array, int|float $min, string $message = '', string $exception = '') - * @method static void nullOrMaxCount(\Countable|mixed[]|null $array, int|float $max, string $message = '', string $exception = '') - * @method static void allMaxCount(iterable<\Countable|mixed[]> $array, int|float $max, string $message = '', string $exception = '') - * @method static void nullOrCountBetween(\Countable|mixed[]|null $array, int|float $min, int|float $max, string $message = '', string $exception = '') - * @method static void allCountBetween(iterable<\Countable|mixed[]> $array, int|float $min, int|float $max, string $message = '', string $exception = '') - * @method static void nullOrIsList(mixed $array, string $message = '', string $exception = '') - * @method static void allIsList(mixed $array, string $message = '', string $exception = '') - * @method static void nullOrIsNonEmptyList(mixed $array, string $message = '', string $exception = '') - * @method static void allIsNonEmptyList(mixed $array, string $message = '', string $exception = '') - * @method static void nullOrIsMap(mixed $array, string $message = '', string $exception = '') - * @method static void allIsMap(mixed $array, string $message = '', string $exception = '') - * @method static void nullOrIsNonEmptyMap(mixed $array, string $message = '', string $exception = '') - * @method static void allIsNonEmptyMap(mixed $array, string $message = '', string $exception = '') - * @method static void nullOrUuid(string|null $value, string $message = '', string $exception = '') - * @method static void allUuid(string[] $value, string $message = '', string $exception = '') - * @method static void nullOrThrows(\Closure|null $expression, string $class, string $message = '', string $exception = '') - * @method static void allThrows(\Closure[] $expression, string $class, string $message = '', string $exception = '') + * @method static mixed nullOrString(mixed $value, string $message = '', string $exception = '') + * @method static mixed allString(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrStringNotEmpty(mixed $value, string $message = '', string $exception = '') + * @method static mixed allStringNotEmpty(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrInteger(mixed $value, string $message = '', string $exception = '') + * @method static mixed allInteger(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrIntegerish(mixed $value, string $message = '', string $exception = '') + * @method static mixed allIntegerish(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrPositiveInteger(mixed $value, string $message = '', string $exception = '') + * @method static mixed allPositiveInteger(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrFloat(mixed $value, string $message = '', string $exception = '') + * @method static mixed allFloat(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrNumeric(mixed $value, string $message = '', string $exception = '') + * @method static mixed allNumeric(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrNatural(mixed $value, string $message = '', string $exception = '') + * @method static mixed allNatural(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrBoolean(mixed $value, string $message = '', string $exception = '') + * @method static mixed allBoolean(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrScalar(mixed $value, string $message = '', string $exception = '') + * @method static mixed allScalar(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrObject(mixed $value, string $message = '', string $exception = '') + * @method static mixed allObject(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrResource(mixed $value, string|null $type, string $message = '', string $exception = '') + * @method static mixed allResource(mixed $value, string|null $type, string $message = '', string $exception = '') + * @method static mixed nullOrIsCallable(mixed $value, string $message = '', string $exception = '') + * @method static mixed allIsCallable(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrIsArray(mixed $value, string $message = '', string $exception = '') + * @method static mixed allIsArray(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrIsTraversable(mixed $value, string $message = '', string $exception = '') + * @method static mixed allIsTraversable(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrIsArrayAccessible(mixed $value, string $message = '', string $exception = '') + * @method static mixed allIsArrayAccessible(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrIsCountable(mixed $value, string $message = '', string $exception = '') + * @method static mixed allIsCountable(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrIsIterable(mixed $value, string $message = '', string $exception = '') + * @method static mixed allIsIterable(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrIsInstanceOf(mixed $value, string|object $class, string $message = '', string $exception = '') + * @method static mixed allIsInstanceOf(mixed $value, string|object $class, string $message = '', string $exception = '') + * @method static mixed nullOrNotInstanceOf(mixed $value, string|object $class, string $message = '', string $exception = '') + * @method static mixed allNotInstanceOf(mixed $value, string|object $class, string $message = '', string $exception = '') + * @method static mixed nullOrIsInstanceOfAny(mixed $value, array $classes, string $message = '', string $exception = '') + * @method static mixed allIsInstanceOfAny(mixed $value, array $classes, string $message = '', string $exception = '') + * @method static mixed nullOrIsAOf(object|string|null $value, string $class, string $message = '', string $exception = '') + * @method static mixed allIsAOf(object|string|null $value, string $class, string $message = '', string $exception = '') + * @method static mixed nullOrIsNotA(object|string|null $value, string $class, string $message = '', string $exception = '') + * @method static mixed allIsNotA(iterable $value, string $class, string $message = '', string $exception = '') + * @method static mixed nullOrIsAnyOf(object|string|null $value, string[] $classes, string $message = '', string $exception = '') + * @method static mixed allIsAnyOf(iterable $value, string[] $classes, string $message = '', string $exception = '') + * @method static mixed nullOrIsEmpty(mixed $value, string $message = '', string $exception = '') + * @method static mixed allIsEmpty(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrNotEmpty(mixed $value, string $message = '', string $exception = '') + * @method static mixed allNotEmpty(mixed $value, string $message = '', string $exception = '') + * @method static mixed allNull(mixed $value, string $message = '', string $exception = '') + * @method static mixed allNotNull(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrTrue(mixed $value, string $message = '', string $exception = '') + * @method static mixed allTrue(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrFalse(mixed $value, string $message = '', string $exception = '') + * @method static mixed allFalse(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrNotFalse(mixed $value, string $message = '', string $exception = '') + * @method static mixed allNotFalse(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrIp(mixed $value, string $message = '', string $exception = '') + * @method static mixed allIp(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrIpv4(mixed $value, string $message = '', string $exception = '') + * @method static mixed allIpv4(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrIpv6(mixed $value, string $message = '', string $exception = '') + * @method static mixed allIpv6(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrEmail(mixed $value, string $message = '', string $exception = '') + * @method static mixed allEmail(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrUniqueValues(mixed[]|null $values, string $message = '', string $exception = '') + * @method static mixed allUniqueValues(iterable $values, string $message = '', string $exception = '') + * @method static mixed nullOrEq(mixed $value, mixed $expect, string $message = '', string $exception = '') + * @method static mixed allEq(mixed $value, mixed $expect, string $message = '', string $exception = '') + * @method static mixed nullOrNotEq(mixed $value, mixed $expect, string $message = '', string $exception = '') + * @method static mixed allNotEq(mixed $value, mixed $expect, string $message = '', string $exception = '') + * @method static mixed nullOrSame(mixed $value, mixed $expect, string $message = '', string $exception = '') + * @method static mixed allSame(mixed $value, mixed $expect, string $message = '', string $exception = '') + * @method static mixed nullOrNotSame(mixed $value, mixed $expect, string $message = '', string $exception = '') + * @method static mixed allNotSame(mixed $value, mixed $expect, string $message = '', string $exception = '') + * @method static mixed nullOrGreaterThan(mixed $value, mixed $limit, string $message = '', string $exception = '') + * @method static mixed allGreaterThan(mixed $value, mixed $limit, string $message = '', string $exception = '') + * @method static mixed nullOrGreaterThanEq(mixed $value, mixed $limit, string $message = '', string $exception = '') + * @method static mixed allGreaterThanEq(mixed $value, mixed $limit, string $message = '', string $exception = '') + * @method static mixed nullOrLessThan(mixed $value, mixed $limit, string $message = '', string $exception = '') + * @method static mixed allLessThan(mixed $value, mixed $limit, string $message = '', string $exception = '') + * @method static mixed nullOrLessThanEq(mixed $value, mixed $limit, string $message = '', string $exception = '') + * @method static mixed allLessThanEq(mixed $value, mixed $limit, string $message = '', string $exception = '') + * @method static mixed nullOrRange(mixed $value, mixed $min, mixed $max, string $message = '', string $exception = '') + * @method static mixed allRange(mixed $value, mixed $min, mixed $max, string $message = '', string $exception = '') + * @method static mixed nullOrOneOf(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed allOneOf(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed nullOrInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed allInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed nullOrContains(string|null $value, string $subString, string $message = '', string $exception = '') + * @method static mixed allContains(string[] $value, string $subString, string $message = '', string $exception = '') + * @method static mixed nullOrNotContains(string|null $value, string $subString, string $message = '', string $exception = '') + * @method static mixed allNotContains(string[] $value, string $subString, string $message = '', string $exception = '') + * @method static mixed nullOrNotWhitespaceOnly(string|null $value, string $message = '', string $exception = '') + * @method static mixed allNotWhitespaceOnly(string[] $value, string $message = '', string $exception = '') + * @method static mixed nullOrStartsWith(string|null $value, string $prefix, string $message = '', string $exception = '') + * @method static mixed allStartsWith(string[] $value, string $prefix, string $message = '', string $exception = '') + * @method static mixed nullOrNotStartsWith(string|null $value, string $prefix, string $message = '', string $exception = '') + * @method static mixed allNotStartsWith(string[] $value, string $prefix, string $message = '', string $exception = '') + * @method static mixed nullOrStartsWithLetter(mixed $value, string $message = '', string $exception = '') + * @method static mixed allStartsWithLetter(string[] $value, string $message = '', string $exception = '') + * @method static mixed nullOrEndsWith(string|null $value, string $suffix, string $message = '', string $exception = '') + * @method static mixed allEndsWith(string[] $value, string $suffix, string $message = '', string $exception = '') + * @method static mixed nullOrNotEndsWith(string|null $value, string $suffix, string $message = '', string $exception = '') + * @method static mixed allNotEndsWith(string[] $value, string $suffix, string $message = '', string $exception = '') + * @method static mixed nullOrRegex(string|null $value, string $prefix, string $message = '', string $exception = '') + * @method static mixed allRegex(string[] $value, string $prefix, string $message = '', string $exception = '') + * @method static mixed nullOrNotRegex(string|null $value, string $prefix, string $message = '', string $exception = '') + * @method static mixed allNotRegex(string[] $value, string $prefix, string $message = '', string $exception = '') + * @method static mixed nullOrUnicodeLetters(mixed $value, string $message = '', string $exception = '') + * @method static mixed allUnicodeLetters(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrAlpha(mixed $value, string $message = '', string $exception = '') + * @method static mixed allAlpha(string[] $value, string $message = '', string $exception = '') + * @method static mixed nullOrDigits(string|null $value, string $message = '', string $exception = '') + * @method static mixed allDigits(string[] $value, string $message = '', string $exception = '') + * @method static mixed nullOrAlnum(string|null $value, string $message = '', string $exception = '') + * @method static mixed allAlnum(string[] $value, string $message = '', string $exception = '') + * @method static mixed nullOrLower(string|null $value, string $message = '', string $exception = '') + * @method static mixed allLower(string[] $value, string $message = '', string $exception = '') + * @method static mixed nullOrUpper(string|null $value, string $message = '', string $exception = '') + * @method static mixed allUpper(string[] $value, string $message = '', string $exception = '') + * @method static mixed nullOrLength(string|null $value, int $length, string $message = '', string $exception = '') + * @method static mixed allLength(string[] $value, int $length, string $message = '', string $exception = '') + * @method static mixed nullOrMinLength(string|null $value, int|float $min, string $message = '', string $exception = '') + * @method static mixed allMinLength(string[] $value, int|float $min, string $message = '', string $exception = '') + * @method static mixed nullOrMaxLength(string|null $value, int|float $max, string $message = '', string $exception = '') + * @method static mixed allMaxLength(string[] $value, int|float $max, string $message = '', string $exception = '') + * @method static mixed nullOrLengthBetween(string|null $value, int|float $min, int|float $max, string $message = '', string $exception = '') + * @method static mixed allLengthBetween(string[] $value, int|float $min, int|float $max, string $message = '', string $exception = '') + * @method static mixed nullOrFileExists(mixed $value, string $message = '', string $exception = '') + * @method static mixed allFileExists(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrFile(mixed $value, string $message = '', string $exception = '') + * @method static mixed allFile(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrDirectory(mixed $value, string $message = '', string $exception = '') + * @method static mixed allDirectory(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrReadable(string|null $value, string $message = '', string $exception = '') + * @method static mixed allReadable(string[] $value, string $message = '', string $exception = '') + * @method static mixed nullOrWritable(string|null $value, string $message = '', string $exception = '') + * @method static mixed allWritable(string[] $value, string $message = '', string $exception = '') + * @method static mixed nullOrClassExists(mixed $value, string $message = '', string $exception = '') + * @method static mixed allClassExists(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrSubclassOf(mixed $value, string|object $class, string $message = '', string $exception = '') + * @method static mixed allSubclassOf(mixed $value, string|object $class, string $message = '', string $exception = '') + * @method static mixed nullOrInterfaceExists(mixed $value, string $message = '', string $exception = '') + * @method static mixed allInterfaceExists(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrImplementsInterface(mixed $value, mixed $interface, string $message = '', string $exception = '') + * @method static mixed allImplementsInterface(mixed $value, mixed $interface, string $message = '', string $exception = '') + * @method static mixed nullOrPropertyExists(string|object|null $classOrObject, mixed $property, string $message = '', string $exception = '') + * @method static mixed allPropertyExists(iterable $classOrObject, mixed $property, string $message = '', string $exception = '') + * @method static mixed nullOrPropertyNotExists(string|object|null $classOrObject, mixed $property, string $message = '', string $exception = '') + * @method static mixed allPropertyNotExists(iterable $classOrObject, mixed $property, string $message = '', string $exception = '') + * @method static mixed nullOrMethodExists(string|object|null $classOrObject, mixed $method, string $message = '', string $exception = '') + * @method static mixed allMethodExists(iterable $classOrObject, mixed $method, string $message = '', string $exception = '') + * @method static mixed nullOrMethodNotExists(string|object|null $classOrObject, mixed $method, string $message = '', string $exception = '') + * @method static mixed allMethodNotExists(iterable $classOrObject, mixed $method, string $message = '', string $exception = '') + * @method static mixed nullOrKeyExists(mixed[]|null $array, string|int $key, string $message = '', string $exception = '') + * @method static mixed allKeyExists(iterable $array, string|int $key, string $message = '', string $exception = '') + * @method static mixed nullOrKeyNotExists(mixed[]|null $array, string|int $key, string $message = '', string $exception = '') + * @method static mixed allKeyNotExists(iterable $array, string|int $key, string $message = '', string $exception = '') + * @method static mixed nullOrValidArrayKey(mixed $value, string $message = '', string $exception = '') + * @method static mixed allValidArrayKey(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrCount(\Countable|mixed[]|null $array, int $number, string $message = '', string $exception = '') + * @method static mixed allCount(iterable<\Countable|mixed[]> $array, int $number, string $message = '', string $exception = '') + * @method static mixed nullOrMinCount(\Countable|mixed[]|null $array, int|float $min, string $message = '', string $exception = '') + * @method static mixed allMinCount(iterable<\Countable|mixed[]> $array, int|float $min, string $message = '', string $exception = '') + * @method static mixed nullOrMaxCount(\Countable|mixed[]|null $array, int|float $max, string $message = '', string $exception = '') + * @method static mixed allMaxCount(iterable<\Countable|mixed[]> $array, int|float $max, string $message = '', string $exception = '') + * @method static mixed nullOrCountBetween(\Countable|mixed[]|null $array, int|float $min, int|float $max, string $message = '', string $exception = '') + * @method static mixed allCountBetween(iterable<\Countable|mixed[]> $array, int|float $min, int|float $max, string $message = '', string $exception = '') + * @method static mixed nullOrIsList(mixed $array, string $message = '', string $exception = '') + * @method static mixed allIsList(mixed $array, string $message = '', string $exception = '') + * @method static mixed nullOrIsNonEmptyList(mixed $array, string $message = '', string $exception = '') + * @method static mixed allIsNonEmptyList(mixed $array, string $message = '', string $exception = '') + * @method static mixed nullOrIsMap(mixed $array, string $message = '', string $exception = '') + * @method static mixed allIsMap(mixed $array, string $message = '', string $exception = '') + * @method static mixed nullOrIsNonEmptyMap(mixed $array, string $message = '', string $exception = '') + * @method static mixed allIsNonEmptyMap(mixed $array, string $message = '', string $exception = '') + * @method static mixed nullOrUuid(string|null $value, string $message = '', string $exception = '') + * @method static mixed allUuid(string[] $value, string $message = '', string $exception = '') + * @method static mixed nullOrThrows(\Closure|null $expression, string $class, string $message = '', string $exception = '') + * @method static mixed allThrows(\Closure[] $expression, string $class, string $message = '', string $exception = '') * - * @method static void validBase64(mixed $value, string $message = '', string $exception = '') - * @method static void notInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') - * @method static void validURN(mixed $value, string $message = '', string $exception = '') - * @method static void validURI(mixed $value, string $message = '', string $exception = '') - * @method static void validURL(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrValidBase64(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrNotInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') - * @method static void nullOrValidURN(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrValidURI(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrValidURL(mixed $value, string $message = '', string $exception = '') - * @method static void allValidBase64(mixed $value, string $message = '', string $exception = '') - * @method static void allNotInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') - * @method static void allValidURN(mixed $value, string $message = '', string $exception = '') - * @method static void allValidURI(mixed $value, string $message = '', string $exception = '') - * @method static void allValidURL(mixed $value, string $message = '', string $exception = '') + * @method static mixed validBase64(mixed $value, string $message = '', string $exception = '') + * @method static mixed notInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed validURN(mixed $value, string $message = '', string $exception = '') + * @method static mixed validURI(mixed $value, string $message = '', string $exception = '') + * @method static mixed validURL(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrValidBase64(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrNotInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed nullOrValidURN(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrValidURI(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrValidURL(mixed $value, string $message = '', string $exception = '') + * @method static mixed allValidBase64(mixed $value, string $message = '', string $exception = '') + * @method static mixed allNotInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed allValidURN(mixed $value, string $message = '', string $exception = '') + * @method static mixed allValidURI(mixed $value, string $message = '', string $exception = '') + * @method static mixed allValidURL(mixed $value, string $message = '', string $exception = '') */ class Assert { @@ -389,7 +389,6 @@ public static function __callStatic(string $name, array $arguments): void * * @param callable $method * @param mixed[] $arguments - * @return void */ private static function nullOr(callable $method, array $arguments): void { @@ -403,7 +402,6 @@ private static function nullOr(callable $method, array $arguments): void * * @param callable $method * @param mixed[] $arguments - * @return void */ private static function all(callable $method, array $arguments): void { From 7a4cea127a60c08bd90b50be1e46957eb9465b78 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 16 Dec 2025 21:50:59 +0100 Subject: [PATCH 2/7] Add new assertions --- src/Assert.php | 27 ++++++++++++++----- src/NotInArrayTrait.php | 47 -------------------------------- tests/Assert/NotInArrayTest.php | 48 --------------------------------- 3 files changed, 21 insertions(+), 101 deletions(-) delete mode 100644 src/NotInArrayTrait.php delete mode 100644 tests/Assert/NotInArrayTest.php diff --git a/src/Assert.php b/src/Assert.php index abf33e0..1527296 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -33,6 +33,8 @@ * @method static mixed string(mixed $value, string $message = '', string $exception = '') * @method static mixed stringNotEmpty(mixed $value, string $message = '', string $exception = '') * @method static mixed integer(mixed $value, string $message = '', string $exception = '') + * @method static mixed negativeInteger(mixed $value, string $message = '', string $exception = '') + * @method static mixed notNegativeInteger(mixed $value, string $message = '', string $exception = '') * @method static mixed integerish(mixed $value, string $message = '', string $exception = '') * @method static mixed positiveInteger(mixed $value, string $message = '', string $exception = '') * @method static mixed float(mixed $value, string $message = '', string $exception = '') @@ -76,7 +78,9 @@ * @method static mixed lessThanEq(mixed $value, mixed $limit, string $message = '', string $exception = '') * @method static mixed range(mixed $value, mixed $min, mixed $max, string $message = '', string $exception = '') * @method static mixed oneOf(mixed $value, mixed[] $values, string $message = '', string $exception = '') - * @method static mixed inArray(mixed $value, mixed $values, string $message = '', string $exception = '') + * @method static mixed notOneOf(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed inArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed notInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') * @method static mixed contains(string $value, string $subString, string $message = '', string $exception = '') * @method static mixed notContains(string $value, string $subString, string $message = '', string $exception = '') * @method static mixed notWhitespaceOnly($value, string $message = '', string $exception = '') @@ -122,6 +126,9 @@ * @method static mixed isMap(mixed $array, string $message = '', string $exception = '') * @method static mixed isNonEmptyMap(mixed $array, string $message = '', string $exception = '') * @method static mixed uuid(string $value, string $message = '', string $exception = '') + * @method static mixed isInitialized(mixed $value, string $property, string $message = '', string $exception = '') + * @method static mixed isStatic(\Closure $callable, string $message = '', string $exception = '') + * @method static mixed notStatic(\Closure $callable, string $message = '', string $exception = '') * @method static mixed throws(\Closure $expression, string $class = 'Exception', string $message = '', string $exception = '') * * @method static mixed nullOrString(mixed $value, string $message = '', string $exception = '') @@ -130,6 +137,10 @@ * @method static mixed allStringNotEmpty(mixed $value, string $message = '', string $exception = '') * @method static mixed nullOrInteger(mixed $value, string $message = '', string $exception = '') * @method static mixed allInteger(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrNegativeInteger(mixed $value, string $message = '', string $exception = '') + * @method static mixed allNegativeInteger(mixed $value, string $message = '', string $exception = '') + * @method static mixed nullOrNotNegativeInteger(mixed $value, string $message = '', string $exception = '') + * @method static mixed allNotNegativeInteger(mixed $value, string $message = '', string $exception = '') * @method static mixed nullOrIntegerish(mixed $value, string $message = '', string $exception = '') * @method static mixed allIntegerish(mixed $value, string $message = '', string $exception = '') * @method static mixed nullOrPositiveInteger(mixed $value, string $message = '', string $exception = '') @@ -214,8 +225,12 @@ * @method static mixed allRange(mixed $value, mixed $min, mixed $max, string $message = '', string $exception = '') * @method static mixed nullOrOneOf(mixed $value, mixed[] $values, string $message = '', string $exception = '') * @method static mixed allOneOf(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed nullOrNotOneOf(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed allNotOneOf(mixed[] $value, mixed[] $values, string $message = '', string $exception = '') * @method static mixed nullOrInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') - * @method static mixed allInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed allInArray(mixed[] $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed nullOrNotInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') + * @method static mixed allNotInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') * @method static mixed nullOrContains(string|null $value, string $subString, string $message = '', string $exception = '') * @method static mixed allContains(string[] $value, string $subString, string $message = '', string $exception = '') * @method static mixed nullOrNotContains(string|null $value, string $subString, string $message = '', string $exception = '') @@ -306,21 +321,22 @@ * @method static mixed allIsNonEmptyMap(mixed $array, string $message = '', string $exception = '') * @method static mixed nullOrUuid(string|null $value, string $message = '', string $exception = '') * @method static mixed allUuid(string[] $value, string $message = '', string $exception = '') + * @method static mixed nullOrIsStatic(\Closure $callable, string $message = '', string $exception = '') + * @method static mixed allIsStatic(\Closure[] $callable, string $message = '', string $exception = '') + * @method static mixed nullOrNotStatic(\Closure $callable, string $message = '', string $exception = '') + * @method static mixed allNotStatic(\Closure[] $callable, string $message = '', string $exception = '') * @method static mixed nullOrThrows(\Closure|null $expression, string $class, string $message = '', string $exception = '') * @method static mixed allThrows(\Closure[] $expression, string $class, string $message = '', string $exception = '') * * @method static mixed validBase64(mixed $value, string $message = '', string $exception = '') - * @method static mixed notInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') * @method static mixed validURN(mixed $value, string $message = '', string $exception = '') * @method static mixed validURI(mixed $value, string $message = '', string $exception = '') * @method static mixed validURL(mixed $value, string $message = '', string $exception = '') * @method static mixed nullOrValidBase64(mixed $value, string $message = '', string $exception = '') - * @method static mixed nullOrNotInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') * @method static mixed nullOrValidURN(mixed $value, string $message = '', string $exception = '') * @method static mixed nullOrValidURI(mixed $value, string $message = '', string $exception = '') * @method static mixed nullOrValidURL(mixed $value, string $message = '', string $exception = '') * @method static mixed allValidBase64(mixed $value, string $message = '', string $exception = '') - * @method static mixed allNotInArray(mixed $value, mixed[] $values, string $message = '', string $exception = '') * @method static mixed allValidURN(mixed $value, string $message = '', string $exception = '') * @method static mixed allValidURI(mixed $value, string $message = '', string $exception = '') * @method static mixed allValidURL(mixed $value, string $message = '', string $exception = '') @@ -328,7 +344,6 @@ class Assert { use Base64Trait; - use NotInArrayTrait; use URITrait; diff --git a/src/NotInArrayTrait.php b/src/NotInArrayTrait.php deleted file mode 100644 index 55d66f4..0000000 --- a/src/NotInArrayTrait.php +++ /dev/null @@ -1,47 +0,0 @@ - $values - * @param string $message - */ - protected static function notInArray($value, array $values, string $message = ''): void - { - if (in_array($value, $values, true)) { - $callable = function (mixed $val) { - return self::valueToString($val); - }; - - throw new InvalidArgumentException(sprintf( - $message ?: 'Expected none of: %2$s. Got: %s', - self::valueToString($value), - implode(', ', array_map($callable, $values)), - )); - } - } -} diff --git a/tests/Assert/NotInArrayTest.php b/tests/Assert/NotInArrayTest.php deleted file mode 100644 index f5ca377..0000000 --- a/tests/Assert/NotInArrayTest.php +++ /dev/null @@ -1,48 +0,0 @@ - $arr - */ - #[DataProvider('provideNotInArray')] - public function testnotInArray(bool $shouldPass, $item, array $arr): void - { - try { - Assert::notInArray($item, $arr); - $this->assertTrue($shouldPass); - } catch (AssertionFailedException $e) { - $this->assertFalse($shouldPass); - } - } - - - /** - * @return array - */ - public static function provideNotInArray(): array - { - return [ - [true, 0, [1]], - [false, 1, [1]], - ]; - } -} From dbc27e7b7f785578ccf508acc3ea84c4743ef68e Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 16 Dec 2025 21:59:51 +0100 Subject: [PATCH 3/7] Migrate custom assertions to follow the same pattern as webmozart. --- src/Assert.php | 2 ++ src/Base64Trait.php | 7 +++---- src/URITrait.php | 41 ++++++++++++++++++++++++++--------------- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/Assert.php b/src/Assert.php index 1527296..75eec72 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -340,6 +340,8 @@ * @method static mixed allValidURN(mixed $value, string $message = '', string $exception = '') * @method static mixed allValidURI(mixed $value, string $message = '', string $exception = '') * @method static mixed allValidURL(mixed $value, string $message = '', string $exception = '') + * + * @method static mixed getUri() */ class Assert { diff --git a/src/Base64Trait.php b/src/Base64Trait.php index 12a52c5..f5edc5d 100644 --- a/src/Base64Trait.php +++ b/src/Base64Trait.php @@ -32,11 +32,8 @@ trait Base64Trait /** * Note: This test is not bullet-proof but prevents a string containing illegal characters * from being passed and ensures the string roughly follows the correct format for a Base64 encoded string - * - * @param string $value - * @param string $message */ - protected static function validBase64(string $value, string $message = ''): void + protected static function validBase64(string $value, string $message = ''): string { $result = true; @@ -57,5 +54,7 @@ protected static function validBase64(string $value, string $message = ''): void $value, )); } + + return $value; } } diff --git a/src/URITrait.php b/src/URITrait.php index 00e5545..c993d60 100644 --- a/src/URITrait.php +++ b/src/URITrait.php @@ -17,6 +17,8 @@ */ trait URITrait { + private static Uri $uri; + /*********************************************************************************** * NOTE: Custom assertions may be added below this line. * * They SHOULD be marked as `protected` to ensure the call is forced * @@ -27,13 +29,11 @@ trait URITrait /** - * @param string $value - * @param string $message */ - protected static function validURN(string $value, string $message = ''): void + protected static function validURN(string $value, string $message = ''): string { try { - $uri = new Uri($value); + self::$uri = new Uri($value); } catch (MalformedUriException $e) { throw new InvalidArgumentException(sprintf( $message ?: '\'%s\' is not a valid RFC3986 compliant URI', @@ -42,25 +42,25 @@ protected static function validURN(string $value, string $message = ''): void } if ( - $uri->getScheme() !== 'urn' - || $uri->getPath() !== substr($value, strlen($uri->getScheme()) + 1) + self::$uri->getScheme() !== 'urn' + || self::$uri->getPath() !== substr($value, strlen(self::$uri->getScheme()) + 1) ) { throw new InvalidArgumentException(sprintf( $message ?: '\'%s\' is not a valid RFC8141 compliant URN', $value, )); } + + return $value; } /** - * @param string $value - * @param string $message */ - protected static function validURL(string $value, string $message = ''): void + protected static function validURL(string $value, string $message = ''): string { try { - $uri = new Uri($value); + self::$uri = new Uri($value); } catch (MalformedUriException $e) { throw new InvalidArgumentException(sprintf( $message ?: '\'%s\' is not a valid RFC3986 compliant URI', @@ -68,28 +68,39 @@ protected static function validURL(string $value, string $message = ''): void )); } - if ($uri->getScheme() !== 'http' && $uri->getScheme() !== 'https') { + if (self::$uri->getScheme() !== 'http' && self::$uri->getScheme() !== 'https') { throw new InvalidArgumentException(sprintf( $message ?: '\'%s\' is not a valid RFC2396 compliant URL', $value, )); } + + return $value; } /** - * @param string $value - * @param string $message */ - protected static function validURI(string $value, string $message = ''): void + protected static function validURI(string $value, string $message = ''): string { try { - new Uri($value); + self::$uri = new Uri($value); } catch (MalformedUriException $e) { throw new InvalidArgumentException(sprintf( $message ?: '\'%s\' is not a valid RFC3986 compliant URI', $value, )); } + + return $value; + } + + + /** + * For convenience and efficiency, to get the Uri-object from the last assertion. + */ + public static function getUri(): Uri + { + return self::$uri; } } From da4a025e7c54ee992605200b8db7347cdbc62cbb Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 16 Dec 2025 22:06:19 +0100 Subject: [PATCH 4/7] Add ext-sodium for composer-require-checker --- .github/workflows/php.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index a46f51a..b56ffb1 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -53,7 +53,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} - extensions: ctype, date, filter, intl, pcre, spl + extensions: ctype, date, filter, intl, pcre, sodium, spl tools: composer ini-values: error_reporting=E_ALL coverage: pcov @@ -115,7 +115,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} - extensions: ctype, date, filter, intl, pcre, spl + extensions: ctype, date, filter, intl, pcre, sodium, spl tools: composer ini-values: error_reporting=E_ALL coverage: none @@ -164,7 +164,7 @@ jobs: # Should be the higest supported version, so we can use the newest tools php-version: '8.5' tools: composer, composer-require-checker, composer-unused - extensions: ctype, date, filter, pcre, spl + extensions: ctype, date, filter, pcre, sodium, spl coverage: none - name: Setup problem matchers for PHP From 04e4f8d592482e517e981148df318f70335d7cfc Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 16 Dec 2025 22:13:38 +0100 Subject: [PATCH 5/7] Fix coding style --- src/URITrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/URITrait.php b/src/URITrait.php index c993d60..84fb2c9 100644 --- a/src/URITrait.php +++ b/src/URITrait.php @@ -17,8 +17,6 @@ */ trait URITrait { - private static Uri $uri; - /*********************************************************************************** * NOTE: Custom assertions may be added below this line. * * They SHOULD be marked as `protected` to ensure the call is forced * @@ -27,6 +25,8 @@ trait URITrait * not handle any custom exception passed to it. * ***********************************************************************************/ + private static Uri $uri; + /** */ From 7a0d76d95ab242eaeb418893acbcaabbaed3f26e Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 16 Dec 2025 23:02:39 +0100 Subject: [PATCH 6/7] Add ext-intl for composer-require-checker --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index b56ffb1..31142c9 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -164,7 +164,7 @@ jobs: # Should be the higest supported version, so we can use the newest tools php-version: '8.5' tools: composer, composer-require-checker, composer-unused - extensions: ctype, date, filter, pcre, sodium, spl + extensions: ctype, date, filter, intl, pcre, sodium, spl coverage: none - name: Setup problem matchers for PHP From 636fda555feb2332101f10b800142a7f6f2042ae Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 22 Dec 2025 12:15:27 +0100 Subject: [PATCH 7/7] Bump webmozart --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0897c10..7fea232 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "ext-spl": "*", "guzzlehttp/psr7": "~2.8", - "webmozart/assert": "~1.12" + "webmozart/assert": "~2.0" }, "require-dev": { "ext-intl": "*",