php-parser/test/code/parser/expr/arrayDef.test

173 lines
4.3 KiB
Plaintext
Raw Normal View History

2011-11-27 11:20:35 +01:00
Array definitions
-----
<?php
array();
2011-12-07 18:17:05 +01:00
array('a');
array('a', );
array('a', 'b');
array('a', &$b, 'c' => 'd', 'e' => &$f);
2011-11-27 11:20:35 +01:00
2011-12-07 18:17:05 +01:00
// short array syntax
2011-11-27 11:20:35 +01:00
[];
[1, 2, 3];
['a' => 'b'];
-----
array(
2017-01-19 22:25:22 +01:00
0: Stmt_Expression(
expr: Expr_Array(
items: array(
)
2011-11-27 11:20:35 +01:00
)
)
2017-01-19 22:25:22 +01:00
1: Stmt_Expression(
expr: Expr_Array(
items: array(
0: Expr_ArrayItem(
key: null
value: Scalar_String(
value: a
)
byRef: false
2019-05-09 15:11:00 +02:00
unpack: false
2011-11-27 11:20:35 +01:00
)
)
)
)
2017-01-19 22:25:22 +01:00
2: Stmt_Expression(
expr: Expr_Array(
items: array(
0: Expr_ArrayItem(
key: null
value: Scalar_String(
value: a
)
byRef: false
2019-05-09 15:11:00 +02:00
unpack: false
2011-11-27 11:20:35 +01:00
)
)
)
)
2017-01-19 22:25:22 +01:00
3: Stmt_Expression(
expr: Expr_Array(
items: array(
0: Expr_ArrayItem(
key: null
value: Scalar_String(
value: a
)
byRef: false
2019-05-09 15:11:00 +02:00
unpack: false
2011-11-27 11:20:35 +01:00
)
2017-01-19 22:25:22 +01:00
1: Expr_ArrayItem(
key: null
value: Scalar_String(
value: b
)
byRef: false
2019-05-09 15:11:00 +02:00
unpack: false
2011-11-27 11:20:35 +01:00
)
)
)
)
2017-01-19 22:25:22 +01:00
4: Stmt_Expression(
expr: Expr_Array(
items: array(
0: Expr_ArrayItem(
key: null
value: Scalar_String(
value: a
)
byRef: false
2019-05-09 15:11:00 +02:00
unpack: false
2011-12-07 18:17:05 +01:00
)
2017-01-19 22:25:22 +01:00
1: Expr_ArrayItem(
key: null
value: Expr_Variable(
name: b
)
byRef: true
2019-05-09 15:11:00 +02:00
unpack: false
2011-12-07 18:17:05 +01:00
)
2017-01-19 22:25:22 +01:00
2: Expr_ArrayItem(
key: Scalar_String(
value: c
)
value: Scalar_String(
value: d
)
byRef: false
2019-05-09 15:11:00 +02:00
unpack: false
2011-12-07 18:17:05 +01:00
)
2017-01-19 22:25:22 +01:00
3: Expr_ArrayItem(
key: Scalar_String(
value: e
)
value: Expr_Variable(
name: f
)
byRef: true
2019-05-09 15:11:00 +02:00
unpack: false
2011-12-07 18:17:05 +01:00
)
2011-11-27 11:20:35 +01:00
)
)
)
2017-01-19 22:25:22 +01:00
5: Stmt_Expression(
expr: Expr_Array(
items: array(
)
comments: array(
0: // short array syntax
)
2011-11-27 11:20:35 +01:00
)
comments: array(
0: // short array syntax
)
2011-11-27 11:20:35 +01:00
)
2017-01-19 22:25:22 +01:00
6: Stmt_Expression(
expr: Expr_Array(
items: array(
0: Expr_ArrayItem(
key: null
value: Scalar_LNumber(
value: 1
)
byRef: false
2019-05-09 15:11:00 +02:00
unpack: false
2011-11-27 11:20:35 +01:00
)
2017-01-19 22:25:22 +01:00
1: Expr_ArrayItem(
key: null
value: Scalar_LNumber(
value: 2
)
byRef: false
2019-05-09 15:11:00 +02:00
unpack: false
2011-11-27 11:20:35 +01:00
)
2017-01-19 22:25:22 +01:00
2: Expr_ArrayItem(
key: null
value: Scalar_LNumber(
value: 3
)
byRef: false
2019-05-09 15:11:00 +02:00
unpack: false
2011-11-27 11:20:35 +01:00
)
)
)
)
2017-01-19 22:25:22 +01:00
7: Stmt_Expression(
expr: Expr_Array(
items: array(
0: Expr_ArrayItem(
key: Scalar_String(
value: a
)
value: Scalar_String(
value: b
)
byRef: false
2019-05-09 15:11:00 +02:00
unpack: false
2011-11-27 11:20:35 +01:00
)
)
)
)
)