FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=18204&edit=1

ID: 18204
Updated by: gsherwood@squiz.net
Reported By: spam at endstadium dot com
-Summary: Squiz.Commenting.FunctionCommentThrowTag.WrongType
seems to malfunction
+Summary: FunctionCommentThrowTag picks wrong exception type
when throwing function call
-Status: Open
+Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Package Version: 1.3.0RC2
PHP Version: 5.3.1
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-Summary:
Squiz.Commenting.FunctionCommentThrowTag.WrongType seems
to
malfunction
+Summary: FunctionCommentThrowTag picks wrong exception
type when throwing function call
-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 pear.php.net
by the end of next Sunday (CET).

If this was a problem with the pear.php.net 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.

The sniff doesn't have problems with multiple end points. It just
assumes you are throwing your own exceptions or variables. It does not
support throwing the result of function calls.

The sniff requires you to explicitly state the different types of
exceptions that this method may throw, using a @throws tag for each. But
if it sees you are throwing a variable, it doesn't check the type of the
exception in the comment. It just makes sure there is at least one tag
in there.

I've changed the sniff to do the same thing for function calls.


Previous Comments:
------------------------------------------------------------------------

[2011-01-20 20:15:41] seikilos

Description:
------------
Testscript below, run over it and got
Expected "getErrorSchema" but found "mixed" for @throws tag exception

Seems not to detect multiple exception exit points?

Test script:
---------------
/**
* Stores settings
*
* @param mixed $con A database connection
*
* @throws mixed If the form is not valid
*
* @return mixed The current saved object
*/
public function save($con = null)
{
if ( $this->isValid() === false )
{
throw $this->getErrorSchema();
}

if ( null === $con )
{
$con = $this->getConnection();
}

$result = null;
try
{
$con->beginTransaction();

$result = $this->doSave($con);

$con->commit();
}
catch ( Exception $e )
{
$con->rollBack();

throw $e;
}

return $result;

}

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJan 20, '11 at 11:54p
activeJan 20, '11 at 11:54p
posts1
users1
websitepear.php.net

1 user in discussion

Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase