Re: [RFC] Optional Catch Block Body
| From: | Ayesh Karunaratne | Date: | Thu, 31 Jul 2025 06:20:35 +0000 |
| Subject: | Re: [RFC] Optional Catch Block Body | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-128323@lists.php.net to get a copy of this message | ||
> Motivation
>
> Reduced Boilerplate: Eliminates unnecessary empty blocks when exceptions only need to be caught
> and ignored.
> Improved Readability: Makes the code more concise and focuses on the important parts.
>
Empty
catch blocks are a code-smell. If the try block is not ready
to handle the exception, it should let the exception bubble up; not
silence it. I think we should not encourage this further.