Allow auto-fixing Generic.Commenting.DocComment#3752
Allow auto-fixing Generic.Commenting.DocComment#3752fredden wants to merge 8 commits intosquizlabs:masterfrom
Conversation
| // No content at all. | ||
| $error = 'Doc comment is empty'; | ||
| $phpcsFile->addError($error, $stackPtr, 'Empty'); | ||
| $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Empty'); |
There was a problem hiding this comment.
This is an opinionated fix, which - in my opinion - should not be included in PHPCS.
The Doc comment is empty error can lead to two distinctly different fixes/outcomes:
- Either the docblock should be removed (current fix).
- Or the docblock should be filled out.
As those different outcomes are mutually exclusive and the second one cannot be automated (at least not for the descriptions), I do not think this is an error which is suitable for auto-fixing.
There was a problem hiding this comment.
The whole standard is opinionated. ;)
Yes, I agree that there are two valid ways to satisfy the rule, and only one of these are able to be automated. That's why I chose this particular avenue.
Shall I remove the auto-fixing of this particular rule from this pull request?
There was a problem hiding this comment.
Shall I remove the auto-fixing of this particular rule from this pull request?
Not for me to say, I'm a contributor to this repo, just like you.
|
Thanks for the feedback. I'll respond to each block in the coming days. |
See also #3751 where this same change is being applied to the
4.0branch.Note that I did development on the
4.0branch for this and cherry-picked the resulting commit here. I couldn't get the tests to pass with themasterbranch easily on PHP 8.2.