We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7da8363 commit 572d8d0Copy full SHA for 572d8d0
src/iterable-functions.php
@@ -16,14 +16,19 @@
16
/**
17
* Maps a callable to an iterable.
18
*
19
- * @param iterable<mixed> $iterable
+ * @param iterable<TKey, TValue> $iterable
20
+ * @param callable(TValue):TResult $mapper
21
+ *
22
+ * @return iterable<TKey, TValue2>
23
- * @return iterable<mixed>
24
+ * @template TKey
25
+ * @template TValue
26
+ * @template TResult
27
*/
-function iterable_map(iterable $iterable, callable $map): iterable
28
+function iterable_map(iterable $iterable, callable $mapper): iterable
29
{
30
foreach ($iterable as $key => $item) {
- yield $key => $map($item);
31
+ yield $key => $mapper($item);
32
}
33
34
0 commit comments