blocklessStatement.test 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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: Expr_Variable(
  20. name: A
  21. )
  22. )
  23. elseifs: array(
  24. 0: Stmt_ElseIf(
  25. cond: Expr_Variable(
  26. name: b
  27. )
  28. stmts: array(
  29. 0: Expr_Variable(
  30. name: B
  31. )
  32. )
  33. )
  34. )
  35. else: Stmt_Else(
  36. stmts: array(
  37. 0: Expr_Variable(
  38. name: C
  39. )
  40. )
  41. )
  42. )
  43. 1: Stmt_For(
  44. init: array(
  45. )
  46. cond: array(
  47. )
  48. loop: array(
  49. )
  50. stmts: array(
  51. 0: Expr_Variable(
  52. name: foo
  53. )
  54. )
  55. )
  56. 2: Stmt_Foreach(
  57. expr: Expr_Variable(
  58. name: a
  59. )
  60. keyVar: null
  61. byRef: false
  62. valueVar: Expr_Variable(
  63. name: b
  64. )
  65. stmts: array(
  66. 0: Expr_Variable(
  67. name: AB
  68. )
  69. )
  70. )
  71. 3: Stmt_While(
  72. cond: Expr_Variable(
  73. name: a
  74. )
  75. stmts: array(
  76. 0: Expr_Variable(
  77. name: A
  78. )
  79. )
  80. )
  81. 4: Stmt_Do(
  82. cond: Expr_Variable(
  83. name: a
  84. )
  85. stmts: array(
  86. 0: Expr_Variable(
  87. name: A
  88. )
  89. )
  90. )
  91. 5: Stmt_Declare(
  92. declares: array(
  93. 0: Stmt_DeclareDeclare(
  94. key: a
  95. value: Scalar_String(
  96. value: b
  97. )
  98. )
  99. )
  100. stmts: array(
  101. 0: Expr_Variable(
  102. name: C
  103. )
  104. )
  105. )
  106. )