On Thu, 14 Apr 2016, Lin Yo-An wrote:

> On Thu, Apr 14, 2016 at 5:12 PM, Derick Rethans <der...@php.net> wrote:
> 
> > I think what I am missing in the RFC is behaviour with scalar (weak)
> > typehints, and which type the variable in a class would be converted to.
> > Take for example:
> >
> > function foo(int|bool $var) { echo get_type( $var ), "\n"; }
> >
> > foo(5);     I guess int(5)
> > foo(false); I guess bool(false)
> > foo(0.5);   It could be either int(1) or bool(true)
> >
> > And what if the hint would be "bool|int" ?
> 
> I think type conversion shouldn't be done internally, implicitly.
> 
> Implicit conversion leads more confusion in the language. when you 
> pass variables, you have to remember these conversion rules.

Sorry, we already have this with our weak scalar types. You can't make 
union types not work with that.

cheers,
Derick

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to