1Anonymous classes 2----- 3<?php 4 5new class { 6 public function test() {} 7}; 8new class extends A implements B, C {}; 9new class() { 10 public $foo; 11}; 12new class($a, $b) extends A { 13 use T; 14}; 15 16class A { 17 public function test() { 18 return new class($this) extends A { 19 const A = 'B'; 20 }; 21 } 22} 23----- 24array( 25 0: Stmt_Expression( 26 expr: Expr_New( 27 class: Stmt_Class( 28 attrGroups: array( 29 ) 30 flags: 0 31 name: null 32 extends: null 33 implements: array( 34 ) 35 stmts: array( 36 0: Stmt_ClassMethod( 37 attrGroups: array( 38 ) 39 flags: PUBLIC (1) 40 byRef: false 41 name: Identifier( 42 name: test 43 ) 44 params: array( 45 ) 46 returnType: null 47 stmts: array( 48 ) 49 ) 50 ) 51 ) 52 args: array( 53 ) 54 ) 55 ) 56 1: Stmt_Expression( 57 expr: Expr_New( 58 class: Stmt_Class( 59 attrGroups: array( 60 ) 61 flags: 0 62 name: null 63 extends: Name( 64 name: A 65 ) 66 implements: array( 67 0: Name( 68 name: B 69 ) 70 1: Name( 71 name: C 72 ) 73 ) 74 stmts: array( 75 ) 76 ) 77 args: array( 78 ) 79 ) 80 ) 81 2: Stmt_Expression( 82 expr: Expr_New( 83 class: Stmt_Class( 84 attrGroups: array( 85 ) 86 flags: 0 87 name: null 88 extends: null 89 implements: array( 90 ) 91 stmts: array( 92 0: Stmt_Property( 93 attrGroups: array( 94 ) 95 flags: PUBLIC (1) 96 type: null 97 props: array( 98 0: PropertyItem( 99 name: VarLikeIdentifier( 100 name: foo 101 ) 102 default: null 103 ) 104 ) 105 hooks: array( 106 ) 107 ) 108 ) 109 ) 110 args: array( 111 ) 112 ) 113 ) 114 3: Stmt_Expression( 115 expr: Expr_New( 116 class: Stmt_Class( 117 attrGroups: array( 118 ) 119 flags: 0 120 name: null 121 extends: Name( 122 name: A 123 ) 124 implements: array( 125 ) 126 stmts: array( 127 0: Stmt_TraitUse( 128 traits: array( 129 0: Name( 130 name: T 131 ) 132 ) 133 adaptations: array( 134 ) 135 ) 136 ) 137 ) 138 args: array( 139 0: Arg( 140 name: null 141 value: Expr_Variable( 142 name: a 143 ) 144 byRef: false 145 unpack: false 146 ) 147 1: Arg( 148 name: null 149 value: Expr_Variable( 150 name: b 151 ) 152 byRef: false 153 unpack: false 154 ) 155 ) 156 ) 157 ) 158 4: Stmt_Class( 159 attrGroups: array( 160 ) 161 flags: 0 162 name: Identifier( 163 name: A 164 ) 165 extends: null 166 implements: array( 167 ) 168 stmts: array( 169 0: Stmt_ClassMethod( 170 attrGroups: array( 171 ) 172 flags: PUBLIC (1) 173 byRef: false 174 name: Identifier( 175 name: test 176 ) 177 params: array( 178 ) 179 returnType: null 180 stmts: array( 181 0: Stmt_Return( 182 expr: Expr_New( 183 class: Stmt_Class( 184 attrGroups: array( 185 ) 186 flags: 0 187 name: null 188 extends: Name( 189 name: A 190 ) 191 implements: array( 192 ) 193 stmts: array( 194 0: Stmt_ClassConst( 195 attrGroups: array( 196 ) 197 flags: 0 198 type: null 199 consts: array( 200 0: Const( 201 name: Identifier( 202 name: A 203 ) 204 value: Scalar_String( 205 value: B 206 ) 207 ) 208 ) 209 ) 210 ) 211 ) 212 args: array( 213 0: Arg( 214 name: null 215 value: Expr_Variable( 216 name: this 217 ) 218 byRef: false 219 unpack: false 220 ) 221 ) 222 ) 223 ) 224 ) 225 ) 226 ) 227 ) 228) 229