Merge pull request #17641 from woocommerce/fix/17625

Integrate PHPCompatibility sniffs
This commit is contained in:
Claudiu Lodromanean 2017-11-09 11:19:52 -08:00 committed by GitHub
commit a574401ddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 113 additions and 41 deletions

View File

@ -11,7 +11,8 @@
"squizlabs/php_codesniffer": "*",
"wp-coding-standards/wpcs": "0.13.1",
"phpunit/phpunit": "6.2.3",
"woocommerce/woocommerce-git-hooks": "1.0.2"
"woocommerce/woocommerce-git-hooks": "1.0.3",
"wimg/php-compatibility": "^8.0"
},
"scripts": {
"pre-update-cmd": [
@ -21,11 +22,9 @@
"WooCommerce\\GitHooks\\Hooks::preHooks"
],
"post-install-cmd": [
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs",
"WooCommerce\\GitHooks\\Hooks::postHooks"
],
"post-update-cmd": [
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs",
"WooCommerce\\GitHooks\\Hooks::postHooks"
]
}

121
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "5268174ad56d2293f14e24b931afeb63",
"content-hash": "990370f7f1455724582fc62049c57da5",
"packages": [
{
"name": "composer/installers",
@ -181,37 +181,40 @@
},
{
"name": "myclabs/deep-copy",
"version": "1.6.1",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102"
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102",
"reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
"php": "^5.6 || ^7.0"
},
"require-dev": {
"doctrine/collections": "1.*",
"phpunit/phpunit": "~4.1"
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
"phpunit/phpunit": "^4.1"
},
"type": "library",
"autoload": {
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
},
"files": [
"src/DeepCopy/deep_copy.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"homepage": "https://github.com/myclabs/DeepCopy",
"keywords": [
"clone",
"copy",
@ -219,7 +222,7 @@
"object",
"object graph"
],
"time": "2017-04-12T18:52:22+00:00"
"time": "2017-10-19T19:58:43+00:00"
},
{
"name": "phar-io/manifest",
@ -534,16 +537,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "5.2.2",
"version": "5.2.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "8ed1902a57849e117b5651fc1a5c48110946c06b"
"reference": "8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/8ed1902a57849e117b5651fc1a5c48110946c06b",
"reference": "8ed1902a57849e117b5651fc1a5c48110946c06b",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d",
"reference": "8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d",
"shasum": ""
},
"require": {
@ -552,7 +555,7 @@
"php": "^7.0",
"phpunit/php-file-iterator": "^1.4.2",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-token-stream": "^1.4.11 || ^2.0",
"phpunit/php-token-stream": "^2.0",
"sebastian/code-unit-reverse-lookup": "^1.0.1",
"sebastian/environment": "^3.0",
"sebastian/version": "^2.0.1",
@ -594,7 +597,7 @@
"testing",
"xunit"
],
"time": "2017-08-03T12:40:43+00:00"
"time": "2017-11-03T13:47:33+00:00"
},
{
"name": "phpunit/php-file-iterator",
@ -972,30 +975,30 @@
},
{
"name": "sebastian/comparator",
"version": "2.0.2",
"version": "2.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "ae068fede81d06e7bb9bb46a367210a3d3e1fe6a"
"reference": "1174d9018191e93cb9d719edec01257fc05f8158"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/ae068fede81d06e7bb9bb46a367210a3d3e1fe6a",
"reference": "ae068fede81d06e7bb9bb46a367210a3d3e1fe6a",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1174d9018191e93cb9d719edec01257fc05f8158",
"reference": "1174d9018191e93cb9d719edec01257fc05f8158",
"shasum": ""
},
"require": {
"php": "^7.0",
"sebastian/diff": "^2.0",
"sebastian/exporter": "^3.0"
"sebastian/exporter": "^3.1"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
"phpunit/phpunit": "^6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
"dev-master": "2.1.x-dev"
}
},
"autoload": {
@ -1026,13 +1029,13 @@
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "http://www.github.com/sebastianbergmann/comparator",
"homepage": "https://github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"time": "2017-08-03T07:14:59+00:00"
"time": "2017-11-03T07:16:52+00:00"
},
{
"name": "sebastian/diff",
@ -1626,17 +1629,69 @@
"time": "2016-11-23T20:04:58+00:00"
},
{
"name": "woocommerce/woocommerce-git-hooks",
"version": "1.0.2",
"name": "wimg/php-compatibility",
"version": "8.0.1",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-git-hooks.git",
"reference": "f0eea8aa392c822f0f3b9cd0b31f92bfa4de6a0c"
"url": "https://github.com/wimg/PHPCompatibility.git",
"reference": "4c4385fb891dff0501009670f988d4fe36785249"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-git-hooks/zipball/f0eea8aa392c822f0f3b9cd0b31f92bfa4de6a0c",
"reference": "f0eea8aa392c822f0f3b9cd0b31f92bfa4de6a0c",
"url": "https://api.github.com/repos/wimg/PHPCompatibility/zipball/4c4385fb891dff0501009670f988d4fe36785249",
"reference": "4c4385fb891dff0501009670f988d4fe36785249",
"shasum": ""
},
"require": {
"php": ">=5.3",
"squizlabs/php_codesniffer": "^2.2 || ^3.0.2"
},
"conflict": {
"squizlabs/php_codesniffer": "2.6.2"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.1"
},
"type": "phpcodesniffer-standard",
"autoload": {
"psr-4": {
"PHPCompatibility\\": "PHPCompatibility/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
],
"authors": [
{
"name": "Wim Godden",
"role": "lead"
}
],
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility.",
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
"keywords": [
"compatibility",
"phpcs",
"standards"
],
"time": "2017-08-07T19:39:05+00:00"
},
{
"name": "woocommerce/woocommerce-git-hooks",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-git-hooks.git",
"reference": "a9ea000877a996c57862aa81f0e61c04d8973d7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-git-hooks/zipball/a9ea000877a996c57862aa81f0e61c04d8973d7e",
"reference": "a9ea000877a996c57862aa81f0e61c04d8973d7e",
"shasum": ""
},
"type": "scripts",
@ -1656,7 +1711,7 @@
}
],
"description": "WooCommerce Git Hooks",
"time": "2017-09-27T16:03:36+00:00"
"time": "2017-11-09T18:27:22+00:00"
},
{
"name": "wp-coding-standards/wpcs",

View File

@ -171,7 +171,7 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
if ( $wpdb->use_mysqli ) {
$ver = mysqli_get_server_info( $wpdb->dbh );
} else {
$ver = mysql_get_server_info();
$ver = mysql_get_server_info(); // @codingStandardsIgnoreLine
}
if ( ! empty( $wpdb->is_mysql ) && ! stristr( $ver, 'MariaDB' ) ) : ?>
<tr>

View File

@ -619,7 +619,8 @@ class WC_API_Server {
* @return string
*/
public function get_raw_data() {
// $HTTP_RAW_POST_DATA is deprecated on PHP 5.6
// @codingStandardsIgnoreStart
// $HTTP_RAW_POST_DATA is deprecated on PHP 5.6.
if ( function_exists( 'phpversion' ) && version_compare( phpversion(), '5.6', '>=' ) ) {
return file_get_contents( 'php://input' );
}
@ -633,6 +634,7 @@ class WC_API_Server {
}
return $HTTP_RAW_POST_DATA;
// @codingStandardsIgnoreEnd
}
/**

View File

@ -651,7 +651,8 @@ class WC_API_Server {
* @return string
*/
public function get_raw_data() {
// $HTTP_RAW_POST_DATA is deprecated on PHP 5.6
// @codingStandardsIgnoreStart
// $HTTP_RAW_POST_DATA is deprecated on PHP 5.6.
if ( function_exists( 'phpversion' ) && version_compare( phpversion(), '5.6', '>=' ) ) {
return file_get_contents( 'php://input' );
}
@ -665,6 +666,7 @@ class WC_API_Server {
}
return $HTTP_RAW_POST_DATA;
// @codingStandardsIgnoreEnd
}
/**

View File

@ -658,7 +658,8 @@ class WC_API_Server {
* @return string
*/
public function get_raw_data() {
// $HTTP_RAW_POST_DATA is deprecated on PHP 5.6
// @codingStandardsIgnoreStart
// $HTTP_RAW_POST_DATA is deprecated on PHP 5.6.
if ( function_exists( 'phpversion' ) && version_compare( phpversion(), '5.6', '>=' ) ) {
return file_get_contents( 'php://input' );
}
@ -672,6 +673,7 @@ class WC_API_Server {
}
return $HTTP_RAW_POST_DATA;
// @codingStandardsIgnoreEnd
}
/**

View File

@ -324,7 +324,7 @@ class WC_Download_Handler {
private static function check_server_config() {
wc_set_time_limit( 0 );
if ( function_exists( 'get_magic_quotes_runtime' ) && get_magic_quotes_runtime() && version_compare( phpversion(), '5.4', '<' ) ) {
set_magic_quotes_runtime( 0 );
set_magic_quotes_runtime( 0 ); // @codingStandardsIgnoreLine
}
if ( function_exists( 'apache_setenv' ) ) {
@apache_setenv( 'no-gzip', 1 );

View File

@ -5,6 +5,18 @@
<description>WooCommerce dev PHP_CodeSniffer ruleset.</description>
<!-- Include WPCS and PHPCompatibility paths -->
<config name="installed_paths" value="vendor/wp-coding-standards/wpcs,vendor/wimg/php-compatibility" />
<!-- Exclude paths -->
<exclude-pattern>tests/cli/</exclude-pattern>
<exclude-pattern>apigen/</exclude-pattern>
<exclude-pattern>includes/gateways/simplify-commerce/includes/</exclude-pattern>
<exclude-pattern>includes/libraries/</exclude-pattern>
<exclude-pattern>includes/api/legacy/</exclude-pattern>
<rule ref="PHPCompatibility"/>
<rule ref="WordPress">
<exclude name="WordPress.VIP.RestrictedFunctions" />
<exclude name="WordPress.VIP.OrderByRand" />