Skip to content

Commit ae6d254

Browse files
authored
Merge pull request #2429 from WordPress/feature/update-for-phpcs-3.9.0
Extra: do not allow ambiguous conditions (needs PHPCS 3.9.0)
2 parents d15a466 + 92751a1 commit ae6d254

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

Diff for: .github/CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ When you introduce new `public` sniff properties, or your sniff extends a class
3939

4040
## Pre-requisites
4141
* WordPress-Coding-Standards
42-
* PHP_CodeSniffer 3.8.0 or higher
42+
* PHP_CodeSniffer 3.9.0 or higher
4343
* PHPCSUtils 1.0.9 or higher
4444
* PHPCSExtra 1.2.1 or higher
4545
* PHPUnit 4.x - 9.x

Diff for: Tests/RulesetCheck/class-ruleset-test.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Ruleset_Test {
6464
if ( preg_match( '`' . preg_quote( $param_a, '`' ) . '`i', $param_b ) === 1 ) {
6565
echo esc_html( "doublequoted $string" );
6666
} elseif ( $this->a ) {
67-
$ab = $a % $b + $c / $d && $param_a || $param_b >> $bitshift;
67+
$ab = $a % $b + $c / $d && ( $param_a || $param_b >> $bitshift );
6868
}
6969
};
7070

Diff for: WordPress-Extra/ruleset.xml

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
https://github.com/WordPress/WordPress-Coding-Standards/pull/809 -->
4242
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
4343

44+
<!-- Do not allow ambiguous conditions.
45+
https://github.com/WordPress/WordPress-Coding-Standards/issues/2429 -->
46+
<rule ref="Generic.CodeAnalysis.RequireExplicitBooleanOperatorPrecedence"/>
47+
4448
<!-- Check that functions use all parameters passed.
4549
https://github.com/WordPress/WordPress-Coding-Standards/issues/1510 -->
4650
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"ext-libxml": "*",
2222
"ext-tokenizer": "*",
2323
"ext-xmlreader": "*",
24-
"squizlabs/php_codesniffer": "^3.8.0",
24+
"squizlabs/php_codesniffer": "^3.9.0",
2525
"phpcsstandards/phpcsutils": "^1.0.9",
2626
"phpcsstandards/phpcsextra": "^1.2.1"
2727
},

0 commit comments

Comments
 (0)