Skip to content

Instantly share code, notes, and snippets.

@juhasz
Created September 5, 2014 12:18
Show Gist options
  • Save juhasz/ac8fe952a71de2aa6aba to your computer and use it in GitHub Desktop.
Save juhasz/ac8fe952a71de2aa6aba to your computer and use it in GitHub Desktop.
diff --git a/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php b/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php
index 61eb55b..030b239 100644
--- a/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php
+++ b/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php
@@ -106,7 +106,9 @@ class Drupal_Sniffs_Commenting_InlineCommentSniff implements PHP_CodeSniffer_Sni
}
// Only error once per comment.
- if (substr($tokens[$stackPtr]['content'], 0, 3) === '/**') {
+ $dockBlock = substr($tokens[$stackPtr]['content'], 0, 3) === '/**';
+ $varHint = substr($tokens[$stackPtr]['content'], 0, 9) === '/** @var ';
+ if ($dockBlock && !$varHint) {
$error = 'Inline doc block comments are not allowed; use "// Comment" instead';
$phpcsFile->addError($error, $stackPtr, 'DocBlock');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment