Page MenuHomePhabricator

Ignore blocks with @inheritDoc
Closed, ResolvedPublic

Description

@inheritDoc should be exempt from documentation checking, since presumably we'll check whatever it is inheriting from.

Noted by @Jdforrester-WMF and @Anomie

Event Timeline

Also consider whether requiring /** @inheritDoc */ is even necessary on inherited methods.

Change 353623 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/tools/codesniffer@master] Don't require return/throws/param for doc blocks with @inheritDoc

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

Also consider whether requiring /** @inheritDoc */ is even necessary on inherited methods.

I read through https://www.phpdoc.org/docs/latest/guides/inheritance.html#the-inheritdoc-tag, and one of the points it made was that the @inheritDoc tag can be used to mark something as explicitly documented, versus something that someone forgot to document, and it just happens to inherit so it was skipped.

Also in MW-CS we don't keep track of inheritance stuff, so it wouldn't be technically possible right now.

Change 353623 merged by jenkins-bot:
[mediawiki/tools/codesniffer@master] Don't require return/throws/param for doc blocks with @inheritDoc

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

Note that while the PSR-5 draft has @inheritDoc, most other projects and tools use @inheritdoc, in all lowercase. (E.g. phpDocumentor, Drupal, PhpStorm.) At a minumum, there should be a specific warning in that case, instead of just ignoring the lowercase variant and warning about missing documentation.