Re: [RFC] Deprecations for PHP 8.5
| From: | Theodore Brown | Date: | Mon, 07 Jul 2025 23:30:29 +0000 |
| Subject: | Re: [RFC] Deprecations for PHP 8.5 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-127953@lists.php.net to get a copy of this message | ||
Apologies for the duplicate; I missed CCing Internals previously.
On Mon, July 7, 2025 at 13:53 Niels Dossche wrote:
>>> There are a few things I will vote no for:
>>>
>>> * Deprecate semicolon after case in switch statement.
>>> People seem to use this and it doesn't seem harmful to have. Just because you
>>> don't like it doesn't mean we should yeet it.
>>
>> Can you point to a project in current use where this syntax is intentionally used? I
>> searched quite extensively
>> (even well beyond the top 1000 Composer packages where there are zero usages) and only
>> found a tiny number of
>> accidental usages (e.g. where all the cases in a switch statement had a normal colon except
>> one which had a semicolon typo).
>> Almost all of these were quickly fixed by sending a pull request.
>
> See https://externals.io/message/126000, in particular
> Derick's reply.
I believe Derick was commenting specifically on using separate <?php ?> tags interleaved
around
each switch, case, break, and endswitch statement (which there are no plans to deprecate). Based
on the follow-up replies from him and Tim, deprecating semicolon-terminated case statements
would not affect his xdebug.org site templates.
> Also I'm sure there's a lot of brownfield PHP code that we have no idea about how it
> looks like.
Perhaps, but even if so the migration is automatic with a single php-cs-fixer command.
>> Maybe the unnecessary legacy syntax doesn't seem harmful, but I disagree..
>> Non-standard alternate syntax can cause confusion
>> about a potential behavioral difference, and sometimes can even hold back future features
>> (for example, deprecating the curly
>> brace array access syntax in PHP 7.4 made it possible to implement property hooks in PHP
>> 8.4).
>
> Sure, but whether it opens up anything useful in the future is highly speculative.
>
>> I updated the RFC to document the planned deprecation message, as well a command which
>> automatically fixes any usages in a project.
>
> :+1:
Kind regards,
Theodore