php-http / httplug

HTTPlug, the HTTP client abstraction for PHP
http://httplug.io
MIT License
2.57k stars 39 forks source link

Custom SPL exceptions #50

Closed sagikazarmark closed 9 years ago

sagikazarmark commented 9 years ago

Should we make out SPL exceptions final?

The case came up: I created an UnexpectedValueException which extends the original SPL exception, which extends RuntimeException. However it does not extend our RuntimeException, which is a bit of inconsistency.

This is why I think making our SPL extensions final. They should be used as is. Other exceptions can extend the SPL exceptions and implement our interface.

dbu commented 9 years ago

our rule with symfony and symfony cmf is: make it restricted (private methods and properties) until somebody has a valid use case to lessen the restriction. in that spirit, final sounds good. there is no BC break in removing final if there is a good use case and the people needing to extend can then depend on the lowest version where the exceptions are not final anymore.

sagikazarmark commented 9 years ago

Sounds reasonable.