Re: [RFC] Context Managers

From: Date: Sat, 17 Jan 2026 14:48:12 +0000
Subject: Re: [RFC] Context Managers
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-129769@lists.php.net to get a copy of this message
On 2026-01-15 18:01, Larry Garfield wrote:
continue is really just to mirror what switch does with it. If the consensus is to simply disallow continue entirely (which is inconsistent with what switch does today), we're OK with that. I don't feel strongly either way, so we're looking for a consensus.
Hey, I think the benefit of switch supporting continue is to ensure consistency in the number of breakable/continuable structures. Consider
    foreach ($a as $e) {
        switch ($e) {
            case 0:
                foreach ($x as $y) {
                    if (!$y) break 3;
                }
        }
    }
If I need to change break to continue, I will naturally change break 3 to continue 3. I would suggest sticking to same in context managers — have it respected not because you would ever continue to exit it, but to have the onion layer numbers consistent. BR, Juris

« previous php.internals (#129769) next »