Davey Shafik wrote:
Do you propose to have a warning when the types are a mis-match, similar to the
array->scalar conversion example from Gustavo? (strtoupper(array('ABC')))

If you have a warning or notice, that warns of potential loss of data accuracy, 
then
I think I'd be OK with auto-converting.

Having said that, all other type hints are strict, throwing a catchable fatal 
error — consistency
for what is essentially the same syntax, is more important IMO.

Would it be possible to support two syntaxes:

function foo( (int) $bar) { }  // auto-cast to int
function foo(int $bar) { }      // require int

There has never been casting to objects other than stdClass, so I don't think 
it conflicts that
there is no:

function foo( (DBAdapter) $bar) { }

- Davey

I completely agree with this option, would vote for it. The two syntaxes and errors if it's not supported. I've wanted this option since it was proposed. Again, from a PHP user.

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

Reply via email to