|
@@ 164-168 (lines=5) @@
|
| 161 |
|
while (T_WHITESPACE === $tokens[$firstPreviousSpacePtr]['code'] && $firstPreviousSpacePtr > 0) { |
| 162 |
|
$firstPreviousSpacePtr--; |
| 163 |
|
} |
| 164 |
|
if ($tokens[$firstPreviousSpacePtr]['line'] >= $tokens[$firstCommentPtr]['line'] - 1) { |
| 165 |
|
$error = "Please add a blank line before comments counting more than {$this->longCommentLimit} lines."; |
| 166 |
|
$phpcsFile->addError($error, $firstCommentPtr, 'LongCommentWithoutSpacing'); |
| 167 |
|
$hasBlankLinesAround = FALSE; |
| 168 |
|
} |
| 169 |
|
|
| 170 |
|
// check blank line after the long comment |
| 171 |
|
$lastCommentPtr = end($commentLines); |
|
@@ 176-180 (lines=5) @@
|
| 173 |
|
while (T_WHITESPACE === $tokens[$lastNextSpacePtr]['code'] && $lastNextSpacePtr < count($tokens)) { |
| 174 |
|
$lastNextSpacePtr++; |
| 175 |
|
} |
| 176 |
|
if ($tokens[$lastNextSpacePtr]['line'] <= $tokens[$lastCommentPtr]['line'] + 1) { |
| 177 |
|
$error = "Please add a blank line after comments counting more than {$this->longCommentLimit} lines."; |
| 178 |
|
$phpcsFile->addError($error, $lastCommentPtr, 'LongCommentWithoutSpacing'); |
| 179 |
|
$hasBlankLinesAround = FALSE; |
| 180 |
|
} |
| 181 |
|
|
| 182 |
|
return $hasBlankLinesAround; |
| 183 |
|
}//end _checkBlanksAroundLongComment() |