Skip to content

Commit 133c298

Browse files
Transform collection only to array when necessary in mp (#87)
* Transform collection only to array when necessary * Fix argument name Co-authored-by: Rafa Gómez <[email protected]>
1 parent 4d0ce74 commit 133c298

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/map.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@
2020
*/
2121
function map(callable $fn, iterable $coll): array
2222
{
23-
$args = to_array($coll);
24-
2523
try {
26-
return ___map_indexed($fn, $args);
24+
return ___map_indexed($fn, $coll);
2725
} catch (ArgumentCountError $error) {
28-
return array_map($fn, $args);
26+
return array_map($fn, to_array($coll));
2927
}
3028
}
3129

0 commit comments

Comments
 (0)