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

Generic.WhiteSpace.Disallow[Space/Tab]Indent not inspecting content before open tag #1762

Conversation

Projects
None yet
2 participants
@jrfnl
Copy link
Contributor

jrfnl commented Nov 26, 2017

Both these sniffs include T_INLINE_HTML in the $checkTokens array, but would only start checking the file after the first PHP open tag, so if a file - such as a view - would start with inline HTML and only have the first PHP open tag on line 5, the first 4 lines would not be inspected, nor fixed for tabs vs spaces.

I have not added unit tests for this as it would require to either renumber all the unit tests òr to add a second unit test file for both sniffs. If so desired, I'd be happy to make those changes, but it seemed a bit over the top for such a small change.

WhiteSpace/DisallowSpace/TabIndent: bug fix - inspect complete file
Both these sniffs include `T_INLINE_HTML` in the `$checkTokens` array, but would only start checking the file **after** the first PHP open tag, so if a file - such as a view - would start with inline HTML and only have the first PHP open tag on line 5, the first 4 lines would not be inspected, nor fixed for tabs vs spaces.

I have not added unit tests for this as it would require to either renumber all the unit tests òr to add a second unit test file for both sniffs. If so desired, I'd be happy to make those changes, but it seemed a bit over the top for such a small change.

@gsherwood gsherwood added this to the 3.2.0 milestone Nov 27, 2017

@gsherwood gsherwood added the Bug label Nov 27, 2017

@gsherwood gsherwood changed the title WhiteSpace/DisallowSpace/TabIndent: bug fix - inspect complete file Generic.WhiteSpace.Disallow[Space/Tab]Indent not inspecting content before open tag Nov 27, 2017

@gsherwood

This comment has been minimized.

Copy link
Member

gsherwood commented Nov 27, 2017

Thanks for this fix.

@gsherwood gsherwood merged commit 0b2d95d into squizlabs:master Nov 27, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

gsherwood added a commit that referenced this pull request Nov 27, 2017

@jrfnl jrfnl deleted the jrfnl:feature/fix-whitespace-indent-sniffs-walk-complete-files branch Nov 27, 2017

@jrfnl

This comment has been minimized.

Copy link
Contributor Author

jrfnl commented Nov 27, 2017

You're welcome ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.