Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107569 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 82288 invoked from network); 17 Oct 2019 23:57:48 -0000 Received: from unknown (HELO localhost.localdomain) (76.75.200.58) by pb1.pair.com with SMTP; 17 Oct 2019 23:57:48 -0000 To: internals@lists.php.net References: <929062F1-E83F-4D81-B2C6-3916B744E101@newclarity.net> Date: Thu, 17 Oct 2019 22:42:34 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <929062F1-E83F-4D81-B2C6-3916B744E101@newclarity.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Posted-By: 94.12.0.100 Subject: Re: Adding explicit intent for SWITCH/CASE fall through? From: marandall@php.net (Mark Randall) Message-ID: On 17/10/2019 21:54, Mike Schinkel wrote: > Additionally it could be added in 8.0 and then in 8.1 flagged with a warning when a CASE does not have one for the two, but only if people don't object to this. While I know some on this list feel strongly that warnings must come with to future plans to generate errors I would personally be 100% okay if it indefinitely generated only a warning. Would you put this at switch level, or case level? Unless your plan is to redefine how switch works by default, which would be quite ambitious, I'm not sure it makes a great deal of sense to add a token that would effectively no-op in all circumstances. It sounds like a job for a static analysis comment: /** @DisableSwitchStatementFallthroughWarning */ switch ($x) { case 1: $x = doSomething(); case 2: doLaLaLaLa(); break; default: doTralala(); } -- Mark Randall