From 2a51205e8e3dcab71984ea7837329b67cdd936d5 Mon Sep 17 00:00:00 2001 From: Juliette <663378+jrfnl@users.noreply.github.com> Date: Thu, 29 Sep 2022 06:48:30 +0200 Subject: [PATCH] PHPCS: use PHPCompatibilityWP (#44542) 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 --- composer.json | 2 +- phpcs.xml.dist | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b91bb973ade417..3f16ba495a94ca 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 59c87341f6eb29..7473a44d819bc3 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -2,8 +2,10 @@ Sniffs for WordPress plugins, with minor modifications for Gutenberg - + + *\.php$ +