Re: Re: PHP Standards and Best Practices for PHP 5.3+ Frameworks and Libraries

From: Date: Tue, 26 May 2009 20:31:09 +0000
Subject: Re: Re: PHP Standards and Best Practices for PHP 5.3+ Frameworks and Libraries
References: 1 2  Groups: php.standards 
Request: Send a blank email to standards-+get-6@lists.php.net to get a copy of this message
Matthew Weier O'Phinney wrote:
-- Hannes Magnusson <hannes.magnusson@gmail.com> wrote (on Tuesday, 26 May 2009, 10:09 PM +0200):
**Exceptions and Exception Handling** Each package must provide a base exception of the following name: vendor\package\Exception
      
Err. So every package namespace must have an Exception class/interface called literally 'Exception'? That feels a bit of an overkill. How about "SHOULD provide"?
    
I agree with "SHOULD provide". That said, why *wouldn't* you provide one? It's very common practice to catch exceptions based on type, and having a specific "type" based on the given package would only give more options to developers. What feels like "overkill" to you?
If you change this to "SHOULD provide", then it defeats the whole purpose of the exception. IIRC this exception was meant to be there to enable code calling the package to have at least a global catch for the package's exception. This was specifically proposed from a functional point of few (being able to at least always catch the global package exception). But for this to work, you must enforce the exception to be there, else it defeats the whole purpose of this standard in the first place. Stefan

« previous php.standards (#6) next »