new.test 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. New
  2. -----
  3. <?php
  4. new A;
  5. new A($b);
  6. // class name variations
  7. new $a();
  8. new $a['b']();
  9. new A::$b();
  10. // DNCR object access
  11. new $a->b();
  12. new $a->b->c();
  13. new $a->b['c']();
  14. new $a->b{'c'}();
  15. // test regression introduces by new dereferencing syntax
  16. (new A);
  17. -----
  18. array(
  19. 0: Stmt_Expression(
  20. expr: Expr_New(
  21. class: Name(
  22. parts: array(
  23. 0: A
  24. )
  25. )
  26. args: array(
  27. )
  28. )
  29. )
  30. 1: Stmt_Expression(
  31. expr: Expr_New(
  32. class: Name(
  33. parts: array(
  34. 0: A
  35. )
  36. )
  37. args: array(
  38. 0: Arg(
  39. value: Expr_Variable(
  40. name: b
  41. )
  42. byRef: false
  43. unpack: false
  44. )
  45. )
  46. )
  47. )
  48. 2: Stmt_Expression(
  49. expr: Expr_New(
  50. class: Expr_Variable(
  51. name: a
  52. )
  53. args: array(
  54. )
  55. comments: array(
  56. 0: // class name variations
  57. )
  58. )
  59. comments: array(
  60. 0: // class name variations
  61. )
  62. )
  63. 3: Stmt_Expression(
  64. expr: Expr_New(
  65. class: Expr_ArrayDimFetch(
  66. var: Expr_Variable(
  67. name: a
  68. )
  69. dim: Scalar_String(
  70. value: b
  71. )
  72. )
  73. args: array(
  74. )
  75. )
  76. )
  77. 4: Stmt_Expression(
  78. expr: Expr_New(
  79. class: Expr_StaticPropertyFetch(
  80. class: Name(
  81. parts: array(
  82. 0: A
  83. )
  84. )
  85. name: VarLikeIdentifier(
  86. name: b
  87. )
  88. )
  89. args: array(
  90. )
  91. )
  92. )
  93. 5: Stmt_Expression(
  94. expr: Expr_New(
  95. class: Expr_PropertyFetch(
  96. var: Expr_Variable(
  97. name: a
  98. )
  99. name: Identifier(
  100. name: b
  101. )
  102. )
  103. args: array(
  104. )
  105. comments: array(
  106. 0: // DNCR object access
  107. )
  108. )
  109. comments: array(
  110. 0: // DNCR object access
  111. )
  112. )
  113. 6: Stmt_Expression(
  114. expr: Expr_New(
  115. class: Expr_PropertyFetch(
  116. var: Expr_PropertyFetch(
  117. var: Expr_Variable(
  118. name: a
  119. )
  120. name: Identifier(
  121. name: b
  122. )
  123. )
  124. name: Identifier(
  125. name: c
  126. )
  127. )
  128. args: array(
  129. )
  130. )
  131. )
  132. 7: Stmt_Expression(
  133. expr: Expr_New(
  134. class: Expr_ArrayDimFetch(
  135. var: Expr_PropertyFetch(
  136. var: Expr_Variable(
  137. name: a
  138. )
  139. name: Identifier(
  140. name: b
  141. )
  142. )
  143. dim: Scalar_String(
  144. value: c
  145. )
  146. )
  147. args: array(
  148. )
  149. )
  150. )
  151. 8: Stmt_Expression(
  152. expr: Expr_New(
  153. class: Expr_ArrayDimFetch(
  154. var: Expr_PropertyFetch(
  155. var: Expr_Variable(
  156. name: a
  157. )
  158. name: Identifier(
  159. name: b
  160. )
  161. )
  162. dim: Scalar_String(
  163. value: c
  164. )
  165. )
  166. args: array(
  167. )
  168. )
  169. )
  170. 9: Stmt_Expression(
  171. expr: Expr_New(
  172. class: Name(
  173. parts: array(
  174. 0: A
  175. )
  176. )
  177. args: array(
  178. )
  179. )
  180. comments: array(
  181. 0: // test regression introduces by new dereferencing syntax
  182. )
  183. )
  184. )