File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -27,21 +27,23 @@ public function traversablesProvider()
2727 ]));
2828
2929 // Generator example
30- $ generatorInput = (function () {
30+ $ innerGenerator = function () {
31+ yield 0 => 'B ' ;
32+ yield 1 => 'bB ' ;
33+ };
34+
35+ $ generatorInput = function () use ($ innerGenerator ) {
3136 yield 0 => 'a ' ;
3237 yield 0 => 'A ' ;
3338 yield 1 => 'b ' ;
34- yield 1 => (function () {
35- yield 0 => 'B ' ;
36- yield 1 => 'bB ' ;
37- })();
39+ yield 1 => $ innerGenerator ();
3840 yield 100 => 'c ' ;
3941 yield 100 => ['d ' , 'e ' , 'f ' ];
4042 yield 'd ' => [1 , 2 , 3 ];
4143 yield 101 => 'e ' ;
4244 yield 101 => 'E ' ;
4345 yield 'D ' => 'd ' ;
44- })() ;
46+ };
4547
4648 $ expectedOutput = [
4749 [['a ' , 'A ' ]],
@@ -54,7 +56,7 @@ public function traversablesProvider()
5456
5557 return [
5658 'Iterator ' => [$ iteratorsInput , $ expectedOutput ],
57- 'Generator ' => [$ generatorInput , $ expectedOutput ]
59+ 'Generator ' => [$ generatorInput() , $ expectedOutput ]
5860 ];
5961 }
6062
You can’t perform that action at this time.
0 commit comments