trailingCommas.test 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. PHP 7.3 trailing comma additions
  2. -----
  3. <?php
  4. foo($a, $b, );
  5. $foo->bar($a, $b, );
  6. Foo::bar($a, $b, );
  7. new Foo($a, $b, );
  8. unset($a, $b, );
  9. isset($a, $b, );
  10. -----
  11. !!php7
  12. array(
  13. 0: Stmt_Expression(
  14. expr: Expr_FuncCall(
  15. name: Name(
  16. parts: array(
  17. 0: foo
  18. )
  19. )
  20. args: array(
  21. 0: Arg(
  22. value: Expr_Variable(
  23. name: a
  24. )
  25. byRef: false
  26. unpack: false
  27. )
  28. 1: Arg(
  29. value: Expr_Variable(
  30. name: b
  31. )
  32. byRef: false
  33. unpack: false
  34. )
  35. )
  36. )
  37. )
  38. 1: Stmt_Expression(
  39. expr: Expr_MethodCall(
  40. var: Expr_Variable(
  41. name: foo
  42. )
  43. name: Identifier(
  44. name: bar
  45. )
  46. args: array(
  47. 0: Arg(
  48. value: Expr_Variable(
  49. name: a
  50. )
  51. byRef: false
  52. unpack: false
  53. )
  54. 1: Arg(
  55. value: Expr_Variable(
  56. name: b
  57. )
  58. byRef: false
  59. unpack: false
  60. )
  61. )
  62. )
  63. )
  64. 2: Stmt_Expression(
  65. expr: Expr_StaticCall(
  66. class: Name(
  67. parts: array(
  68. 0: Foo
  69. )
  70. )
  71. name: Identifier(
  72. name: bar
  73. )
  74. args: array(
  75. 0: Arg(
  76. value: Expr_Variable(
  77. name: a
  78. )
  79. byRef: false
  80. unpack: false
  81. )
  82. 1: Arg(
  83. value: Expr_Variable(
  84. name: b
  85. )
  86. byRef: false
  87. unpack: false
  88. )
  89. )
  90. )
  91. )
  92. 3: Stmt_Expression(
  93. expr: Expr_New(
  94. class: Name(
  95. parts: array(
  96. 0: Foo
  97. )
  98. )
  99. args: array(
  100. 0: Arg(
  101. value: Expr_Variable(
  102. name: a
  103. )
  104. byRef: false
  105. unpack: false
  106. )
  107. 1: Arg(
  108. value: Expr_Variable(
  109. name: b
  110. )
  111. byRef: false
  112. unpack: false
  113. )
  114. )
  115. )
  116. )
  117. 4: Stmt_Unset(
  118. vars: array(
  119. 0: Expr_Variable(
  120. name: a
  121. )
  122. 1: Expr_Variable(
  123. name: b
  124. )
  125. )
  126. )
  127. 5: Stmt_Expression(
  128. expr: Expr_Isset(
  129. vars: array(
  130. 0: Expr_Variable(
  131. name: a
  132. )
  133. 1: Expr_Variable(
  134. name: b
  135. )
  136. )
  137. )
  138. )
  139. )