Skip to content

Commit

Permalink
Start using PHPCompatibilityWP
Browse files Browse the repository at this point in the history
PHPCompatibility has been moved to a dedicated GitHub organisation account and has released version 8.2.0.

A `PHPCompatibilityWP` ruleset is now also available in a separate repo which already excludes all back-fills/poly-fills which WP provides.

This ruleset should from now on be used to test the plugins.

For testing this repository, the "normal" PHPCompatibility ruleset should still be used as the code from this repo is not run within the context of WP, but in the context of PHPCS.

For more details, see the [release notes of the PHPCompatibility 8.2.0 release](https://github.com/PHPCompatibility/PHPCompatibility/releases/tag/8.2.0).
  • Loading branch information
jrfnl committed Jul 26, 2018
1 parent 1449120 commit 181d276
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ before_install:
# The post-install-cmd script takes care of the installed_paths.
else
# For testing the YoastCS native sniffs, the rest of the packages aren't needed.
composer remove wp-coding-standards/wpcs wimg/php-compatibility phpmd/phpmd --no-update
composer remove wp-coding-standards/wpcs phpcompatibility/phpcompatibility-wp phpmd/phpmd --no-update
# This will now only install the version of PHPCS to test against.
composer install --no-dev --no-suggest --no-scripts
# Set the installed_paths for the test environment.
Expand Down
34 changes: 2 additions & 32 deletions Yoast/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,38 +51,8 @@
Exclude a few select errorcodes for things back-filled by WP Core.
#############################################################################
-->
<config name="testVersion" value="5.2-99.0"/>
<rule ref="PHPCompatibility">
<!-- Whitelist PHP native classes, interfaces, functions and constants which
are back-filled by WP.
Based on:
* /wp-includes/compat.php
* /wp-includes/random_compat/random.php
-->
<exclude name="PHPCompatibility.PHP.NewClasses.errorFound"/>
<exclude name="PHPCompatibility.PHP.NewClasses.typeerrorFound"/>

<exclude name="PHPCompatibility.PHP.NewConstants.json_pretty_printFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.php_version_idFound"/>

<exclude name="PHPCompatibility.PHP.NewFunctions.hash_equalsFound"/>
<exclude name="PHPCompatibility.PHP.NewFunctions.json_last_error_msgFound"/>
<exclude name="PHPCompatibility.PHP.NewFunctions.random_intFound"/>
<exclude name="PHPCompatibility.PHP.NewFunctions.random_bytesFound"/>
<exclude name="PHPCompatibility.PHP.NewFunctions.array_replace_recursiveFound"/>

<exclude name="PHPCompatibility.PHP.NewInterfaces.jsonserializableFound"/>
</rule>

<!-- Whitelist the WP Core mysql_to_rfc3339() function. -->
<rule ref="PHPCompatibility.PHP.RemovedExtensions">
<properties>
<property name="functionWhitelist" type="array">
<element value="mysql_to_rfc3339"/>
</property>
</properties>
</rule>
<config name="testVersion" value="5.2-"/>
<rule ref="PHPCompatibilityWP"/>


<!--
Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@
"php": ">=5.4",
"squizlabs/php_codesniffer": "^3.3.0",
"wp-coding-standards/wpcs": "~0.14.0",
"wimg/php-compatibility": "^8.1.0",
"phpcompatibility/phpcompatibility-wp": "^1.0.0",
"phpmd/phpmd": "^2.2.3"
},
"require-dev": {
"phpcompatibility/php-compatibility": "^8.2.0",
},
"suggest" : {
"dealerdirect/phpcodesniffer-composer-installer": "This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
},
"scripts": {
"config-set" : [
"\"vendor/bin/phpcs\" --config-set installed_paths ../../..,../../../vendor/wp-coding-standards/wpcs,../../../vendor/wimg/php-compatibility",
"\"vendor/bin/phpcs\" --config-set installed_paths ../../..,../../../vendor/wp-coding-standards/wpcs,../../../vendor/phpcompatibility/php-compatibility,../../../vendor/phpcompatibility/phpcompatibility-wp",
"\"vendor/bin/phpcs\" --config-set default_standard Yoast"
],
"post-install-cmd": "composer config-set",
Expand Down

0 comments on commit 181d276

Please sign in to comment.