From 568f983b58fdac871328aadc06de41cdffbe789b Mon Sep 17 00:00:00 2001 From: Ashley Gibson Date: Wed, 25 Jun 2025 12:06:37 +0100 Subject: [PATCH 1/2] Explicitly mark parameters as nullable --- .../Handlers/Abstract_Hosted_Payment_Handler.php | 8 ++++---- .../Handlers/Abstract_Payment_Handler.php | 14 +++++++------- .../class-sv-wc-payment-gateway-direct.php | 2 +- ...ss-sv-wc-payment-gateway-my-payment-methods.php | 2 +- .../class-sv-wc-payment-gateway.php | 8 ++++---- ...v-wc-payment-gateway-payment-tokens-handler.php | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php b/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php index 216388310..01680922f 100644 --- a/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php +++ b/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php @@ -195,7 +195,7 @@ public function handle_transaction_response_request() { * @param \WC_Order|null $order order object, if any * @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object, if any */ - protected function do_transaction_response_complete( \WC_Order $order = null, FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { + protected function do_transaction_response_complete( ?\WC_Order $order = null, ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { $this->do_transaction_request_response( $response, $this->get_gateway()->get_return_url( $order ) ); } @@ -211,7 +211,7 @@ protected function do_transaction_response_complete( \WC_Order $order = null, Fr * @param string $user_message user-facing message * @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object, if any */ - protected function do_transaction_response_failed( \WC_Order $order = null, $message = '', $user_message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { + protected function do_transaction_response_failed( ?\WC_Order $order = null, $message = '', $user_message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { $this->get_gateway()->add_debug_message( $message, 'error' ); @@ -236,7 +236,7 @@ protected function do_transaction_response_failed( \WC_Order $order = null, $mes * @param string $message error message, for logging * @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object, if any */ - protected function do_transaction_response_invalid( \WC_Order $order = null, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { + protected function do_transaction_response_invalid( ?\WC_Order $order = null, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { $this->get_gateway()->add_debug_message( $message, 'error' ); @@ -265,7 +265,7 @@ protected function do_transaction_response_invalid( \WC_Order $order = null, $me * @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response * @param string $url */ - protected function do_transaction_request_response( FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null, $url = '' ) { + protected function do_transaction_request_response( ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null, $url = '' ) { // if this is an IPN handler if ( $this->is_ipn() ) { diff --git a/woocommerce/payment-gateway/Handlers/Abstract_Payment_Handler.php b/woocommerce/payment-gateway/Handlers/Abstract_Payment_Handler.php index 54b1f68b5..79e6c61fe 100644 --- a/woocommerce/payment-gateway/Handlers/Abstract_Payment_Handler.php +++ b/woocommerce/payment-gateway/Handlers/Abstract_Payment_Handler.php @@ -288,7 +288,7 @@ protected function process_order_transaction_held( \WC_Order $order, FrameworkBa * @param string $message failure message * @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response response object */ - protected function process_order_transaction_failed( \WC_Order $order, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { + protected function process_order_transaction_failed( \WC_Order $order, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { $this->mark_order_as_failed( $order, $message, $response ); } @@ -305,7 +305,7 @@ protected function process_order_transaction_failed( \WC_Order $order, $message * @param \WC_Order $order order object * @param FrameworkBase\SV_WC_Payment_Gateway_API_Customer_Response|FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object */ - public function mark_order_as_paid( \WC_Order $order, FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { + public function mark_order_as_paid( \WC_Order $order, ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { $this->get_gateway()->add_transaction_data( $order, $response ); @@ -343,7 +343,7 @@ public function mark_order_as_paid( \WC_Order $order, FrameworkBase\SV_WC_Paymen * @param string $message message for the order note * @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object */ - public function mark_order_as_approved( \WC_Order $order, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { + public function mark_order_as_approved( \WC_Order $order, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { $order->add_order_note( $message ); } @@ -360,7 +360,7 @@ public function mark_order_as_approved( \WC_Order $order, $message = '', Framewo * @param string $message order note message * @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response */ - public function mark_order_as_held( \WC_Order $order, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { + public function mark_order_as_held( \WC_Order $order, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { /* translators: Example: "Authorize.Net Transaction Held for Review". Placeholder: %s - Payment gateway title */ $order_note = sprintf( __( '%s Transaction Held for Review', 'woocommerce-plugin-framework' ), $this->get_gateway()->get_method_title() ); @@ -390,7 +390,7 @@ public function mark_order_as_held( \WC_Order $order, $message = '', FrameworkBa * * @return string */ - public function get_held_order_status( \WC_Order $order, $response = null ) { + public function get_held_order_status( \WC_Order $order, ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { /** * Held Order Status Filter. @@ -431,7 +431,7 @@ public function get_held_order_status( \WC_Order $order, $response = null ) { * @param string $message order note message * @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response */ - public function mark_order_as_failed( \WC_Order $order, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { + public function mark_order_as_failed( \WC_Order $order, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { /* translators: Placeholders: %s - payment gateway title */ $order_note = sprintf( esc_html__( '%s Payment Failed', 'woocommerce-plugin-framework' ), $this->get_gateway()->get_method_title() ); @@ -458,7 +458,7 @@ public function mark_order_as_failed( \WC_Order $order, $message = '', Framework * @param string $message order note message * @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response */ - public function mark_order_as_cancelled( \WC_Order $order, $message, FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { + public function mark_order_as_cancelled( \WC_Order $order, $message, ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) { /* translators: Placeholders: %s - payment gateway title */ $order_note = sprintf( __( '%s Transaction Cancelled', 'woocommerce-plugin-framework' ), $this->get_gateway()->get_method_title() ); diff --git a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php index 8cb03e3ca..4185a7c26 100644 --- a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php +++ b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php @@ -988,7 +988,7 @@ public function add_payment_method() { * @return array result with success/error message and request status (success/failure) * @throws SV_WC_Plugin_Exception */ - protected function do_add_payment_method_transaction( \WC_Order $order, SV_WC_Payment_Gateway_API_Create_Payment_Token_Response $response = null ) { + protected function do_add_payment_method_transaction( \WC_Order $order, ?SV_WC_Payment_Gateway_API_Create_Payment_Token_Response $response = null ) { if ( is_null( $response ) ) { $response = $this->get_api()->tokenize_payment_method( $order ); diff --git a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php index 5fb257539..52642c4a4 100644 --- a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php +++ b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php @@ -900,7 +900,7 @@ protected function get_payment_method_title_html( SV_WC_Payment_Gateway_Payment_ * @param SV_WC_Payment_Gateway_Payment_Token|null $token FW token object, only set if the token is a FW token * @return string */ - protected function get_payment_method_default_html( $is_default = false, SV_WC_Payment_Gateway_Payment_Token $token = null ) { + protected function get_payment_method_default_html( $is_default = false, ?SV_WC_Payment_Gateway_Payment_Token $token = null ) { $html = $is_default ? '' . esc_html__( 'Default', 'woocommerce-plugin-framework' ) . '' : ''; diff --git a/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php b/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php index 7b6942040..39de01002 100755 --- a/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php +++ b/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php @@ -3414,10 +3414,10 @@ public function get_authorization_time_window() { * * @since 1.0.0 * - * @param \WC_Order $order Optional. The order being charged + * @param \WC_Order|null $order Optional. The order being charged * @return bool */ - public function perform_credit_card_charge( \WC_Order $order = null ) { + public function perform_credit_card_charge( ?\WC_Order $order = null ) { $this->get_plugin()->assert( $this->supports_credit_card_charge() ); @@ -3445,10 +3445,10 @@ public function perform_credit_card_charge( \WC_Order $order = null ) { * * @since 1.0.0 * - * @param \WC_Order $order Optional. The order being authorized + * @param \WC_Order|null $order Optional. The order being authorized * @return bool */ - public function perform_credit_card_authorization( \WC_Order $order = null ) { + public function perform_credit_card_authorization( ?\WC_Order $order = null ) { $this->get_plugin()->assert( $this->supports_credit_card_authorization() ); diff --git a/woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php b/woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php index f67c70b9a..a923af614 100644 --- a/woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php +++ b/woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php @@ -302,7 +302,7 @@ public function get_token( $user_id, $token, $environment_id = null ) { * @param string|null $environment_id optional environment id, defaults to plugin current environment * @return SV_WC_Payment_Gateway_Payment_Token payment token object or null */ - public function get_token_by_core_id( int $user_id, int $core_token_id, string $environment_id = null ): ?SV_WC_Payment_Gateway_Payment_Token + public function get_token_by_core_id( int $user_id, int $core_token_id, ?string $environment_id = null ): ?SV_WC_Payment_Gateway_Payment_Token { // default to current environment if ( is_null( $environment_id ) ) { From 770bfbeb8e3e2d6fb6b29a4d849366100203e84c Mon Sep 17 00:00:00 2001 From: Ashley Gibson Date: Thu, 25 Sep 2025 12:47:34 +0100 Subject: [PATCH 2/2] Update changelog --- woocommerce/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/woocommerce/changelog.txt b/woocommerce/changelog.txt index 07bf50e0b..e237de0cf 100644 --- a/woocommerce/changelog.txt +++ b/woocommerce/changelog.txt @@ -1,6 +1,7 @@ *** SkyVerge WooCommerce Plugin Framework Changelog *** 2025.nn.nn - version 6.0.0 + * Dev - Address "Implicitly marking parameter as nullable is deprecated" warnings in PHP 8.4 2025.nn.nn - version 5.15.12 * Fix: Only retrieve subscriptions data during checkout if there's a valid order to associate them with