Fix PHPCS and Psalm errors

This commit is contained in:
Daniel Dudzic 2024-04-23 15:18:04 +02:00
parent 436fd77587
commit 5aa00d8914
No known key found for this signature in database
GPG key ID: 31B40D33E3465483
3 changed files with 26 additions and 19 deletions

View file

@ -155,11 +155,11 @@ class PayPalApiException extends RuntimeException {
return $json->message; return $json->message;
} }
$improved_keys_messages = array( $improved_keys_messages = array(
'PAYMENT_DENIED' => __( 'PayPal rejected the payment. Please reach out to the PayPal support for more information.', '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' ), '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' ), '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' ), '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' ), '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' ), '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( $improved_errors = array_filter(

View file

@ -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 { public function load_block_editor_assets( ContainerInterface $c, ApplePayButton $button ): void {
// Enqueue backend scripts. // Enqueue backend scripts.
add_action( add_action(

View file

@ -468,9 +468,9 @@ class ApplePayButton implements ButtonInterface {
return false; return false;
} }
return wp_verify_nonce( return wp_verify_nonce(
$nonce, $nonce,
'woocommerce-process_checkout' 'woocommerce-process_checkout'
) === 1; ) === 1;
} }
/** /**
@ -559,11 +559,11 @@ class ApplePayButton implements ButtonInterface {
list( list(
$shipping_methods_array, $selected_shipping_method $shipping_methods_array, $selected_shipping_method
) = $this->cart_shipping_methods( ) = $this->cart_shipping_methods(
$cart, $cart,
$customer_address, $customer_address,
$shipping_method, $shipping_method,
$shipping_method_id $shipping_method_id
); );
} }
$cart->calculate_shipping(); $cart->calculate_shipping();
$cart->calculate_fees(); $cart->calculate_fees();
@ -717,7 +717,7 @@ class ApplePayButton implements ButtonInterface {
*/ */
protected function calculate_totals_cart_page( protected function calculate_totals_cart_page(
array $customer_address, array $customer_address,
$shipping_method = null $shipping_method = null
): array { ): array {
$results = array(); $results = array();
@ -742,11 +742,11 @@ class ApplePayButton implements ButtonInterface {
list( list(
$shipping_methods_array, $selected_shipping_method $shipping_methods_array, $selected_shipping_method
) = $this->cart_shipping_methods( ) = $this->cart_shipping_methods(
$cart, $cart,
$customer_address, $customer_address,
$shipping_method, $shipping_method,
$shipping_method_id $shipping_method_id
); );
} }
$cart->calculate_shipping(); $cart->calculate_shipping();
$cart->calculate_fees(); $cart->calculate_fees();