diff --git a/plugins/woocommerce-admin/composer.json b/plugins/woocommerce-admin/composer.json index 3e80f4cc30c..2e531d72cd1 100644 --- a/plugins/woocommerce-admin/composer.json +++ b/plugins/woocommerce-admin/composer.json @@ -39,6 +39,9 @@ "includes/core-functions.php", "includes/feature-config.php", "includes/page-controller/page-controller-functions.php" - ] + ], + "psr-4": { + "Automattic\\WooCommerce\\Admin\\": "src/" + } } } 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 4dbbd1f3d0e..521166d6952 100644 --- a/plugins/woocommerce-admin/includes/class-wc-admin-reports-sync.php +++ b/plugins/woocommerce-admin/includes/class-wc-admin-reports-sync.php @@ -7,6 +7,8 @@ defined( 'ABSPATH' ) || exit; +use \Automattic\WooCommerce\Admin\WC_Admin_Order; + /** * WC_Admin_Reports_Sync Class. */ diff --git a/plugins/woocommerce-admin/includes/class-wc-admin-order.php b/plugins/woocommerce-admin/src/WC_Admin_Order.php similarity index 83% rename from plugins/woocommerce-admin/includes/class-wc-admin-order.php rename to plugins/woocommerce-admin/src/WC_Admin_Order.php index 705b82b3f19..4a10514b95e 100644 --- a/plugins/woocommerce-admin/includes/class-wc-admin-order.php +++ b/plugins/woocommerce-admin/src/WC_Admin_Order.php @@ -7,16 +7,18 @@ * @package WooCommerce Admin/Classes */ +namespace Automattic\WooCommerce\Admin; + defined( 'ABSPATH' ) || exit; /** * WC_Admin_Order class. */ -class WC_Admin_Order extends WC_Order { +class WC_Admin_Order extends \WC_Order { /** * Order traits. */ - use WC_Admin_Order_Trait; + use \WC_Admin_Order_Trait; /** * Holds refund amounts and quantities for the order. @@ -42,8 +44,9 @@ class WC_Admin_Order extends WC_Order { * @return string */ public static function order_class_name( $classname, $order_type, $order_id ) { + // @todo - Only substitute class when necessary (during sync). if ( 'WC_Order' === $classname ) { - return 'WC_Admin_Order'; + return '\Automattic\WooCommerce\Admin\WC_Admin_Order'; } else { return $classname; } @@ -55,7 +58,7 @@ class WC_Admin_Order extends WC_Order { * @return int */ public function get_report_customer_id() { - return WC_Admin_Reports_Customers_Data_Store::get_or_create_customer_from_order( $this ); + return \WC_Admin_Reports_Customers_Data_Store::get_or_create_customer_from_order( $this ); } /** @@ -64,7 +67,7 @@ class WC_Admin_Order extends WC_Order { * @return bool */ public function is_returning_customer() { - return WC_Admin_Reports_Orders_Stats_Data_Store::is_returning_customer( $this ); + return \WC_Admin_Reports_Orders_Stats_Data_Store::is_returning_customer( $this ); } /**