> I'm not sure about you, but I don't wanna see that kind of thing
eventually making it's way into the language

Me neither. All I am saying is that, since int|null is already here from
the back door, I think it should be properly supported.


Lazare INEPOLOGLOU
Ingénieur Logiciel


2012/3/12 Arvids Godjuks <arvids.godj...@gmail.com>

> I think that the "null issue" is not an issue. Strictly speaking if you
> want null or an int - leave out the type hint and use generic argument that
> will accept anything.
> I think it's over-engineering to try and push a special treatment for the
> null. If function/method argument accepts anything but a single type -
> it's type-less and does not need a type hint.
>
> Developers should not abuse type hints and adding a special case for
> handling null will make many start to request things like this:
> function foo(string|array $data)
> function foo(bool|int $flag)
> function foo(mixed $someVar)
> etc.
>
> I'm not sure about you, but I don't wanna see that kind of thing
> eventually making it's way into the language (believe me - even I
> considered that at some point, but i'm more mature now and more settled in
> my wishes :))
>

Reply via email to