Bring back whitespace tolerance in selective phpcs:ignore
comments
#1278
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.
Description
To selectively ignore /disable/enable standards, sniff categories, sniffs or error codes, the
phpcs:ignore
,phpcs:disable
andphpcs:enable
annotations take a comma-separated list of rule references and allow for an optional-- comment
at the end of the annotation.While not strictly speaking "officially supported", the comma-separated list was whitespace tolerant in PHPCS 3.x.
This was unintentionally broken in PR #123, but only for the
phpcs:ignore
syntax. Thephpcs:disable
/phpcs:enable
annotations were not affected.This commit fixes this bug and brings back whitespace tolerance in the comma-separated list of rule references for
phpcs:ignore
.It also adds a set of tests for all three types of annotations to safeguard this. The addition of these tests effectively means that this whitespace tolerance is now officially supported.
Suggested changelog entry
Fixed: whitespace tolerance in
phpcs:ignore
comma-separated rule ref lists.Related issues/external references
Fixes #1277
Types of changes