leyou
leyou

Reputation: 817

phpdoc not inheriting method parameters

In the parent class I have:

/**
 * Render the widget.
 * @param  array $options
 * @return string
 */
abstract public function render(array $options=[]);

In the child class I have:

/**
 * {@inheritDoc}
 */
public function render(array $options=[]) { /*...*/ }

But phpdoc gives me the following error for the child class:

Argument $options is missing from the Docblock of render()

Why?

Edit: if I understand it right at http://phpdoc.org/docs/latest/guides/inheritance.html, the method params should be inherited regardless the inheritDoc presence.

Upvotes: 1

Views: 2226

Answers (2)

Avinash Babu
Avinash Babu

Reputation: 6252

If you do not redeclare the method in the child class, then I think the structure of the various output converters will only show you a list of inherited methods. Some converters will include at least the Short Description of the method from the docblock (HTML:Smarty:PHP), whereas others do not

From the accepted answer here.

Upvotes: 0

Maks
Maks

Reputation: 82

@inheritDoc wasn't designed for this purpose.

The {@inheritdoc} inline tag is used in the class DocBlocks of child classes. phpDocumentor will automatically inherit the @author tag, @version tag, and @copyright tag from a parent class.

Have a look here for official documentation.

Upvotes: 1

Related Questions