Re: Proposal: Introduction of InvalidStateException

From: Date: Thu, 17 Oct 2013 18:01:14 +0000
Subject: Re: Proposal: Introduction of InvalidStateException
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-69649@lists.php.net to get a copy of this message
On Thu, Oct 17, 2013 at 11:54 AM, Johannes Schlüter <johannes@schlueters.de>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.

« previous php.internals (#69649) next »