1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-12 09:29:47 +01:00
PHP-Parser/test/code/parser/expr/nullsafe.test

83 lines
1.8 KiB
Plaintext
Raw Normal View History

2020-08-02 10:30:44 +02:00
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
2020-08-02 10:30:44 +02:00
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
)
)
)
)
)