1

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.

0

2 Answers 2

1

@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.

Sign up to request clarification or add additional context in comments.

2 Comments

Yes but does it prevent inheritance such as explained here phpdoc.org/docs/latest/guides/inheritance.html? Method params should be inherited regardless of inheritDoc, no?
Inheritance of nearly all tags should be expected just via object inheritance. The inheritdoc inline tag only ever had one purpose -- for you to include the parent's Long Description in a designated spot in the child's docblock. The tag has no other purpose whatsoever. Granted, for years I've seen it placed in child docblocks on the expectation that it was necessary for any inheritance of docblock info at all. I fear that some IDEs may have presumed the same and included it in their autotemplating.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.