multiCatch.test 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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: Expr_Variable(
  17. name: x
  18. )
  19. )
  20. catches: array(
  21. 0: Stmt_Catch(
  22. types: array(
  23. 0: Name(
  24. parts: array(
  25. 0: X
  26. )
  27. )
  28. 1: Name(
  29. parts: array(
  30. 0: Y
  31. )
  32. )
  33. )
  34. var: e1
  35. stmts: array(
  36. 0: Expr_Variable(
  37. name: y
  38. )
  39. )
  40. )
  41. 1: Stmt_Catch(
  42. types: array(
  43. 0: Name_FullyQualified(
  44. parts: array(
  45. 0: A
  46. )
  47. )
  48. 1: Name(
  49. parts: array(
  50. 0: B
  51. 1: C
  52. )
  53. )
  54. )
  55. var: e2
  56. stmts: array(
  57. 0: Expr_Variable(
  58. name: z
  59. )
  60. )
  61. )
  62. )
  63. finally: null
  64. )
  65. )