Page MenuHomePhabricator

phpcs should validate @return phpdoc annotations of abstract methods
Closed, ResolvedPublicFeature

Description

Currently MediaWIki PHPcs sniff FunctionCommentSniff only validates @return annotations of methods with a body.
It does not complain about annotations like @return boolean or @return integer that should be written @return bool and @return int.

See, e.g. https://github.com/wikimedia/mediawiki-extensions-ProofreadPage/blob/3ae6d26ae1b0e6511052eea5bb49baa26c09df6b/includes/Pagination/Pagination.php#L25

The relevant line in FunctionCommentSniff is: https://github.com/wikimedia/mediawiki-tools-codesniffer/blob/5f813f727ee47d5c90981b44e82f0c5a0263e933/MediaWiki/Sniffs/Commenting/FunctionCommentSniff.php#L198

Event Timeline

MediaWiki.Commenting.FunctionComment.NotShortBoolReturn and MediaWiki.Commenting.FunctionComment.NotShortIntReturn should already cover these

Tpt renamed this task from phpcs should warn against common type variants like "boolean" or "integer" in PHPdoc comments to phpcs should validate @return phpdoc annotations of abstract methods.Jul 31 2021, 7:38 AM
Tpt updated the task description. (Show Details)

Change 709208 had a related patch set uploaded (by Tpt; author: Tpt):

[mediawiki/tools/codesniffer@master] Validates @return annotations of abstract methods

https://gerrit.wikimedia.org/r/709208

Change 709208 merged by jenkins-bot:

[mediawiki/tools/codesniffer@master] Validates @return annotations of abstract methods

https://gerrit.wikimedia.org/r/709208

Umherirrender assigned this task to Tpt.