Hi internals,

I'm wondering why PHP 8 started warning about required parameters declared
after optional ones, when this version is the one that also introduced
named parameters, which can take advantage of this:

```
function test($a = 1, $b) {
    echo $a, $b;
}

test(b: 2);
```

> Deprecated: Required parameter $b follows optional parameter $a in
/in/DmhYG on line 3
> 12

https://3v4l.org/DmhYG

If I'm not mistaken, the introduction of this warning (January 2020
<https://externals.io/message/108052>) predates the introduction of named
parameters (May 2020 <https://wiki.php.net/rfc/named_params>), which could
explain why it would have temporarily made sense to introduce this warning.

Shouldn't it be removed now, that it makes IMO full sense with named
parameters to have required and optional parameters at arbitrary positions?

Thank you for your time,

— Benjamin

Reply via email to