Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPCS/Composer: update PHPCompatibility #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jrfnl
Copy link

@jrfnl jrfnl commented Dec 5, 2019

Composer:

  • wimg/php-compatibility has been abandoned for over 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.
  • As of PHPCompatibility 8.0, the directory layout of the PHPCompatibility standard has been updated to work correctly with Composer, so no need for the custom scripts moving the files anymore.
  • 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.
  • 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.5 and above.
    PHPCompatibility was checking against PHP 5.5 up to PHP 7.0.
    The new testVersion actually checks against PHP 5.5 up to the latest version (7.4 at this moment).

Refs:

Suggestion:

  • You may also want to update the Symfony standard dependency which is currently at version 3.10.0 3.11.0
    Ref: https://github.com/djoos/Symfony-coding-standard/blob/master/UPGRADE-3.0.md
    Note: the ruleset name has been changed in version 3 from Symfony2 to Symfony.
  • And consider updating (or removing) the PHP_CodeSniffer dependency, of which the latest release is version 3.5.3 3.5.6
    I'd suggest removing it as it is not your dependency, but a dependency of the PHPCompatibility and the Symfony coding standards, so let those dependencies manage the version rather than doing that yourself.
    Ref: https://github.com/squizlabs/php_codesniffer/releases

Composer:
* `wimg/php-compatibility` has been abandoned for over 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.
* As of PHPCompatibility 8.0, the directory layout of the PHPCompatibility standard has been updated to work correctly with Composer, so no need for the custom scripts moving the files anymore.
* 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.
* 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.5 and above.
    PHPCompatibility _was_ checking against PHP 5.5 up to PHP 7.0.
    The new `testVersion` actually checks against PHP 5.5 up to the latest version (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

Suggestion:
* You may also want to update the Symfony standard dependency which is currently at version `3.11.0`
    Ref: https://github.com/djoos/Symfony-coding-standard/blob/master/UPGRADE-3.0.md
    Note: the ruleset name has been changed in version 3 from `Symfony2` to `Symfony`.
* And consider updating (or removing) the PHP_CodeSniffer dependency, of which the latest release is version `3.5.6`
    I'd suggest removing it as it is not _your_ dependency, but a dependency of the PHPCompatibility and the Symfony coding standards, so let those dependencies manage the version rather than doing that yourself.
    Ref: https://github.com/squizlabs/php_codesniffer/releases
@jrfnl jrfnl force-pushed the feature/update-phpcompatibility branch from 12f8896 to edf19c5 Compare October 7, 2020 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant