- 实现 useAliases 映射来处理常量别名 - 添加命名空间类名解析逻辑到 getNamespacedClassName 方法 - 修复 parseUse 方法的参数类型声明为 Node\Stmt\Use_ - 更新变量命名提高代码可读性 - 添加 use-const.phpt 测试用例验证常量别名功能pull/1/head
parent
4a5fe8dd6c
commit
0cee9a4154
2 changed files with 39 additions and 5 deletions
@ -0,0 +1,28 @@ |
||||
--TEST-- |
||||
aliasing imported constants to resolve naming conflicts |
||||
--FILE-- |
||||
<?php |
||||
|
||||
namespace foo { |
||||
const baz = 42; |
||||
} |
||||
|
||||
namespace bar { |
||||
const baz = 43; |
||||
} |
||||
|
||||
namespace { |
||||
use const foo\baz; |
||||
use const bar\baz as bar_baz; |
||||
function main() { |
||||
var_dump(baz); |
||||
var_dump(bar_baz); |
||||
echo "Done\n"; |
||||
} |
||||
} |
||||
|
||||
?> |
||||
--EXPECT-- |
||||
int(42) |
||||
int(43) |
||||
Done |
||||
Loading…
Reference in new issue