Re: Warn when declaring required parameter after optional one
| From: | Nikita Popov | Date: | Fri, 17 Jan 2020 17:59:42 +0000 |
| Subject: | Re: Warn when declaring required parameter after optional one | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108184@lists.php.net to get a copy of this message | ||
On Sat, Jan 11, 2020 at 2:35 PM Niklas Keller <me@kelunik.com> wrote:
> Hi Nikita,
>
> while this is a rather small change, it has quite some BC impact, as
> not all old code has been adjusted to run on PHP 7.1+ only using
> nullable types.
>
> I'd like to see an RFC with a vote for this.
>
> Regards,
> Niklas
>
I was interested in seeing how prevalent this pattern, is, so I ran some
analysis on the top 2k composer packages. I found 527 signatures that would
throw a deprecation warning with this change. Of these 187 are potentially
used as "poor man's nullable types" (the optional argument has both a type
and a null default), while the other 340 are definite bugs.
Regards,
Nikita