Skip to content

Commit 15b42c6

Browse files
Explicitly mark parameters as nullable
1 parent 5b40a16 commit 15b42c6

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php

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

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

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

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

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

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

269269
// if this is an IPN handler
270270
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
@@ -977,7 +977,7 @@ public function add_payment_method() {
977977
* @return array result with success/error message and request status (success/failure)
978978
* @throws SV_WC_Plugin_Exception
979979
*/
980-
protected function do_add_payment_method_transaction( \WC_Order $order, SV_WC_Payment_Gateway_API_Create_Payment_Token_Response $response = null ) {
980+
protected function do_add_payment_method_transaction( \WC_Order $order, ?SV_WC_Payment_Gateway_API_Create_Payment_Token_Response $response = null ) {
981981

982982
if ( is_null( $response ) ) {
983983
$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
@@ -3376,10 +3376,10 @@ public function get_authorization_time_window() {
33763376
*
33773377
* @since 1.0.0
33783378
*
3379-
* @param \WC_Order $order Optional. The order being charged
3379+
* @param \WC_Order|null $order Optional. The order being charged
33803380
* @return bool
33813381
*/
3382-
public function perform_credit_card_charge( \WC_Order $order = null ) {
3382+
public function perform_credit_card_charge( ?\WC_Order $order = null ) {
33833383

33843384
$this->get_plugin()->assert( $this->supports_credit_card_charge() );
33853385

@@ -3407,10 +3407,10 @@ public function perform_credit_card_charge( \WC_Order $order = null ) {
34073407
*
34083408
* @since 1.0.0
34093409
*
3410-
* @param \WC_Order $order Optional. The order being authorized
3410+
* @param \WC_Order|null $order Optional. The order being authorized
34113411
* @return bool
34123412
*/
3413-
public function perform_credit_card_authorization( \WC_Order $order = null ) {
3413+
public function perform_credit_card_authorization( ?\WC_Order $order = null ) {
34143414

34153415
$this->get_plugin()->assert( $this->supports_credit_card_authorization() );
34163416

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
@@ -295,7 +295,7 @@ public function get_token( $user_id, $token, $environment_id = null ) {
295295
* @param string|null $environment_id optional environment id, defaults to plugin current environment
296296
* @return SV_WC_Payment_Gateway_Payment_Token payment token object or null
297297
*/
298-
public function get_token_by_core_id( int $user_id, int $core_token_id, string $environment_id = null ): ?SV_WC_Payment_Gateway_Payment_Token
298+
public function get_token_by_core_id( int $user_id, int $core_token_id, ?string $environment_id = null ): ?SV_WC_Payment_Gateway_Payment_Token
299299
{
300300
// default to current environment
301301
if ( is_null( $environment_id ) ) {

0 commit comments

Comments
 (0)