Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-19 Thread Pierrick Charron
Thanks for the feedback Patrick :-) I understand your concern. I added a section to the RFC Impact section to mention that PHP tools/IDE will require some modifications. Feel free to add some additional details in this section if you want. People who will vote will then be aware of the situation

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-15 Thread Patrick ALLAERT
Hi, Le mer. 9 mars 2016 à 14:08, Marco Pivetta a écrit : > On 9 March 2016 at 14:03, Pierrick Charron wrote: > > > Hi Derick > > > > I agree that most of the time the best solution is to implement a clean > > exception hierarchy but as stated in the RFC :

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-11 Thread Pierrick Charron
Thanks for your feedback ! Any other thoughts from anyone else on this ? On 10 March 2016 at 02:31, Björn Larsson wrote: > Hi, Thanks for clarifying. Think the RFC would benefit from having > some of these examples in it. I also had in mind that it's handy for >

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-09 Thread Björn Larsson
Hi, Thanks for clarifying. Think the RFC would benefit from having some of these examples in it. I also had in mind that it's handy for catching many exceptions when logging stuff and re-throwing like: } catch (FirstException | SecondException ex) { logger.error(ex); throw ex; }

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-09 Thread Pierrick Charron
On 9 March 2016 at 08:30, Marco Pivetta wrote: > On 9 March 2016 at 14:24, Pierrick Charron wrote: >> >> The thing I don't like about this approach is that I have to read the >> code and double check to make sure that the catch statement call the same >>

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-09 Thread Marco Pivetta
On 9 March 2016 at 14:24, Pierrick Charron wrote: > > The thing I don't like about this approach is that I have to read the code > and double check to make sure that the catch statement call the same method. > For the amount of work that needs to be done in the Engine (see the

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-09 Thread Arvids Godjuks
I'm definetly lately started to use instanceof to check the type of exception I've got and throw further those that I don't need. This is especially valuable for CLI applications (I have a few daemons in PHP). So a big +1 on the proposal idea, as for the tech part - maybe unions is a good idea.

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-09 Thread Pierrick Charron
On 9 March 2016 at 08:08, Marco Pivetta wrote: > On 9 March 2016 at 14:03, Pierrick Charron wrote: > >> Hi Derick >> >> I agree that most of the time the best solution is to implement a clean >> exception hierarchy but as stated in the RFC : >> >> "A

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-09 Thread Marco Pivetta
On 9 March 2016 at 14:03, Pierrick Charron wrote: > Hi Derick > > I agree that most of the time the best solution is to implement a clean > exception hierarchy but as stated in the RFC : > > "A solution to fix this problem on the user level would be to implement a > common

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-09 Thread Pierrick Charron
Hi Derick I agree that most of the time the best solution is to implement a clean exception hierarchy but as stated in the RFC : "A solution to fix this problem on the user level would be to implement a common interface for ExceptionType1 and ExceptionType2 and catch it. However, this is only

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-09 Thread Niklas Keller
2016-03-09 12:52 GMT+01:00 Derick Rethans : > Hi! > > On Tue, 8 Mar 2016, Pierrick Charron wrote: > > > 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. > > > >

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-09 Thread Derick Rethans
Hi! On Tue, 8 Mar 2016, Pierrick Charron wrote: > 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 Would it not be better, to have your Exceptions extend a

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-08 Thread Bronisław Białek
Hi :) I think it is feature that is useful time to time, not very often. One example: class PackingFailed extends \Exception implements PackagingException {} // this exception could originate from package with assertions/exceptions, // so I cannot use common interface with above class EmptyName

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-08 Thread Pierrick Charron
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

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-08 Thread Björn Larsson
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

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-08 Thread Pierrick Charron
Hi Sean and Yasuo I agree that they are somehow related, but I also think (and I might be wrong) that the behaviour of the Multi-Catch is obvious and I don't see how this syntax/feature could be interpreted otherwise. The multi-catch don't have any open-issue that the Union-Types have like weak

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-08 Thread Yasuo Ohgaki
Hi all, On Wed, Mar 9, 2016 at 6:50 AM, Sean DuBois wrote: > It may be an issue that this is close in design to [0] union types. > This RFC would be *great* for code quality, just might be a subset of > union types. > > thanks > > [0] https://wiki.php.net/rfc/union_types Nice

Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-08 Thread Sean DuBois
On Tue, Mar 08, 2016 at 04:42:29PM -0500, Pierrick Charron wrote: > 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

[PHP-DEV] [RFC Discussion] Catching multiple exception types

2016-03-08 Thread 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