Skip to content

Commit 4b1127e

Browse files
committed
PEAR: improve realism for tests involving closures
Verified that all closures in test cases are: * either assigned to a variable * or used as a function call parameter / callback * or otherwise "valid"/realistic code In those cases where this wasn't the case before, the test cases have been adjusted in the most minimal fashion possible.
1 parent 016d870 commit 4b1127e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ $x = $var('y',
345345
$obj->{$x}(1,
346346
2);
347347

348-
(function ($a, $b) {
348+
return (function ($a, $b) {
349349
return function ($c, $d) use ($a, $b) {
350350
echo $a, $b, $c, $d;
351351
};
@@ -366,7 +366,7 @@ class Foo
366366
}
367367
}
368368

369-
(function ($a, $b) {
369+
return (function ($a, $b) {
370370
return function ($c, $d) use ($a, $b) {
371371
echo $a, $b, $c, $d;
372372
};

src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ $obj->{$x}(
356356
2
357357
);
358358

359-
(function ($a, $b) {
359+
return (function ($a, $b) {
360360
return function ($c, $d) use ($a, $b) {
361361
echo $a, $b, $c, $d;
362362
};
@@ -379,7 +379,7 @@ class Foo
379379
}
380380
}
381381

382-
(function ($a, $b) {
382+
return (function ($a, $b) {
383383
return function ($c, $d) use ($a, $b) {
384384
echo $a, $b, $c, $d;
385385
};

src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function foo($baz, Foo $foo = null, $bar = true) {}
9393
function foo($baz, $bar = true, Foo $foo = null) {}
9494

9595
// Valid closure
96-
function ($arg1, $arg2='hello') {};
96+
$closure = function ($arg1, $arg2='hello') {};
9797

9898
// Invalid closure
99-
function(array $arg2=array(), array $arg1) {}
99+
$closure = function(array $arg2=array(), array $arg1) {}

0 commit comments

Comments
 (0)