- 修正了getNativeName方法中类名和命名空间参数的顺序 - 添加了对包含反斜杠的函数名进行转义处理 - 修复了常量解析时的类名获取逻辑 - 正确实现了魔术常量__FUNCTION__、__CLASS__和__METHOD__的完整命名空间支持 - 修正了self和static关键字的处理,使其在AOT编译时都使用编译期确定的类名 - 修复了方法调用时类名的命名空间解析和占位符生成逻辑 - 添加了对静态属性访问的支持pull/1/head
parent
081c9fcc82
commit
1ce204d4b2
3 changed files with 81 additions and 9 deletions
@ -0,0 +1,29 @@ |
||||
--TEST-- |
||||
class namespace |
||||
--FILE-- |
||||
<?php |
||||
namespace Test { |
||||
class Session { |
||||
public static function init() |
||||
{ |
||||
var_dump(__METHOD__); |
||||
} |
||||
} |
||||
|
||||
function foo() |
||||
{ |
||||
var_dump(__FUNCTION__); |
||||
} |
||||
} |
||||
namespace { |
||||
use Test\Session; |
||||
function main() |
||||
{ |
||||
Session::init(); |
||||
Test\foo(); |
||||
} |
||||
} |
||||
?> |
||||
--EXPECT-- |
||||
string(18) "Test\Session::init" |
||||
string(8) "Test\foo" |
||||
@ -0,0 +1,32 @@ |
||||
--TEST-- |
||||
class static |
||||
--FILE-- |
||||
<?php |
||||
namespace Test { |
||||
#[AllowDynamicProperties] |
||||
class Worker |
||||
{ |
||||
public const FOO = 'foo'; |
||||
protected static string $hello; |
||||
public function __construct() |
||||
{ |
||||
self::$hello = 'hello'; |
||||
var_dump(self::$hello); |
||||
static::$hello = 'world'; |
||||
|
||||
var_dump(static::$hello); |
||||
var_dump(static::FOO); |
||||
} |
||||
} |
||||
} |
||||
namespace { |
||||
function main() |
||||
{ |
||||
$obj = new \Test\Worker(); |
||||
} |
||||
} |
||||
?> |
||||
--EXPECT-- |
||||
string(5) "hello" |
||||
string(5) "world" |
||||
string(3) "foo" |
||||
Loading…
Reference in new issue