菜谱项目

new.test 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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: Expr_New(
  20. class: Name(
  21. parts: array(
  22. 0: A
  23. )
  24. )
  25. args: array(
  26. )
  27. )
  28. 1: Expr_New(
  29. class: Name(
  30. parts: array(
  31. 0: A
  32. )
  33. )
  34. args: array(
  35. 0: Arg(
  36. value: Expr_Variable(
  37. name: b
  38. )
  39. byRef: false
  40. unpack: false
  41. )
  42. )
  43. )
  44. 2: Expr_New(
  45. class: Expr_Variable(
  46. name: a
  47. )
  48. args: array(
  49. )
  50. comments: array(
  51. 0: // class name variations
  52. )
  53. )
  54. 3: Expr_New(
  55. class: Expr_ArrayDimFetch(
  56. var: Expr_Variable(
  57. name: a
  58. )
  59. dim: Scalar_String(
  60. value: b
  61. )
  62. )
  63. args: array(
  64. )
  65. )
  66. 4: Expr_New(
  67. class: Expr_StaticPropertyFetch(
  68. class: Name(
  69. parts: array(
  70. 0: A
  71. )
  72. )
  73. name: b
  74. )
  75. args: array(
  76. )
  77. )
  78. 5: Expr_New(
  79. class: Expr_PropertyFetch(
  80. var: Expr_Variable(
  81. name: a
  82. )
  83. name: b
  84. )
  85. args: array(
  86. )
  87. comments: array(
  88. 0: // DNCR object access
  89. )
  90. )
  91. 6: Expr_New(
  92. class: Expr_PropertyFetch(
  93. var: Expr_PropertyFetch(
  94. var: Expr_Variable(
  95. name: a
  96. )
  97. name: b
  98. )
  99. name: c
  100. )
  101. args: array(
  102. )
  103. )
  104. 7: Expr_New(
  105. class: Expr_ArrayDimFetch(
  106. var: Expr_PropertyFetch(
  107. var: Expr_Variable(
  108. name: a
  109. )
  110. name: b
  111. )
  112. dim: Scalar_String(
  113. value: c
  114. )
  115. )
  116. args: array(
  117. )
  118. )
  119. 8: Expr_New(
  120. class: Expr_ArrayDimFetch(
  121. var: Expr_PropertyFetch(
  122. var: Expr_Variable(
  123. name: a
  124. )
  125. name: b
  126. )
  127. dim: Scalar_String(
  128. value: c
  129. )
  130. )
  131. args: array(
  132. )
  133. )
  134. 9: Expr_New(
  135. class: Name(
  136. parts: array(
  137. 0: A
  138. )
  139. )
  140. args: array(
  141. )
  142. )
  143. )