On 1 Jul 2009, at 18:59, Ilia Alshanetsky wrote:

The main source of conflict appears to be that in some cases typical type hinting is just too strict for PHP's typeless nature (most people expect that "1" == 1, while int type hint would definitely reject string "1").

To be fair, this is really my compliant, but:

I think, for consistency, it should behaviour like zend_parse_parameters, hence not being overly strict, and should set the variable to it casted to the expected type. If it behaves differently to zend_parse_parameters then it'll be annoying that substr(), whose first parameter is a string, behaves differently to function foobar(string $what) when passed an int, for example.

I'd expect:

function foo(string $bar) {
var_dump($bar);
}

foo(1234);

To output:
string(4) "1234"

As this appears to be consistent with what internal functions that use zend_parse_parameters do. I don't want PHP to become any more inconsistent with itself than it already is.


--
Geoffrey Sneddon
<http://gsnedders.com/>


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

Reply via email to