Exception declares protected properties that may be used in child classes directly. This is not possible with interface.
Thanks. Dmitry. On Thu, Feb 19, 2015 at 6:31 PM, Dan Ackroyd <dan...@basereality.com> wrote: > On 19 February 2015 at 09:54, Dmitry Stogov <dmi...@zend.com> wrote: > > > I think we may introduce the following hierarchy > > the existing code that caught Exception is going to be unaffected. > > We could do that. But it's not obviously correct, and ought to be > justified as to why it would be the correct thing to do. > > The problem of people needing to catch every type of exception could > also be solved by using a common interface. > > class EngineException implements ExceptionInterface {} > class Exception implements ExceptionInterface {} > > try { > foo(); > } > catch(ExceptionInterface $exception) { > //catches everything. > } > > This avoids a requirement for all exceptions to extend from a common > base class. The interface for exceptions would be the current > Exception classes methods, excluding the constructor. > > > We thought about "Throwable" or "Catchable" interface, but this change > > would require more changes and will make more BC breaks. > > Please can you explain what those problems are? > > > cheers > Dan >