mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-26 20:14:46 +01:00
Merge branch '3.x'
This commit is contained in:
commit
fa12dc8a22
@ -1,7 +1,9 @@
|
||||
Version 3.1.1-dev
|
||||
-----------------
|
||||
|
||||
Nothing yet.
|
||||
### Fixed
|
||||
|
||||
* Fixed syntax error on comment after brace-style namespace declaration. (#412)
|
||||
|
||||
Version 3.1.0 (2017-07-28)
|
||||
--------------------------
|
||||
|
@ -470,6 +470,7 @@ abstract class ParserAbstract implements Parser
|
||||
if ($stmt instanceof Node\Stmt\Namespace_) {
|
||||
$afterFirstNamespace = true;
|
||||
} elseif (!$stmt instanceof Node\Stmt\HaltCompiler
|
||||
&& !$stmt instanceof Node\Stmt\Nop
|
||||
&& $afterFirstNamespace && !$hasErrored) {
|
||||
$this->emitError(new Error(
|
||||
'No code may exist outside of namespace {}', $stmt->getAttributes()));
|
||||
|
22
test/code/parser/stmt/namespace/commentAfterNamespace.test
Normal file
22
test/code/parser/stmt/namespace/commentAfterNamespace.test
Normal file
@ -0,0 +1,22 @@
|
||||
Trailing comment after braced namespace declaration
|
||||
-----
|
||||
<?php
|
||||
namespace Foo {}
|
||||
// Comment
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Nop(
|
||||
comments: array(
|
||||
0: // Comment
|
||||
)
|
||||
)
|
||||
)
|
Loading…
Reference in New Issue
Block a user