Skip to content

Commit

Permalink
Fixed bug #852 : Generic.Commenting.DocComment not finding errors whe…
Browse files Browse the repository at this point in the history
…n long description is omitted
  • Loading branch information
gsherwood committed Jan 11, 2016
1 parent 0010bbe commit 498786a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
}

$long = $phpcsFile->findNext($empty, ($shortEnd + 1), ($commentEnd - 1), true);
if ($long === false) {
return;
}

if ($tokens[$long]['code'] === T_DOC_COMMENT_STRING) {
if ($long !== false && $tokens[$long]['code'] === T_DOC_COMMENT_STRING) {
if ($tokens[$long]['line'] !== ($tokens[$shortEnd]['line'] + 2)) {
$error = 'There must be exactly one blank line between descriptions in a doc comment';
$fix = $phpcsFile->addFixableError($error, $long, 'SpacingBetween');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,16 @@
/**
* 这是一条测试评论.
*/

/**
* I'm a function short-description
* @return boolean
*/

/**
* this is a test
* @author test
* @param boolean $foo blah
* @return boolean
* @param boolean $bar Blah.
*/
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,16 @@
/**
* 这是一条测试评论.
*/

/**
* I'm a function short-description
* @return boolean
*/

/**
* this is a test
* @author test
* @param boolean $foo blah
* @return boolean
* @param boolean $bar Blah.
*/
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ public function getErrorList()
158 => 1,
170 => 3,
171 => 3,
179 => 1,
183 => 1,
184 => 1,
185 => 2,
186 => 1,
187 => 2,
);

}//end getErrorList()
Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Fixed bug #828 : Null classname is tokenized as T_NULL instead of T_STRING
- Fixed bug #831 : PHPCS freezes in an infinite loop under Windows if no standard is passed
- Fixed bug #835 : PEAR.Functions.FunctionCallSignature broken when closure uses return types
- Fixed bug #852 : Generic.Commenting.DocComment not finding errors when long description is omitted
- Fixed bug #21005 : Incorrect indent detection when multiple properties are initialized to arrays
- Fixed bug #21010 : Incorrect missing colon detection in CSS when first style is not on new line
- Fixed bug #21011 : Incorrect error message text when newline found after opening brace
Expand Down

0 comments on commit 498786a

Please sign in to comment.