Skip to content

Commit

Permalink
Use two new sniffs from PHPCSExtra 1.2.0
Browse files Browse the repository at this point in the history
PHPCSExtra 1.2.0 was released yesterday and contains two new sniffs which IMO would be suitable for adding to WordPressCS.

Includes raising the minimum supported PHPCSExtra version. (will conflict with PR 2408 and will need rebase depending on which is merged first)

Ref:
* https://github.com/PHPCSStandards/PHPCSExtra/releases/tag/1.2.0
  • Loading branch information
jrfnl committed Dec 3, 2023
1 parent fe78958 commit 253a1fc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ When you introduce new `public` sniff properties, or your sniff extends a class
* WordPress-Coding-Standards
* PHP_CodeSniffer 3.7.2 or higher
* PHPCSUtils 1.0.8 or higher
* PHPCSExtra 1.1.0 or higher
* PHPCSExtra 1.2.0 or higher
* PHPUnit 4.x, 5.x, 6.x or 7.x

The WordPress Coding Standards use the `PHP_CodeSniffer` native unit test framework for unit testing the sniffs.
Expand Down
3 changes: 3 additions & 0 deletions WordPress-Core/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,9 @@
<!-- Important to prevent issues with content being sent before headers. -->
<rule ref="Generic.Files.ByteOrderMark"/>

<!-- Always have a lowertag PHP open tag. -->
<rule ref="Universal.PHP.LowercasePHPTag"/>

<!-- All line endings should be \n. -->
<rule ref="Generic.Files.LineEndings">
<properties>
Expand Down
3 changes: 3 additions & 0 deletions WordPress-Extra/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@
<!-- Detect useless "echo sprintf(...)". -->
<rule ref="Universal.CodeAnalysis.NoEchoSprintf"/>

<!-- Detect use of double negative `!!`. -->
<rule ref="Universal.CodeAnalysis.NoDoubleNegative"/>

<!--
#############################################################################
Code style sniffs for more recent PHP features and syntaxes.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"ext-xmlreader": "*",
"squizlabs/php_codesniffer": "^3.7.2",
"phpcsstandards/phpcsutils": "^1.0.8",
"phpcsstandards/phpcsextra": "^1.1.0"
"phpcsstandards/phpcsextra": "^1.2.0"
},
"require-dev": {
"phpcompatibility/php-compatibility": "^9.0",
Expand Down

0 comments on commit 253a1fc

Please sign in to comment.