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

Core: add sniff to check spacing around spread operators #2100

Merged
merged 1 commit into from
Oct 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions WordPress-Core/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose">
<severity>0</severity>
</rule>
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterVariadic">
<severity>0</severity>
</rule>


<!-- Covers rule: Call a function, like so: my_function( $param1, func_param( $param2 ) ); -->
Expand Down Expand Up @@ -336,6 +339,23 @@
https://github.com/WordPress/WordPress-Coding-Standards/issues/1330 -->


<!--
#############################################################################
Handbook: Formatting - Spread operator.
Ref: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#spread-operator
#############################################################################
-->
<!-- Covers rule: When using the spread operator, there should be one space or a new line
with the appropriate indentation before the spread operator. -->
<!-- Covered by a variety of sniffs which deal with function calls, function declarations, array declarations. -->

<!-- Covers rule: There should be no spaces between the spread operator and the variable/function call it applies to. -->
<rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter"/>

<!-- Covers rule: When combining the spread operator with the reference operator (&), there should be no spaces between them.. -->
<!-- Covered by the Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterReference error code. -->


<!--
#############################################################################
Handbook: Object-Oriented Programming - Only One Object Structure (Class/Interface/Trait) per File.
Expand Down