Skip to content

Commit

Permalink
Deprecated items do not need a description (moodlehq#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Mar 29, 2024
1 parent baeb6d5 commit b425006
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions moodle/Sniffs/Commenting/DocblockDescriptionSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ public function process(File $phpcsFile, $stackPtr) {
}
$faultAtLine = $tokens[$stopAt]['line'];

$deprecatedTagPtrs = Docblocks::getMatchingDocTags($phpcsFile, $docblockPtr, '@deprecated');
if (count($deprecatedTagPtrs) > 0) {
// Skip if the docblock contains a @deprecated tag.
continue;
}

// Skip to the next T_DOC_COMMENT_STAR line. We do not accept single line docblocks.
$docblockLinePtr = $docblockPtr;
while ($docblockLinePtr = $phpcsFile->findNext(T_DOC_COMMENT_STAR, $docblockLinePtr + 1, $stopAt)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ trait trait_with_docblock_but_no_description {}
* @license
*/
function function_with_docblock_but_no_description() {}

/**
* @deprecated
*/
function function_with_deprecated_tag() {}

0 comments on commit b425006

Please sign in to comment.