Commenting/CodeCoverageIgnoreDeprecated: apply rule to OO docblocks too + small other improvements #329
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commenting/CodeCoverageIgnoreDeprecated: minor test improvements
Add some more variation of method prefixes to the tests to safeguard the handling of those better.
Commenting/CodeCoverageIgnoreDeprecated: minor code simplifications
Remove two redundant conditions.
The first is not needed as it's not actually important what token type we encounter, the only thing important is that there is a known attribute opener to skip to.
The second is not needed as the
findPrevious()
call will always find something, if nothing else, it will find the docblock opener, so checking forfalse
is unnecessary.Commenting/CodeCoverageIgnoreDeprecated: check OO docblocks too
As things were, the
Yoast.Commenting.CodeCoverageIgnoreDeprecated
sniff only checked function docblocks to find a@deprecated
tag and verify this was accompanied by a@codeCoverageIgnore
tag.However, if a complete class (or other OO structure) is deprecated, we can also safely ignore it for code coverage checking.
This updates the sniff to also check the docblocks of OO structures for
@deprecated
tags and verifies that, if those are found, they are accompanied by a@codeCoverageIgnore
tag.Two exceptions are made:
Includes tests.