Re: [VOTE] Catching Multiple Exception Types
| From: | Larry Garfield | Date: | Tue, 19 Apr 2016 03:01:17 +0000 |
| Subject: | Re: [VOTE] Catching Multiple Exception Types | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-92440@lists.php.net to get a copy of this message | ||
On 04/18/2016 08:28 PM, Stanislav Malyshev wrote:
Hi!I detailed use cases for both & and | here: http://news.php.net/php.internals/92335 Admittedly Foo|Bar is of limited use, although there is some use. Foo&Bar, however, has plenty of uses. I do agree with the sentiment that having Foo|Bar for catch but not for function signatures is going to confuse people. If nothing else, it will result in even more pressure to add union types. --Larry GarfieldIt's about the perception of consistency. "Oh, I can do this! Neat:" function neat(Foo | Bar $a) { ... }You shouldn't be able to do this, because it makes no sense - why would a function accept two random types and only them? That's probably a bad design - it should be one type or two functions.