From 67ff58251142fdd4028e74c98c98c396bdfffe2d Mon Sep 17 00:00:00 2001 From: dinamiko Date: Thu, 23 Jun 2022 14:55:16 +0200 Subject: [PATCH] Fix psalm --- .../src/Gateway/PayUponInvoice/PayUponInvoice.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php index df72722e5..acb8ec8cd 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php +++ b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php @@ -455,19 +455,17 @@ class PayUponInvoice { add_action( 'add_meta_boxes', - function( $post_type ) { + function( string $post_type ) { if ( $post_type === 'shop_order' ) { $post_id = filter_input( INPUT_GET, 'post', FILTER_SANITIZE_STRING ); $order = wc_get_order( $post_id ); - if ( $order->get_payment_method() === 'ppcp-pay-upon-invoice-gateway' ) { + if ( is_a( $order, WC_Order::class ) && $order->get_payment_method() === 'ppcp-pay-upon-invoice-gateway' ) { $instructions = $order->get_meta( 'ppcp_ratepay_payment_instructions_payment_reference' ); if ( $instructions ) { - $this->logger->info("Displaying payment instructions for WC order #{$order->get_id()}"); - $this->logger->info(wc_print_r($instructions, true)); add_meta_box( 'ppcp_pui_ratepay_payment_instructions', __( 'RatePay payment instructions', 'woocommerce-paypal-payments' ), - function() { + function() use ( $instructions ) { $payment_reference = $instructions[0] ?? ''; $bic = $instructions[1]->bic ?? ''; $bank_name = $instructions[1]->bank_name ?? '';