Le 13/07/2014 18:15, Rowan Collins a écrit :
On 13/07/2014 17:09, Jocelyn Fournier wrote:If "type hint" is doing exactly the same than explicit cast, it should not fail on wants_array('abc'), but give a warning about the implicit cast conversion.Agreed, but that's a very big "if", and is not what this RFC is proposing at all. Nor could it cleanly use the current syntax, since function foo(array $foo) is already valid, and does not perform such a cast.
I agree if we cast, the current "array" behaviour needs to be changed. And if we don't change this behaviour, it would be logical the "type hint" correspond to a strict check for all the type used (there's no reason why array should be an exception).
If you haven't already, please do read Nikita's article which has been linked several times in this thread, which discusses the different options. This proposal is closer to "strict weak type hinting" than "casting weak type hinting"; it differs in *performing* a non-lossy cast, rather than just asserting the *possibility* of one.
I do, but I just voice that as a PHP developer I don't like this approach much, and I prefer the approach of casting + warning as a good compromise :)
Jocelyn -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
