On 18 Jul 2014, at 06:02, Theodore Brown <theodor...@outlook.com> wrote:

> Another concern I have is in regard to the future. I'm looking forward to the 
> possibility of specifying nullable types in a future version of PHP (see Levi 
> Morrison's "Declaring Nullable Types" RFC: 
> http://wiki.php.net/rfc/nullable_typehints). If the 
> nullable types RFC is accepted, it would be highly disconcerting if scalar 
> type 
> annotations allowed null values regardless of whether a nullable marker is 
> specified.

The current proposed behaviour could be changed. At the moment, if a scalar 
type hint is nullable, then it won’t cast NULL if it’s passed that value, but 
if it’s not nullable, then it will cast it.

Considering how this tends to only allow lossless casts, though, it might be 
worth reconsidering this and just disallowing NULL altogether. It’s worth 
pointing out that NULL is usually an error value, and you might get it from 
using an uninitialised variable or calling an internal function with bad 
parameters.

--
Andrea Faulds
http://ajf.me/





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

Reply via email to