Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed bug #20240 : Squiz block comment sniff fails when newline present

  • Loading branch information...
commit 34903295738c66ad8ea87c04ad6eaa1477700868 1 parent 32e103b
@gsherwood gsherwood authored
View
4 CodeSniffer/Standards/Squiz/Sniffs/Commenting/BlockCommentSniff.php
@@ -59,7 +59,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
- // If its an inline comment return.
+ // If it's an inline comment, return.
if (substr($tokens[$stackPtr]['content'], 0, 2) !== '/*') {
return;
}
@@ -232,7 +232,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$commentCloser = $commentLines[$lastIndex];
$contentAfter = $phpcsFile->findNext(T_WHITESPACE, ($commentCloser + 1), null, true);
- if (($tokens[$contentAfter]['line'] - $tokens[$commentCloser]['line']) < 2) {
+ if ($contentAfter !== false && ($tokens[$contentAfter]['line'] - $tokens[$commentCloser]['line']) < 2) {
$error = 'Empty line required after block comment';
$phpcsFile->addError($error, $commentCloser, 'NoEmptyLineAfter');
}
View
1  package.xml
@@ -45,6 +45,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Fixed bug #20213 : Invalid error, Inline IF must be declared on single line
- Fixed bug #20225 : array_merge() that takes more than one line generates error
- Fixed bug #20230 : Squiz ControlStructureSpacing sniff assumes specific condition formatting
+ - Fixed bug #20240 : Squiz block comment sniff fails when newline present
- Fixed bug #20247 : The Squiz.WhiteSpace.ControlStructureSpacing sniff and do-while
-- Thanks to Alexander Obuhovich for the patch
- Fixed bug #20248 : The Squiz_Sniffs_WhiteSpace_ControlStructureSpacingSniff sniff and empty scope
Please sign in to comment.
Something went wrong with that request. Please try again.