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 392d8b2 commit c15c082Copy full SHA for c15c082
Zend/tests/pipe_operator/generators.phpt
@@ -0,0 +1,30 @@
1
+--TEST--
2
+Generators
3
+--FILE--
4
+<?php
5
+
6
+function producer(): \Generator {
7
+ yield 1;
8
+ yield 2;
9
+ yield 3;
10
+}
11
12
+function map_incr(iterable $it): \Generator {
13
+ foreach ($it as $val) {
14
+ yield $val +1;
15
+ }
16
17
18
+$result = producer() |> map_incr(...) |> iterator_to_array(...);
19
20
+var_dump($result);
21
+?>
22
+--EXPECT--
23
+array(3) {
24
+ [0]=>
25
+ int(2)
26
+ [1]=>
27
+ int(3)
28
+ [2]=>
29
+ int(4)
30
0 commit comments