> On 31. Jul 2025, at 11:53, Mihail Liahimov <91lia...@gmail.com> wrote: > > Introduction > > Currently, PHP requires a block body for catch clauses even when the caught > exception is not used. This results in unnecessary boilerplate code. This RFC > proposes allowing catch clauses without a body when the exception variable is > omitted. > > Proposal > > Allow the following syntax where the curly braces can be omitted when no > exception variable is specified and no handling is needed: > > try { > // code that may throw > } catch (SomeError); > > This would be equivalent to: > > try { > // code that may throw > } catch (SomeError) {} > > 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. > > Backward Incompatible Changes > > None. This is purely an additive change to the syntax. >
Hey Mihail, Why would the `catch (SomeError)` still be required if it isn’t used? Cheers, Nick