Skip to content

Commit df2f48d

Browse files
committed
bc php5 calling anonymous function
1 parent ffcf38c commit df2f48d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/Util/TraversableToArrayTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)