diff --git a/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php b/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php index 0b2d342c..c58c97aa 100644 --- a/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php @@ -370,6 +370,7 @@ public function process(File $phpcsFile, $stackPtr) if ($tokens[$firstTag]['line'] !== ($tokens[$prev]['line'] + 2) && isset($fileShort) === false && in_array($tokens[$firstTag]['content'], ['@code', '@link', '@endlink']) === false + && isset(Tokens::$phpcsCommentTokens[$tokens[$prev]['code']]) === false ) { $error = 'There must be exactly one blank line before the tags in a doc comment'; $fix = $phpcsFile->addFixableError($error, $firstTag, 'SpacingBeforeTags'); diff --git a/tests/Drupal/good/good.php b/tests/Drupal/good/good.php index 357ba614..42c269ae 100644 --- a/tests/Drupal/good/good.php +++ b/tests/Drupal/good/good.php @@ -1986,3 +1986,20 @@ protected function getFallbackPluginId($plugin_id, array $configuration = []) { } } + +/** + * Provides a collection of condition plugins. + */ +class ConditionPluginCollection extends DefaultLazyPluginCollection { + + /** + * {@inheritdoc} + * + * phpcs:ignore Drupal.Commenting.FunctionComment.MissingReturnComment + * @return \Drupal\Core\Condition\ConditionInterface + */ + public function &get($instance_id) { + return 'x'; + } + +}