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
12 changes: 4 additions & 8 deletions src/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -1986,11 +1986,9 @@ public static function countBetween(mixed $array, mixed $min, mixed $max, string
/**
* @psalm-pure
*
* @psalm-assert list<T> $array
* @psalm-assert list<mixed> $array
*
* @psalm-return list<T>
*
* @template T
* @psalm-return list<mixed>
*
* @throws InvalidArgumentException
*/
Expand All @@ -2008,11 +2006,9 @@ public static function isList(mixed $array, string $message = ''): array
/**
* @psalm-pure
*
* @psalm-assert non-empty-list<T> $array
* @psalm-assert non-empty-list<mixed> $array
*
* @psalm-return non-empty-list<T>
*
* @template T
* @psalm-return non-empty-list<mixed>
*
* @throws InvalidArgumentException
*/
Expand Down
30 changes: 12 additions & 18 deletions src/Mixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4754,10 +4754,9 @@ public static function allNullOrCountBetween(mixed $array, mixed $min, mixed $ma
/**
* @psalm-pure
*
* @psalm-assert list<T>|null $array
* @psalm-assert list<mixed>|null $array
*
* @template T
* @return list<T>|null
* @return list<mixed>|null
*
* @throws InvalidArgumentException
*/
Expand All @@ -4771,10 +4770,9 @@ public static function nullOrIsList(mixed $array, string $message = ''): mixed
/**
* @psalm-pure
*
* @psalm-assert iterable<list<T>> $array
* @psalm-assert iterable<list<mixed>> $array
*
* @template T
* @return iterable<list<T>>
* @return iterable<list<mixed>>
*
* @throws InvalidArgumentException
*/
Expand All @@ -4792,10 +4790,9 @@ public static function allIsList(mixed $array, string $message = ''): mixed
/**
* @psalm-pure
*
* @psalm-assert iterable<list<T>|null> $array
* @psalm-assert iterable<list<mixed>|null> $array
*
* @template T
* @return iterable<list<T>|null>
* @return iterable<list<mixed>|null>
*
* @throws InvalidArgumentException
*/
Expand All @@ -4813,10 +4810,9 @@ public static function allNullOrIsList(mixed $array, string $message = ''): mixe
/**
* @psalm-pure
*
* @psalm-assert non-empty-list<T>|null $array
* @psalm-assert non-empty-list<mixed>|null $array
*
* @template T
* @return non-empty-list<T>|null
* @return non-empty-list<mixed>|null
*
* @throws InvalidArgumentException
*/
Expand All @@ -4830,10 +4826,9 @@ public static function nullOrIsNonEmptyList(mixed $array, string $message = ''):
/**
* @psalm-pure
*
* @psalm-assert iterable<non-empty-list<T>> $array
* @psalm-assert iterable<non-empty-list<mixed>> $array
*
* @template T
* @return iterable<non-empty-list<T>>
* @return iterable<non-empty-list<mixed>>
*
* @throws InvalidArgumentException
*/
Expand All @@ -4851,10 +4846,9 @@ public static function allIsNonEmptyList(mixed $array, string $message = ''): mi
/**
* @psalm-pure
*
* @psalm-assert iterable<non-empty-list<T>|null> $array
* @psalm-assert iterable<non-empty-list<mixed>|null> $array
*
* @template T
* @return iterable<non-empty-list<T>|null>
* @return iterable<non-empty-list<mixed>|null>
*
* @throws InvalidArgumentException
*/
Expand Down
12 changes: 12 additions & 0 deletions tests/static-analysis/assert-isNonEmptyList.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ function isNonEmptyList(mixed $value): array
return $value;
}

/**
* @psalm-pure
*/
function isNonEmptyListWithRange(): mixed
{
$value = range(1, 100);

Assert::isNonEmptyList($value);

return $value[0];
}

/**
* @psalm-pure
*
Expand Down