Skip to content

Commit

Permalink
Merge pull request #2429 from WordPress/feature/update-for-phpcs-3.9.0
Browse files Browse the repository at this point in the history
Extra: do not allow ambiguous conditions (needs PHPCS 3.9.0)
  • Loading branch information
GaryJones committed Mar 5, 2024
2 parents d15a466 + 92751a1 commit ae6d254
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ When you introduce new `public` sniff properties, or your sniff extends a class

## Pre-requisites
* WordPress-Coding-Standards
* PHP_CodeSniffer 3.8.0 or higher
* PHP_CodeSniffer 3.9.0 or higher
* PHPCSUtils 1.0.9 or higher
* PHPCSExtra 1.2.1 or higher
* PHPUnit 4.x - 9.x
Expand Down
2 changes: 1 addition & 1 deletion Tests/RulesetCheck/class-ruleset-test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Ruleset_Test {
if ( preg_match( '`' . preg_quote( $param_a, '`' ) . '`i', $param_b ) === 1 ) {
echo esc_html( "doublequoted $string" );
} elseif ( $this->a ) {
$ab = $a % $b + $c / $d && $param_a || $param_b >> $bitshift;
$ab = $a % $b + $c / $d && ( $param_a || $param_b >> $bitshift );
}
};

Expand Down
4 changes: 4 additions & 0 deletions WordPress-Extra/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
https://github.com/WordPress/WordPress-Coding-Standards/pull/809 -->
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>

<!-- Do not allow ambiguous conditions.
https://github.com/WordPress/WordPress-Coding-Standards/issues/2429 -->
<rule ref="Generic.CodeAnalysis.RequireExplicitBooleanOperatorPrecedence"/>

<!-- Check that functions use all parameters passed.
https://github.com/WordPress/WordPress-Coding-Standards/issues/1510 -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"ext-libxml": "*",
"ext-tokenizer": "*",
"ext-xmlreader": "*",
"squizlabs/php_codesniffer": "^3.8.0",
"squizlabs/php_codesniffer": "^3.9.0",
"phpcsstandards/phpcsutils": "^1.0.9",
"phpcsstandards/phpcsextra": "^1.2.1"
},
Expand Down

0 comments on commit ae6d254

Please sign in to comment.