This PR adds the @codeCoverageIgnoreStart/@codeCoverageIgnoreEnd PHPUnit annotations to ignore, for the purposes of code coverage, a line that can't be tested. I considered doing this initially when I worked on improving code coverage for this sniff in #465, but I wrongly assumed that was not an option due to the Squiz.Commenting.InlineComment.InvalidEndChar error (which is part of the standard used by PHPCS).
What I failed to notice back then is that I was adding the annotation below a comment, and this triggers the error:
// Shouldn't be possible but may happen if external sniffs are using this method.
// @codeCoverageIgnoreStart
Adding the annotation before the comment as it is done in this PR does not trigger the error because the Squiz.Commenting.InlineComment sniff will only trigger the InvalidEndChar error if the first character of the comment is a letter.
I also considered using return true; // @codeCoverageIgnore, but this is not an option because it triggers Squiz.Commenting.PostStatementComment.Found.
Related issues/external references
Part of #146
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
[ ] This change is only breaking for integrators, not for external standards or end-users.
[ ] Documentation improvement
PR checklist
[x] I have checked there is no other PR open for the same change.
Description
This PR adds the
@codeCoverageIgnoreStart/@codeCoverageIgnoreEnd
PHPUnit annotations to ignore, for the purposes of code coverage, a line that can't be tested. I considered doing this initially when I worked on improving code coverage for this sniff in #465, but I wrongly assumed that was not an option due to theSquiz.Commenting.InlineComment.InvalidEndChar
error (which is part of the standard used by PHPCS).What I failed to notice back then is that I was adding the annotation below a comment, and this triggers the error:
Adding the annotation before the comment as it is done in this PR does not trigger the error because the
Squiz.Commenting.InlineComment
sniff will only trigger theInvalidEndChar
error if the first character of the comment is a letter.I also considered using
return true; // @codeCoverageIgnore
, but this is not an option because it triggersSquiz.Commenting.PostStatementComment.Found
.Related issues/external references
Part of #146
Types of changes
PR checklist