Skip to content

Commit 91f4801

Browse files
Explicitly mark parameters as nullable (#788)
* Explicitly mark parameters as nullable * Update changelog
1 parent 531f046 commit 91f4801

7 files changed

+19
-18
lines changed

woocommerce/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*** SkyVerge WooCommerce Plugin Framework Changelog ***
22

33
2025.nn.nn - version 6.0.0
4+
* Dev - Address "Implicitly marking parameter as nullable is deprecated" warnings in PHP 8.4
45

56
2025.nn.nn - version 5.15.12
67
* Fix: Only retrieve subscriptions data during checkout if there's a valid order to associate them with

woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function handle_transaction_response_request() {
195195
* @param \WC_Order|null $order order object, if any
196196
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object, if any
197197
*/
198-
protected function do_transaction_response_complete( \WC_Order $order = null, FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
198+
protected function do_transaction_response_complete( ?\WC_Order $order = null, ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
199199

200200
$this->do_transaction_request_response( $response, $this->get_gateway()->get_return_url( $order ) );
201201
}
@@ -211,7 +211,7 @@ protected function do_transaction_response_complete( \WC_Order $order = null, Fr
211211
* @param string $user_message user-facing message
212212
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object, if any
213213
*/
214-
protected function do_transaction_response_failed( \WC_Order $order = null, $message = '', $user_message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
214+
protected function do_transaction_response_failed( ?\WC_Order $order = null, $message = '', $user_message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
215215

216216
$this->get_gateway()->add_debug_message( $message, 'error' );
217217

@@ -236,7 +236,7 @@ protected function do_transaction_response_failed( \WC_Order $order = null, $mes
236236
* @param string $message error message, for logging
237237
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object, if any
238238
*/
239-
protected function do_transaction_response_invalid( \WC_Order $order = null, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
239+
protected function do_transaction_response_invalid( ?\WC_Order $order = null, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
240240

241241
$this->get_gateway()->add_debug_message( $message, 'error' );
242242

@@ -265,7 +265,7 @@ protected function do_transaction_response_invalid( \WC_Order $order = null, $me
265265
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response
266266
* @param string $url
267267
*/
268-
protected function do_transaction_request_response( FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null, $url = '' ) {
268+
protected function do_transaction_request_response( ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null, $url = '' ) {
269269

270270
// if this is an IPN handler
271271
if ( $this->is_ipn() ) {

woocommerce/payment-gateway/Handlers/Abstract_Payment_Handler.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ protected function process_order_transaction_held( \WC_Order $order, FrameworkBa
288288
* @param string $message failure message
289289
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response response object
290290
*/
291-
protected function process_order_transaction_failed( \WC_Order $order, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
291+
protected function process_order_transaction_failed( \WC_Order $order, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
292292

293293
$this->mark_order_as_failed( $order, $message, $response );
294294
}
@@ -305,7 +305,7 @@ protected function process_order_transaction_failed( \WC_Order $order, $message
305305
* @param \WC_Order $order order object
306306
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Customer_Response|FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object
307307
*/
308-
public function mark_order_as_paid( \WC_Order $order, FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
308+
public function mark_order_as_paid( \WC_Order $order, ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
309309

310310
$this->get_gateway()->add_transaction_data( $order, $response );
311311

@@ -343,7 +343,7 @@ public function mark_order_as_paid( \WC_Order $order, FrameworkBase\SV_WC_Paymen
343343
* @param string $message message for the order note
344344
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object
345345
*/
346-
public function mark_order_as_approved( \WC_Order $order, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
346+
public function mark_order_as_approved( \WC_Order $order, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
347347

348348
$order->add_order_note( $message );
349349
}
@@ -360,7 +360,7 @@ public function mark_order_as_approved( \WC_Order $order, $message = '', Framewo
360360
* @param string $message order note message
361361
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response
362362
*/
363-
public function mark_order_as_held( \WC_Order $order, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
363+
public function mark_order_as_held( \WC_Order $order, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
364364

365365
/* translators: Example: "Authorize.Net Transaction Held for Review". Placeholder: %s - Payment gateway title */
366366
$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
390390
*
391391
* @return string
392392
*/
393-
public function get_held_order_status( \WC_Order $order, $response = null ) {
393+
public function get_held_order_status( \WC_Order $order, ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
394394

395395
/**
396396
* Held Order Status Filter.
@@ -431,7 +431,7 @@ public function get_held_order_status( \WC_Order $order, $response = null ) {
431431
* @param string $message order note message
432432
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response
433433
*/
434-
public function mark_order_as_failed( \WC_Order $order, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
434+
public function mark_order_as_failed( \WC_Order $order, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
435435

436436
/* translators: Placeholders: %s - payment gateway title */
437437
$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
458458
* @param string $message order note message
459459
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response
460460
*/
461-
public function mark_order_as_cancelled( \WC_Order $order, $message, FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
461+
public function mark_order_as_cancelled( \WC_Order $order, $message, ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
462462

463463
/* translators: Placeholders: %s - payment gateway title */
464464
$order_note = sprintf( __( '%s Transaction Cancelled', 'woocommerce-plugin-framework' ), $this->get_gateway()->get_method_title() );

woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ public function add_payment_method() {
988988
* @return array result with success/error message and request status (success/failure)
989989
* @throws SV_WC_Plugin_Exception
990990
*/
991-
protected function do_add_payment_method_transaction( \WC_Order $order, SV_WC_Payment_Gateway_API_Create_Payment_Token_Response $response = null ) {
991+
protected function do_add_payment_method_transaction( \WC_Order $order, ?SV_WC_Payment_Gateway_API_Create_Payment_Token_Response $response = null ) {
992992

993993
if ( is_null( $response ) ) {
994994
$response = $this->get_api()->tokenize_payment_method( $order );

woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ protected function get_payment_method_title_html( SV_WC_Payment_Gateway_Payment_
900900
* @param SV_WC_Payment_Gateway_Payment_Token|null $token FW token object, only set if the token is a FW token
901901
* @return string
902902
*/
903-
protected function get_payment_method_default_html( $is_default = false, SV_WC_Payment_Gateway_Payment_Token $token = null ) {
903+
protected function get_payment_method_default_html( $is_default = false, ?SV_WC_Payment_Gateway_Payment_Token $token = null ) {
904904

905905
$html = $is_default ? '<mark class="default">' . esc_html__( 'Default', 'woocommerce-plugin-framework' ) . '</mark>' : '';
906906

woocommerce/payment-gateway/class-sv-wc-payment-gateway.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3414,10 +3414,10 @@ public function get_authorization_time_window() {
34143414
*
34153415
* @since 1.0.0
34163416
*
3417-
* @param \WC_Order $order Optional. The order being charged
3417+
* @param \WC_Order|null $order Optional. The order being charged
34183418
* @return bool
34193419
*/
3420-
public function perform_credit_card_charge( \WC_Order $order = null ) {
3420+
public function perform_credit_card_charge( ?\WC_Order $order = null ) {
34213421

34223422
$this->get_plugin()->assert( $this->supports_credit_card_charge() );
34233423

@@ -3445,10 +3445,10 @@ public function perform_credit_card_charge( \WC_Order $order = null ) {
34453445
*
34463446
* @since 1.0.0
34473447
*
3448-
* @param \WC_Order $order Optional. The order being authorized
3448+
* @param \WC_Order|null $order Optional. The order being authorized
34493449
* @return bool
34503450
*/
3451-
public function perform_credit_card_authorization( \WC_Order $order = null ) {
3451+
public function perform_credit_card_authorization( ?\WC_Order $order = null ) {
34523452

34533453
$this->get_plugin()->assert( $this->supports_credit_card_authorization() );
34543454

woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public function get_token( $user_id, $token, $environment_id = null ) {
302302
* @param string|null $environment_id optional environment id, defaults to plugin current environment
303303
* @return SV_WC_Payment_Gateway_Payment_Token payment token object or null
304304
*/
305-
public function get_token_by_core_id( int $user_id, int $core_token_id, string $environment_id = null ): ?SV_WC_Payment_Gateway_Payment_Token
305+
public function get_token_by_core_id( int $user_id, int $core_token_id, ?string $environment_id = null ): ?SV_WC_Payment_Gateway_Payment_Token
306306
{
307307
// default to current environment
308308
if ( is_null( $environment_id ) ) {

0 commit comments

Comments
 (0)