Skip to content

Commit

Permalink
Update for PHPCompatibility 9.0.0
Browse files Browse the repository at this point in the history
[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).
  • Loading branch information
jrfnl committed Oct 8, 2018
1 parent 1cb6a74 commit b2e9f98
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 21 deletions.
20 changes: 10 additions & 10 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@
<config name="testVersion" value="5.3-"/>
<rule ref="PHPCompatibility">
<!-- Exclude PHP constants back-filled by PHPCS. -->
<exclude name="PHPCompatibility.PHP.NewConstants.t_finallyFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_yieldFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_ellipsisFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_powFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_pow_equalFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_spaceshipFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_coalesceFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_coalesce_equalFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_yield_fromFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_finallyFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_yieldFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_ellipsisFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_powFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_pow_equalFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_spaceshipFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_coalesceFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_coalesce_equalFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_yield_fromFound"/>

<!-- Unclear how, but appears to be back-filled anyhow, could be that PHP did so before the token was in use. -->
<exclude name="PHPCompatibility.PHP.NewConstants.t_traitFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_traitFound"/>
</rule>

</ruleset>
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions WordPress/Sniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
8 changes: 5 additions & 3 deletions phpcs.xml.dist.sample
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@

<!-- Check for PHP cross-version compatibility. -->
<!--
To enable this, the PHPCompatibility standard needs
To enable this, the PHPCompatibilityWP standard needs
to be installed.
See the readme for installation instructions:
https://github.com/wimg/PHPCompatibility
https://github.com/PHPCompatibility/PHPCompatibilityWP
For more information, also see:
https://github.com/PHPCompatibility/PHPCompatibility
-->
<!--
<config name="testVersion" value="5.2-"/>
<rule ref="PHPCompatibility"/>
<rule ref="PHPCompatibilityWP"/>
-->

<!--
Expand Down

0 comments on commit b2e9f98

Please sign in to comment.