Re: [RFC] Throwable Hierarchy Policy for Extensions
On Sun, 27 Apr 2025, Tim Düsterhus wrote:
> Hi
>
> as announced in the URI RFC discussion thread
> (https://externals.io/message/123997#127142), I've now written up an
> “Exception Hierarchy” policy RFC together with Gina.
>
> Please find the following links:
>
> RFC: https://wiki.php.net/rfc/extension_exceptions
> Policy PR: https://github.com/php/policies/pull/17
>
> The RFC itself also contains additional references.
>
> This message is intended to begin the official discussion period. Please do
> not comment on the PR itself, but reply to this discussion thread for proper
> visibility.
- Exceptions MUST NOT be `final
`.
Could the RFC explain why not?
- The name of the extension SHOULD NOT be used as a prefix or suffix of
the unqualified class name of additional exceptions.
Could you add an example of how to do it instead (or a "not this" "but
that" example)?
- Any two exceptions with different causes MUST be identifiable either
by a unique exception class name, a stable `$code
`, or a
class-specific additional property suitable for programmatic
consumption (e.g. an enum).
I would probably not even allow the stable `$code
` in here, as I have
seen from experience people don't really check for them.
cheers,
Derick
--
https://derickrethans.nl | https://xdebug.org | https://dram.io
Author of Xdebug. Like it? Consider supporting me: https://xdebug.org/support
mastodon: @[email protected] @[email protected]
Thread (18 messages)