]> granicus.if.org Git - php/commit
Allow catching multiple exception types in a single catch statement
authorPierrick Charron <pierrick@php.net>
Sun, 1 May 2016 22:47:08 +0000 (18:47 -0400)
committerPierrick Charron <pierrick@php.net>
Sun, 1 May 2016 22:47:08 +0000 (18:47 -0400)
commit0aed2cc2a440e7be17552cc669d71fdd24d1204a
tree19bb9bb48c0d634d502112b84c49795b998e64cf
parent770a6d1342fcc30bb273ac6d65fc9fc057b1ce21
Allow catching multiple exception types in a single catch statement

This commit add the possibility to catch multiple exception types in
a single catch statement to avoid code duplication.

try {
   // Some code...
} catch (ExceptionType1 | ExceptionType2 $e) {
   // Code to handle the exception
} catch (\Exception $e) {
   // ...
}
Zend/tests/try/exceptions.inc [new file with mode: 0644]
Zend/tests/try/try_multicatch_001.phpt [new file with mode: 0644]
Zend/tests/try/try_multicatch_002.phpt [new file with mode: 0644]
Zend/tests/try/try_multicatch_003.phpt [new file with mode: 0644]
Zend/tests/try/try_multicatch_004.phpt [new file with mode: 0644]
Zend/tests/try/try_multicatch_005.phpt [new file with mode: 0644]
Zend/zend_ast.c
Zend/zend_compile.c
Zend/zend_language_parser.y