mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-11-26 20:04:48 +01:00
parent
4d4896e553
commit
a10780ca0d
@ -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)
|
||||
--------------------------
|
||||
|
@ -445,6 +445,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