Gergő Tisza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/376654 )
Change subject: Sniff & fix lowercase @inheritdoc ...................................................................... Sniff & fix lowercase @inheritdoc @inheritDoc seems to be the more official casing, per the (draft) PSR-5 [1], recent versions of phpDocumentor [2], and Java [3] (where the tag originates); but there is plenty of ambiguity, with old phpDocumentor [4], PHPStorm [5] and NetBeans [6] using the lowercase form. The old code just ignored @inheritdoc, leading to confusing error messages. Treat it as an error of its own instead (and auto-fix when asked). [1] https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md#61-making-inheritance-explicit-using-the-inheritdoc-tag [2] https://docs.phpdoc.org/guides/inheritance.html#the-inheritdoc-tag [3] http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#@inheritDoc [4] https://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.inlineinheritdoc.pkg.html [5] https://youtrack.jetbrains.com/issue/WI-10670#comment=27-330998 [6] https://blogs.oracle.com/netbeansphp/inheritdoc-tag-support-added Change-Id: If8dad50868f507643b71349c6788f41847f32ac9 --- M MediaWiki/Sniffs/Commenting/FunctionCommentSniff.php 1 file changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/codesniffer refs/changes/54/376654/1 diff --git a/MediaWiki/Sniffs/Commenting/FunctionCommentSniff.php b/MediaWiki/Sniffs/Commenting/FunctionCommentSniff.php index 90e8975..2c5ff92 100644 --- a/MediaWiki/Sniffs/Commenting/FunctionCommentSniff.php +++ b/MediaWiki/Sniffs/Commenting/FunctionCommentSniff.php @@ -147,6 +147,13 @@ } } elseif ( $tagText === '@inheritDoc' ) { $inheritDoc = true; + } elseif ( $tagText === '@inheritdoc' ) { + $inheritDoc = true; + $error = 'Incorrect capitalization of @inheritDoc'; + $fix = $phpcsFile->addFixableError( $error, $tag, 'LowercaseInheritDoc' ); + if ( $fix === true ) { + $phpcsFile->fixer->replaceToken( $tag, "@inheritDoc" ); + } } } if ( $inheritDoc ) { -- To view, visit https://gerrit.wikimedia.org/r/376654 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If8dad50868f507643b71349c6788f41847f32ac9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/tools/codesniffer Gerrit-Branch: master Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits