Skip to content

Tag reference

@inheritDoc

The @inheritDoc tag tells documentation generators to pull in the description and tags of the method or class being overridden or implemented, instead of repeating them. It saves an overriding method from having to restate a parent’s contract word for word when it isn’t changing that contract, only its implementation.

Grammar

"@inheritDoc" [ <Description> ]

Examples

As a standalone tag, inheriting the parent docblock wholesale.
/**
* @inheritDoc
*/
public function send(Message $message): bool
Used inline, to graft an addition onto the inherited text.
/**
* {@inheritDoc} Also flushes the queue before
* returning.
*/
public function send(Message $message): bool

Names by platform

phpdocumentor
@inheritDoc

Parsing an @inheritDoc tag produces an InheritDocTag instance:

final class InheritDocTag extends FlagTag {}

Being a pure marker, it adds nothing beyond the $name and optional $description every Tag already carries — the description carries only the text to append when the tag is used inline.

Defined by the PSR-19 draft’s @inheritDoc section and phpDocumentor’s inheritance guide (its tags-reference page 404s for this one).