thanosp/phpstorm-inheritdoc

Automatically add @inheritdoc when override / implement method from an interface

Closed this issue · 5 comments

It would be a super cool feature if the extension could add {@inheritdoc} everytime someone overrides
a method or implements a method from an interface.

Do you think this is a good feature request for this extension?

Thanks for the comment @dawehner
Inheritdoc was a way for documentation tools to combine doc block text with the parent so it still does not make sense to add it by default since you can't read it with a regular editor.
Might as well leave it blank or copy-paste the whole parent doc.

I think I would prefer to see the parent documentation automatically when the whole docblock is missing instead of adding inheritdoc. So have the same result as you are asking but without taking any action.
Do you agree?

Well, there are coding standards out there ... and many people use @inheritdoc simply to not require documentation on interface implementations, given that parts of it are simply redundant.

For me this is more about adding the @inheritdoc block into the sourcecode, so this maybe is not actually a good feature request for this project.

Hmm yes I guess you are right.
Right now you get two suggestions, remove or replace inheritdoc.
I can add a third one for methods without any docblock that actually puts it in place with inheritdoc.
So actually turn the plugin into an inheritdoc toggle. Each warning can be configured individually anyway so no harm done to anyone else.
Would that work?

I guess so

Hi @dawehner
I've implemented a new inspection in version 1.4.0 that will prompt you to add inheritDoc when no docblock is found and a docblock is found on one of the parents. Uploaded and waiting for approval.
You can choose to disable the other inspection that prompts you to remove the tag if you want.
I hope this does the trick :)