Skip to content

Commit 71dbddd

Browse files
jrfnlGaryJones
andcommitted
VIPMinimum ruleset: replace strict comparison sniff
Includes adding PHPCSExtra to the `composer.json` configuration as that is now a direct dependency of VIPCS as VIPCS now uses one of its sniffs in the ruleset. Co-authored-by: Gary Jones <[email protected]>
1 parent 29920a0 commit 71dbddd

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

WordPress-VIP-Go/ruleset-test.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ rawurlencode(); // Ok.
165165
extract( array( 'a' => 1 ) ); // Error.
166166
$obj->extract(); // Ok.
167167

168-
// WordPress.PHP.StrictComparisons.LooseComparison
168+
// Universal.Operators.StrictComparisons
169169
true == $true; // Warning.
170170
false === $true; // Ok.
171171

WordPress-VIP-Go/ruleset.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
<rule ref="WordPress.PHP.DontExtract">
189189
<severity>3</severity>
190190
</rule>
191-
<rule ref="WordPress.PHP.StrictComparisons.LooseComparison">
191+
<rule ref="Universal.Operators.StrictComparisons">
192192
<severity>3</severity>
193193
</rule>
194194
<rule ref="WordPress.PHP.StrictInArray.MissingTrueStrict">

WordPressVIPMinimum/ruleset-test.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ new WP_Query( array(
7272
// WordPress.WP.GlobalVariablesOverride
7373
$GLOBALS['wpdb'] = 'test'; // Error.
7474

75-
// WordPress.PHP.StrictComparisons
75+
// Universal.Operators.StrictComparisons
7676
if ( true == $true ) { // Warning.
7777
}
7878

WordPressVIPMinimum/ruleset.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
<rule ref="WordPress.DB.DirectDatabaseQuery"/>
3737
<rule ref="WordPress.DB.SlowDBQuery"/>
3838
<rule ref="WordPress.WP.GlobalVariablesOverride"/>
39-
<rule ref="WordPress.PHP.StrictComparisons"/>
39+
<rule ref="Universal.Operators.StrictComparisons" phpcs-only="true">
40+
<type>warning</type>
41+
</rule>
4042
<rule ref="WordPress.CodeAnalysis.AssignmentInCondition"/>
4143
<rule ref="WordPress.PHP.StrictInArray"/>
4244
<rule ref="WordPress.PHP.DontExtract"/>

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=5.4",
20+
"phpcsstandards/phpcsextra": "^1.1.0",
2021
"phpcsstandards/phpcsutils": "^1.0.8",
2122
"sirbrillig/phpcs-variable-analysis": "^2.11.17",
2223
"squizlabs/php_codesniffer": "^3.7.2",

0 commit comments

Comments
 (0)