multiCatch.test 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. Try/catch with multiple classes
  2. -----
  3. <?php
  4. try {
  5. $x;
  6. } catch (X|Y $e1) {
  7. $y;
  8. } catch (\A|B\C $e2) {
  9. $z;
  10. }
  11. -----
  12. !!php7
  13. array(
  14. 0: Stmt_TryCatch(
  15. stmts: array(
  16. 0: Stmt_Expression(
  17. expr: Expr_Variable(
  18. name: x
  19. )
  20. )
  21. )
  22. catches: array(
  23. 0: Stmt_Catch(
  24. types: array(
  25. 0: Name(
  26. parts: array(
  27. 0: X
  28. )
  29. )
  30. 1: Name(
  31. parts: array(
  32. 0: Y
  33. )
  34. )
  35. )
  36. var: Expr_Variable(
  37. name: e1
  38. )
  39. stmts: array(
  40. 0: Stmt_Expression(
  41. expr: Expr_Variable(
  42. name: y
  43. )
  44. )
  45. )
  46. )
  47. 1: Stmt_Catch(
  48. types: array(
  49. 0: Name_FullyQualified(
  50. parts: array(
  51. 0: A
  52. )
  53. )
  54. 1: Name(
  55. parts: array(
  56. 0: B
  57. 1: C
  58. )
  59. )
  60. )
  61. var: Expr_Variable(
  62. name: e2
  63. )
  64. stmts: array(
  65. 0: Stmt_Expression(
  66. expr: Expr_Variable(
  67. name: z
  68. )
  69. )
  70. )
  71. )
  72. )
  73. finally: null
  74. )
  75. )