Merge branch '3.x'

This commit is contained in:
Nikita Popov 2017-08-29 23:15:04 +02:00
commit fa12dc8a22
3 changed files with 26 additions and 1 deletions

View File

@ -1,7 +1,9 @@
Version 3.1.1-dev 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) Version 3.1.0 (2017-07-28)
-------------------------- --------------------------

View File

@ -470,6 +470,7 @@ abstract class ParserAbstract implements Parser
if ($stmt instanceof Node\Stmt\Namespace_) { if ($stmt instanceof Node\Stmt\Namespace_) {
$afterFirstNamespace = true; $afterFirstNamespace = true;
} elseif (!$stmt instanceof Node\Stmt\HaltCompiler } elseif (!$stmt instanceof Node\Stmt\HaltCompiler
&& !$stmt instanceof Node\Stmt\Nop
&& $afterFirstNamespace && !$hasErrored) { && $afterFirstNamespace && !$hasErrored) {
$this->emitError(new Error( $this->emitError(new Error(
'No code may exist outside of namespace {}', $stmt->getAttributes())); 'No code may exist outside of namespace {}', $stmt->getAttributes()));

View 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
)
)
)