From b2e9f984b2006ce2a3eef637dbb300bfd51eded3 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 8 Oct 2018 02:03:39 +0200 Subject: [PATCH] Update for PHPCompatibility 9.0.0 [PHPCompatibility 9.0.0](https://github.com/PHPCompatibility/PHPCompatibility/releases/tag/9.0.0) has just been released and renames all sniffs. * Updated the version restrictions in `composer.json`. As the sniff names have changed, set minimum version. Note: PHPCompatibility 9.0.0 is still compatible with PHPCS 2.3.0 up to current, so this doesn't make a difference for running the sniffs. * Updated the WPCS native PHPCS ruleset for the new PHPCompatibility sniff codes. * Updated the inline annotations for the new PHPCompatibility sniff codes. * Updated the `phpcs.xml.dist.sample` to favour the `PHPCompatibilityWP` ruleset (was missed in PR 1426). * Updated a few more links to the PHPCompatibility repo for the move to an organisation (which were missed in PR 1426). --- .phpcs.xml.dist | 20 +++++++++---------- CHANGELOG.md | 2 +- WordPress/Sniff.php | 10 +++++----- .../PrefixAllGlobalsSniff.php | 2 +- composer.json | 2 +- phpcs.xml.dist.sample | 8 +++++--- 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 3153fcd76b..ec29a1708c 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -38,18 +38,18 @@ - - - - - - - - - + + + + + + + + + - + diff --git a/CHANGELOG.md b/CHANGELOG.md index f4d6bb8ca8..94e731cc59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -539,7 +539,7 @@ You are also encouraged to check the file history of any WPCS classes you extend - Ability to use a whitelist comment for tax queries for the `WordPress.VIP.SlowDBQuery` sniff. - Instructions on how to use WPCS with Atom and SublimeLinter to the Readme. - Reference to the [wiki](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki) to the Readme. -- Recommendation to also use the [PHPCompatibility](https://github.com/wimg/PHPCompatibility) ruleset to the Readme. +- Recommendation to also use the [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility) ruleset to the Readme. ### Changed - The minimum required PHP_CodeSniffer version to 2.6.0. diff --git a/WordPress/Sniff.php b/WordPress/Sniff.php index 24d599da3a..8af58bd0fe 100644 --- a/WordPress/Sniff.php +++ b/WordPress/Sniff.php @@ -2015,8 +2015,8 @@ public function strip_interpolated_variables( $string ) { * Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer, it * will detect whether the array has values or is empty. * - * @link https://github.com/wimg/PHPCompatibility/issues/120 - * @link https://github.com/wimg/PHPCompatibility/issues/152 + * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/120 + * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/152 * * @since 0.11.0 * @@ -2082,9 +2082,9 @@ public function does_function_call_have_parameters( $stackPtr ) { * Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer, * it will return the number of values in the array. * - * @link https://github.com/wimg/PHPCompatibility/issues/111 - * @link https://github.com/wimg/PHPCompatibility/issues/114 - * @link https://github.com/wimg/PHPCompatibility/issues/151 + * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/111 + * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/114 + * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/151 * * @since 0.11.0 * diff --git a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php index dd37c1e455..d9ff2b02a8 100644 --- a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php +++ b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php @@ -328,7 +328,7 @@ public function process_token( $stackPtr ) { break; case 'T_TRAIT': - // phpcs:ignore PHPCompatibility.PHP.NewFunctions.trait_existsFound + // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.trait_existsFound if ( function_exists( '\trait_exists' ) && trait_exists( '\\' . $item_name, false ) ) { // Backfill for PHP native trait. return; diff --git a/composer.json b/composer.json index 027b7a5b0d..db2f784258 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "squizlabs/php_codesniffer": "^2.9.0 || ^3.0.2" }, "require-dev": { - "phpcompatibility/php-compatibility": "*" + "phpcompatibility/php-compatibility": "^9.0" }, "suggest": { "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." diff --git a/phpcs.xml.dist.sample b/phpcs.xml.dist.sample index 411d59a9a2..4563369602 100644 --- a/phpcs.xml.dist.sample +++ b/phpcs.xml.dist.sample @@ -48,14 +48,16 @@