blocklessStatement.test 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. Blockless statements for if/for/etc
  2. -----
  3. <?php
  4. if ($a) $A;
  5. elseif ($b) $B;
  6. else $C;
  7. for (;;) $foo;
  8. foreach ($a as $b) $AB;
  9. while ($a) $A;
  10. do $A; while ($a);
  11. declare (a='b') $C;
  12. -----
  13. array(
  14. 0: Stmt_If(
  15. cond: Expr_Variable(
  16. name: a
  17. )
  18. stmts: array(
  19. 0: Stmt_Expression(
  20. expr: Expr_Variable(
  21. name: A
  22. )
  23. )
  24. )
  25. elseifs: array(
  26. 0: Stmt_ElseIf(
  27. cond: Expr_Variable(
  28. name: b
  29. )
  30. stmts: array(
  31. 0: Stmt_Expression(
  32. expr: Expr_Variable(
  33. name: B
  34. )
  35. )
  36. )
  37. )
  38. )
  39. else: Stmt_Else(
  40. stmts: array(
  41. 0: Stmt_Expression(
  42. expr: Expr_Variable(
  43. name: C
  44. )
  45. )
  46. )
  47. )
  48. )
  49. 1: Stmt_For(
  50. init: array(
  51. )
  52. cond: array(
  53. )
  54. loop: array(
  55. )
  56. stmts: array(
  57. 0: Stmt_Expression(
  58. expr: Expr_Variable(
  59. name: foo
  60. )
  61. )
  62. )
  63. )
  64. 2: Stmt_Foreach(
  65. expr: Expr_Variable(
  66. name: a
  67. )
  68. keyVar: null
  69. byRef: false
  70. valueVar: Expr_Variable(
  71. name: b
  72. )
  73. stmts: array(
  74. 0: Stmt_Expression(
  75. expr: Expr_Variable(
  76. name: AB
  77. )
  78. )
  79. )
  80. )
  81. 3: Stmt_While(
  82. cond: Expr_Variable(
  83. name: a
  84. )
  85. stmts: array(
  86. 0: Stmt_Expression(
  87. expr: Expr_Variable(
  88. name: A
  89. )
  90. )
  91. )
  92. )
  93. 4: Stmt_Do(
  94. stmts: array(
  95. 0: Stmt_Expression(
  96. expr: Expr_Variable(
  97. name: A
  98. )
  99. )
  100. )
  101. cond: Expr_Variable(
  102. name: a
  103. )
  104. )
  105. 5: Stmt_Declare(
  106. declares: array(
  107. 0: Stmt_DeclareDeclare(
  108. key: Identifier(
  109. name: a
  110. )
  111. value: Scalar_String(
  112. value: b
  113. )
  114. )
  115. )
  116. stmts: array(
  117. 0: Stmt_Expression(
  118. expr: Expr_Variable(
  119. name: C
  120. )
  121. )
  122. )
  123. )
  124. )