TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
442 B
35 lines
442 B
--TEST--
|
|
closure 001
|
|
--FILE--
|
|
<?php
|
|
class Bar {
|
|
public function __construct(callable $fn) {
|
|
$data = $fn();
|
|
var_dump($data);
|
|
}
|
|
}
|
|
|
|
class Foo {
|
|
private $arr = [1, 2, 3];
|
|
function run() {
|
|
$bar = new Bar(function () {
|
|
return $this->arr;
|
|
});
|
|
}
|
|
}
|
|
|
|
function main()
|
|
{
|
|
$foo = new Foo();
|
|
$foo->run();
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
array(3) {
|
|
[0]=>
|
|
int(1)
|
|
[1]=>
|
|
int(2)
|
|
[2]=>
|
|
int(3)
|
|
}
|
|
|