-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't suggest "Generate @inheritDoc" for methods when parameter list differs #404
Comments
I know @inheritdoc is a very gray area, but I've always been under the impression that it pulls in the long description from the parent doc. Most environments I've used pull the short description, long description and parameter list from the parent, but allow overriding each in the child. So a docblock like: /**
* @inheritDoc
*
* @param Foo bar
*/ would inherit the short and long descriptions and replace the parameter list in the parent. In most cases, when overriding a method, the intention of the method (it's short/long description) doesn't change, even when there are extra parameters. |
It depends; I think you're referring to The major problem is that currently there is no standard around docblocks, just some implementations. To make matters worse, some code bases (such as Symfony) have begun plopping As such, the To make matters worse, the PSR-5 did say that class A
{
/** Some summary */
public function foo() {}
}
class B
{
// The summary is inherited here.
/**
* @param string $additionalParam
*/
public function foo($additionalParam) {}
} Unfortunately the PSR-5 was abandoned, though, so we're back to square one. In the meantime, PHPStan - which is a great initiative in itself - has created another variant by introducing intersection types inside docblocks (which no other tool I've seen supports) as well as generic syntax (PhpStorm supports that too), which may conflict with the actual generics syntax if it is ever added to core PHP. Of course these projects are only adding what they feel is necessary for their own operation, but it is making it extremely hard to write docblocks that work harmoniously with all tools. I've thought about taking over the standard effort, but this project is already massive in scope for one guy, and that is one additional task I do not wish to tackle :/. |
You can't inherit the entire documentation from a parent method if its parameter list is different, as the documentation doesn't apply.
The text was updated successfully, but these errors were encountered: