Skip to content

CS: clean up use statements #347

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

Merged
merged 3 commits into from
Feb 18, 2024
Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Feb 18, 2024

Description

CS: alphabetically order import use statements

Follow up on squizlabs/PHP_CodeSniffer#2714

Note: sniffs which have been removed in 4.0 have been excluded from this commit.

CS: always import all used classes [1]

... instead of using fully qualified global/PHP native classes inline.

CS: always import all used classes [2]

.... instead of importing the namespace and using partially qualified names.

Previously, this was not consistently applied, which led to near-miss bugs/code which only worked by accident, not by design, like in the Config, Fixer and Runner classes, where certain code only worked by the grace of the namespace of the class itself being the top-level PHP_CodeSniffer namespace.

Note: the JS/CSS tokenizers and a sniff which has been removed in 4.0 have been excluded from this commit.

Suggested changelog entry

N/A

Follow up on squizlabs/PHP_CodeSniffer 2714

Note: sniffs which have been removed in 4.0 have been excluded from this commit.
... instead of using fully qualified global/PHP native classes inline.
.... instead of importing the namespace and using partially qualified names.

Previously, this was not consistently applied, which led to near-miss bugs/code which only worked by accident, not by design, like in the `Config`, `Fixer` and `Runner` classes, where certain code only worked by the grace of the namespace of the class itself being the top-level `PHP_CodeSniffer` namespace.

Note: the JS/CSS tokenizers and a sniff which has been removed in 4.0 have been excluded from this commit.
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