a4b7a7240b97706436e7a4d4b8534ac649685b9b
[yaffs-website] / vendor / nikic / php-parser / test / code / parser / expr / fetchAndCall / newDeref.test
1 New expression dereferencing
2 -----
3 <?php
4
5 (new A)->b;
6 (new A)->b();
7 (new A)['b'];
8 (new A)['b']['c'];
9 -----
10 array(
11     0: Stmt_Expression(
12         expr: Expr_PropertyFetch(
13             var: Expr_New(
14                 class: Name(
15                     parts: array(
16                         0: A
17                     )
18                 )
19                 args: array(
20                 )
21             )
22             name: Identifier(
23                 name: b
24             )
25         )
26     )
27     1: Stmt_Expression(
28         expr: Expr_MethodCall(
29             var: Expr_New(
30                 class: Name(
31                     parts: array(
32                         0: A
33                     )
34                 )
35                 args: array(
36                 )
37             )
38             name: Identifier(
39                 name: b
40             )
41             args: array(
42             )
43         )
44     )
45     2: Stmt_Expression(
46         expr: Expr_ArrayDimFetch(
47             var: Expr_New(
48                 class: Name(
49                     parts: array(
50                         0: A
51                     )
52                 )
53                 args: array(
54                 )
55             )
56             dim: Scalar_String(
57                 value: b
58             )
59         )
60     )
61     3: Stmt_Expression(
62         expr: Expr_ArrayDimFetch(
63             var: Expr_ArrayDimFetch(
64                 var: Expr_New(
65                     class: Name(
66                         parts: array(
67                             0: A
68                         )
69                     )
70                     args: array(
71                     )
72                 )
73                 dim: Scalar_String(
74                     value: b
75                 )
76             )
77             dim: Scalar_String(
78                 value: c
79             )
80         )
81     )
82 )