On Tue, May 25, 2021 at 8:18 AM Nikita Popov <nikita....@gmail.com> wrote:
>
> Hi internals,
>
> Currently, argument unpacking (...$foo) cannot be combined with named
> arguments (foo: $bar) at all. Both func(...$args, x: $y) and func(x: $y,
> ...$args) are rejected by the compiler.
>
> https://github.com/php/php-src/pull/7009 relaxes this by allowing
> func(...$args, x: $y). The named arguments are required to come last,
> because this automatically enforces the invariant that named arguments must
> be sorted after positional argument.
>
> Are there any concerns with relaxing this restriction?
>
> Regards,
> Nikita

How do named parameters interact with the variadic parameter?

    function f(...$params) { var_dump($params); }
    $args = [1, 2, 3];
    f(...$args, params: [4, 5, 6]);

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

Reply via email to