Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128839 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 1C79C1A00BC for ; Wed, 15 Oct 2025 00:08:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1760486914; bh=GsP+V9cYrcpnkvQe/WJVxVsuELJOS+eqdJiCjaV+vp0=; h=To:From:Subject:Date:From; b=LIlQLYj0raz9O6gACbfMJxfKnH+34o8DV9C5m+k+3LC8TM7YJuyrB3zBHigjrbw/b bYcl4F2kRPUJQ01PMo8lMxnjeziDKR/Q7ieGtS57+MApYK49sI6SAh1beMxUbhX/hY Zz+5FiyQ0l6kyWy5PcfsTGBsdkb/9GbuK8rFIYTYsJ9B00fWeVWFHC35lbYfwD/328 FcXpO7VECYRR3f86/EQOq2IHca6rrjJemnO+KNY1788ikWeD3C8R8/iIY8ouGSTM2K 2KA3QPsLR241GqxNQyd96ZF51iLjQ9bL6XCTL8LMi+EJmsQxUSWWXQnuuP8EViKHQm hKf1zmLkTgqqQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1B7A11801D9 for ; Wed, 15 Oct 2025 00:08:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.9 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from rusty.tulip.relay.mailchannels.net (rusty.tulip.relay.mailchannels.net [23.83.218.252]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 15 Oct 2025 00:08:32 +0000 (UTC) X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id AB2516A1E46 for ; Wed, 15 Oct 2025 00:08:26 +0000 (UTC) Received: from nl1-ss105.a2hosting.com (trex-green-1.trex.outbound.svc.cluster.local [100.114.113.86]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id DE7456A1DED for ; Wed, 15 Oct 2025 00:08:25 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1760486906; a=rsa-sha256; cv=none; b=kt/TVVDnB4KyJORHLHCebGiIQLRCfHmj2C1+qGftAWY9nI9Wlf+NDwhDoBC/vNp39gkHoh NA2c8Y+x13zCffUowai9QuTveDpQVOv7n/dSu5ezQHincjvNrlDPl/wtSnKxNs4+RSJ8n0 RdGjF/otrJMd1AhfGhgzh3XJNqiodYcEqGcc5D5MfrnyBZTT2xKHO23usyeKMUOmHbSMBk J2m7ejJstFu9kAF/MHBU/0hOQOlaNzSMOhGop0FJIpSULdSR2/Pk2IAn6rNLeCJ9CWEn0c UP+WFWt0tm89XUS8bJdQJyvphHoaYdfeN+8o/uyytYkaAIlJMILFjiOSZC67nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1760486906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: dkim-signature; bh=R+PLm2JtBIynx+hKGxCAyrLR0LbNBUUDYAuoxDw5Fok=; b=eZHxyVcDI8jen7noqjRewA0XdIp1Gz7JmTLDTSDhNMcG5HsfaReUFPo1zIK0TEoX6aFVdD lNrABvS2fNi8LSTsRoRHemL53UG7awnCLM2U65/uPzi/IRXxOXdWQr/npIxSVPfUtmO2Ab JsmkyASNuG3+fGQkXcIsrDIfnJmup+WkbPCH0T5hIh5cLKEASx5rgRKS5QuFag/ZMvEueG H8DzHW/hOYhSo4T1FRC1IZADrsvgH5xZ++mNFkXg4PN42CpRPQ/3IWelTwZytjCK3IXds4 FnSLKjKAJa2d/dL67Izcfv/NlVeOq5v8fUo+j4+MsrlpNchCwyXzIwCPO8U7Og== ARC-Authentication-Results: i=1; rspamd-777888ddf6-hjhhh; auth=pass smtp.auth=a2hosting smtp.mailfrom=php-internals_nospam@adviesenzo.nl X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|juliette@adviesenzo.nl X-MailChannels-Auth-Id: a2hosting X-Abaft-Shoe: 43d749ea2ac76182_1760486906252_3924725127 X-MC-Loop-Signature: 1760486906252:47869648 X-MC-Ingress-Time: 1760486906251 Received: from nl1-ss105.a2hosting.com (nl1-ss105.a2hosting.com [85.187.142.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.114.113.86 (trex/7.1.3); Wed, 15 Oct 2025 00:08:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=adviesenzo.nl; s=default; h=Content-Type:MIME-Version:Date:Message-ID: Subject:From:To:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=R+PLm2JtBIynx+hKGxCAyrLR0LbNBUUDYAuoxDw5Fok=; b=B4weuMbHxx4j1K61iIbFyTj/By TaVYzWymjoX1Q+5C7+chSxd2ijVyKPuvYhrEX8/iRBueg5/9COLSLFQ59QpAJJGJbyQ1V/b3X5I/B wPAuOv++WeCMa4qDY76R/JrpBUfHGq7Mubd33M7UqA0ZN7oR5tcQh1R73FmM6mbUh874=; Received: from mailnull by nl1-ss105.a2hosting.com with spam-scanner (Exim 4.98.2) (envelope-from ) id 1v8p44-0000000GQgu-0E13 for internals@lists.php.net; Wed, 15 Oct 2025 02:08:24 +0200 X-ImunifyEmail-Filter-Score: 0.69 X-ImunifyEmail-Filter-Info: QVNOIE1JTUVfVFJBQ0UgUkNQVF9DT1VOVF9UV08gUkNWRF9D T1VOVF9 PTkUgRlJPTV9IQVNfRE4gTUlNRV9VTktOT1dOIElFX1ZMX1BCTF9ET0 1BSU5fMDUgSUVfVkxfUEJMX0FDQ09VTlRfMjAgQVJDX05BIEZST01fR VFfRU5WRlJPTSBUT19NQVRDSF9FTlZSQ1BUX1NPTUUgSUVfVkxfUEJM X0VNQUlMXzA1IFJDVkRfVklBX1NNVFBfQVVUSCBCQVlFU19IQU0gUkN WRF9UTFNfQUxMIElFX1ZMX1BCTF9BQ0NPVU5UXzA1IE1JRF9SSFNfTU FUQ0hfRlJPTSBWRVJJTE9DS19DQiBJRV9WTF9QQkxfQUNDT1VOVF8wM SBJRV9WTF9QQkxfRE9NQUlOXzAxIElFX1ZMX1BCTF9FTUFJTF8wMSBU T19ETl9BTEw= X-ImunifyEmail-Filter-Action: no action X-ImunifyEmail-Filter-Version: 3.8.18/202510080919 Received: from [31.201.40.213] (port=62750 helo=[192.168.1.16]) by nl1-ss105.a2hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1v8p44-0000000GQ3v-1FWa; Wed, 15 Oct 2025 02:08:23 +0200 To: PHP internals , Theodore Brown Subject: [PHP-DEV] Inconsistency in PHP 8.5 deprecation of terminating case with semicolon Message-ID: <68EEE5F4.5070105@adviesenzo.nl> Date: Wed, 15 Oct 2025 02:08:20 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------050601050801020701080401" X-AuthUser: juliette@adviesenzo.nl From: php-internals_nospam@adviesenzo.nl (Juliette Reinders Folmer) This is a multi-part message in MIME format. --------------050601050801020701080401 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Dear Theodore and list, I've been looking into the "Deprecate semicolon after case in switch statement" PHP 8.5 deprecation [1] with the aim of adding a sniff for this to the PHPCompatibility standard and I'm noticing an oddity for which I would like to clarify whether this is intentional or an oversight. As demonstrated in the example code provided in the deprecation RFC, both switch `case` condition statements, as well as `default` statements, can be ended with a semicolon. So when I first read the RFC, I interpreted the proposal to include both `case` as well as `default`, as, in my mind, `default` is just a special `case` in a switch. However, the RFC explicitly only talked about deprecating the use of a semicolon after a `case` statement and the implementation has followed this to the letter. [2] The net result of this, is that you can now have a `switch` statement with semicolons terminating `case` statements and `default` statements, where the former (`case`) will result in a deprecation notice, while the latter (`default`) will not. For an example, see [3] This feels inconsistent to me and counter to the intention of the RFC, which is stated to be: > Case statements followed by a semicolon can cause confusion, as a developer may think they behave differently in some way from regular case statements (e.g. preventing fallthrough), when they do not. Which leaves me wondering what the reason was not to _also_ deprecate the use of a semicolon to terminate a `default` statement in a switch ? I can't find any discussion about this in the original mailing list thread [4]. Anyone would care to clarify ? Smile, Juliette 1: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_semicolon_after_case_in_switch_statement 2: https://github.com/php/php-src/commit/5f8d648af6ef4e29a3c7f2b2029d08466c12bc6f 3: https://3v4l.org/liFIK/rfc#vgit.master 4: https://externals.io/message/126000 --------------050601050801020701080401 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Dear Theodore and list,

I've been looking into the "Deprecate semicolon after case in switch statement" PHP 8.5 deprecation [1] with the aim of adding a sniff for this to the PHPCompatibility standard and I'm noticing an oddity for which I would like to clarify whether this is intentional or an oversight.

As demonstrated in the example code provided in the deprecation RFC, both switch `case` condition statements, as well as `default` statements, can be ended with a semicolon.

So when I first read the RFC, I interpreted the proposal to include both `case` as well as `default`, as, in my mind, `default` is just a special `case` in a switch.

However, the RFC explicitly only talked about deprecating the use of a semicolon after a `case` statement and the implementation has followed this to the letter. [2]

The net result of this, is that you can now have a `switch` statement with semicolons terminating `case` statements and `default` statements, where the former (`case`) will result in a deprecation notice, while the latter (`default`) will not. For an example, see [3]

This feels inconsistent to me and counter to the intention of the RFC, which is stated to be:

>
Case statements followed by a semicolon can cause confusion, as a developer may think they behave differently in some way from regular case statements (e.g. preventing fallthrough), when they do not.

Which leaves me wondering what the reason was not to _also_ deprecate the use of a semicolon to terminate a `default` statement in a switch ?
I can't find any discussion about this in the original mailing list thread [4].

Anyone would care to clarify ?

Smile,
Juliette

1: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_semicolon_after_case_in_switch_statement
2: https://github.com/php/php-src/commit/5f8d648af6ef4e29a3c7f2b2029d08466c12bc6f
3: https://3v4l.org/liFIK/rfc#vgit.master
4: https://externals.io/message/126000
--------------050601050801020701080401--