From 8602c03671d4e2e0e87bfe22fcf38859fb07239c Mon Sep 17 00:00:00 2001 From: Jeff Stieler Date: Wed, 31 Jul 2019 11:30:49 -0600 Subject: [PATCH] PSR-4 ify WC_Admin_Order_Refund class. --- .../includes/class-wc-admin-reports-sync.php | 1 + .../WC_Admin_Order_Refund.php} | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) rename plugins/woocommerce-admin/{includes/class-wc-admin-order-refund.php => src/WC_Admin_Order_Refund.php} (81%) diff --git a/plugins/woocommerce-admin/includes/class-wc-admin-reports-sync.php b/plugins/woocommerce-admin/includes/class-wc-admin-reports-sync.php index 521166d6952..6e7ba758d50 100644 --- a/plugins/woocommerce-admin/includes/class-wc-admin-reports-sync.php +++ b/plugins/woocommerce-admin/includes/class-wc-admin-reports-sync.php @@ -8,6 +8,7 @@ defined( 'ABSPATH' ) || exit; use \Automattic\WooCommerce\Admin\WC_Admin_Order; +use \Automattic\WooCommerce\Admin\WC_Admin_Order_Refund; /** * WC_Admin_Reports_Sync Class. diff --git a/plugins/woocommerce-admin/includes/class-wc-admin-order-refund.php b/plugins/woocommerce-admin/src/WC_Admin_Order_Refund.php similarity index 81% rename from plugins/woocommerce-admin/includes/class-wc-admin-order-refund.php rename to plugins/woocommerce-admin/src/WC_Admin_Order_Refund.php index f2450ec34ba..bb914a17158 100644 --- a/plugins/woocommerce-admin/includes/class-wc-admin-order-refund.php +++ b/plugins/woocommerce-admin/src/WC_Admin_Order_Refund.php @@ -7,16 +7,18 @@ * @package WooCommerce Admin/Classes */ +namespace Automattic\WooCommerce\Admin; + defined( 'ABSPATH' ) || exit; /** * WC_Admin_Order_Refund class. */ -class WC_Admin_Order_Refund extends WC_Order_Refund { +class WC_Admin_Order_Refund extends \WC_Order_Refund { /** * Order traits. */ - use WC_Admin_Order_Trait; + use \WC_Admin_Order_Trait; /** * Add filter(s) required to hook WC_Admin_Order_Refund class to substitute WC_Order_Refund. @@ -35,8 +37,9 @@ class WC_Admin_Order_Refund extends WC_Order_Refund { * @return string */ public static function order_class_name( $classname, $order_type, $order_id ) { + // @todo - Only substitute class when necessary (during sync). if ( 'WC_Order_Refund' === $classname ) { - return 'WC_Admin_Order_Refund'; + return '\Automattic\WooCommerce\Admin\WC_Admin_Order_Refund'; } else { return $classname; } @@ -54,7 +57,7 @@ class WC_Admin_Order_Refund extends WC_Order_Refund { return false; } - return WC_Admin_Reports_Customers_Data_Store::get_or_create_customer_from_order( $parent_order ); + return \WC_Admin_Reports_Customers_Data_Store::get_or_create_customer_from_order( $parent_order ); } /**