Loading coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php +8 −2 Original line number Diff line number Diff line Loading @@ -221,7 +221,10 @@ class DocCommentSniff implements Sniff // Remove any trailing white spaces which are detected by other sniffs. $shortContent = trim($shortContent); if (preg_match('|\p{Lu}|u', $shortContent[0]) === 0 && $shortContent !== '{@inheritdoc}' if (preg_match('|\p{Lu}|u', $shortContent[0]) === 0 // Allow both variants of inheritdoc comments. && $shortContent !== '{@inheritdoc}' && $shortContent !== '{@inheritDoc}' // Ignore Features module export files that just use the file name as // comment. && $shortContent !== basename($phpcsFile->getFilename()) Loading @@ -240,7 +243,10 @@ class DocCommentSniff implements Sniff } $lastChar = substr($shortContent, -1); if (in_array($lastChar, ['.', '!', '?', ')']) === false && $shortContent !== '{@inheritdoc}' if (in_array($lastChar, ['.', '!', '?', ')']) === false // Allow both variants of inheritdoc comments. && $shortContent !== '{@inheritdoc}' && $shortContent !== '{@inheritDoc}' // Ignore Features module export files that just use the file name as // comment. && $shortContent !== basename($phpcsFile->getFilename()) Loading coder_sniffer/Drupal/Sniffs/Commenting/VariableCommentSniff.php +4 −1 Original line number Diff line number Diff line Loading @@ -86,8 +86,11 @@ class VariableCommentSniff extends AbstractVariableSniff $commentStart = $tokens[$commentEnd]['comment_opener']; // Ignore variable comments that use inheritdoc, allow both variants. $commentContent = $phpcsFile->getTokensAsString($commentStart, ($commentEnd - $commentStart)); if (strpos($commentContent, '{@inheritdoc}') !== false) { if (strpos($commentContent, '{@inheritdoc}') !== false || strpos($commentContent, '{@inheritDoc}') !== false ) { return; } Loading coder_sniffer/Drupal/Test/good/good.php +10 −0 Original line number Diff line number Diff line Loading @@ -616,6 +616,11 @@ class Bar { */ protected $modules = ['node', 'user']; /** * {@inheritDoc} */ protected $allowedModules = ['node', 'user']; /** * Enter description here ... */ Loading Loading @@ -1098,6 +1103,11 @@ class Foo implements FooInterface { throw new Exception(); } /** * {@inheritDoc} */ public function test8() {} } t('Some long mulit-line Loading Loading
coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php +8 −2 Original line number Diff line number Diff line Loading @@ -221,7 +221,10 @@ class DocCommentSniff implements Sniff // Remove any trailing white spaces which are detected by other sniffs. $shortContent = trim($shortContent); if (preg_match('|\p{Lu}|u', $shortContent[0]) === 0 && $shortContent !== '{@inheritdoc}' if (preg_match('|\p{Lu}|u', $shortContent[0]) === 0 // Allow both variants of inheritdoc comments. && $shortContent !== '{@inheritdoc}' && $shortContent !== '{@inheritDoc}' // Ignore Features module export files that just use the file name as // comment. && $shortContent !== basename($phpcsFile->getFilename()) Loading @@ -240,7 +243,10 @@ class DocCommentSniff implements Sniff } $lastChar = substr($shortContent, -1); if (in_array($lastChar, ['.', '!', '?', ')']) === false && $shortContent !== '{@inheritdoc}' if (in_array($lastChar, ['.', '!', '?', ')']) === false // Allow both variants of inheritdoc comments. && $shortContent !== '{@inheritdoc}' && $shortContent !== '{@inheritDoc}' // Ignore Features module export files that just use the file name as // comment. && $shortContent !== basename($phpcsFile->getFilename()) Loading
coder_sniffer/Drupal/Sniffs/Commenting/VariableCommentSniff.php +4 −1 Original line number Diff line number Diff line Loading @@ -86,8 +86,11 @@ class VariableCommentSniff extends AbstractVariableSniff $commentStart = $tokens[$commentEnd]['comment_opener']; // Ignore variable comments that use inheritdoc, allow both variants. $commentContent = $phpcsFile->getTokensAsString($commentStart, ($commentEnd - $commentStart)); if (strpos($commentContent, '{@inheritdoc}') !== false) { if (strpos($commentContent, '{@inheritdoc}') !== false || strpos($commentContent, '{@inheritDoc}') !== false ) { return; } Loading
coder_sniffer/Drupal/Test/good/good.php +10 −0 Original line number Diff line number Diff line Loading @@ -616,6 +616,11 @@ class Bar { */ protected $modules = ['node', 'user']; /** * {@inheritDoc} */ protected $allowedModules = ['node', 'user']; /** * Enter description here ... */ Loading Loading @@ -1098,6 +1103,11 @@ class Foo implements FooInterface { throw new Exception(); } /** * {@inheritDoc} */ public function test8() {} } t('Some long mulit-line Loading