mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-11-26 20:34:59 +01:00
simplify the readme example (#21)
This commit is contained in:
parent
7bf9aefe17
commit
723a4f208e
@ -28,9 +28,12 @@ use Psl\Iter;
|
||||
*/
|
||||
function foo(iterable $codes): string
|
||||
{
|
||||
return Str\join(Iter\map(
|
||||
Iter\filter_nulls($codes), fn($i) => Str\chr($i),
|
||||
), ', ');
|
||||
/** @var Iter\Iterator<int> $codes */
|
||||
$codes = Iter\filter_nulls($codes);
|
||||
/** @var Iter\Iterator<string> $chars */
|
||||
$chars = Iter\map($codes, fn(int $code): string => Str\chr($code));
|
||||
|
||||
return Str\join($chars, ', ');
|
||||
}
|
||||
|
||||
foo([95, 96, null, 98]);
|
||||
|
Loading…
Reference in New Issue
Block a user