Merge pull request 'fix(compiler): 修复命名空间尾部有注释导致编译不通过' (#29) from compiler-fix-namespace-trailing-comment into master
Reviewed-on: #29pull/40/head
commit
e3f55fe69c
5 changed files with 59 additions and 0 deletions
@ -0,0 +1,14 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
namespace NamespaceEndingComment; |
||||
|
||||
const VALUE = 42; |
||||
|
||||
function value(): int |
||||
{ |
||||
return VALUE; |
||||
} |
||||
|
||||
// unbracketed namespace trailing comment |
||||
@ -0,0 +1,22 @@ |
||||
--TEST-- |
||||
A namespace block ending with a comment must not be treated as stray code |
||||
--FILE-- |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
namespace Test { |
||||
/* named namespace trailing block comment */ |
||||
} |
||||
|
||||
namespace { |
||||
function main() |
||||
{ |
||||
var_dump('done'); |
||||
} |
||||
|
||||
// global namespace trailing line comment |
||||
} |
||||
?> |
||||
--EXPECT-- |
||||
string(4) "done" |
||||
Loading…
Reference in new issue