Update PHPCompatibility sniff names

The name of some sniffs changed in the most recent PHPCompatiblity version. This commit update all instances where those names are used in WooCommerce codebase.
This commit is contained in:
Rodrigo Primo 2018-11-21 11:08:26 -02:00
parent bfa9424d17
commit 2c8d006c37
8 changed files with 9 additions and 9 deletions

View File

@ -101,7 +101,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
*/
private function import_start() {
if ( function_exists( 'gc_enable' ) ) {
gc_enable(); // phpcs:ignore PHPCompatibility.PHP.NewFunctions.gc_enableFound
gc_enable(); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.gc_enableFound
}
wc_set_time_limit( 0 );
@ob_flush();

View File

@ -55,7 +55,7 @@ class WC_Geolite_Integration {
$iso_code = '';
try {
$reader = new MaxMind\Db\Reader( $this->database ); // phpcs:ignore PHPCompatibility.PHP.NewLanguageConstructs.t_ns_separatorFound
$reader = new MaxMind\Db\Reader( $this->database ); // phpcs:ignore PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound
$data = $reader->get( $ip_address );
if ( isset( $data['country']['iso_code'] ) ) {

View File

@ -265,7 +265,7 @@ class WC_Geolocation {
$dest_path = trailingslashit( $upload_dir['basedir'] ) . $database;
// Extract files with PharData. Tool built into PHP since 5.3.
$file = new PharData( $tmp_database_path ); // phpcs:ignore PHPCompatibility.PHP.NewClasses.phardataFound
$file = new PharData( $tmp_database_path ); // phpcs:ignore PHPCompatibility.Classes.NewClasses.phardataFound
$file_path = trailingslashit( $file->current()->getFileName() ) . $database;
// Extract under uploads directory.

View File

@ -85,7 +85,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
*/
public function apply_changes() {
if ( function_exists( 'array_replace' ) ) {
$this->data = array_replace( $this->data, $this->changes ); // phpcs:ignore PHPCompatibility.PHP.NewFunctions.array_replaceFound
$this->data = array_replace( $this->data, $this->changes ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.array_replaceFound
} else { // PHP 5.2 compatibility.
foreach ( $this->changes as $key => $change ) {
$this->data[ $key ] = $change;

View File

@ -171,7 +171,7 @@ abstract class WC_CSV_Exporter {
*/
public function send_headers() {
if ( function_exists( 'gc_enable' ) ) {
gc_enable(); // phpcs:ignore PHPCompatibility.PHP.NewFunctions.gc_enableFound
gc_enable(); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.gc_enableFound
}
if ( function_exists( 'apache_setenv' ) ) {
@apache_setenv( 'no-gzip', 1 ); // @codingStandardsIgnoreLine

View File

@ -166,7 +166,7 @@ class WC_Log_Handler_DB extends WC_Log_Handler {
* @see http://php.net/manual/en/function.debug-backtrace.php#refsect1-function.debug-backtrace-parameters
*/
if ( defined( 'DEBUG_BACKTRACE_IGNORE_ARGS' ) ) {
$debug_backtrace_arg = DEBUG_BACKTRACE_IGNORE_ARGS; // phpcs:ignore PHPCompatibility.PHP.NewConstants.debug_backtrace_ignore_argsFound
$debug_backtrace_arg = DEBUG_BACKTRACE_IGNORE_ARGS; // phpcs:ignore PHPCompatibility.Constants.NewConstants.debug_backtrace_ignore_argsFound
} else {
$debug_backtrace_arg = false;
}

View File

@ -1477,7 +1477,7 @@ function wc_get_shipping_method_count( $include_legacy = false ) {
* @param int $limit Time limit.
*/
function wc_set_time_limit( $limit = 0 ) {
if ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { // phpcs:ignore PHPCompatibility.PHP.DeprecatedIniDirectives.safe_modeDeprecatedRemoved
if ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
@set_time_limit( $limit ); // @codingStandardsIgnoreLine
}
}
@ -2115,7 +2115,7 @@ function wc_decimal_to_fraction( $decimal ) {
*/
function wc_round_discount( $value, $precision ) {
if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) ) {
return round( $value, $precision, WC_DISCOUNT_ROUNDING_MODE ); // phpcs:ignore PHPCompatibility.PHP.NewFunctionParameters.round_modeFound
return round( $value, $precision, WC_DISCOUNT_ROUNDING_MODE ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctionParameters.round_modeFound
}
if ( 2 === WC_DISCOUNT_ROUNDING_MODE ) {

View File

@ -228,7 +228,7 @@ function wc_round_tax_total( $value, $precision = null ) {
$precision = is_null( $precision ) ? wc_get_price_decimals() : intval( $precision );
if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) ) {
$rounded_tax = round( $value, $precision, wc_get_tax_rounding_mode() ); // phpcs:ignore PHPCompatibility.PHP.NewFunctionParameters.round_modeFound
$rounded_tax = round( $value, $precision, wc_get_tax_rounding_mode() ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctionParameters.round_modeFound
} elseif ( 2 === wc_get_tax_rounding_mode() ) {
$rounded_tax = wc_legacy_round_half_down( $value, $precision );
} else {