75c6ec66f0b581109613cfb70c2c937a9572eb46
[yaffs-website] / vendor / nikic / php-parser / test / code / parser / stmt / class / trait.test
1 Traits
2 -----
3 <?php
4
5 trait A {
6     public function a() {}
7 }
8
9 class B {
10     use C;
11     use D {
12         a as protected b;
13         c as d;
14         e as private;
15     }
16     use E, F, G {
17         E::a insteadof F, G;
18         E::b as protected c;
19         E::d as e;
20         E::f as private;
21     }
22 }
23 -----
24 array(
25     0: Stmt_Trait(
26         name: A
27         stmts: array(
28             0: Stmt_ClassMethod(
29                 flags: MODIFIER_PUBLIC (1)
30                 byRef: false
31                 name: a
32                 params: array(
33                 )
34                 returnType: null
35                 stmts: array(
36                 )
37             )
38         )
39     )
40     1: Stmt_Class(
41         flags: 0
42         name: B
43         extends: null
44         implements: array(
45         )
46         stmts: array(
47             0: Stmt_TraitUse(
48                 traits: array(
49                     0: Name(
50                         parts: array(
51                             0: C
52                         )
53                     )
54                 )
55                 adaptations: array(
56                 )
57             )
58             1: Stmt_TraitUse(
59                 traits: array(
60                     0: Name(
61                         parts: array(
62                             0: D
63                         )
64                     )
65                 )
66                 adaptations: array(
67                     0: Stmt_TraitUseAdaptation_Alias(
68                         trait: null
69                         method: a
70                         newModifier: MODIFIER_PROTECTED (2)
71                         newName: b
72                     )
73                     1: Stmt_TraitUseAdaptation_Alias(
74                         trait: null
75                         method: c
76                         newModifier: null
77                         newName: d
78                     )
79                     2: Stmt_TraitUseAdaptation_Alias(
80                         trait: null
81                         method: e
82                         newModifier: MODIFIER_PRIVATE (4)
83                         newName: null
84                     )
85                 )
86             )
87             2: Stmt_TraitUse(
88                 traits: array(
89                     0: Name(
90                         parts: array(
91                             0: E
92                         )
93                     )
94                     1: Name(
95                         parts: array(
96                             0: F
97                         )
98                     )
99                     2: Name(
100                         parts: array(
101                             0: G
102                         )
103                     )
104                 )
105                 adaptations: array(
106                     0: Stmt_TraitUseAdaptation_Precedence(
107                         trait: Name(
108                             parts: array(
109                                 0: E
110                             )
111                         )
112                         method: a
113                         insteadof: array(
114                             0: Name(
115                                 parts: array(
116                                     0: F
117                                 )
118                             )
119                             1: Name(
120                                 parts: array(
121                                     0: G
122                                 )
123                             )
124                         )
125                     )
126                     1: Stmt_TraitUseAdaptation_Alias(
127                         trait: Name(
128                             parts: array(
129                                 0: E
130                             )
131                         )
132                         method: b
133                         newModifier: MODIFIER_PROTECTED (2)
134                         newName: c
135                     )
136                     2: Stmt_TraitUseAdaptation_Alias(
137                         trait: Name(
138                             parts: array(
139                                 0: E
140                             )
141                         )
142                         method: d
143                         newModifier: null
144                         newName: e
145                     )
146                     3: Stmt_TraitUseAdaptation_Alias(
147                         trait: Name(
148                             parts: array(
149                                 0: E
150                             )
151                         )
152                         method: f
153                         newModifier: MODIFIER_PRIVATE (4)
154                         newName: null
155                     )
156                 )
157             )
158         )
159     )
160 )