mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-02 17:38:19 +01:00
4c22c62783
Adds support for PHP 8 attributes, represented using `AttrGroup` nodes containing `Attribute` nodes. The `attrGroup` subnode is added to all nodes that can have attributes. This is still missing FPPP support. Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
132 lines
2.8 KiB
Plaintext
132 lines
2.8 KiB
Plaintext
Trailing comma in parameter list
|
|
-----
|
|
<?php
|
|
|
|
function foo($bar, ) {
|
|
}
|
|
-----
|
|
!!php7
|
|
array(
|
|
0: Stmt_Function(
|
|
attrGroups: array(
|
|
)
|
|
byRef: false
|
|
name: Identifier(
|
|
name: foo
|
|
)
|
|
params: array(
|
|
0: Param(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
type: null
|
|
byRef: false
|
|
variadic: false
|
|
var: Expr_Variable(
|
|
name: bar
|
|
)
|
|
default: null
|
|
)
|
|
)
|
|
returnType: null
|
|
stmts: array(
|
|
)
|
|
)
|
|
)
|
|
-----
|
|
<?php
|
|
|
|
class Foo
|
|
{
|
|
function __construct($name, $value, )
|
|
{
|
|
}
|
|
}
|
|
-----
|
|
!!php7
|
|
array(
|
|
0: Stmt_Class(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
name: Identifier(
|
|
name: Foo
|
|
)
|
|
extends: null
|
|
implements: array(
|
|
)
|
|
stmts: array(
|
|
0: Stmt_ClassMethod(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
byRef: false
|
|
name: Identifier(
|
|
name: __construct
|
|
)
|
|
params: array(
|
|
0: Param(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
type: null
|
|
byRef: false
|
|
variadic: false
|
|
var: Expr_Variable(
|
|
name: name
|
|
)
|
|
default: null
|
|
)
|
|
1: Param(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
type: null
|
|
byRef: false
|
|
variadic: false
|
|
var: Expr_Variable(
|
|
name: value
|
|
)
|
|
default: null
|
|
)
|
|
)
|
|
returnType: null
|
|
stmts: array(
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
-----
|
|
<?php
|
|
fn($foo, ) => $bar;
|
|
-----
|
|
!!php7
|
|
array(
|
|
0: Stmt_Expression(
|
|
expr: Expr_ArrowFunction(
|
|
attrGroups: array(
|
|
)
|
|
static: false
|
|
byRef: false
|
|
params: array(
|
|
0: Param(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
type: null
|
|
byRef: false
|
|
variadic: false
|
|
var: Expr_Variable(
|
|
name: foo
|
|
)
|
|
default: null
|
|
)
|
|
)
|
|
returnType: null
|
|
expr: Expr_Variable(
|
|
name: bar
|
|
)
|
|
)
|
|
)
|
|
) |