From 71e31f85831ea22520400ed13972c4858e7fe603 Mon Sep 17 00:00:00 2001 From: Daniel Guerra Date: Thu, 5 Dec 2024 10:57:49 -0600 Subject: [PATCH] Fix return values --- includes/class-wc-payment-gateway-wcpay.php | 2 +- includes/class-wc-payments-utils.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/class-wc-payment-gateway-wcpay.php b/includes/class-wc-payment-gateway-wcpay.php index e85a2b241d3..71c6427b30b 100644 --- a/includes/class-wc-payment-gateway-wcpay.php +++ b/includes/class-wc-payment-gateway-wcpay.php @@ -4231,7 +4231,7 @@ public function reset_upe_appearance_ajax() { * Get the correct appearance transients for the given location. * * @param string $elements_location The location of the payment element. - * @return string|null[] + * @return (string|null)[] */ private function get_appearance_transients( $elements_location ) { $appearance_transient = [ diff --git a/includes/class-wc-payments-utils.php b/includes/class-wc-payments-utils.php index bb969fd5ec1..cdfdf61cd39 100644 --- a/includes/class-wc-payments-utils.php +++ b/includes/class-wc-payments-utils.php @@ -1032,9 +1032,9 @@ public static function force_disconnected_enabled(): bool { * Gets the appearance value from the transient or the persistent option. * * @param string $appearance_transient The transient where the appearance is stored. - * @return array|null The appearance value or null if it's not set. + * @return array|string|false The appearance value or false if it's not set. */ - public static function get_appearance_value( $appearance_transient ) { + public static function get_appearance_value( string $appearance_transient ) { $persistent_appearance = get_option( $appearance_transient ); if ( $persistent_appearance ) { return $persistent_appearance; @@ -1396,7 +1396,7 @@ public static function is_store_api_request(): bool { * * @param string $location The theme location. * @param string $context The theme location to fall back to if both transients are set. - * @return string + * @return string|null */ public static function get_active_upe_theme_transient_for_location( string $location = 'checkout', string $context = 'blocks' ) { $themes = \WC_Payment_Gateway_WCPay::APPEARANCE_THEME_TRANSIENTS; @@ -1435,7 +1435,7 @@ public static function get_active_upe_theme_transient_for_location( string $loca } // If $active_theme is still false, we don't have any theme set in the transients, so we fallback to 'stripe'. - if ( $active_theme ) { + if ( $active_theme && is_string( $active_theme ) ) { return $active_theme; }