On 04/18/2016 08:28 PM, Stanislav Malyshev wrote:
Hi!
It'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.
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 Garfield
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php