Home » PHP » PHP_CodeSniffer » Bug #9883
Fatal error if empty comment block encountered
Details
| Submitted | 2007-01-20 06:00 UTC |
|---|---|
| From | mike at sprokets dot net |
| Assigned | squiz |
| Status | Duplicate |
| Package | PHP_CodeSniffer |
| PHP Version | 5.2.0 |
| OS | FreeBSD |
| 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.