Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed PHPCS annotations in multi-line tab-indented comments + not ignoring whole line for phpcs:set #1901

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Feb 17, 2018

This PR should go into 3.2.3 as it fixes two bugs in how the tokenizer deals with the new PHPCS annotations.

This PR will be easiest to review by looking at each commit individually.

Bug 1:
PHPCS annotations in tab-indented multi-line block comments were not recognized nor tokenized correctly.

Includes extensive unit tests.

Bug 2:
A phpcs:set would always cause the whole line to be ignored, even when it's used as an end-comment.

As phpcs:set annotations are not covered in the unit test file, I wasn't sure were to add the tests for this.

Other:
While staring at the code I saw a few minor other optimizations/typos, those have been fixed in separate commits.

…nnotation is complete line

This fixes a situation where a `phpcs:set` could be used at the end of a line and the whole line was always being ignored.

```php
do_something(); //phpcs:set Standard.Category.Sniff propertyName value
```

I wasn't sure where to add a unit test for this as there did not seem to be any for `phpcs:set` in the `errorSuppression.Test.php` file.
@gsherwood gsherwood added this to the 3.2.3 milestone Feb 18, 2018
@gsherwood gsherwood changed the title [Hotfix] Tokenizer/ErrorSuppression: fix two bugs in how the tokenizer deals with PHPCS annotations Fixed PHPCS annotations in multi-line tab-indented comments + not ignoring whole line for phpcs:set Feb 18, 2018
@gsherwood
Copy link
Member

Thanks for both of these fixes

@gsherwood gsherwood merged commit d9c6e9c into squizlabs:master Feb 18, 2018
gsherwood added a commit that referenced this pull request Feb 18, 2018
@jrfnl jrfnl deleted the feature/tokenizer-phpcs-annotations-various-minor-improvements branch February 19, 2018 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants