1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-11 08:59:46 +01:00
PHP-Parser/test/code/parser/expr/fetchAndCall/objectAccess.test

172 lines
3.7 KiB
Plaintext
Raw Normal View History

2011-12-07 18:17:05 +01:00
Object access
-----
<?php
// property fetch variations
$a->b;
$a->b['c'];
$a->b{'c'};
// method call variations
$a->b();
$a->{'b'}();
$a->$b();
$a->$b['c']();
// array dereferencing
$a->b()['c'];
$a->b(){'c'}; // invalid PHP: drop Support?
-----
2015-06-13 14:59:24 +02:00
!!php5
2011-12-07 18:17:05 +01:00
array(
2017-01-19 22:25:22 +01:00
0: Stmt_Expression(
expr: Expr_PropertyFetch(
var: Expr_Variable(
name: a
comments: array(
0: // property fetch variations
)
)
name: b
comments: array(
0: // property fetch variations
)
2011-12-07 18:17:05 +01:00
)
comments: array(
0: // property fetch variations
)
2011-12-07 18:17:05 +01:00
)
2017-01-19 22:25:22 +01:00
1: Stmt_Expression(
expr: Expr_ArrayDimFetch(
var: Expr_PropertyFetch(
var: Expr_Variable(
name: a
)
name: b
)
dim: Scalar_String(
value: c
2011-12-07 18:17:05 +01:00
)
)
2017-01-19 22:25:22 +01:00
)
2: Stmt_Expression(
expr: Expr_ArrayDimFetch(
var: Expr_PropertyFetch(
var: Expr_Variable(
name: a
)
name: b
)
dim: Scalar_String(
value: c
)
2011-12-07 18:17:05 +01:00
)
)
2017-01-19 22:25:22 +01:00
3: Stmt_Expression(
expr: Expr_MethodCall(
2011-12-07 18:17:05 +01:00
var: Expr_Variable(
name: a
2017-01-19 22:25:22 +01:00
comments: array(
0: // method call variations
)
2011-12-07 18:17:05 +01:00
)
name: b
2017-01-19 22:25:22 +01:00
args: array(
)
comments: array(
0: // method call variations
)
2011-12-07 18:17:05 +01:00
)
comments: array(
0: // method call variations
)
2011-12-07 18:17:05 +01:00
)
2017-01-19 22:25:22 +01:00
4: Stmt_Expression(
expr: Expr_MethodCall(
var: Expr_Variable(
name: a
)
name: Scalar_String(
value: b
)
args: array(
)
2011-12-07 18:17:05 +01:00
)
)
2017-01-19 22:25:22 +01:00
5: Stmt_Expression(
expr: Expr_MethodCall(
2011-12-07 18:17:05 +01:00
var: Expr_Variable(
2017-01-19 22:25:22 +01:00
name: a
)
name: Expr_Variable(
2011-12-07 18:17:05 +01:00
name: b
)
2017-01-19 22:25:22 +01:00
args: array(
2011-12-07 18:17:05 +01:00
)
)
)
2017-01-19 22:25:22 +01:00
6: Stmt_Expression(
expr: Expr_MethodCall(
2011-12-07 18:17:05 +01:00
var: Expr_Variable(
name: a
2017-01-19 22:25:22 +01:00
)
name: Expr_ArrayDimFetch(
var: Expr_Variable(
name: b
)
dim: Scalar_String(
value: c
)
)
args: array(
)
)
)
7: Stmt_Expression(
expr: Expr_ArrayDimFetch(
var: Expr_MethodCall(
var: Expr_Variable(
name: a
comments: array(
0: // array dereferencing
)
)
name: b
args: array(
)
comments: array(
0: // array dereferencing
)
2011-12-07 18:17:05 +01:00
)
2017-01-19 22:25:22 +01:00
dim: Scalar_String(
value: c
2011-12-07 18:17:05 +01:00
)
comments: array(
0: // array dereferencing
)
2011-12-07 18:17:05 +01:00
)
comments: array(
0: // array dereferencing
)
2011-12-07 18:17:05 +01:00
)
2017-01-19 22:25:22 +01:00
8: Stmt_Expression(
expr: Expr_ArrayDimFetch(
var: Expr_MethodCall(
var: Expr_Variable(
name: a
)
name: b
args: array(
)
2011-12-07 18:17:05 +01:00
)
2017-01-19 22:25:22 +01:00
dim: Scalar_String(
value: c
2011-12-07 18:17:05 +01:00
)
)
)
9: Stmt_Nop(
comments: array(
0: // invalid PHP: drop Support?
)
)
)