Skip to content

Commit 55d4687

Browse files
committed
Improve closure_const_expr/disallows_non_static.phpt
1 parent 13ef06c commit 55d4687

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Zend/tests/closure_const_expr/disallows_non_static.phpt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ Disallows using non-static closures.
33
--FILE--
44
<?php
55

6-
$foo = "bar";
6+
class C {
7+
public Closure $d = function () {
8+
var_dump($this);
9+
};
10+
}
711

8-
const Closure = function () {
9-
echo $foo, PHP_EOL;
10-
};
11-
12-
var_dump(Closure);
13-
(Closure)();
12+
$foo = new C();
13+
var_dump($foo->d);
14+
($foo->d)();
1415

1516
?>
1617
--EXPECTF--

0 commit comments

Comments
 (0)