Re: Type hinting
| From: | spam at geleia dot net | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: Type hinting | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-48431@lists.php.net to get a copy of this message | ||
On Mon, May 24, 2010 1:12 pm, Zeev Suraski wrote:
>
> Sounds acceptable to me, that's along the lines of the 3rd option
> which appears to be getting the most traction. I'd also no conversion of
> arrays to scalars to that list.
>
Arrays to scalars already fail. See
http://wiki.php.net/rfc/typecheckingstrictandweak#current_behavior_of_zend_parse_parameters
<?php
var_dump(strtoupper(array("abc")));
gives:
Warning: strtoupper() expects parameter 1 to be string, array given in ...
on line 2
NULL
To respond to Jordi Boggiano, I am not advocating changing the behavior of
cast, only of internal functions' argument parsing.
Also, I think it doesn't make sense to allow "17.", but disallow "17.5"
when an int is expected. See floating point arithmetic and equality
comparisons.
--
Gustavo Lopes