Skip to content

Commit 866e0de

Browse files
committed
Add test for yielding short function.
1 parent aae5d1b commit 866e0de

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Short functions that yield.
3+
--FILE--
4+
<?php
5+
6+
function read($it): iterable => yield from $it;
7+
8+
$a = [1, 2, 3];
9+
10+
print_r(iterator_to_array(read($a)));
11+
12+
?>
13+
--EXPECT--
14+
Array
15+
(
16+
[0] => 1
17+
[1] => 2
18+
[2] => 3
19+
)

0 commit comments

Comments
 (0)