PHP has a number of de facto rules and policies around the use of exceptions in extensions, for example not to use SPL exceptions in new code, but no official de jure policy.
Since a de facto policy depends on someone remembering the policy and bringing it up during discussion based on a collected list of random links, we intend to codify the current de facto policy in the official policies repository.
Accept the policy in https://github.com/php/policies/pull/17.
The described policy is based on the guidelines used for the exceptions introduced in the new ext/random extension in PHP 8.2. ext/random extension is the first self-contained greenfield addition to PHP’s standard library and the first user of PHP’s Namespace Policy, which allowed for a proper and consistent API design, including the Exception hierarchy. The guidelines used for ext/random’s exception hierachy have since then been used as the basis of the RFC: More Appropriate Date/Time Exceptions RFC and the Add RFC 3986 and WHATWG compliant URI parsing support RFC, making it the current de facto policy for newly designed APIs.
n/a
After the project is implemented, this section should contain