Skip to content

Commit

Permalink
PHPCS: use PHPCompatibilityWP (#44542)
Browse files Browse the repository at this point in the history
The current PHPCS ruleset `phpcs.xml.dist` uses the `PHPCompatibility` ruleset to flag code which could be incompatible with the supported PHP versions.

For code used in the Context of WordPress, a dedicated [`PHPCompatibilityWP`](https://github.com/PHPCompatibility/PHPCompatibilityWP) ruleset is available to prevent PHPCompatibility flagging code for which WordPress prevents polyfills.

Fixes 44541

Co-authored-by: jrfnl <[email protected]>
  • Loading branch information
jrfnl and jrfnl authored Sep 29, 2022
1 parent e8c1805 commit 2a51205
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"squizlabs/php_codesniffer": "^3.5",
"phpcompatibility/php-compatibility": "^9.3",
"phpcompatibility/phpcompatibility-wp": "^2.1.3",
"wp-coding-standards/wpcs": "^2.2",
"sirbrillig/phpcs-variable-analysis": "^2.8",
"spatie/phpunit-watcher": "^1.23",
Expand Down
4 changes: 3 additions & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<ruleset name="WordPress Coding Standards for Gutenberg Plugin">
<description>Sniffs for WordPress plugins, with minor modifications for Gutenberg</description>

<rule ref="PHPCompatibility"/>
<config name="testVersion" value="5.6-"/>
<rule ref="PHPCompatibilityWP">
<include-pattern>*\.php$</include-pattern>
</rule>

<rule ref="WordPress-Core"/>
<rule ref="WordPress-Docs"/>
Expand Down

0 comments on commit 2a51205

Please sign in to comment.