php-src/Zend/tests/try/try_multicatch_001.phpt
Pierrick Charron 0aed2cc2a4 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) {
	   // ...
}
2016-05-01 18:47:08 -04:00

19 lines
235 B
PHP

--TEST--
Parsing test
--FILE--
<?php
require_once __DIR__ . '/exceptions.inc';
try {
echo 'TRY' . PHP_EOL;
} catch(Exception1 | Exception2 $e) {
echo 'Exception';
} finally {
echo 'FINALLY' . PHP_EOL;
}
?>
--EXPECT--
TRY
FINALLY