mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-02 17:38:19 +01:00
9aebf377fc
Fixes issue #800.
108 lines
3.2 KiB
Plaintext
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(
|
|
)
|
|
)
|
|
)
|
|
)
|
|
) |