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

Universal/NoLeadingBackslash: examine imports within a group use statement #167

Merged
merged 2 commits into from
Dec 1, 2022

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Dec 1, 2022

Universal/NoLeadingBackslash: minor code reorganization

Universal/NoLeadingBackslash: examine imports within a group use statement

Previously the sniff would only examine the start of a complete import statement, now it will also examine the partial imports within a group use statement.

A partial import statement within a group use starting with a leading backslash is actually a parse error, which normally gets ignored by PHPCS, but this is a very specific one, which is also auto-fixable, so may as well report it.

This new error for leading backslashes for partial import statements within a group use statement will be reported using a separate error code LeadingBackslashFoundInGroup.

Includes updated and extra unit tests.

…ement

Previously the sniff would only examine the start of a complete import statement, now it will also examine the partial imports within a group `use` statement.

A partial import statement within a group use starting with a leading backslash is actually a parse error, which normally gets ignored by PHPCS, but this is a very specific one, which is also auto-fixable, so may as well report it.

This new error for leading backslashes for partial import statements within a group use statement will be reported using a separate error code `LeadingBackslashFoundInGroup`.

Includes updated and extra unit tests.
@jrfnl jrfnl added this to the 1.0.0-alpha4 milestone Dec 1, 2022
@jrfnl jrfnl changed the title Universal/noleadingbackslash check inside group use Universal/NoLeadingBackslash: examine imports within a group use statement Dec 1, 2022
@jrfnl jrfnl merged commit 2827af2 into develop Dec 1, 2022
@jrfnl jrfnl deleted the universal/noleadingbackslash-check-inside-group-use branch December 1, 2022 23:07
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.

1 participant