mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
28 lines
344 B
PHP
28 lines
344 B
PHP
--TEST--
|
|
Closure in property initializer
|
|
--FILE--
|
|
<?php
|
|
|
|
class C {
|
|
public Closure $d = static function () {
|
|
echo "called", PHP_EOL;
|
|
};
|
|
}
|
|
|
|
$c = new C();
|
|
var_dump($c->d);
|
|
($c->d)();
|
|
|
|
|
|
?>
|
|
--EXPECTF--
|
|
object(Closure)#%d (3) {
|
|
["name"]=>
|
|
string(%d) "{closure:%s:%d}"
|
|
["file"]=>
|
|
string(%d) "%s"
|
|
["line"]=>
|
|
int(4)
|
|
}
|
|
called
|