Skip to content

Explicitly mark parameters as nullable #784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: release/5.15.13
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions woocommerce/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*** SkyVerge WooCommerce Plugin Framework Changelog ***

2025.nn.nn - version 5.15.13
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,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 ) );
}
Expand All @@ -210,7 +210,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' );

Expand All @@ -235,7 +235,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' );

Expand Down Expand Up @@ -264,7 +264,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() ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand All @@ -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 );

Expand Down Expand Up @@ -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 );
}
Expand All @@ -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() );
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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() );
Expand All @@ -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() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? '<mark class="default">' . esc_html__( 'Default', 'woocommerce-plugin-framework' ) . '</mark>' : '';

Expand Down
8 changes: 4 additions & 4 deletions woocommerce/payment-gateway/class-sv-wc-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -3376,10 +3376,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() );

Expand Down Expand Up @@ -3407,10 +3407,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() );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,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 ) ) {
Expand Down
Loading