On May 26, 2010, at 3:08 PM, Zeev Suraski wrote:

> At 21:12 26/05/2010, Pierre Joye wrote:
>> As PHP's type system is seen as a big plus,
>> I have to say that many users consider it as a plus in the
>> implementation of a given method function or method. But the same
>> users ask to have something more strict for the methods signature. I
>> think it is a valid request and somehow makes sense too.
> 
> I think that the proposed auto-converting type hints answer this request 
> quite well...
> 
> Zeev

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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to