Skip to content

feat(sniffs): allow @phpstan directives in single-line comments#17

Merged
kodyhagen-gh merged 3 commits into
releasefrom
feat/phpstan-comment-exception
Jun 2, 2026
Merged

feat(sniffs): allow @phpstan directives in single-line comments#17
kodyhagen-gh merged 3 commits into
releasefrom
feat/phpstan-comment-exception

Conversation

@kodyhagen-gh

Copy link
Copy Markdown
Contributor

Summary

  • Adds @phpstan as an exempted pattern in SingleLineCommentSniff alongside the existing phpcs: and @codeCoverageIgnore exceptions
  • PHPStan ignore directives (@phpstan-ignore-next-line, @phpstan-ignore) require // syntax — they cannot be written as /* */ block comments
  • Without this exception, every PHPStan ignore comment in consuming projects requires a redundant trailing // phpcs:ignore BSUWordPressCS.Commenting.SingleLineComment
  • Updates SingleLineCommentUnitTest.inc with @phpstan fixture lines that are expected to pass without errors

Test plan

  • vendor/bin/phpunit — all 8 tests pass
  • vendor/bin/phpcs --standard=BSUWordPressCS ./Sniffs — sniff files lint clean
  • Verify // @phpstan-ignore-next-line identifier -- reason is not flagged
  • Verify // @phpstan-ignore identifier -- reason is not flagged

kodyhagen-gh and others added 3 commits May 21, 2026 13:15
PHPStan ignore directives require // syntax. Add @phpstan as an exempted
pattern in SingleLineCommentSniff alongside phpcs: and @codeCoverageIgnore.
Update the test fixture with @phpstan examples that are not flagged.
@kodyhagen-gh
kodyhagen-gh merged commit 34d63c7 into release Jun 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant