Skip to content
Snippets Groups Projects
Commit 67c1bcf2 authored by Klaus Purer's avatar Klaus Purer
Browse files

docs(InlineVariableComment): Add inline code comment (#3177757)

parent 525a2b70
No related branches found
No related tags found
No related merge requests found
...@@ -84,6 +84,9 @@ class InlineVariableCommentSniff implements Sniff ...@@ -84,6 +84,9 @@ class InlineVariableCommentSniff implements Sniff
$warning = 'Inline @var declarations should use the /** */ delimiters'; $warning = 'Inline @var declarations should use the /** */ delimiters';
if (strpos($tokens[$stackPtr]['content'], '#') === 0 || strpos($tokens[$stackPtr]['content'], '//') === 0) { if (strpos($tokens[$stackPtr]['content'], '#') === 0 || strpos($tokens[$stackPtr]['content'], '//') === 0) {
// If this comment contains '*/' then the developer is mixing
// inline comment styles. This could be commented out code,
// so leave this line alone completely.
if (strpos($tokens[$stackPtr]['content'], '*/') !== false) { if (strpos($tokens[$stackPtr]['content'], '*/') !== false) {
return; return;
} }
...@@ -102,7 +105,7 @@ class InlineVariableCommentSniff implements Sniff ...@@ -102,7 +105,7 @@ class InlineVariableCommentSniff implements Sniff
if ($phpcsFile->addFixableWarning($warning, $stackPtr, 'VarInline') === true) { if ($phpcsFile->addFixableWarning($warning, $stackPtr, 'VarInline') === true) {
$phpcsFile->fixer->replaceToken($stackPtr, substr_replace($tokens[$stackPtr]['content'], '/**', 0, 2)); $phpcsFile->fixer->replaceToken($stackPtr, substr_replace($tokens[$stackPtr]['content'], '/**', 0, 2));
} }
} }//end if
}//end if }//end if
return; return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment