5e1caf2fc2c56cc90dc790d522d7ed4f66dca91e
[yaffs-website] / vendor / nikic / php-parser / test / code / parser / expr / uvs / new.test
1 UVS new expressions
2 -----
3 <?php
4 new $className;
5 new $array['className'];
6 new $array{'className'};
7 new $obj->className;
8 new Test::$className;
9 new $test::$className;
10 new $weird[0]->foo::$className;
11 -----
12 !!php7
13 array(
14     0: Stmt_Expression(
15         expr: Expr_New(
16             class: Expr_Variable(
17                 name: className
18             )
19             args: array(
20             )
21         )
22     )
23     1: Stmt_Expression(
24         expr: Expr_New(
25             class: Expr_ArrayDimFetch(
26                 var: Expr_Variable(
27                     name: array
28                 )
29                 dim: Scalar_String(
30                     value: className
31                 )
32             )
33             args: array(
34             )
35         )
36     )
37     2: Stmt_Expression(
38         expr: Expr_New(
39             class: Expr_ArrayDimFetch(
40                 var: Expr_Variable(
41                     name: array
42                 )
43                 dim: Scalar_String(
44                     value: className
45                 )
46             )
47             args: array(
48             )
49         )
50     )
51     3: Stmt_Expression(
52         expr: Expr_New(
53             class: Expr_PropertyFetch(
54                 var: Expr_Variable(
55                     name: obj
56                 )
57                 name: Identifier(
58                     name: className
59                 )
60             )
61             args: array(
62             )
63         )
64     )
65     4: Stmt_Expression(
66         expr: Expr_New(
67             class: Expr_StaticPropertyFetch(
68                 class: Name(
69                     parts: array(
70                         0: Test
71                     )
72                 )
73                 name: VarLikeIdentifier(
74                     name: className
75                 )
76             )
77             args: array(
78             )
79         )
80     )
81     5: Stmt_Expression(
82         expr: Expr_New(
83             class: Expr_StaticPropertyFetch(
84                 class: Expr_Variable(
85                     name: test
86                 )
87                 name: VarLikeIdentifier(
88                     name: className
89                 )
90             )
91             args: array(
92             )
93         )
94     )
95     6: Stmt_Expression(
96         expr: Expr_New(
97             class: Expr_StaticPropertyFetch(
98                 class: Expr_PropertyFetch(
99                     var: Expr_ArrayDimFetch(
100                         var: Expr_Variable(
101                             name: weird
102                         )
103                         dim: Scalar_LNumber(
104                             value: 0
105                         )
106                     )
107                     name: Identifier(
108                         name: foo
109                     )
110                 )
111                 name: VarLikeIdentifier(
112                     name: className
113                 )
114             )
115             args: array(
116             )
117         )
118     )
119 )