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>
202 lines
5.3 KiB
Plaintext
202 lines
5.3 KiB
Plaintext
Default values (static scalar tests)
|
|
-----
|
|
<?php
|
|
|
|
function a(
|
|
$b = null,
|
|
$c = 'foo',
|
|
$d = A::B,
|
|
$f = +1,
|
|
$g = -1.0,
|
|
$h = array(),
|
|
$i = [],
|
|
$j = ['foo'],
|
|
$k = ['foo', 'bar' => 'baz']
|
|
) {}
|
|
-----
|
|
array(
|
|
0: Stmt_Function(
|
|
attrGroups: array(
|
|
)
|
|
byRef: false
|
|
name: Identifier(
|
|
name: a
|
|
)
|
|
params: array(
|
|
0: Param(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
type: null
|
|
byRef: false
|
|
variadic: false
|
|
var: Expr_Variable(
|
|
name: b
|
|
)
|
|
default: Expr_ConstFetch(
|
|
name: Name(
|
|
parts: array(
|
|
0: null
|
|
)
|
|
)
|
|
)
|
|
)
|
|
1: Param(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
type: null
|
|
byRef: false
|
|
variadic: false
|
|
var: Expr_Variable(
|
|
name: c
|
|
)
|
|
default: Scalar_String(
|
|
value: foo
|
|
)
|
|
)
|
|
2: Param(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
type: null
|
|
byRef: false
|
|
variadic: false
|
|
var: Expr_Variable(
|
|
name: d
|
|
)
|
|
default: Expr_ClassConstFetch(
|
|
class: Name(
|
|
parts: array(
|
|
0: A
|
|
)
|
|
)
|
|
name: Identifier(
|
|
name: B
|
|
)
|
|
)
|
|
)
|
|
3: Param(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
type: null
|
|
byRef: false
|
|
variadic: false
|
|
var: Expr_Variable(
|
|
name: f
|
|
)
|
|
default: Expr_UnaryPlus(
|
|
expr: Scalar_LNumber(
|
|
value: 1
|
|
)
|
|
)
|
|
)
|
|
4: Param(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
type: null
|
|
byRef: false
|
|
variadic: false
|
|
var: Expr_Variable(
|
|
name: g
|
|
)
|
|
default: Expr_UnaryMinus(
|
|
expr: Scalar_DNumber(
|
|
value: 1
|
|
)
|
|
)
|
|
)
|
|
5: Param(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
type: null
|
|
byRef: false
|
|
variadic: false
|
|
var: Expr_Variable(
|
|
name: h
|
|
)
|
|
default: Expr_Array(
|
|
items: array(
|
|
)
|
|
)
|
|
)
|
|
6: Param(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
type: null
|
|
byRef: false
|
|
variadic: false
|
|
var: Expr_Variable(
|
|
name: i
|
|
)
|
|
default: Expr_Array(
|
|
items: array(
|
|
)
|
|
)
|
|
)
|
|
7: Param(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
type: null
|
|
byRef: false
|
|
variadic: false
|
|
var: Expr_Variable(
|
|
name: j
|
|
)
|
|
default: Expr_Array(
|
|
items: array(
|
|
0: Expr_ArrayItem(
|
|
key: null
|
|
value: Scalar_String(
|
|
value: foo
|
|
)
|
|
byRef: false
|
|
unpack: false
|
|
)
|
|
)
|
|
)
|
|
)
|
|
8: Param(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
type: null
|
|
byRef: false
|
|
variadic: false
|
|
var: Expr_Variable(
|
|
name: k
|
|
)
|
|
default: Expr_Array(
|
|
items: array(
|
|
0: Expr_ArrayItem(
|
|
key: null
|
|
value: Scalar_String(
|
|
value: foo
|
|
)
|
|
byRef: false
|
|
unpack: false
|
|
)
|
|
1: Expr_ArrayItem(
|
|
key: Scalar_String(
|
|
value: bar
|
|
)
|
|
value: Scalar_String(
|
|
value: baz
|
|
)
|
|
byRef: false
|
|
unpack: false
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
returnType: null
|
|
stmts: array(
|
|
)
|
|
)
|
|
) |