Re: [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters

From: Date: Mon, 12 Mar 2012 13:52:32 +0000
Subject: Re: [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  Groups: php.internals 
Request: Send a blank email to internals+get-58875@lists.php.net to get a copy of this message
> 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.godjuks@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 :)) >

« previous php.internals (#58875) next »