Re: [RFC] Context Managers

From: Date: Wed, 08 Apr 2026 16:07:38 +0000
Subject: Re: [RFC] Context Managers
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-130590@lists.php.net to get a copy of this message
On Tue, Apr 7, 2026, at 5:27 PM, Rowan Tommins [IMSoP] wrote: > On 07/04/2026 17:20, Larry Garfield wrote: >> We've updated the RFC to address the break question (new section), the continue >> question (which is now a secondary vote) > > > You are still relying on an incorrect explanation of the relationship > between "switch" and "continue": > >> This behavior is due to a quirk of PHP's design, where >> switch is treated as a looping structure, which most languages do >> not. > > > > "continue" is counted for switch statements not because it is "treated > as a loop", but because PHP has numbered break and continue targets. > Numbering break targets differently from continue targets would be > extremely confusing, so they have to target the same list of constructs. > > There was strong consensus on this point in the previous discussion. Quoting from the Nikita post that is linked from the RFC: --- a) In PHP "switch" is considered a looping structure, for this reason "break" and "continue" both apply to "switch", as aliases. For PHP, these are reasonable semantics, as PHP supports multi-level breaks. It would be very questionable if "break N" and "continue N" could refer to different loop structures just because there is a "switch" involved somewhere. --- Switch being considered a looping structure does qualify as a "quirk" in my book. If we want break/continue to still always have the same numbering, then "do the same as switch, even though it is a Warning" is the only option. Not having an early-success syntax at all is not an option on the table. --Larry Garfield

« previous php.internals (#130590) next »