From 86a9c40c6961c3c16e3429304dd42c747a343195 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 2 Sep 2019 02:40:57 +0200 Subject: [PATCH] PHPCS/Composer: update PHPCompatibility Composer: * `wimg/php-compatibility` has been abandoned for nearly a year. Use `phpcompatibility/php-compatibility` instead. * Use the latest version of PHPCompatibility. You were missing out on a lot of new checks, including the checks to make sure your code is compatible with the upcoming PHP 7.4. * Add the DealerDirect Composer PHPCS plugin. This plugin will handle setting the PHPCS `installed_paths` automatically. This also allows for referencing the ruleset by name instead of via the path in the ruleset, which is generally more stable. PHPCS ruleset: * Rename the ruleset to `phpcs.xml.dist` which will allow PHPCS to automatically pick up on it. No need to pass the `--standard=...` command-line argument anymore. Includes removing the argument from the Travis script. * Check for cross-version compatibility for the PHP versions officially supported. According to the `composer.json` file, this code should be compatible with PHP 5.6 and above. PHPCompatibility _was_ checking against PHP 5.5 up to PHP 7.1. The new `testVersion` actually checks against PHP 5.6 up to the latest version (upcoming 7.4 at this moment). Refs: * https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions * https://github.com/PHPCompatibility/PHPCompatibility/releases/ * https://github.com/Dealerdirect/phpcodesniffer-composer-installer --- .travis.yml | 2 +- composer.json | 3 ++- ruleset.xml => phpcs.xml.dist | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) rename ruleset.xml => phpcs.xml.dist (68%) diff --git a/.travis.yml b/.travis.yml index 269bffa..0b37d99 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ before_script: - composer install --dev --prefer-dist --no-interaction script: - - ./vendor/bin/phpcs --standard=ruleset.xml + - ./vendor/bin/phpcs - ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=coverage.xml after_success: diff --git a/composer.json b/composer.json index a39f4b9..3fa2e65 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,8 @@ "fzaninotto/faker": "^1.6", "friendsofphp/php-cs-fixer": "^2.3", "escapestudios/symfony2-coding-standard": "^3.0", - "wimg/php-compatibility": "^8.0" + "phpcompatibility/php-compatibility": "^9.0", + "dealerdirect/phpcodesniffer-composer-installer": "^0.5" }, "autoload": { "psr-4": { diff --git a/ruleset.xml b/phpcs.xml.dist similarity index 68% rename from ruleset.xml rename to phpcs.xml.dist index e9b6581..033fe04 100644 --- a/ruleset.xml +++ b/phpcs.xml.dist @@ -4,12 +4,12 @@ vendor/ - - + + - +