- 在闭包生成器中保存和恢复 beforeStmtLines 和 afterStmtLines 状态 - 移除闭包结束大括号前的重复代码插入 - 在编译基类中正确处理表达式前的代码行 - 添加对静态属性写入的测试用例 - 添加对箭头函数功能的测试用例pull/1/head
parent
f56bd745e7
commit
eed45fdb61
4 changed files with 63 additions and 4 deletions
@ -0,0 +1,17 @@ |
|||||||
|
--TEST-- |
||||||
|
arrow function 2 |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
function main() |
||||||
|
{ |
||||||
|
$array = [1, 5, 9]; |
||||||
|
$fn1 = fn($x) => var_dump(0, ...$array); |
||||||
|
$fn1(); |
||||||
|
} |
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
int(0) |
||||||
|
int(1) |
||||||
|
int(5) |
||||||
|
int(9) |
||||||
|
|
||||||
@ -0,0 +1,32 @@ |
|||||||
|
--TEST-- |
||||||
|
Static Class Property Read/Write Test |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
class Select { |
||||||
|
public $errorHandler = null; |
||||||
|
public function setErrorHandler($errorHandler): void |
||||||
|
{ |
||||||
|
$this->errorHandler = $errorHandler; |
||||||
|
($this->errorHandler)(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
class Worker |
||||||
|
{ |
||||||
|
public static ?stdClass $globalEvent = null; |
||||||
|
public static string $eventLoopClass = 'Select'; |
||||||
|
|
||||||
|
public static function init() { |
||||||
|
self::$globalEvent = new static::$eventLoopClass(); |
||||||
|
self::$globalEvent->setErrorHandler(function ($exception) { |
||||||
|
var_dump(__FUNCTION__); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function main() { |
||||||
|
Worker::init(); |
||||||
|
} |
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
string(4) "init" |
||||||
Loading…
Reference in new issue