Fix Generic.Formatting.MultipleStatementAlignment violations

This commit fixes all violations of the Generic.Formatting.MultipleStatementAlignment sniff automatically using phpcbf.
This commit is contained in:
Rodrigo Primo 2019-12-20 14:21:08 -03:00
parent 179dd7003e
commit 62d6b05b58
24 changed files with 43 additions and 43 deletions

View File

@ -80,6 +80,6 @@ abstract class WC_Integration extends WC_Settings_API {
*/
public function init_settings() {
parent::init_settings();
$this->enabled = ! empty( $this->settings['enabled'] ) && 'yes' === $this->settings['enabled'] ? 'yes' : 'no';
$this->enabled = ! empty( $this->settings['enabled'] ) && 'yes' === $this->settings['enabled'] ? 'yes' : 'no';
}
}

View File

@ -39,9 +39,9 @@ abstract class WC_Log_Handler implements WC_Log_Handler_Interface {
* @return string Formatted log entry.
*/
protected static function format_entry( $timestamp, $level, $message, $context ) {
$time_string = self::format_time( $timestamp );
$time_string = self::format_time( $timestamp );
$level_string = strtoupper( $level );
$entry = "{$time_string} {$level_string} {$message}";
$entry = "{$time_string} {$level_string} {$message}";
return apply_filters( 'woocommerce_format_log_entry', $entry, array(
'timestamp' => $timestamp,

View File

@ -197,7 +197,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
*/
public function init_settings() {
parent::init_settings();
$this->enabled = ! empty( $this->settings['enabled'] ) && 'yes' === $this->settings['enabled'] ? 'yes' : 'no';
$this->enabled = ! empty( $this->settings['enabled'] ) && 'yes' === $this->settings['enabled'] ? 'yes' : 'no';
}
/**
@ -237,7 +237,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
*/
public function get_transaction_url( $order ) {
$return_url = '';
$return_url = '';
$transaction_id = $order->get_transaction_id();
if ( ! empty( $this->view_transaction_url ) && ! empty( $transaction_id ) ) {
@ -254,7 +254,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
*/
protected function get_order_total() {
$total = 0;
$total = 0;
$order_id = absint( get_query_var( 'order-pay' ) );
// Gets order total from "pay for order" page.

View File

@ -61,9 +61,9 @@ abstract class WC_Abstract_Privacy {
* @param int $erase_priority Erase priority.
*/
public function __construct( $name = '', $export_priority = 5, $erase_priority = 10 ) {
$this->name = $name;
$this->name = $name;
$this->export_priority = $export_priority;
$this->erase_priority = $erase_priority;
$this->erase_priority = $erase_priority;
$this->init();
}

View File

@ -537,7 +537,7 @@ class WC_Admin_Addons {
*/
public static function output() {
$section = isset( $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : '_featured';
$search = isset( $_GET['search'] ) ? sanitize_text_field( wp_unslash( $_GET['search'] ) ) : '';
$search = isset( $_GET['search'] ) ? sanitize_text_field( wp_unslash( $_GET['search'] ) ) : '';
if ( isset( $_GET['section'] ) && 'helper' === $_GET['section'] ) {
do_action( 'woocommerce_helper_output' );

View File

@ -295,7 +295,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
if ( $post_id && in_array( get_post_type( $post_id ), wc_get_order_types( 'order-meta-boxes' ) ) ) {
$order = wc_get_order( $post_id );
if ( $order ) {
$currency = $order->get_currency();
$currency = $order->get_currency();
if ( ! $order->has_status( array( 'pending', 'failed', 'cancelled' ) ) ) {
$remove_item_notice = $remove_item_notice . ' ' . __( "You may need to manually restore the item's stock.", 'woocommerce' );

View File

@ -1676,7 +1676,7 @@ class WC_Admin_Setup_Wizard {
if ( in_array( $klarna_or_square, array( 'klarna_checkout', 'klarna_payments' ), true ) ) {
$gateways[ $klarna_or_square ]['enabled'] = true;
$gateways[ $klarna_or_square ]['featured'] = false;
$offered_gateways += array(
$offered_gateways += array(
$klarna_or_square => $gateways[ $klarna_or_square ],
);
} else {

View File

@ -124,11 +124,11 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
$show_columns['is_in_stock'] = __( 'Stock', 'woocommerce' );
}
$show_columns['price'] = __( 'Price', 'woocommerce' );
$show_columns['product_cat'] = __( 'Categories', 'woocommerce' );
$show_columns['product_tag'] = __( 'Tags', 'woocommerce' );
$show_columns['featured'] = '<span class="wc-featured parent-tips" data-tip="' . esc_attr__( 'Featured', 'woocommerce' ) . '">' . __( 'Featured', 'woocommerce' ) . '</span>';
$show_columns['date'] = __( 'Date', 'woocommerce' );
$show_columns['price'] = __( 'Price', 'woocommerce' );
$show_columns['product_cat'] = __( 'Categories', 'woocommerce' );
$show_columns['product_tag'] = __( 'Tags', 'woocommerce' );
$show_columns['featured'] = '<span class="wc-featured parent-tips" data-tip="' . esc_attr__( 'Featured', 'woocommerce' ) . '">' . __( 'Featured', 'woocommerce' ) . '</span>';
$show_columns['date'] = __( 'Date', 'woocommerce' );
return array_merge( $show_columns, $columns );
}

View File

@ -160,8 +160,8 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report {
$tax_rows = array();
foreach ( $tax_rows_orders + $tax_rows_partial_refunds as $tax_row ) {
$key = $tax_row->rate_id;
$tax_rows[ $key ] = isset( $tax_rows[ $key ] ) ? $tax_rows[ $key ] : (object) array(
$key = $tax_row->rate_id;
$tax_rows[ $key ] = isset( $tax_rows[ $key ] ) ? $tax_rows[ $key ] : (object) array(
'tax_amount' => 0,
'shipping_tax_amount' => 0,
'total_orders' => 0,
@ -173,8 +173,8 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report {
}
foreach ( $tax_rows_full_refunds as $tax_row ) {
$key = $tax_row->rate_id;
$tax_rows[ $key ] = isset( $tax_rows[ $key ] ) ? $tax_rows[ $key ] : (object) array(
$key = $tax_row->rate_id;
$tax_rows[ $key ] = isset( $tax_rows[ $key ] ) ? $tax_rows[ $key ] : (object) array(
'tax_amount' => 0,
'shipping_tax_amount' => 0,
'total_orders' => 0,

View File

@ -290,8 +290,8 @@ class WC_Query {
}
} elseif ( ! empty( $_GET['orderby'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$q->set( 'page_id', (int) get_option( 'page_on_front' ) );
$q->is_page = true;
$q->is_home = false;
$q->is_page = true;
$q->is_home = false;
$q->is_singular = true;
}
}

View File

@ -72,7 +72,7 @@ class WC_Rate_Limiter {
* @return bool True if the option setting was successful, false otherwise.
*/
public static function set_rate_limit( $action_id, $delay ) {
$option_name = self::storage_id( $action_id );
$option_name = self::storage_id( $action_id );
$next_try_allowed_at = time() + $delay;
return update_option( $option_name, $next_try_allowed_at );
}

View File

@ -29,9 +29,9 @@ class WC_Shipping_Zones {
$zones = array();
foreach ( $raw_zones as $raw_zone ) {
$zone = new WC_Shipping_Zone( $raw_zone );
$zones[ $zone->get_id() ] = $zone->get_data();
$zones[ $zone->get_id() ]['zone_id'] = $zone->get_id();
$zone = new WC_Shipping_Zone( $raw_zone );
$zones[ $zone->get_id() ] = $zone->get_data();
$zones[ $zone->get_id() ]['zone_id'] = $zone->get_id();
$zones[ $zone->get_id() ]['formatted_zone_location'] = $zone->get_formatted_location();
$zones[ $zone->get_id() ]['shipping_methods'] = $zone->get_shipping_methods( false, $context );
}

View File

@ -674,7 +674,7 @@ class WC_Tax {
*/
public static function get_rate_percent( $key_or_rate ) {
$rate_percent_value = self::get_rate_percent_value( $key_or_rate );
$tax_rate_id = is_object( $key_or_rate ) ? $key_or_rate->tax_rate_id : $key_or_rate;
$tax_rate_id = is_object( $key_or_rate ) ? $key_or_rate->tax_rate_id : $key_or_rate;
return apply_filters( 'woocommerce_rate_percent', $rate_percent_value . '%', $tax_rate_id );
}

View File

@ -372,7 +372,7 @@ class WC_Webhook_Data_Store implements WC_Webhook_Data_Store_Interface {
protected function get_webhook_count( $status = 'active' ) {
global $wpdb;
$cache_key = WC_Cache_Helper::get_cache_prefix( 'webhooks' ) . $status . '_count';
$count = wp_cache_get( $cache_key, 'webhooks' );
$count = wp_cache_get( $cache_key, 'webhooks' );
if ( false === $count ) {
$count = absint( $wpdb->get_var( $wpdb->prepare( "SELECT count( webhook_id ) FROM {$wpdb->prefix}wc_webhooks WHERE `status` = %s;", $status ) ) );

View File

@ -68,7 +68,7 @@ class WC_Twenty_Twenty {
* Set background color to white if it's default, otherwise don't touch it.
*/
public static function set_white_background() {
$background = sanitize_hex_color_no_hash( get_theme_mod( 'background_color' ) );
$background = sanitize_hex_color_no_hash( get_theme_mod( 'background_color' ) );
$background_default = 'f5efe0';
// Don't change user's choice of background color.

View File

@ -203,8 +203,8 @@ function wc_cart_totals_subtotal_html() {
* Get shipping methods.
*/
function wc_cart_totals_shipping_html() {
$packages = WC()->shipping()->get_packages();
$first = true;
$packages = WC()->shipping()->get_packages();
$first = true;
foreach ( $packages as $i => $package ) {
$chosen_method = isset( WC()->session->chosen_shipping_methods[ $i ] ) ? WC()->session->chosen_shipping_methods[ $i ] : '';

View File

@ -120,7 +120,7 @@ function wc_maybe_increase_stock_levels( $order_id ) {
return;
}
$stock_reduced = $order->get_data_store()->get_stock_reduced( $order_id );
$stock_reduced = $order->get_data_store()->get_stock_reduced( $order_id );
$trigger_increase = (bool) $stock_reduced;
// Only continue if we're increasing stock.
@ -207,8 +207,8 @@ function wc_trigger_stock_change_notifications( $order, $changes ) {
return;
}
$order_notes = array();
$no_stock_amount = absint( get_option( 'woocommerce_notify_no_stock_amount', 0 ) );
$order_notes = array();
$no_stock_amount = absint( get_option( 'woocommerce_notify_no_stock_amount', 0 ) );
foreach ( $changes as $change ) {
$order_notes[] = $change['product']->get_formatted_name() . ' ' . $change['from'] . '&rarr;' . $change['to'];

View File

@ -538,7 +538,7 @@ function wc_modify_map_meta_cap( $caps, $cap, $user_id, $args ) {
$caps[] = 'do_not_allow';
} elseif ( wc_current_user_has_role( 'shop_manager' ) ) {
// Shop managers can only edit customer info.
$userdata = get_userdata( $args[0] );
$userdata = get_userdata( $args[0] );
$shop_manager_editable_roles = apply_filters( 'woocommerce_shop_manager_editable_roles', array( 'customer' ) );
if ( property_exists( $userdata, 'roles' ) && ! empty( $userdata->roles ) && ! array_intersect( $userdata->roles, $shop_manager_editable_roles ) ) {
$caps[] = 'do_not_allow';

View File

@ -564,7 +564,7 @@ class WC_WCCOM_Site_Installer {
);
if ( 1 === count( $related_plugins ) ) {
$plugin_key = array_keys( $related_plugins )[0];
$plugin_key = array_keys( $related_plugins )[0];
$plugin_data = $plugins[ $plugin_key ];
return array(
'name' => $plugin_data['Name'],

View File

@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
foreach ( $items as $item_id => $item ) :
if ( apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
$product = $item->get_product();
$product = $item->get_product();
$sku = '';
$purchase_note = '';

View File

@ -116,7 +116,7 @@ class WC_Helper_Product {
)
);
$attributes = array();
$attributes = array();
$attribute = new WC_Product_Attribute();
$attribute_data = self::create_attribute( 'size', array( 'small', 'large', 'huge' ) );

View File

@ -260,7 +260,7 @@ class WC_Tests_Cart extends WC_Unit_Test_Case {
update_option( 'woocommerce_calc_taxes', 'yes' );
update_option( 'woocommerce_tax_round_at_subtotal', 'yes' );
$tax_rate = array(
$tax_rate = array(
'tax_rate_country' => '',
'tax_rate_state' => '',
'tax_rate' => '24.0000',
@ -273,7 +273,7 @@ class WC_Tests_Cart extends WC_Unit_Test_Case {
);
WC_Tax::_insert_tax_rate( $tax_rate );
$tax_rate = array(
$tax_rate = array(
'tax_rate_country' => '',
'tax_rate_state' => '',
'tax_rate' => '24.0000',

View File

@ -20,7 +20,7 @@ class WC_Tests_Order extends WC_Unit_Test_Case {
update_option( 'woocommerce_calc_taxes', 'yes' );
update_option( 'woocommerce_tax_round_at_subtotal', 'yes' );
$tax_rate = array(
$tax_rate = array(
'tax_rate_country' => '',
'tax_rate_state' => '',
'tax_rate' => '7.0000',

View File

@ -31,8 +31,8 @@ class WC_Tests_Rate_Limiter extends WC_Unit_Test_Case {
*/
public function test_rate_limit_limits() {
$action_identifier = 'action_1';
$user_1_id = 10;
$user_2_id = 15;
$user_1_id = 10;
$user_2_id = 15;
$rate_limit_id_1 = $action_identifier . $user_1_id;
$rate_limit_id_2 = $action_identifier . $user_2_id;