- 为getNamespacedClassName方法添加可选的当前命名空间参数 - 在gen_stub.php中传递当前类信息到getClassConstValue调用 - 在Translator.php中使用当前类的命名空间信息进行类常量查找 - 在类注册完成后清理ClassInfo::$currentClass避免污染 - 修复self引用时的默认值解析逻辑pull/1/head
parent
ec5f393a27
commit
ce7d254709
4 changed files with 54 additions and 7 deletions
@ -0,0 +1,38 @@ |
|||||||
|
--TEST-- |
||||||
|
trait full class name |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
namespace App2 { |
||||||
|
trait THello1 |
||||||
|
{ |
||||||
|
public const array DATA = [ |
||||||
|
TraitsTest::NAME => 'Hello 1', |
||||||
|
]; |
||||||
|
public function hello() |
||||||
|
{ |
||||||
|
var_dump(self::DATA); |
||||||
|
var_dump(self::DATA[TraitsTest::NAME]); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
class TraitsTest |
||||||
|
{ |
||||||
|
public const NAME = 'test_trait'; |
||||||
|
use THello1; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
namespace { |
||||||
|
function main() |
||||||
|
{ |
||||||
|
$o = new App2\TraitsTest; |
||||||
|
$o->hello(); |
||||||
|
} |
||||||
|
} |
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
array(1) { |
||||||
|
["test_trait"]=> |
||||||
|
string(7) "Hello 1" |
||||||
|
} |
||||||
|
string(7) "Hello 1" |
||||||
Loading…
Reference in new issue