Draft
PHP 8.7
https://wiki.php.net/rfc/context-managers-v2
From the RFC
Context Managers are a concept borrowed from Python. They provide a way to abstract out common control-flow and variable-lifetime-management patterns, leading to vastly simplified "business logic" code that can skip over a great deal of boilerplate. They place certain guards around a "context" (block), such that certain behaviors are guaranteed upon entering and leaving the block.Read the full RFC on wiki.php.net →