Re: Proposal: Introduction of InvalidStateException
On Thu, Oct 17, 2013 at 11:54 AM, Johannes Schlüter
<[email protected]>wrote:
> On Thu, 2013-10-17 at 15:30 +0200, Benjamin Schneider wrote:
> > Hello,
> >
> > I would like to propose the introduction of an 'InvalidStateException'
> > into the SPL extension. Within the existing exceptions I am not able
> > to find a type that would represent a state error, throwable if a
> > method has been invoked at an illegal or inappropriate time.
> >
> > I would be able to write the RFC and later on implement this new
> > exception by myself, in case people share my opinion.
>
> I'm a strong believer in "what hasn't to be in core should not be" and
> these exceptions can easily be implemented in PHP. They have to be in C
> when internal things should throw those.
I agree, Johannes. However, there are actually times where the SPL should
internally throw these exceptions. A work-in-progress can be at found
https://github.com/morrisonlevi/php-src/tree/StateExceptions.
There are
actually way more use-cases for StateException than I originally believed.
Thread (14 messages)