From af47f7b0b297967145d70d4bfd441dd8bdacde6d Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Tue, 6 Mar 2018 15:08:46 -0300 Subject: [PATCH] Fix PHPCS violations in includes/admin/list-tables/class-wc-admin-list-table-products.php --- .../class-wc-admin-list-table-products.php | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/includes/admin/list-tables/class-wc-admin-list-table-products.php b/includes/admin/list-tables/class-wc-admin-list-table-products.php index 651f101a98b..a0b0bd2c1c6 100644 --- a/includes/admin/list-tables/class-wc-admin-list-table-products.php +++ b/includes/admin/list-tables/class-wc-admin-list-table-products.php @@ -55,7 +55,7 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table { /** * Define primary column. * - * @return array + * @return string */ protected function get_primary_column() { return 'name'; @@ -405,35 +405,31 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table { protected function query_filters( $query_vars ) { if ( isset( $query_vars['orderby'] ) ) { if ( 'price' === $query_vars['orderby'] ) { - // @codingStandardsIgnoreStart $query_vars = array_merge( $query_vars, array( - 'meta_key' => '_price', - 'orderby' => 'meta_value_num', + // phpcs:ignore WordPress.VIP.SlowDBQuery.slow_db_query_meta_key + 'meta_key' => '_price', + 'orderby' => 'meta_value_num', ) ); - // @codingStandardsIgnoreEnd } if ( 'sku' === $query_vars['orderby'] ) { - // @codingStandardsIgnoreStart $query_vars = array_merge( $query_vars, array( - 'meta_key' => '_sku', - 'orderby' => 'meta_value', + // phpcs:ignore WordPress.VIP.SlowDBQuery.slow_db_query_meta_key + 'meta_key' => '_sku', + 'orderby' => 'meta_value', ) ); - // @codingStandardsIgnoreEnd } } if ( isset( $query_vars['product_type'] ) ) { - // @codingStandardsIgnoreStart if ( 'downloadable' === $query_vars['product_type'] ) { $query_vars['product_type'] = ''; - $query_vars['meta_value'] = 'yes'; - $query_vars['meta_key'] = '_downloadable'; + $query_vars['meta_value'] = 'yes'; // phpcs:ignore WordPress.VIP.SlowDBQuery.slow_db_query_meta_value + $query_vars['meta_key'] = '_downloadable'; // phpcs:ignore WordPress.VIP.SlowDBQuery.slow_db_query_meta_key } elseif ( 'virtual' === $query_vars['product_type'] ) { $query_vars['product_type'] = ''; - $query_vars['meta_value'] = 'yes'; - $query_vars['meta_key'] = '_virtual'; + $query_vars['meta_value'] = 'yes'; // phpcs:ignore WordPress.VIP.SlowDBQuery.slow_db_query_meta_value + $query_vars['meta_key'] = '_virtual'; // phpcs:ignore WordPress.VIP.SlowDBQuery.slow_db_query_meta_key } - // @codingStandardsIgnoreEnd } if ( isset( $_GET['product_shipping_class'] ) && '0' === $_GET['product_shipping_class'] ) { // WPCS: input var ok. @@ -447,7 +443,7 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table { if ( ! empty( $_GET['stock_status'] ) ) { if ( ! isset( $query_vars['meta_query'] ) ) { - $query_vars['meta_query'] = array(); + $query_vars['meta_query'] = array(); // phpcs:ignore WordPress.VIP.SlowDBQuery.slow_db_query_meta_query } $query_vars['meta_query'][] = array(