Re: Adding explicit intent for SWITCH/CASE fall through?

From: Date: Thu, 17 Oct 2019 21:42:34 +0000
Subject: Re: Adding explicit intent for SWITCH/CASE fall through?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-107569@lists.php.net to get a copy of this message
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

« previous php.internals (#107569) next »