From 241fad75cc38ac561432452ece0d7a5071e9bcbb Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Mon, 18 Nov 2019 11:17:48 -0400 Subject: [PATCH] PHPCS fixes for onboarding files (https://github.com/woocommerce/woocommerce-admin/pull/3269) --- .../src/API/OnboardingPlugins.php | 14 +++++++------- .../woocommerce-admin/src/API/OnboardingTasks.php | 2 ++ .../woocommerce-admin/src/Features/Onboarding.php | 3 ++- .../src/Features/OnboardingTasks.php | 5 ++++- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/plugins/woocommerce-admin/src/API/OnboardingPlugins.php b/plugins/woocommerce-admin/src/API/OnboardingPlugins.php index ad8615776fe..05d4193cebb 100644 --- a/plugins/woocommerce-admin/src/API/OnboardingPlugins.php +++ b/plugins/woocommerce-admin/src/API/OnboardingPlugins.php @@ -160,7 +160,7 @@ class OnboardingPlugins extends \WC_REST_Data_Controller { * Installs the requested plugin. * * @param WP_REST_Request $request Full details about the request. - * @return array Plugin Status + * @return WP_Error|array Plugin Status */ public function install_plugin( $request ) { $allowed_plugins = Onboarding::get_allowed_plugins(); @@ -234,7 +234,7 @@ class OnboardingPlugins extends \WC_REST_Data_Controller { * Activate the requested plugin. * * @param WP_REST_Request $request Full details about the request. - * @return array Plugin Status + * @return WP_Error|array Plugin Status */ public function activate_plugins( $request ) { $allowed_plugins = Onboarding::get_allowed_plugins(); @@ -274,7 +274,7 @@ class OnboardingPlugins extends \WC_REST_Data_Controller { * Generates a Jetpack Connect URL. * * @param WP_REST_Request $request Full details about the request. - * @return array Connection URL for Jetpack + * @return WP_Error|array Connection URL for Jetpack */ public function connect_jetpack( $request ) { if ( ! class_exists( '\Jetpack' ) ) { @@ -298,7 +298,7 @@ class OnboardingPlugins extends \WC_REST_Data_Controller { /** * Kicks off the WCCOM Connect process. * - * @return array Connection URL for WooCommerce.com + * @return WP_Error|array Connection URL for WooCommerce.com */ public function request_wccom_connect() { include_once WC_ABSPATH . 'includes/admin/helper/class-wc-helper-api.php'; @@ -358,7 +358,7 @@ class OnboardingPlugins extends \WC_REST_Data_Controller { * Finishes connecting to WooCommerce.com. * * @param object $rest_request Request details. - * @return array Contains success status. + * @return WP_Error|array Contains success status. */ public function finish_wccom_connect( $rest_request ) { include_once WC_ABSPATH . 'includes/admin/helper/class-wc-helper.php'; @@ -419,7 +419,7 @@ class OnboardingPlugins extends \WC_REST_Data_Controller { /** * Returns a URL that can be used to connect to PayPal. * - * @return array Connect URL. + * @return WP_Error|array Connect URL. */ public function connect_paypal() { if ( ! function_exists( 'wc_gateway_ppec' ) ) { @@ -450,7 +450,7 @@ class OnboardingPlugins extends \WC_REST_Data_Controller { /** * Returns a URL that can be used to connect to Square. * - * @return array Connect URL. + * @return WP_Error|array Connect URL. */ public function connect_square() { if ( ! class_exists( '\WooCommerce\Square\Handlers\Connection' ) ) { diff --git a/plugins/woocommerce-admin/src/API/OnboardingTasks.php b/plugins/woocommerce-admin/src/API/OnboardingTasks.php index 843d3e83922..2416499a8bc 100644 --- a/plugins/woocommerce-admin/src/API/OnboardingTasks.php +++ b/plugins/woocommerce-admin/src/API/OnboardingTasks.php @@ -394,6 +394,8 @@ class OnboardingTasks extends \WC_REST_Data_Controller { /** * Create a homepage from a template. + * + * @return WP_Error|array */ public static function create_homepage() { $post_id = wp_insert_post( diff --git a/plugins/woocommerce-admin/src/Features/Onboarding.php b/plugins/woocommerce-admin/src/Features/Onboarding.php index c70af574b8e..f5233e72c70 100644 --- a/plugins/woocommerce-admin/src/Features/Onboarding.php +++ b/plugins/woocommerce-admin/src/Features/Onboarding.php @@ -261,7 +261,7 @@ class Onboarding { } /** - * Check if theme has declared support for WooCommerce + * Check if theme has declared support for WooCommerce. * * @param WP_Theme $theme Theme to check. * @return bool @@ -470,6 +470,7 @@ class Onboarding { /** * Gets an array of plugins that can be installed & activated via the onboarding wizard. * + * @return array * @todo Handle edgecase of where installed plugins may have versioned folder names (i.e. `jetpack-master/jetpack.php`). */ public static function get_allowed_plugins() { diff --git a/plugins/woocommerce-admin/src/Features/OnboardingTasks.php b/plugins/woocommerce-admin/src/Features/OnboardingTasks.php index 321d8c31c69..7fc64fafa3c 100644 --- a/plugins/woocommerce-admin/src/Features/OnboardingTasks.php +++ b/plugins/woocommerce-admin/src/Features/OnboardingTasks.php @@ -75,6 +75,7 @@ class OnboardingTasks { * Add task items to component settings. * * @param array $settings Component settings. + * @return array */ public function component_settings( $settings ) { $products = wp_count_posts( 'product' ); @@ -130,6 +131,8 @@ class OnboardingTasks { /** * Check for active task completion, and clears the transient. + * + * @return bool */ public static function is_active_task_complete() { $active_task = self::get_active_task(); @@ -150,7 +153,7 @@ class OnboardingTasks { * Check for task completion of a given task. * * @param string $task Name of task. - * @return bool; + * @return bool */ public static function check_task_completion( $task ) { switch ( $task ) {