Skip to content

Commit 67c1bcf

Browse files
committed
docs(InlineVariableComment): Add inline code comment (#3177757)
1 parent 525a2b7 commit 67c1bcf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

coder_sniffer/Drupal/Sniffs/Commenting/InlineVariableCommentSniff.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public function process(File $phpcsFile, $stackPtr)
8484
$warning = 'Inline @var declarations should use the /** */ delimiters';
8585

8686
if (strpos($tokens[$stackPtr]['content'], '#') === 0 || strpos($tokens[$stackPtr]['content'], '//') === 0) {
87+
// If this comment contains '*/' then the developer is mixing
88+
// inline comment styles. This could be commented out code,
89+
// so leave this line alone completely.
8790
if (strpos($tokens[$stackPtr]['content'], '*/') !== false) {
8891
return;
8992
}
@@ -102,7 +105,7 @@ public function process(File $phpcsFile, $stackPtr)
102105
if ($phpcsFile->addFixableWarning($warning, $stackPtr, 'VarInline') === true) {
103106
$phpcsFile->fixer->replaceToken($stackPtr, substr_replace($tokens[$stackPtr]['content'], '/**', 0, 2));
104107
}
105-
}
108+
}//end if
106109
}//end if
107110

108111
return;

0 commit comments

Comments
 (0)