Re: [RFC] Deprecations for PHP 8.5

From: Date: Tue, 22 Jul 2025 17:28:02 +0000
Subject: Re: [RFC] Deprecations for PHP 8.5
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-128181@lists.php.net to get a copy of this message
On Tue, July 8, 2025 at 06:35 Christoph M. Becker wrote:

> On 08.07.2025 at 01:30, Theodore Brown wrote:
>
>> 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.
>
> The use case we're talking about would be something like (indented to
> avoid issues with Newsreaders):
>
>   <?switch ($foo):?>
>   <?case 1?>
>   <p>1</p>
>   <?break?>
>   <?case 2?>
>   <p>2</p>
>   <?break?>
>   <?endswitch?>
>
> If that code wouldn't trigger a deprecation notice, fine.  However, we
> had apparently introduced an inconsistency then.

Hi Christoph,

I implemented the deprecation in a branch in order to test this [1].
That code would emit deprecation notices, and should be fixed by adding a colon
after each case statement, just like is required after the opening switch ($foo).

> Note that I do not advocate writing such code, but I wouldn't be
> surprised if such code exists in the wild, but even more suprised if
> such code would be found in a Composer package.

If such code does exist anywhere, I expect it to be extremely rare, given how
many PHP devs seem to be surprised that the alternative case syntax is even possible.
Certainly this deprecation should be _far_ less impactful than the curly brace
array/string access syntax that was successfully deprecated in PHP 7.4.

Sincerely,
Theodore Brown

[1]: https://github.com/php/php-src/pull/19215


Thread (73 messages)

« previous php.internals (#128181) next »