Skip to content

Commit bf5993d

Browse files
committed
Squiz BlockCommentSniff no longer reports that a blank line between a scope closer and block comment is invalid
1 parent 5cc2790 commit bf5993d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CodeSniffer/Standards/Squiz/Sniffs/Commenting/BlockCommentSniff.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
216216

217217
// Check that the lines before and after this comment are blank.
218218
$contentBefore = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
219-
if (isset($tokens[$contentBefore]['scope_closer']) === true) {
219+
if (isset($tokens[$contentBefore]['scope_closer']) === true
220+
&& $tokens[$contentBefore]['scope_opener'] === $contentBefore
221+
) {
220222
if (($tokens[$stackPtr]['line'] - $tokens[$contentBefore]['line']) !== 1) {
221223
$error = 'Empty line not required before block comment';
222224
$phpcsFile->addError($error, $stackPtr, 'HasEmptyLineBefore');

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
4848
-- This allows you to create wrapper scripts for PHPCS more easily
4949
- PSR2 MethodDeclarationSniff no longer generates a notice for methods named "_"
5050
-- Thanks to Bart S for the patch
51+
- Squiz BlockCommentSniff no longer reports that a blank line between a scope closer and block comment is invalid
5152
- Generic DuplicateClassNameSniff no longer reports an invalid error if multiple PHP open tags exist in a file
5253
- Generic DuplicateClassNameSniff no longer reports duplicate errors if multiple PHP open tags exist in a file
5354
- Fixed bug #19819 : Freeze with syntax error in use statement

0 commit comments

Comments
 (0)