mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-07-12 18:06:46 +02:00
PHP 7.3: Add support for trailing commas in calls
RFC: https://wiki.php.net/rfc/trailing-comma-function-calls
This commit is contained in:
@ -613,11 +613,8 @@ A trailing comma is not allowed here from 11:25 to 11:25
|
||||
A trailing comma is not allowed here from 13:17 to 13:17
|
||||
A trailing comma is not allowed here from 14:14 to 14:14
|
||||
A trailing comma is not allowed here from 16:22 to 16:22
|
||||
A trailing comma is not allowed here from 18:9 to 18:9
|
||||
A trailing comma is not allowed here from 19:9 to 19:9
|
||||
A trailing comma is not allowed here from 21:13 to 21:13
|
||||
A trailing comma is not allowed here from 23:16 to 23:16
|
||||
A trailing comma is not allowed here from 24:7 to 24:7
|
||||
A trailing comma is not allowed here from 25:10 to 25:10
|
||||
A trailing comma is not allowed here from 26:10 to 26:10
|
||||
A trailing comma is not allowed here from 27:8 to 27:8
|
||||
|
140
test/code/parser/expr/trailingCommas.test
Normal file
140
test/code/parser/expr/trailingCommas.test
Normal file
@ -0,0 +1,140 @@
|
||||
PHP 7.3 trailing comma additions
|
||||
-----
|
||||
<?php
|
||||
|
||||
foo($a, $b, );
|
||||
$foo->bar($a, $b, );
|
||||
Foo::bar($a, $b, );
|
||||
new Foo($a, $b, );
|
||||
unset($a, $b, );
|
||||
isset($a, $b, );
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
1: Arg(
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Expression(
|
||||
expr: Expr_MethodCall(
|
||||
var: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
name: Identifier(
|
||||
name: bar
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
1: Arg(
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Expression(
|
||||
expr: Expr_StaticCall(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
name: Identifier(
|
||||
name: bar
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
1: Arg(
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_Expression(
|
||||
expr: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
1: Arg(
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Stmt_Unset(
|
||||
vars: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_Expression(
|
||||
expr: Expr_Isset(
|
||||
vars: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
Reference in New Issue
Block a user