A PHP internals pre-RFC discussion proposes deprecating `return` inside `finally` blocks. Currently, a `return` in a `finally` block silently discards any pending exception or return value from the `try`/`catch` block with no warning. The author notes this is inconsistent — `break`, `continue`, and `goto` out of `finally` are already compile errors, and `throw` auto-chains discarded exceptions. The feature was originally added only because Java allowed it, despite the original RFC author thinking it made 'no sense'. After implementing the deprecation and scanning ~5000 Composer packages, only 12 occurrences were found across 9 packages, with 3 identified as genuine latent bugs. The proposal is to deprecate now and make it a compile error in a future major version, consistent with how C# handles the same case.

8m read timeFrom externals.io
Post cover image
393 Impressions