php-parser/test/code/parser/expr/nullsafe.test
Nikita Popov 98f7f39d1c Add named argument support
Not adding any explicit FPPP support, as I don't think add/remove
of names can be handled any better than full reformatting.
2020-08-09 17:37:44 +02:00

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
)
)
)
)
)