Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.1

Bug #18624 @throws namespace problem
Submitted: 2011-06-23 17:58 UTC
From: boxgav Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.3.0)
PHP Version: 5.3.6 OS: Ubuntu
Roadmaps: (Not assigned)    

 [2011-06-23 17:58 UTC] boxgav (Gavin Davies)
Description: ------------ When checking namespace annotations, using a backslash to indicate the root namespace causes the sniff to fail when it's actually OK. Test script: --------------- <?php /** * @package testdata.shouldpass */ namespace Foo\Bar; class FooBarException extends \Exception {} class NamespacedException { /** * @throws \Exception */ public function foo() { throw new \Exception(); } /** * @throws \Foo\Bar\FooBarException */ public function fooBar2() { throw new \Foo\Bar\FooBarException(); } } Expected result: ---------------- It should pick up the \Namespace\Stuff as part of the Exception name Actual result: -------------- -------------------------------------------------------------------------------- FOUND 2 ERROR(S) AFFECTING 2 LINE(S) -------------------------------------------------------------------------------- 13 | ERROR | Expected "Exception" but found "\Exception" for @throws tag | | exception 27 | ERROR | Expected "Foo" but found "\Foo\Bar\FooBarException" for @throws | | tag exception --------------------------------------------------------------------------------


 [2011-06-23 18:40 UTC] boxgav (Gavin Davies)
 [2011-07-13 09:26 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Thanks a lot for the patch.