2013/9/6 Adam Harvey <[email protected]>
>
>
> Variadics/splat: collecting both named and positional arguments into
> one array seems reasonable to me. I think the main use case there
> would be option parameters, which you'd have to validate anyway, so
> positional parameters would be dealt with at that point — I don't see
> separate arrays as conferring any great advantage in terms of
> validating parameters, and it's no simpler conceptually.
>
>
There is a small drawback. Suppose this code:
function foo( $bar = 0 , ...$args ){}
foo( bart => 3 ); // misspelled name
According to the RFC, any unknown argument name will fall into the $args
array, making the above code valid. As this cannot be verified statically,
it is a possible source of bugs.
Lazare INEPOLOGLOU
Ingénieur Logiciel