newDeref.test 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. New dereference without parentheses
  2. -----
  3. <?php
  4. new A()->foo;
  5. new A()->foo();
  6. new A()::FOO;
  7. new A()::foo();
  8. new A()::$foo;
  9. new A()[0];
  10. new A(){0};
  11. new A()();
  12. new class {}->foo;
  13. new class {}->foo();
  14. new class {}::FOO;
  15. new class {}::foo();
  16. new class {}::$foo;
  17. new class {}[0];
  18. new class {}{0};
  19. new class {}();
  20. -----
  21. array(
  22. 0: Stmt_Expression(
  23. expr: Expr_PropertyFetch(
  24. var: Expr_New(
  25. class: Name(
  26. name: A
  27. )
  28. args: array(
  29. )
  30. )
  31. name: Identifier(
  32. name: foo
  33. )
  34. )
  35. )
  36. 1: Stmt_Expression(
  37. expr: Expr_MethodCall(
  38. var: Expr_New(
  39. class: Name(
  40. name: A
  41. )
  42. args: array(
  43. )
  44. )
  45. name: Identifier(
  46. name: foo
  47. )
  48. args: array(
  49. )
  50. )
  51. )
  52. 2: Stmt_Expression(
  53. expr: Expr_ClassConstFetch(
  54. class: Expr_New(
  55. class: Name(
  56. name: A
  57. )
  58. args: array(
  59. )
  60. )
  61. name: Identifier(
  62. name: FOO
  63. )
  64. )
  65. )
  66. 3: Stmt_Expression(
  67. expr: Expr_StaticCall(
  68. class: Expr_New(
  69. class: Name(
  70. name: A
  71. )
  72. args: array(
  73. )
  74. )
  75. name: Identifier(
  76. name: foo
  77. )
  78. args: array(
  79. )
  80. )
  81. )
  82. 4: Stmt_Expression(
  83. expr: Expr_StaticPropertyFetch(
  84. class: Expr_New(
  85. class: Name(
  86. name: A
  87. )
  88. args: array(
  89. )
  90. )
  91. name: VarLikeIdentifier(
  92. name: foo
  93. )
  94. )
  95. )
  96. 5: Stmt_Expression(
  97. expr: Expr_ArrayDimFetch(
  98. var: Expr_New(
  99. class: Name(
  100. name: A
  101. )
  102. args: array(
  103. )
  104. )
  105. dim: Scalar_Int(
  106. value: 0
  107. )
  108. )
  109. )
  110. 6: Stmt_Expression(
  111. expr: Expr_ArrayDimFetch(
  112. var: Expr_New(
  113. class: Name(
  114. name: A
  115. )
  116. args: array(
  117. )
  118. )
  119. dim: Scalar_Int(
  120. value: 0
  121. )
  122. )
  123. )
  124. 7: Stmt_Expression(
  125. expr: Expr_FuncCall(
  126. name: Expr_New(
  127. class: Name(
  128. name: A
  129. )
  130. args: array(
  131. )
  132. )
  133. args: array(
  134. )
  135. )
  136. )
  137. 8: Stmt_Expression(
  138. expr: Expr_PropertyFetch(
  139. var: Expr_New(
  140. class: Stmt_Class(
  141. attrGroups: array(
  142. )
  143. flags: 0
  144. name: null
  145. extends: null
  146. implements: array(
  147. )
  148. stmts: array(
  149. )
  150. )
  151. args: array(
  152. )
  153. )
  154. name: Identifier(
  155. name: foo
  156. )
  157. )
  158. )
  159. 9: Stmt_Expression(
  160. expr: Expr_MethodCall(
  161. var: Expr_New(
  162. class: Stmt_Class(
  163. attrGroups: array(
  164. )
  165. flags: 0
  166. name: null
  167. extends: null
  168. implements: array(
  169. )
  170. stmts: array(
  171. )
  172. )
  173. args: array(
  174. )
  175. )
  176. name: Identifier(
  177. name: foo
  178. )
  179. args: array(
  180. )
  181. )
  182. )
  183. 10: Stmt_Expression(
  184. expr: Expr_ClassConstFetch(
  185. class: Expr_New(
  186. class: Stmt_Class(
  187. attrGroups: array(
  188. )
  189. flags: 0
  190. name: null
  191. extends: null
  192. implements: array(
  193. )
  194. stmts: array(
  195. )
  196. )
  197. args: array(
  198. )
  199. )
  200. name: Identifier(
  201. name: FOO
  202. )
  203. )
  204. )
  205. 11: Stmt_Expression(
  206. expr: Expr_StaticCall(
  207. class: Expr_New(
  208. class: Stmt_Class(
  209. attrGroups: array(
  210. )
  211. flags: 0
  212. name: null
  213. extends: null
  214. implements: array(
  215. )
  216. stmts: array(
  217. )
  218. )
  219. args: array(
  220. )
  221. )
  222. name: Identifier(
  223. name: foo
  224. )
  225. args: array(
  226. )
  227. )
  228. )
  229. 12: Stmt_Expression(
  230. expr: Expr_StaticPropertyFetch(
  231. class: Expr_New(
  232. class: Stmt_Class(
  233. attrGroups: array(
  234. )
  235. flags: 0
  236. name: null
  237. extends: null
  238. implements: array(
  239. )
  240. stmts: array(
  241. )
  242. )
  243. args: array(
  244. )
  245. )
  246. name: VarLikeIdentifier(
  247. name: foo
  248. )
  249. )
  250. )
  251. 13: Stmt_Expression(
  252. expr: Expr_ArrayDimFetch(
  253. var: Expr_New(
  254. class: Stmt_Class(
  255. attrGroups: array(
  256. )
  257. flags: 0
  258. name: null
  259. extends: null
  260. implements: array(
  261. )
  262. stmts: array(
  263. )
  264. )
  265. args: array(
  266. )
  267. )
  268. dim: Scalar_Int(
  269. value: 0
  270. )
  271. )
  272. )
  273. 14: Stmt_Expression(
  274. expr: Expr_ArrayDimFetch(
  275. var: Expr_New(
  276. class: Stmt_Class(
  277. attrGroups: array(
  278. )
  279. flags: 0
  280. name: null
  281. extends: null
  282. implements: array(
  283. )
  284. stmts: array(
  285. )
  286. )
  287. args: array(
  288. )
  289. )
  290. dim: Scalar_Int(
  291. value: 0
  292. )
  293. )
  294. )
  295. 15: Stmt_Expression(
  296. expr: Expr_FuncCall(
  297. name: Expr_New(
  298. class: Stmt_Class(
  299. attrGroups: array(
  300. )
  301. flags: 0
  302. name: null
  303. extends: null
  304. implements: array(
  305. )
  306. stmts: array(
  307. )
  308. )
  309. args: array(
  310. )
  311. )
  312. args: array(
  313. )
  314. )
  315. )
  316. )