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

✨ New WordPress.WhiteSpace.ObjectOperatorSpacing sniff #2095

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Oct 27, 2022

This sniff largely defers to the upstream Squiz.WhiteSpace.ObjectOperatorSpacing sniff, which was previously already included.

The only real difference between the two sniffs is that for class resolution using ClassName::class, new lines around the :: object operator will not be ignored.

The WPCS sniff has the same default property settings as the upstream sniff and changes to the property values should be made in the ruleset.

Includes docs.
Includes unit tests covering the difference and safeguarding that the sniff doesn't overreach.

Related to: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#magic-constants

This sniff largely defers to the upstream `Squiz.WhiteSpace.ObjectOperatorSpacing` sniff, which was previously already included.

The only real difference between the two sniffs is that for class resolution using `ClassName::class`, new lines around the `::` object operator will not be ignored.

The WPCS sniff has the same default property settings as the upstream sniff and changes to the property values should be made in the ruleset.

Includes docs.
Includes unit tests covering the difference and safeguarding that the sniff doesn't overreach.
@jrfnl
Copy link
Member Author

jrfnl commented Oct 27, 2022

Note: there will be a follow-up PR to address the rest of that handbook section once PHPCSExtra 1.0.0-alpha4 has been tagged.

Copy link
Member

@GaryJones GaryJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GaryJones GaryJones merged commit 81d479c into develop Oct 27, 2022
@GaryJones GaryJones deleted the feature/new-wordpress-objectoperatorspacing-sniff branch October 27, 2022 19:01
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.

3 participants