From 5aa00d89141cc5dd8f67a8f4f3e356444a52b34f Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Tue, 23 Apr 2024 15:18:04 +0200 Subject: [PATCH] Fix PHPCS and Psalm errors --- .../src/Exception/PayPalApiException.php | 10 +++---- modules/ppcp-applepay/src/ApplepayModule.php | 7 +++++ .../src/Assets/ApplePayButton.php | 28 +++++++++---------- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/modules/ppcp-api-client/src/Exception/PayPalApiException.php b/modules/ppcp-api-client/src/Exception/PayPalApiException.php index 9db633729..11405b22b 100644 --- a/modules/ppcp-api-client/src/Exception/PayPalApiException.php +++ b/modules/ppcp-api-client/src/Exception/PayPalApiException.php @@ -155,11 +155,11 @@ class PayPalApiException extends RuntimeException { return $json->message; } $improved_keys_messages = array( - 'PAYMENT_DENIED' => __( 'PayPal rejected the payment. Please reach out to the PayPal support for more information.', 'woocommerce-paypal-payments' ), - 'TRANSACTION_REFUSED' => __( 'The transaction has been refused by the payment processor. Please reach out to the PayPal support for more information.', 'woocommerce-paypal-payments' ), - 'DUPLICATE_INVOICE_ID' => __( 'The transaction has been refused because the Invoice ID already exists. Please create a new order or reach out to the store owner.', 'woocommerce-paypal-payments' ), - 'PAYER_CANNOT_PAY' => __( 'There was a problem processing this transaction. Please reach out to the store owner.', 'woocommerce-paypal-payments' ), - 'PAYEE_ACCOUNT_RESTRICTED' => __( 'There was a problem processing this transaction. Please reach out to the store owner.', 'woocommerce-paypal-payments' ), + 'PAYMENT_DENIED' => __( 'PayPal rejected the payment. Please reach out to the PayPal support for more information.', 'woocommerce-paypal-payments' ), + 'TRANSACTION_REFUSED' => __( 'The transaction has been refused by the payment processor. Please reach out to the PayPal support for more information.', 'woocommerce-paypal-payments' ), + 'DUPLICATE_INVOICE_ID' => __( 'The transaction has been refused because the Invoice ID already exists. Please create a new order or reach out to the store owner.', 'woocommerce-paypal-payments' ), + 'PAYER_CANNOT_PAY' => __( 'There was a problem processing this transaction. Please reach out to the store owner.', 'woocommerce-paypal-payments' ), + 'PAYEE_ACCOUNT_RESTRICTED' => __( 'There was a problem processing this transaction. Please reach out to the store owner.', 'woocommerce-paypal-payments' ), 'AGREEMENT_ALREADY_CANCELLED' => __( 'The requested agreement is already canceled. Please reach out to the PayPal support for more information.', 'woocommerce-paypal-payments' ), ); $improved_errors = array_filter( diff --git a/modules/ppcp-applepay/src/ApplepayModule.php b/modules/ppcp-applepay/src/ApplepayModule.php index b1d0177bc..d9d93d6e6 100644 --- a/modules/ppcp-applepay/src/ApplepayModule.php +++ b/modules/ppcp-applepay/src/ApplepayModule.php @@ -231,6 +231,13 @@ class ApplepayModule implements ModuleInterface { ); } + /** + * Enqueues the editor assets. + * + * @param ContainerInterface $c The container. + * @param ApplePayButton $button The button. + * @return void + */ public function load_block_editor_assets( ContainerInterface $c, ApplePayButton $button ): void { // Enqueue backend scripts. add_action( diff --git a/modules/ppcp-applepay/src/Assets/ApplePayButton.php b/modules/ppcp-applepay/src/Assets/ApplePayButton.php index 16d28ad23..517f76cf0 100644 --- a/modules/ppcp-applepay/src/Assets/ApplePayButton.php +++ b/modules/ppcp-applepay/src/Assets/ApplePayButton.php @@ -468,9 +468,9 @@ class ApplePayButton implements ButtonInterface { return false; } return wp_verify_nonce( - $nonce, - 'woocommerce-process_checkout' - ) === 1; + $nonce, + 'woocommerce-process_checkout' + ) === 1; } /** @@ -559,11 +559,11 @@ class ApplePayButton implements ButtonInterface { list( $shipping_methods_array, $selected_shipping_method ) = $this->cart_shipping_methods( - $cart, - $customer_address, - $shipping_method, - $shipping_method_id - ); + $cart, + $customer_address, + $shipping_method, + $shipping_method_id + ); } $cart->calculate_shipping(); $cart->calculate_fees(); @@ -717,7 +717,7 @@ class ApplePayButton implements ButtonInterface { */ protected function calculate_totals_cart_page( array $customer_address, - $shipping_method = null + $shipping_method = null ): array { $results = array(); @@ -742,11 +742,11 @@ class ApplePayButton implements ButtonInterface { list( $shipping_methods_array, $selected_shipping_method ) = $this->cart_shipping_methods( - $cart, - $customer_address, - $shipping_method, - $shipping_method_id - ); + $cart, + $customer_address, + $shipping_method, + $shipping_method_id + ); } $cart->calculate_shipping(); $cart->calculate_fees();