On 14 Jul 2014, at 17:25, Anthony Ferrara <ircmax...@gmail.com> wrote:

> And that also hints towards a benefit of adding a numeric hint as well
> (which will accept (and cast to) either an int or a float, exactly how
> is_numeric_string() does internally)... Which is something that may
> want to be considered for this RFC.

I’ve finally gotten round to doing this (I had to fix most of the mess of 
segfaults and broken tests first). The RFC now proposes a ‘numeric’ type hint 
that does what you expect it to, casting to int or float.

The implementation (which is done and tested for this type hint) is 
straightforward, though there’s a minor issue with casting of objects. As 
IS_NUMERIC is a fake type, cast_object doesn’t support it, so it’ll try IS_LONG 
first, unfortunately. Not much we can do about that.

Actually, perhaps it would be possible to try IS_NUMERIC, and if that fails, 
try IS_LONG, then try IS_DOUBLE. Should I do that?

--
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