mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-05-06 05:15:23 +02:00
This fixes the long-standing issue where a comment would get assigned to all nodes with the same starting position, instead of only the outer-most one. Fixes #253.
160 lines
3.3 KiB
Plaintext
160 lines
3.3 KiB
Plaintext
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'};
|
|
-----
|
|
array(
|
|
0: Stmt_Expression(
|
|
expr: Expr_PropertyFetch(
|
|
var: Expr_Variable(
|
|
name: a
|
|
)
|
|
name: Identifier(
|
|
name: b
|
|
)
|
|
)
|
|
comments: array(
|
|
0: // property fetch variations
|
|
)
|
|
)
|
|
1: Stmt_Expression(
|
|
expr: Expr_ArrayDimFetch(
|
|
var: Expr_PropertyFetch(
|
|
var: Expr_Variable(
|
|
name: a
|
|
)
|
|
name: Identifier(
|
|
name: b
|
|
)
|
|
)
|
|
dim: Scalar_String(
|
|
value: c
|
|
)
|
|
)
|
|
)
|
|
2: Stmt_Expression(
|
|
expr: Expr_ArrayDimFetch(
|
|
var: Expr_PropertyFetch(
|
|
var: Expr_Variable(
|
|
name: a
|
|
)
|
|
name: Identifier(
|
|
name: b
|
|
)
|
|
)
|
|
dim: Scalar_String(
|
|
value: c
|
|
)
|
|
)
|
|
)
|
|
3: Stmt_Expression(
|
|
expr: Expr_MethodCall(
|
|
var: Expr_Variable(
|
|
name: a
|
|
)
|
|
name: Identifier(
|
|
name: b
|
|
)
|
|
args: array(
|
|
)
|
|
)
|
|
comments: array(
|
|
0: // method call variations
|
|
)
|
|
)
|
|
4: Stmt_Expression(
|
|
expr: Expr_MethodCall(
|
|
var: Expr_Variable(
|
|
name: a
|
|
)
|
|
name: Scalar_String(
|
|
value: b
|
|
)
|
|
args: array(
|
|
)
|
|
)
|
|
)
|
|
5: Stmt_Expression(
|
|
expr: Expr_MethodCall(
|
|
var: Expr_Variable(
|
|
name: a
|
|
)
|
|
name: Expr_Variable(
|
|
name: b
|
|
)
|
|
args: array(
|
|
)
|
|
)
|
|
)
|
|
6: Stmt_Expression(
|
|
expr: Expr_FuncCall(
|
|
name: Expr_ArrayDimFetch(
|
|
var: Expr_PropertyFetch(
|
|
var: Expr_Variable(
|
|
name: a
|
|
)
|
|
name: 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
|
|
)
|
|
name: Identifier(
|
|
name: b
|
|
)
|
|
args: array(
|
|
)
|
|
)
|
|
dim: Scalar_String(
|
|
value: c
|
|
)
|
|
)
|
|
comments: array(
|
|
0: // array dereferencing
|
|
)
|
|
)
|
|
8: Stmt_Expression(
|
|
expr: Expr_ArrayDimFetch(
|
|
var: Expr_MethodCall(
|
|
var: Expr_Variable(
|
|
name: a
|
|
)
|
|
name: Identifier(
|
|
name: b
|
|
)
|
|
args: array(
|
|
)
|
|
)
|
|
dim: Scalar_String(
|
|
value: c
|
|
)
|
|
)
|
|
)
|
|
)
|