php-parser/test/code/parser/stmt/class/property_promotion.test
2021-08-08 19:12:44 +02:00

108 lines
3.2 KiB
Plaintext

Property promotion
-----
<?php
class Point {
public function __construct(
public float $x = 0.0,
protected array $y = [],
private string $z = 'hello',
public readonly int $a = 0,
) {}
}
-----
!!php7
array(
0: Stmt_Class(
attrGroups: array(
)
flags: 0
name: Identifier(
name: Point
)
extends: null
implements: array(
)
stmts: array(
0: Stmt_ClassMethod(
attrGroups: array(
)
flags: MODIFIER_PUBLIC (1)
byRef: false
name: Identifier(
name: __construct
)
params: array(
0: Param(
attrGroups: array(
)
flags: MODIFIER_PUBLIC (1)
type: Identifier(
name: float
)
byRef: false
variadic: false
var: Expr_Variable(
name: x
)
default: Scalar_DNumber(
value: 0
)
)
1: Param(
attrGroups: array(
)
flags: MODIFIER_PROTECTED (2)
type: Identifier(
name: array
)
byRef: false
variadic: false
var: Expr_Variable(
name: y
)
default: Expr_Array(
items: array(
)
)
)
2: Param(
attrGroups: array(
)
flags: MODIFIER_PRIVATE (4)
type: Identifier(
name: string
)
byRef: false
variadic: false
var: Expr_Variable(
name: z
)
default: Scalar_String(
value: hello
)
)
3: Param(
attrGroups: array(
)
flags: MODIFIER_PUBLIC | MODIFIER_READONLY (65)
type: Identifier(
name: int
)
byRef: false
variadic: false
var: Expr_Variable(
name: a
)
default: Scalar_LNumber(
value: 0
)
)
)
returnType: null
stmts: array(
)
)
)
)
)