Re: [RFC] Syntax for variadic functions
| From: | Nikita Popov | Date: | Wed, 28 Aug 2013 21:06:31 +0000 |
| Subject: | Re: [RFC] Syntax for variadic functions | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-68653@lists.php.net to get a copy of this message | ||
On Wed, Aug 28, 2013 at 11:01 PM, Damian Wadley <php@requinix.net> wrote:
> How about having the ellipsis _after_ the variable? That then coincides
> with phpDocumentor's recommended syntax of "$c,..."
>
That syntax has it neither before nor after, because there is no parameter
name.
and it keeps any typehint or & with the variable name ("array &$arr..."
> versus "array &...$arr") and, honestly, I think that reads more easily.
>
Please see the https://wiki.php.net/rfc/variadics#choice_of_syntax
section
of the RFC. Quoting: "With ref-modifier (&$args...) this does not show well
that the individual arguments are references, rather than $args itself.
With typehint (array $args...) it also looks like the typehint applies to
$args itself rather than all variadic arguments."
Thanks,
Nikita