On 18 Jul 2014, at 14:09, Andrea Faulds <a...@ajf.me> wrote:

> I’ve updated the RFC and patch to make int, string and double nullability 
> work like the other types (bool already did). If the default value isn’t 
> NULL, NULL isn’t accepted and you’ll get E_RECOVERABLE_ERROR. If the default 
> value is NULL, NULL is accepted and will not be casted.
>
> This will likely lead to less bugs as NULL is a common error value, and it 
> also makes the scalar type hints more consistent with the others.

Thank you very much for making this change. It goes a long way towards making 
scalar type annotations more useful to me as a userland developer. Also, I 
really like the new "numeric" type hint.

The one remaining issue I have with this proposal is that boolean values are 
currently accepted for every other scalar type except array. As with NULL, 
FALSE is a common error value, and allowing booleans to be passed to a function 
expecting a string or numeric value could easily mask errors and lead to 
hard-to-debug issues in a program. Just as a string cannot be passed to a 
function expecting a boolean, a boolean should not be passed to a function 
expecting a string, etc.

Thanks for all you do for the community.

--

Theodore Brown

A PHP developer interested in the future of the language                        
                  
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to