On 11 March 2017 13:23:16 GMT+00:00, Andrey Andreev <n...@devilix.net> wrote:
>Ironically enough, the following code executes silently:
>
>    $array = ['a', 'b', 'c'];
>    sort($array, '2234234324');
>
>If you don't see the problem with that, I guess it does make "no sense
>at all" from your POV. Just agree to disagree.


I see a problem with that, but I see exactly the same problem with this:

$array = ['a', 'b', 'c'];
sort($array, 2234234324);

The fact is, "int" is far too loose a type constraint to meaningfully validate 
that parameter. The solution to that is not to be more strict in rejecting 
strings, but to create richer types of constraint: enums, unions, domains, etc.

Regards,

-- 
Rowan Collins
[IMSoP]

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

Reply via email to