tryCatch.test 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. Try/catch
  2. -----
  3. <?php
  4. try {
  5. doTry();
  6. } catch (A $b) {
  7. doCatchA();
  8. } catch (B $c) {
  9. doCatchB();
  10. } finally {
  11. doFinally();
  12. }
  13. // no finally
  14. try { }
  15. catch (A $b) { }
  16. // no catch
  17. try { }
  18. finally { }
  19. -----
  20. array(
  21. 0: Stmt_TryCatch(
  22. stmts: array(
  23. 0: Expr_FuncCall(
  24. name: Name(
  25. parts: array(
  26. 0: doTry
  27. )
  28. )
  29. args: array(
  30. )
  31. )
  32. )
  33. catches: array(
  34. 0: Stmt_Catch(
  35. types: array(
  36. 0: Name(
  37. parts: array(
  38. 0: A
  39. )
  40. )
  41. )
  42. var: b
  43. stmts: array(
  44. 0: Expr_FuncCall(
  45. name: Name(
  46. parts: array(
  47. 0: doCatchA
  48. )
  49. )
  50. args: array(
  51. )
  52. )
  53. )
  54. )
  55. 1: Stmt_Catch(
  56. types: array(
  57. 0: Name(
  58. parts: array(
  59. 0: B
  60. )
  61. )
  62. )
  63. var: c
  64. stmts: array(
  65. 0: Expr_FuncCall(
  66. name: Name(
  67. parts: array(
  68. 0: doCatchB
  69. )
  70. )
  71. args: array(
  72. )
  73. )
  74. )
  75. )
  76. )
  77. finally: Stmt_Finally(
  78. stmts: array(
  79. 0: Expr_FuncCall(
  80. name: Name(
  81. parts: array(
  82. 0: doFinally
  83. )
  84. )
  85. args: array(
  86. )
  87. )
  88. )
  89. )
  90. )
  91. 1: Stmt_TryCatch(
  92. stmts: array(
  93. )
  94. catches: array(
  95. 0: Stmt_Catch(
  96. types: array(
  97. 0: Name(
  98. parts: array(
  99. 0: A
  100. )
  101. )
  102. )
  103. var: b
  104. stmts: array(
  105. )
  106. )
  107. )
  108. finally: null
  109. comments: array(
  110. 0: // no finally
  111. )
  112. )
  113. 2: Stmt_TryCatch(
  114. stmts: array(
  115. )
  116. catches: array(
  117. )
  118. finally: Stmt_Finally(
  119. stmts: array(
  120. )
  121. )
  122. comments: array(
  123. 0: // no catch
  124. )
  125. )
  126. )