From 83b2179aaf086672fe1e7d260ed977c11219700a Mon Sep 17 00:00:00 2001 From: emilicastells Date: Thu, 17 Nov 2022 15:37:46 +0100 Subject: [PATCH 1/2] Remove type in callback signature to avoid conflicts with third-party plugins --- .../src/Gateway/PayUponInvoice/PayUponInvoice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php index 3082460f5..ede1b13ce 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php +++ b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php @@ -291,12 +291,12 @@ class PayUponInvoice { add_action( 'woocommerce_email_before_order_table', - function( WC_Order $order, bool $sent_to_admin, bool $plain_text, WC_Email $email ) { + function( WC_Order $order, bool $sent_to_admin, bool $plain_text, $email ) { if ( ! $sent_to_admin && PayUponInvoiceGateway::ID === $order->get_payment_method() && $order->has_status( 'processing' ) - && $email->id === 'customer_processing_order' + && is_a( $email, WC_Email::class ) && $email->id === 'customer_processing_order' ) { $this->logger->info( "Adding Ratepay payment instructions to email for order #{$order->get_id()}." ); From 8584322da348e310d32c8303b0b55a1e0828f46c Mon Sep 17 00:00:00 2001 From: emilicastells Date: Thu, 17 Nov 2022 15:43:15 +0100 Subject: [PATCH 2/2] Fix psalm --- .../src/Gateway/PayUponInvoice/PayUponInvoice.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php index ede1b13ce..ac4f31559 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php +++ b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php @@ -291,6 +291,11 @@ class PayUponInvoice { add_action( 'woocommerce_email_before_order_table', + /** + * WC_Email type removed to avoid third-party issues. + * + * @psalm-suppress MissingClosureParamType + */ function( WC_Order $order, bool $sent_to_admin, bool $plain_text, $email ) { if ( ! $sent_to_admin