Skip to content

Commit a11bac0

Browse files
authored
Chore: Add types to iterable_filter() (#30)
1 parent 09aeff9 commit a11bac0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/iterable-functions.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,14 @@ function iterable_to_traversable(iterable $iterable): Traversable
7575
/**
7676
* Filters an iterable.
7777
*
78-
* @param iterable<mixed> $iterable
78+
* @param (callable(TValue):bool)|null $filter
7979
*
80-
* @return iterable<mixed>
80+
* @psalm-param iterable<TKey, TValue> $iterable
81+
* @phpstan-param iterable<array-key, TValue> $iterable https://github.com/phpstan/phpstan/issues/4498
82+
* @psalm-return iterable<TKey, TValue>
83+
* @phpstan-return iterable<array-key, TValue> https://github.com/phpstan/phpstan/issues/4498
84+
* @template TKey
85+
* @template TValue
8186
*/
8287
function iterable_filter(iterable $iterable, ?callable $filter = null): iterable
8388
{

0 commit comments

Comments
 (0)