Re: PEAR2 Standards Update

From: Date: Tue, 22 Sep 2009 17:47:13 +0000
Subject: Re: PEAR2 Standards Update
References: 1 2  Groups: php.pear.dev php.standards 
Request: Send a blank email to pear-dev+get-52886@lists.php.net to get a copy of this message
On Tue, 2009-09-22 at 18:42 +0200, till wrote: > On Tue, Sep 22, 2009 at 5:38 PM, Brett Bieber <brett.bieber@gmail.com> wrote: > > Greetings everyone - > > > > Just an update on PEAR's progress adopting the "PHP Standards and Best > > Practices for PHP 5.3+ Frameworks and Libraries." :-) > > > > At the last PEAR Group meeting the exception policy and the class > > naming policy were approved by the PEAR Group and are now incorporated > > into the PEAR2 standards. > > I got a couple questions -- and I looked at the docs. > > Currently, a couple packages implement/use SPL exceptions directly, > e.g. they throw an InvalidArgumentException and not > Foo_InvalidArgumentException. Does this mean we have to wrap all SPL > exceptions when we want to use them? > > Also, how exactly does that play with having a base exception class? > > My base exception class is Foo_Exception, but I want to use SPL > exceptions as well. How do I extend to conform to the rule to provide > one base exception for the package? From what it looks like, I extend > the SPL exception but implement my own package' base exception. I'm > not sure if I read the code right, so I'm asking to make sure. You are required to wrap SPL exceptions thrown by your package. The idea here is that all exceptions generated by a package can be caught using "catch foo\Exception $e". For example: class foo\InvalidArgumentException extends \InvalidArgumentException implements foo\Exception { } Cheers, Mike

« previous php.pear.dev (#52886) next »