Re: [RFC] Context Managers
| From: | Tim Düsterhus | Date: | Wed, 29 Apr 2026 13:15:20 +0000 |
| Subject: | Re: [RFC] Context Managers | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130707@lists.php.net to get a copy of this message | ||
Hi
Am 2026-04-22 20:28, schrieb Larry Garfield:
## Ways of handling a single method's returns Possible ways to do so off the top of my head, in no particular order:I don't currently have the time to digest this email in detail, but I wanted to mention an alternative you didn't before I forget: Making the exception an in-out parameter. That would be functionally similar to a return value, but more strongly default to “don't make a change”, because “doing nothing” will just work. i.e.
public function exitContext(?\Throwable &$e): void {
// Assign null to suppress.
$e = null;
}
Best regards
Tim Düsterhus