So I have an issue that I just learned from klausi I should probably open here first.
Earlier this year phpstorm started autocompleting {@inheritdoc} to {@inheritDoc}. And the latter would generate an error in coder with the following message:
404 | ERROR | [ ] Doc comment short description must start with a capital letter
404 | ERROR | [x] Doc comment short description must end with a full stop
And changing that comment to {@inheritdoc} would again make the coding standards pass.
So basically, this issue is only that I am now kind of annoyed that I have to manually edit the autocompleted docblock. Which I assume is the case for several others. :)
So the question is: Should we change it? Should we allow both? What should we do? :)
Attached also a more informative explaination in form of a gif.
Comments
Comment #2
eiriksmAdditional info: phpstorm does not seem to have plans to change or make a setting for this:
https://youtrack.jetbrains.com/issue/WI-46482
Comment #3
br0kenphpDocumentor 1.x was using the
{@inheritdoc}while 2.x uses{@inheritDoc}.- 2.x: https://docs.phpdoc.org/guides/inheritance.html
- 1.x: https://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutori...
However,
{@inheritDoc}(wrapped within brackets) means that only parent description is imported. Example:The resulting description for
B::myMethod()will beMethod's description. It can be extended.. This means we shouldn't use something like this:Comment #4
eiriksmSo basically this means we always have to change the autogenerated docblock when using phpstorm and there is no way around it? :)
Comment #5
br0kenIn my understanding, we should start writing
@inhertiDocwithout brackets.Quoting https://docs.phpdoc.org/guides/inheritance.html.
Comment #6
jhodgdonSee also this issue, which has more about what people want vs. what we are doing vs. what PHPDoc and other documentation things do with @inheritdoc and similar tags:
#1994890: Allow {@inheritdoc} and additional documentation
Comment #7
jhodgdonAlso please note that the Drupal project is *not* using PHPDoc standards.
Comment #8
drunken monkeyI also find this a bit annoying, but not a lot, and I think I’d find seeing both variants mixed even more annoying.
Changing completely to
{@inheritDoc}(instead of allowing both) seems to be completely out of the question, due to the sheer volume of completely unnecessary changes to our entire code base (Core plus nearly all contrib modules).So, while I sympathize, I think I’m more leaning in the -1 direction.
Comment #9
br0kenComment #10
klausiWe will allow both variants in Coder until this issue is settled. Popular IDEs such as PHPStorm are now pushing {@inheritDoc} in their autocomplete. That becomes very annoying for developers to fix that back to lower case d just to satisfy Coder.
Comment #11
br0kenComment #12
rosinegrean commentedComment #13
borisson_I agree, this has been really annoying.
I disagree, it's simple to automate and a lot easier to review compared to something like the array syntax conversion.
I would be +1 to completely change to the new notation.
Comment #14
drunken monkeyEasy to review, yes, but would still surely cause a lot of merge conflicts/necessitate patch re-rolls. (Or maybe not that many? Not sure how near to each other two changes must be to cause a conflict.)
But yes, “completely out of the question” was probably a bit too strong. In any case, this seems like something that would have to be evaluated and decided by a Core committer (or product manager or whatever role is appropriate here).
Comment #15
thierry.beeckmans commentedI would also +1 to change to the new notation.
But I do not like the IDE to enforce the new notation without making it configurable per project. There is an issue for PhpStorm related to this issue: https://youtrack.jetbrains.com/issue/WI-46482
Comment #16
andypostPhpStan adopted both https://github.com/phpstan/phpstan/pull/2054
Comment #17
kristen polHere's a concrete example of when a patch ended up with a mixture of the two and failed code review in order to have all lowercase:
https://www.drupal.org/project/drupal/issues/3126957#comment-13563516
Comment #18
dropa commentedAny updates on this? It seems that both passes the validation currently, but it is honestly ugly to have two allowed styles.
I wouldn't mind which one would be the allowed one, I could argue for both.
Also I've to mention that even by changing to newer syntax, the work required for the old codebase is next to nothing.
Comment #19
mondrakeFWIW, Symfony has abandoned the usage of @inheritdoc in 6.2,
See https://github.com/symfony/symfony/pull/47390
Comment #20
quietone commented@eiriksm, thanks for bringing this up.
As of 10.1.x, there is a sniff that standardizes on {@inheritdoc}, It was added in the related issue. This is in accord with existing policy. See {@inheritdoc}: Documentation inheritance.
I am changing this to Fixed. If I have missed something, re-open and explain what more there is to do.