1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-04 10:18:09 +01:00
PHP-Parser/test/code/parser/expr/uvs/misc.test

129 lines
3.3 KiB
Plaintext
Raw Normal View History

2015-06-13 15:42:09 +02:00
Uniform variable syntax in PHP 7 (misc)
-----
<?php
A::A[0];
A::A[0][1][2];
"string"->length();
(clone $obj)->b[0](1);
[0, 1][0] = 1;
-----
!!php7
array(
2017-01-19 22:25:22 +01:00
0: Stmt_Expression(
expr: Expr_ArrayDimFetch(
var: Expr_ClassConstFetch(
class: Name(
parts: array(
0: A
)
2015-06-13 15:42:09 +02:00
)
name: Identifier(
name: A
)
2017-01-19 22:25:22 +01:00
)
dim: Scalar_LNumber(
value: 0
2015-06-13 15:42:09 +02:00
)
)
)
2017-01-19 22:25:22 +01:00
1: Stmt_Expression(
expr: Expr_ArrayDimFetch(
2015-06-13 15:42:09 +02:00
var: Expr_ArrayDimFetch(
2017-01-19 22:25:22 +01:00
var: Expr_ArrayDimFetch(
var: Expr_ClassConstFetch(
class: Name(
parts: array(
0: A
)
2015-06-13 15:42:09 +02:00
)
name: Identifier(
name: A
)
2017-01-19 22:25:22 +01:00
)
dim: Scalar_LNumber(
value: 0
2015-06-13 15:42:09 +02:00
)
)
dim: Scalar_LNumber(
2017-01-19 22:25:22 +01:00
value: 1
2015-06-13 15:42:09 +02:00
)
)
dim: Scalar_LNumber(
2017-01-19 22:25:22 +01:00
value: 2
2015-06-13 15:42:09 +02:00
)
)
)
2017-01-19 22:25:22 +01:00
2: Stmt_Expression(
expr: Expr_MethodCall(
var: Scalar_String(
value: string
)
name: Identifier(
name: length
)
2017-01-19 22:25:22 +01:00
args: array(
)
2015-06-13 15:42:09 +02:00
)
)
2017-01-19 22:25:22 +01:00
3: Stmt_Expression(
expr: Expr_FuncCall(
name: Expr_ArrayDimFetch(
var: Expr_PropertyFetch(
var: Expr_Clone(
expr: Expr_Variable(
name: obj
)
2015-06-13 15:42:09 +02:00
)
name: Identifier(
name: b
)
2017-01-19 22:25:22 +01:00
)
dim: Scalar_LNumber(
value: 0
2015-06-13 15:42:09 +02:00
)
)
2017-01-19 22:25:22 +01:00
args: array(
0: Arg(
value: Scalar_LNumber(
value: 1
)
byRef: false
unpack: false
2015-06-13 15:42:09 +02:00
)
)
)
)
2017-01-19 22:25:22 +01:00
4: Stmt_Expression(
expr: Expr_Assign(
var: Expr_ArrayDimFetch(
var: Expr_Array(
items: array(
0: Expr_ArrayItem(
key: null
value: Scalar_LNumber(
value: 0
)
byRef: false
2019-05-09 15:11:00 +02:00
unpack: false
2015-06-13 15:42:09 +02:00
)
2017-01-19 22:25:22 +01:00
1: Expr_ArrayItem(
key: null
value: Scalar_LNumber(
value: 1
)
byRef: false
2019-05-09 15:11:00 +02:00
unpack: false
2015-06-13 15:42:09 +02:00
)
)
)
2017-01-19 22:25:22 +01:00
dim: Scalar_LNumber(
value: 0
)
2015-06-13 15:42:09 +02:00
)
2017-01-19 22:25:22 +01:00
expr: Scalar_LNumber(
value: 1
2015-06-13 15:42:09 +02:00
)
)
)
2017-01-19 22:25:22 +01:00
)