PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » PHP » PHP_CodeSniffer » Bug #9883

Fatal error if empty comment block encountered

Details

Submitted2007-01-20 06:00 UTC
Frommike at sprokets dot net
Assignedsquiz
StatusDuplicate
PackagePHP_CodeSniffer
PHP Version5.2.0
OSFreeBSD
Roadmaps(Not assigned)

Comments

[2007-01-20 06:00 UTC] mike at sprokets dot net

Description:
------------
When using both PEAR and Squiz standards, you'll get a Fatal if any empty comment block is encountered for a file, class, or function.

Test script:
---------------
file.php:
/**
*
*
*/
function example() {

}

% phpcs file.php

Example patch to
PEAR/Sniffs/Commenting/FunctionCommentSniff.php, line 167:
if (!$comment instanceof PHP_CodeSniffer_CommentParser_CommentElement) {
$error = 'Entire block comment is empty';
$phpcsFile->addError($error, $commentStart);
return;
}

I suspect the permanent solution lies in adding this check to the CommentParser.

Actual result:
--------------
Fatal error: Call to a member function getShortComment() on a non-object in ...

[2007-01-21 21:43 UTC] squiz at php dot net

Thank you for your bug report. This issue was also reported in bug #9806 and has been fixed in CVS.