-
Notifications
You must be signed in to change notification settings - Fork 272
Closed
Description
Support for multiple catch types was added to PHP 7.1 as per https://wiki.php.net/rfc/multiple-catch.
php/php-src#1796 is the PR that merged this feature into php master.
This makes the following code valid in PHP 7.1:
try {
// Some code...
} catch (ExceptionType1 | ExceptionType2 $e) {
// Code to handle the exception
}
I'm new to this project (and parsers in general) but from what I can tell the grammar for the try statement should be updated to allow for multiple, pipe-separated qualified-name
items.
I think the following grammar is correct:
try-statement:
'try' compound-statement catch-clauses
'try' compound-statement finally-clause
'try' compound-statement catch-clauses finally-clause
catch-clauses:
catch-clause
catch-clauses catch-clause
catch-clause:
'catch' '(' catch-name-list variable-name ')' compound-statement
catch-name-list:
qualified-name
catch-name-list '|' qualified-name
finally-clause:
'finally' compound-statement
jens1o, whatyoubendoing, umpirsky, avdg, echosa and 1 more
Metadata
Metadata
Assignees
Labels
No labels