Hi Björn, The only time I had to do this with core PHP exceptions is to make the code compatible for both PHP5 and PHP7:
try { } catch(\Exceptions $e) { } catch(\Throwable $e) { } But it will of course not be applicable since this feature is targeting PHP7.1. Other than that the PHP core exception hierarchy is well enough for MY needs. But if someone already had to do this fill free to provide your use case as an example. My main target is custom exceptions (even if the logic is applicable on everything Throwable). A custom exception use case would be some method that throw thwo different kind of exceptions like for example the doctrine AbstractQuery::getSingleResult (NoResultException, NonUniqueResultException) that you could want to handle the same way. An other really easy example would be simple code like this one that I found in symfony (not really a big deal but still) } catch (AccessException $e) { return false; } catch (UnexpectedTypeException $e) { return false; } And other piece of code using multiple libraries. On 8 March 2016 at 18:06, Björn Larsson <bjorn.x.lars...@telia.com> wrote: > Den 2016-03-08 kl. 22:42, skrev Pierrick Charron: > >> Hi internals, >> >> Bronisław Białek and I would like to start a discussion about allowing >> multiple exception types to be caught in a single catch statement. >> >> https://wiki.php.net/rfc/multiple-catch >> >> A working implementation and tests are available in the RFC. >> >> We are waiting for your constructive feedback and thoughts. >> >> Thanks >> Pierrick >> >> Nice RFC! Think it would be good if you had an example in the > RFC showing the applicability of catching two php exceptions. > Especially given the new exception hierarchy in PHP 7. I'm also > pondering if the main target for this is custom exceptions or > the built-in ones or both? > > Regards //Björn Larsson > > PS >