Skip to content
Merged
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
4 changes: 3 additions & 1 deletion src/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -2030,9 +2030,11 @@ public static function implementsInterface(mixed $value, mixed $interface, strin
/**
* @psalm-pure
*
* @param string|object $classOrObject
* @template T as class-string|object
* @param T $classOrObject
* @param string|callable():string $message
*
* @return T
* @throws InvalidArgumentException
*/
public static function propertyExists(mixed $classOrObject, mixed $property, string|callable $message = ''): object|string
Expand Down
20 changes: 13 additions & 7 deletions src/Mixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4711,10 +4711,12 @@ public static function allNullOrImplementsInterface(mixed $value, mixed $interfa
/**
* @psalm-pure
*
* @param string|object|null $classOrObject
* @template T as class-string|object
*
* @param T|null $classOrObject
* @param string|callable():string $message
*
* @return string|object|null
* @return T|null
*
* @throws InvalidArgumentException
*/
Expand All @@ -4728,10 +4730,12 @@ public static function nullOrPropertyExists(mixed $classOrObject, mixed $propert
/**
* @psalm-pure
*
* @param iterable<string|object> $classOrObject
* @template T as class-string|object
*
* @param iterable<T> $classOrObject
* @param string|callable():string $message
*
* @return iterable<string|object>
* @return iterable<T>
*
* @throws InvalidArgumentException
*/
Expand All @@ -4749,10 +4753,12 @@ public static function allPropertyExists(mixed $classOrObject, mixed $property,
/**
* @psalm-pure
*
* @param iterable<string|object|null> $classOrObject
* @param string|callable():string $message
* @template T as class-string|object|null
*
* @param iterable<T> $classOrObject
* @param string|callable():string $message
*
* @return iterable<string|object|null>
* @return iterable<T>
*
* @throws InvalidArgumentException
*/
Expand Down
2 changes: 2 additions & 0 deletions tests/static-analysis/assert-alnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function nullOrAlnum(?string $value): ?string
* @psalm-pure
*
* @param iterable<string> $value
* @return iterable<string>
*/
function allAlnum(iterable $value): iterable
{
Expand All @@ -36,6 +37,7 @@ function allAlnum(iterable $value): iterable
* @psalm-pure
*
* @param iterable<string|null> $value
* @return iterable<string|null>
*/
function allNullOrAlnum(iterable $value): iterable
{
Expand Down
4 changes: 4 additions & 0 deletions tests/static-analysis/assert-boolean.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ function nullOrBoolean(mixed $value): ?bool

/**
* @psalm-pure
*
* @return iterable<bool>
*/
function allBoolean(mixed $value): iterable
{
Expand All @@ -32,6 +34,8 @@ function allBoolean(mixed $value): iterable

/**
* @psalm-pure
*
* @return iterable<bool|null>
*/
function allNullOrBoolean(mixed $value): iterable
{
Expand Down
6 changes: 6 additions & 0 deletions tests/static-analysis/assert-classExists.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ function nullOrClassExists(mixed $value): ?string
return Assert::nullOrClassExists($value);
}

/**
* @return iterable<class-string>
*/
function allClassExists(mixed $value): iterable
{
return Assert::allClassExists($value);
}

/**
* @return iterable<class-string|null>
*/
function allNullOrClassExists(mixed $value): iterable
{
return Assert::allNullOrClassExists($value);
Expand Down
2 changes: 2 additions & 0 deletions tests/static-analysis/assert-contains.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function nullOrContains(?string $value, string $subString): ?string
* @psalm-pure
*
* @param iterable<string> $value
* @return iterable<string>
*/
function allContains(iterable $value, string $subString): iterable
{
Expand All @@ -36,6 +37,7 @@ function allContains(iterable $value, string $subString): iterable
* @psalm-pure
*
* @param iterable<string|null> $value
* @return iterable<string|null>
*/
function allNullOrContains(iterable $value, string $subString): iterable
{
Expand Down
4 changes: 4 additions & 0 deletions tests/static-analysis/assert-count.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

/**
* @param Countable|array $value
* @return Countable|array
*/
function count(Countable|array $value, int $number): Countable|array
{
Expand All @@ -17,6 +18,7 @@ function count(Countable|array $value, int $number): Countable|array

/**
* @param null|Countable|array $value
* @return null|Countable|array
*/
function nullOrCount(Countable|array|null $value, int $number): Countable|array|null
{
Expand All @@ -25,6 +27,7 @@ function nullOrCount(Countable|array|null $value, int $number): Countable|array|

/**
* @param iterable<Countable|array> $value
* @return iterable<Countable|array>
*/
function allCount(iterable $value, int $number): iterable
{
Expand All @@ -33,6 +36,7 @@ function allCount(iterable $value, int $number): iterable

/**
* @param iterable<Countable|array|null> $value
* @return iterable<Countable|array|null>
*/
function allNullOrCount(iterable $value, int $number): iterable
{
Expand Down
4 changes: 4 additions & 0 deletions tests/static-analysis/assert-countBetween.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* @param Countable|array $value
* @param int|float $min
* @param int|float $max
* @return Countable|array
*/
function countBetween(mixed $value, $min, $max): Countable|array
{
Expand All @@ -21,6 +22,7 @@ function countBetween(mixed $value, $min, $max): Countable|array
* @param null|Countable|array $value
* @param int|float $min
* @param int|float $max
* @return null|Countable|array
*/
function nullOrCountBetween(mixed $value, $min, $max): Countable|array|null
{
Expand All @@ -31,6 +33,7 @@ function nullOrCountBetween(mixed $value, $min, $max): Countable|array|null
* @param iterable<Countable|array> $value
* @param int|float $min
* @param int|float $max
* @return iterable<Countable|array>
*/
function allCountBetween(iterable $value, $min, $max): iterable
{
Expand All @@ -41,6 +44,7 @@ function allCountBetween(iterable $value, $min, $max): iterable
* @param iterable<Countable|array|null> $value
* @param int|float $min
* @param int|float $max
* @return iterable<Countable|array|null>
*/
function allNullOrCountBetween(iterable $value, $min, $max): iterable
{
Expand Down
2 changes: 2 additions & 0 deletions tests/static-analysis/assert-digits.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function nullOrDigits(?string $value): ?string
* @psalm-pure
*
* @param iterable<string> $value
* @return iterable<string>
*/
function allDigits(iterable $value): iterable
{
Expand All @@ -36,6 +37,7 @@ function allDigits(iterable $value): iterable
* @psalm-pure
*
* @param iterable<string|null> $value
* @return iterable<string|null>
*/
function allNullOrDigits(iterable $value): iterable
{
Expand Down
2 changes: 2 additions & 0 deletions tests/static-analysis/assert-endsWith.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function nullOrEndsWith(?string $value, string $suffix): ?string
* @psalm-pure
*
* @param iterable<string> $value
* @return iterable<string>
*/
function allEndsWith(iterable $value, string $suffix): iterable
{
Expand All @@ -36,6 +37,7 @@ function allEndsWith(iterable $value, string $suffix): iterable
* @psalm-pure
*
* @param iterable<string|null> $value
* @return iterable<string|null>
*/
function allNullOrEndsWith(iterable $value, string $suffix): iterable
{
Expand Down
4 changes: 4 additions & 0 deletions tests/static-analysis/assert-false.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ function nullOrFalse(mixed $value): ?bool

/**
* @psalm-pure
*
* @return iterable<false>
*/
function allFalse(mixed $value): iterable
{
Expand All @@ -36,6 +38,8 @@ function allFalse(mixed $value): iterable

/**
* @psalm-pure
*
* @return iterable<false|null>
*/
function allNullOrFalse(mixed $value): iterable
{
Expand Down
4 changes: 4 additions & 0 deletions tests/static-analysis/assert-float.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ function nullOrFloat(mixed $value): ?float

/**
* @psalm-pure
*
* @return iterable<float>
*/
function allFloat(mixed $value): iterable
{
Expand All @@ -32,6 +34,8 @@ function allFloat(mixed $value): iterable

/**
* @psalm-pure
*
* @return iterable<float|null>
*/
function allNullOrFloat(mixed $value): iterable
{
Expand Down
4 changes: 4 additions & 0 deletions tests/static-analysis/assert-implementsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ function nullOrImplementsInterface(mixed $value)

/**
* @psalm-pure
*
* @return iterable<mixed, Serializable|class-string<Serializable>>
*/
function allImplementsInterface(mixed $value): iterable
{
Expand All @@ -37,6 +39,8 @@ function allImplementsInterface(mixed $value): iterable

/**
* @psalm-pure
*
* @return iterable<mixed, Serializable|class-string<Serializable>|null>
*/
function allNullOrImplementsInterface(mixed $value): iterable
{
Expand Down
4 changes: 4 additions & 0 deletions tests/static-analysis/assert-integer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ function nullOrInteger(mixed $value): ?int

/**
* @psalm-pure
*
* @return iterable<int>
*/
function allInteger(mixed $value): iterable
{
Expand All @@ -32,6 +34,8 @@ function allInteger(mixed $value): iterable

/**
* @psalm-pure
*
* @return iterable<int|null>
*/
function allNullOrInteger(mixed $value): iterable
{
Expand Down
4 changes: 4 additions & 0 deletions tests/static-analysis/assert-integerish.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ function nullOrIntegerish(mixed $value)

/**
* @psalm-pure
*
* @return iterable<numeric>
*/
function allIntegerish(mixed $value): iterable
{
Expand All @@ -36,6 +38,8 @@ function allIntegerish(mixed $value): iterable

/**
* @psalm-pure
*
* @return iterable<numeric|null>
*/
function allNullOrIntegerish(mixed $value): iterable
{
Expand Down
6 changes: 6 additions & 0 deletions tests/static-analysis/assert-interfaceExists.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ function nullOrInterfaceExists(mixed $value): ?string
return Assert::nullOrInterfaceExists($value);
}

/**
* @return iterable<class-string>
*/
function allInterfaceExists(mixed $value): iterable
{
return Assert::allInterfaceExists($value);
}

/**
* @return iterable<class-string|null>
*/
function allNullOrInterfaceExists(mixed $value): iterable
{
return Assert::allNullOrInterfaceExists($value);
Expand Down
4 changes: 4 additions & 0 deletions tests/static-analysis/assert-isAnyOf.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*
* @param object|string $value
* @param array<class-string> $classes
* @return object|string
*/
function isAnyOf(mixed $value, array $classes): object|string
{
Expand All @@ -22,6 +23,7 @@ function isAnyOf(mixed $value, array $classes): object|string
*
* @param null|object|string $value
* @param array<class-string> $classes
* @return null|object|string
*/
function nullOrIsAnyOf(mixed $value, array $classes): object|string|null
{
Expand All @@ -33,6 +35,7 @@ function nullOrIsAnyOf(mixed $value, array $classes): object|string|null
*
* @param iterable<object|string> $value
* @param array<class-string> $classes
* @return iterable<object|string>
*/
function allIsAnyOf(mixed $value, array $classes): iterable
{
Expand All @@ -44,6 +47,7 @@ function allIsAnyOf(mixed $value, array $classes): iterable
*
* @param iterable<object|string|null> $value
* @param array<class-string> $classes
* @return iterable<object|string|null>
*/
function allNullOrIsAnyOf(mixed $value, array $classes): iterable
{
Expand Down
4 changes: 4 additions & 0 deletions tests/static-analysis/assert-isArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ function nullOrIsArray(mixed $value): ?array

/**
* @psalm-pure
*
* @return iterable<array>
*/
function allIsArray(mixed $value): iterable
{
Expand All @@ -32,6 +34,8 @@ function allIsArray(mixed $value): iterable

/**
* @psalm-pure
*
* @return iterable<array|null>
*/
function allNullOrIsArray(mixed $value): iterable
{
Expand Down
Loading
Loading