TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
589 B
29 lines
589 B
--TEST--
|
|
AOT multi-catch handles alternative exception types
|
|
--FILE--
|
|
<?php
|
|
class MultiCatchFirst extends Exception {}
|
|
class MultiCatchSecond extends Exception {}
|
|
|
|
function raise_multi(int $kind): void
|
|
{
|
|
if ($kind === 1) {
|
|
throw new MultiCatchFirst('first');
|
|
}
|
|
throw new MultiCatchSecond('second');
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
foreach ([1, 2] as $kind) {
|
|
try {
|
|
raise_multi($kind);
|
|
} catch (MultiCatchFirst|MultiCatchSecond $e) {
|
|
var_dump($e->getMessage());
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
string(5) "first"
|
|
string(6) "second"
|
|
|