new.test 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. )
  41. )
  42. )
  43. 2: Expr_New(
  44. class: Expr_Variable(
  45. name: a
  46. )
  47. args: array(
  48. )
  49. )
  50. 3: Expr_New(
  51. class: Expr_ArrayDimFetch(
  52. var: Expr_Variable(
  53. name: a
  54. )
  55. dim: Scalar_String(
  56. value: b
  57. )
  58. )
  59. args: array(
  60. )
  61. )
  62. 4: Expr_New(
  63. class: Expr_StaticPropertyFetch(
  64. class: Name(
  65. parts: array(
  66. 0: A
  67. )
  68. )
  69. name: b
  70. )
  71. args: array(
  72. )
  73. )
  74. 5: Expr_New(
  75. class: Expr_PropertyFetch(
  76. var: Expr_Variable(
  77. name: a
  78. )
  79. name: b
  80. )
  81. args: array(
  82. )
  83. )
  84. 6: Expr_New(
  85. class: Expr_PropertyFetch(
  86. var: Expr_PropertyFetch(
  87. var: Expr_Variable(
  88. name: a
  89. )
  90. name: b
  91. )
  92. name: c
  93. )
  94. args: array(
  95. )
  96. )
  97. 7: Expr_New(
  98. class: Expr_ArrayDimFetch(
  99. var: Expr_PropertyFetch(
  100. var: Expr_Variable(
  101. name: a
  102. )
  103. name: b
  104. )
  105. dim: Scalar_String(
  106. value: c
  107. )
  108. )
  109. args: array(
  110. )
  111. )
  112. 8: Expr_New(
  113. class: Expr_ArrayDimFetch(
  114. var: Expr_PropertyFetch(
  115. var: Expr_Variable(
  116. name: a
  117. )
  118. name: b
  119. )
  120. dim: Scalar_String(
  121. value: c
  122. )
  123. )
  124. args: array(
  125. )
  126. )
  127. 9: Expr_New(
  128. class: Name(
  129. parts: array(
  130. 0: A
  131. )
  132. )
  133. args: array(
  134. )
  135. )
  136. )