mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-11 08:39:44 +01:00
98f7f39d1c
Not adding any explicit FPPP support, as I don't think add/remove of names can be handled any better than full reformatting.
83 lines
1.8 KiB
Plaintext
83 lines
1.8 KiB
Plaintext
Nullsafe operator
|
|
-----
|
|
<?php
|
|
|
|
$a?->b;
|
|
$a?->b($c);
|
|
new $a?->b;
|
|
"{$a?->b}";
|
|
"$a?->b";
|
|
-----
|
|
!!php7
|
|
array(
|
|
0: Stmt_Expression(
|
|
expr: Expr_NullsafePropertyFetch(
|
|
var: Expr_Variable(
|
|
name: a
|
|
)
|
|
name: Identifier(
|
|
name: b
|
|
)
|
|
)
|
|
)
|
|
1: Stmt_Expression(
|
|
expr: Expr_NullsafeMethodCall(
|
|
var: Expr_Variable(
|
|
name: a
|
|
)
|
|
name: Identifier(
|
|
name: b
|
|
)
|
|
args: array(
|
|
0: Arg(
|
|
name: null
|
|
value: Expr_Variable(
|
|
name: c
|
|
)
|
|
byRef: false
|
|
unpack: false
|
|
)
|
|
)
|
|
)
|
|
)
|
|
2: Stmt_Expression(
|
|
expr: Expr_New(
|
|
class: Expr_NullsafePropertyFetch(
|
|
var: Expr_Variable(
|
|
name: a
|
|
)
|
|
name: Identifier(
|
|
name: b
|
|
)
|
|
)
|
|
args: array(
|
|
)
|
|
)
|
|
)
|
|
3: Stmt_Expression(
|
|
expr: Scalar_Encapsed(
|
|
parts: array(
|
|
0: Expr_NullsafePropertyFetch(
|
|
var: Expr_Variable(
|
|
name: a
|
|
)
|
|
name: Identifier(
|
|
name: b
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
4: Stmt_Expression(
|
|
expr: Scalar_Encapsed(
|
|
parts: array(
|
|
0: Expr_Variable(
|
|
name: a
|
|
)
|
|
1: Scalar_EncapsedStringPart(
|
|
value: ?->b
|
|
)
|
|
)
|
|
)
|
|
)
|
|
) |