Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion MediaWiki/Sniffs/Commenting/DocCommentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public function process( File $phpcsFile, $stackPtr ) {
// Ensure whitespace or tab after /** or *
if ( ( $tokens[$i]['code'] === T_DOC_COMMENT_OPEN_TAG ||
$tokens[$i]['code'] === T_DOC_COMMENT_STAR ) &&
$tokens[$i + 1]['code'] !== T_DOC_COMMENT_CLOSE_TAG &&
$tokens[$i + 1]['length'] > 0
) {
$commentStarSpacing = $i + 1;
Expand Down Expand Up @@ -284,7 +285,9 @@ public function process( File $phpcsFile, $stackPtr ) {
$phpcsFile->fixer->endChangeset();
}
}
} elseif ( $tokens[$commentEnd]['length'] > 0 ) {
} elseif ( $tokens[$commentEnd]['length'] > 0 &&
$tokens[$commentEnd - 1]['code'] !== T_DOC_COMMENT_OPEN_TAG
) {
// Ensure a whitespace before the token
$commentCloseSpacing = $commentEnd - 1;
$expectedSpaces = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function process( File $phpcsFile, $stackPtr ) {
}
} else {
// Determine whether multiple "*" appears right before the "*/"
if ( preg_match( '/(\*){2,}\//', $currentToken['content'] ) !== 0 ) {
if ( preg_match( '/[^\/*](\*){2,}\//', $currentToken['content'] ) !== 0 ) {
$fix = $phpcsFile->addFixableWarning(
'Invalid end of a single line comment',
$stackPtr,
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"ext-mbstring": "*",
"composer/semver": "3.3.2 || 3.4.0 || 3.4.2 || 3.4.3",
"composer/spdx-licenses": "~1.5.2",
"squizlabs/php_codesniffer": "3.9.0",
"squizlabs/php_codesniffer": "3.10.3",
"symfony/polyfill-php80": "^1.26.0",
"phpcsstandards/phpcsextra": "1.2.1"
},
Expand Down

0 comments on commit a520952

Please sign in to comment.