diff --git a/SlevomatCodingStandard/Helpers/DocCommentHelper.php b/SlevomatCodingStandard/Helpers/DocCommentHelper.php index 40339b819..ffed9954d 100644 --- a/SlevomatCodingStandard/Helpers/DocCommentHelper.php +++ b/SlevomatCodingStandard/Helpers/DocCommentHelper.php @@ -12,6 +12,7 @@ use function in_array; use function preg_match; use function sprintf; +use function stripos; use function strtolower; use function trim; use const T_ABSTRACT; @@ -130,7 +131,7 @@ public static function hasInheritdocAnnotation(File $phpcsFile, int $pointer): b } foreach ($parsedDocComment->getNode()->children as $child) { - if ($child instanceof PhpDocTextNode && strtolower($child->text) === '{@inheritdoc}') { + if ($child instanceof PhpDocTextNode && stripos($child->text, '{@inheritdoc}') !== false) { return true; } diff --git a/tests/Sniffs/Commenting/data/uselessFunctionDocCommentSniffNoErrors.php b/tests/Sniffs/Commenting/data/uselessFunctionDocCommentSniffNoErrors.php index d6c4b3d34..a2bdbebda 100644 --- a/tests/Sniffs/Commenting/data/uselessFunctionDocCommentSniffNoErrors.php +++ b/tests/Sniffs/Commenting/data/uselessFunctionDocCommentSniffNoErrors.php @@ -11,11 +11,20 @@ public function __construct() /** * {@inheritdoc} */ - public function hasInheritdocAnnotation() + public function hasInheritDocAnnotation() { } + /** + * Description. + * + * {@inheritDoc} + */ + public function hasDescriptionAndInheritDocAnnotation() + { + } + /** * Description */ diff --git a/tests/Sniffs/TypeHints/data/returnTypeHintNoErrors.php b/tests/Sniffs/TypeHints/data/returnTypeHintNoErrors.php index cc3f6b54c..3c2eebabf 100644 --- a/tests/Sniffs/TypeHints/data/returnTypeHintNoErrors.php +++ b/tests/Sniffs/TypeHints/data/returnTypeHintNoErrors.php @@ -21,6 +21,15 @@ private function hasInheritdocAnnotation() return true; } + /** + * Description. + * + * {@inheritDoc} + */ + public function hasDescriptionAndInheritDocAnnotation() + { + } + /** * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint */