diff --git a/includes/API/Catalog/Product_Group/Products/Read/Request.php b/includes/API/Catalog/Product_Group/Products/Read/Request.php index 891208f1d..1e481f37b 100644 --- a/includes/API/Catalog/Product_Group/Products/Read/Request.php +++ b/includes/API/Catalog/Product_Group/Products/Read/Request.php @@ -54,6 +54,4 @@ public static function get_rate_limit_id() { return 'ads_management'; } - - } diff --git a/includes/API/Catalog/Product_Group/Products/Read/Response.php b/includes/API/Catalog/Product_Group/Products/Read/Response.php index f0ce1ef81..f179fc167 100644 --- a/includes/API/Catalog/Product_Group/Products/Read/Response.php +++ b/includes/API/Catalog/Product_Group/Products/Read/Response.php @@ -42,6 +42,4 @@ public function get_ids() { return $product_item_ids; } - - } diff --git a/includes/API/Catalog/Product_Item/Find/Request.php b/includes/API/Catalog/Product_Item/Find/Request.php index 20554aac6..7f772ad87 100644 --- a/includes/API/Catalog/Product_Item/Find/Request.php +++ b/includes/API/Catalog/Product_Item/Find/Request.php @@ -60,6 +60,4 @@ public function get_params() { return array( 'fields' => 'id,product_group{id}' ); } - - } diff --git a/includes/API/Catalog/Send_Item_Updates/Request.php b/includes/API/Catalog/Send_Item_Updates/Request.php index 7c1a63b3d..f45a45442 100644 --- a/includes/API/Catalog/Send_Item_Updates/Request.php +++ b/includes/API/Catalog/Send_Item_Updates/Request.php @@ -123,6 +123,4 @@ public function get_data() { 'item_type' => 'PRODUCT_ITEM', ); } - - } diff --git a/includes/API/FBE/Configuration/Read/Response.php b/includes/API/FBE/Configuration/Read/Response.php index 5e4884e45..76b7a617d 100644 --- a/includes/API/FBE/Configuration/Read/Response.php +++ b/includes/API/FBE/Configuration/Read/Response.php @@ -18,7 +18,7 @@ class Response extends API\Response { * @return boolean */ public function is_ig_shopping_enabled(): bool { - return ! ! $this->response_data['ig_shopping']['enabled'] ?? false; + return (bool) $this->response_data['ig_shopping']['enabled'] ?? false; } /** @@ -27,6 +27,6 @@ public function is_ig_shopping_enabled(): bool { * @return boolean */ public function is_ig_cta_enabled(): bool { - return ! ! $this->response_data['ig_cta']['enabled']; + return (bool) $this->response_data['ig_cta']['enabled']; } } diff --git a/includes/API/FBE/Configuration/Update/Request.php b/includes/API/FBE/Configuration/Update/Request.php index a3c76af72..36cea944a 100644 --- a/includes/API/FBE/Configuration/Update/Request.php +++ b/includes/API/FBE/Configuration/Update/Request.php @@ -52,6 +52,4 @@ public function set_plugin_version( string $plugin_version ) { ), ); } - - } diff --git a/includes/API/Pixel/Events/Request.php b/includes/API/Pixel/Events/Request.php index d118227c6..1f14e983f 100644 --- a/includes/API/Pixel/Events/Request.php +++ b/includes/API/Pixel/Events/Request.php @@ -90,6 +90,4 @@ public function get_data() { */ return apply_filters( 'wc_facebook_api_pixel_event_request_data', $data, $this ); } - - } diff --git a/includes/API/Request.php b/includes/API/Request.php index 398b8c780..d695f5b7e 100644 --- a/includes/API/Request.php +++ b/includes/API/Request.php @@ -81,7 +81,7 @@ public function get_retry_count() { * @since 2.1.0 */ public function mark_retry() { - $this->retry_count++; + ++$this->retry_count; } diff --git a/includes/API/Traits/Idempotent_Request.php b/includes/API/Traits/Idempotent_Request.php index b2ba013bc..55c342286 100644 --- a/includes/API/Traits/Idempotent_Request.php +++ b/includes/API/Traits/Idempotent_Request.php @@ -40,6 +40,4 @@ public function get_idempotency_key() { return $this->idempotency_key; } - - } diff --git a/includes/API/Traits/Rate_Limited_Response.php b/includes/API/Traits/Rate_Limited_Response.php index 7db269403..d1abaf2c9 100644 --- a/includes/API/Traits/Rate_Limited_Response.php +++ b/includes/API/Traits/Rate_Limited_Response.php @@ -118,6 +118,4 @@ public function get_rate_limit_estimated_time_to_regain_access( $headers ) { return ! empty( $usage_data['estimated_time_to_regain_access'] ) ? (int) $usage_data['estimated_time_to_regain_access'] : null; } - - } diff --git a/includes/Admin/Enhanced_Catalog_Attribute_Fields.php b/includes/Admin/Enhanced_Catalog_Attribute_Fields.php index 89deb9c14..d50445214 100644 --- a/includes/Admin/Enhanced_Catalog_Attribute_Fields.php +++ b/includes/Admin/Enhanced_Catalog_Attribute_Fields.php @@ -89,20 +89,20 @@ private function extract_attribute( &$attributes, $key ) { public function render( $category_id ) { $all_attributes = $this->category_handler->get_attributes_with_fallback_to_parent_category( $category_id ); $all_attributes_with_values = array_map( - function( $attribute ) use ( $category_id ) { + function ( $attribute ) use ( $category_id ) { return array_merge( $attribute, array( 'value' => $this->get_value( $attribute['key'], $category_id ) ) ); }, $all_attributes ); $recommended_attributes = array_filter( $all_attributes_with_values, - function( $attr ) { + function ( $attr ) { return $attr['recommended']; } ); $optional_attributes = array_filter( $all_attributes_with_values, - function( $attr ) { + function ( $attr ) { return ! $attr['recommended']; } ); @@ -117,7 +117,7 @@ function( $attr ) { $this->extract_attribute( $optional_attributes, 'size' ), $this->extract_attribute( $optional_attributes, 'gender' ), ), - function( $attr ) { + function ( $attr ) { return ! is_null( $attr ); } ); @@ -266,7 +266,6 @@ private function render_field( $attr_id, $attribute ) { // string $this->render_text_field( $attr_id, $attribute, $placeholder ); } - } private function render_select_field( $attr_id, $attribute ) { diff --git a/includes/Admin/Notes/SettingsMoved.php b/includes/Admin/Notes/SettingsMoved.php index d4a06914d..a95fceb3f 100644 --- a/includes/Admin/Notes/SettingsMoved.php +++ b/includes/Admin/Notes/SettingsMoved.php @@ -11,8 +11,8 @@ defined( 'ABSPATH' ) || exit; -use \Automattic\WooCommerce\Admin\Notes\Note; -use \Automattic\WooCommerce\Admin\Notes\NoteTraits; +use Automattic\WooCommerce\Admin\Notes\Note; +use Automattic\WooCommerce\Admin\Notes\NoteTraits; /** * SettingsMoved class. diff --git a/includes/Admin/Product_Categories.php b/includes/Admin/Product_Categories.php index d34c04658..6eb720ad5 100644 --- a/includes/Admin/Product_Categories.php +++ b/includes/Admin/Product_Categories.php @@ -271,8 +271,8 @@ public function render_edit_enhanced_catalog_attributes_field( \WP_Term $term, $ if ( empty( $category_id ) || - $category_handler->is_category( $category_id ) && - $category_handler->is_root_category( $category_id ) + ( $category_handler->is_category( $category_id ) && + $category_handler->is_root_category( $category_id ) ) ) { // show nothing ?> @@ -314,8 +314,8 @@ public function render_add_enhanced_catalog_attributes_field( $category_id ) { if ( empty( $category_id ) || - $category_handler->is_category( $category_id ) && - $category_handler->is_root_category( $category_id ) + ( $category_handler->is_category( $category_id ) && + $category_handler->is_root_category( $category_id ) ) ) { // show nothing return; @@ -377,7 +377,7 @@ public function save_google_product_category_and_enhanced_attributes( $term_id, $google_product_category_id = wc_clean( Helper::get_posted_value( self::FIELD_GOOGLE_PRODUCT_CATEGORY_ID ) ); \WooCommerce\Facebook\Product_Categories::update_google_product_category_id( $term_id, $google_product_category_id ); - $this->save_enhanced_catalog_attributes( $term_id, $tt_id, $taxonomy ); + $this->save_enhanced_catalog_attributes( $term_id ); $term = get_term( $term_id, $taxonomy ); @@ -423,11 +423,9 @@ public function save_google_product_category_and_enhanced_attributes( $term_id, * * @since 2.1.0 * - * @param int $term_id term ID. - * @param int $tt_id term taxonomy ID. - * @param string $taxonomy Taxonomy slug. + * @param int $term_id term ID. */ - public function save_enhanced_catalog_attributes( $term_id, $tt_id, $taxonomy ) { + public function save_enhanced_catalog_attributes( $term_id ) { $enhanced_catalog_attributes = \WooCommerce\Facebook\Products::get_enhanced_catalog_attributes_from_request(); foreach ( $enhanced_catalog_attributes as $key => $value ) { diff --git a/includes/Admin/Product_Sets.php b/includes/Admin/Product_Sets.php index a01e88dd3..e829d26f2 100644 --- a/includes/Admin/Product_Sets.php +++ b/includes/Admin/Product_Sets.php @@ -114,11 +114,11 @@ public function category_field_on_edit( $term ) { * @param int $term_id Term ID. * @param int $tt_id Term taxonomy ID. */ - public function save_custom_field( $term_id, $tt_id ) { + public function save_custom_field( $term_id, $tt_id ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed $wc_product_cats = empty( $_POST[ $this->categories_field ] ) ? '' : wc_clean( wp_unslash( $_POST[ $this->categories_field ] ) ); //phpcs:ignore if ( ! empty( $wc_product_cats ) ) { $wc_product_cats = array_map( - function( $item ) { + function ( $item ) { return absint( $item ); }, $wc_product_cats @@ -149,7 +149,12 @@ protected function get_field_label() { */ protected function get_field( $term_id = '' ) { $saved_items = get_term_meta( $term_id, $this->categories_field, true ); - $product_cats = get_terms( 'product_cat', array( 'hide_empty' => 0 ) ); + $product_cats = get_terms( + array( + 'taxonomy' => 'product_cat', + 'hide_empty' => false, + ) + ); ?>