1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2025-01-22 05:41:23 +01:00

Merge branch '3.x'

Conflicts:
	lib/PhpParser/Parser/Php7.php
This commit is contained in:
Nikita Popov 2017-06-28 23:06:38 +02:00
commit 4fea054ee0
5 changed files with 1078 additions and 1002 deletions

View File

@ -1,6 +1,25 @@
Version 3.0.6-dev
Version 3.1.0-dev
-----------------
### Added
* [PHP 7.2] Added support for trailing comma in group use statements.
Version 3.0.6 (2017-06-28)
--------------------------
### Fixed
* Fixed the spelling of `Class_::VISIBILITY_MODIFIER_MASK`. The previous spelling of
`Class_::VISIBILITY_MODIFER_MASK` is preserved for backwards compatibility.
* The pretty printing will now preserve comments inside array literals and function calls by
printing the array items / function arguments on separate lines. Array literals and functions that
do not contain comments are not affected.
### Added
* Added `Builder\Param::makeVariadic()`.
### Deprecated
* The `Node::setLine()` method has been deprecated.

View File

@ -67,6 +67,10 @@ no_comma:
| ',' { $this->emitError(new Error('A trailing comma is not allowed here', attributes())); }
;
optional_comma:
/* empty */
| ','
top_statement:
statement { $$ = $1; }
| function_declaration_statement { $$ = $1; }
@ -103,7 +107,7 @@ group_use_declaration:
;
unprefixed_use_declarations:
non_empty_unprefixed_use_declarations no_comma { $$ = $1; }
non_empty_unprefixed_use_declarations optional_comma { $$ = $1; }
;
non_empty_unprefixed_use_declarations:
@ -122,7 +126,7 @@ non_empty_use_declarations:
;
inline_use_declarations:
non_empty_inline_use_declarations no_comma { $$ = $1; }
non_empty_inline_use_declarations optional_comma { $$ = $1; }
;
non_empty_inline_use_declarations:

File diff suppressed because it is too large Load Diff

View File

@ -604,8 +604,6 @@ for ($a, ; $b, ; $c, );
function ($a, ) use ($b, ) {};
-----
!!php7
A trailing comma is not allowed here from 3:9 to 3:9
A trailing comma is not allowed here from 4:18 to 4:18
A trailing comma is not allowed here from 5:6 to 5:6
A trailing comma is not allowed here from 6:13 to 6:13
A trailing comma is not allowed here from 8:21 to 8:21

View File

@ -0,0 +1,47 @@
Group use can have trailing comma
-----
<?php
use A\{B,};
use function A\{b,};
-----
!!php7
array(
0: Stmt_GroupUse(
type: TYPE_UNKNOWN (0)
prefix: Name(
parts: array(
0: A
)
)
uses: array(
0: Stmt_UseUse(
type: TYPE_NORMAL (1)
name: Name(
parts: array(
0: B
)
)
alias: null
)
)
)
1: Stmt_GroupUse(
type: TYPE_FUNCTION (2)
prefix: Name(
parts: array(
0: A
)
)
uses: array(
0: Stmt_UseUse(
type: TYPE_UNKNOWN (0)
name: Name(
parts: array(
0: b
)
)
alias: null
)
)
)
)