Fix Psalm errors

This commit is contained in:
Narek Zakarian 2022-08-17 15:03:57 +04:00
parent 9b81ac54f2
commit 2231b7836c
3 changed files with 6 additions and 14 deletions

View file

@ -95,7 +95,7 @@ class OrderTrackingEndpoint {
$action_message = $action === 'create' ? 'created' : 'updated';
$message = sprintf(
// translators: %1$s is the action message (created or updated).
_x( 'successfully %1$s', 'tracking inof success message', 'woocommerce-paypal-payments' ),
_x( 'successfully %1$s', 'tracking info success message', 'woocommerce-paypal-payments' ),
esc_html( $action_message )
);
@ -125,10 +125,9 @@ class OrderTrackingEndpoint {
'headers' => $this->request_headers(),
'body' => wp_json_encode( $body ),
);
$response = $this->request( $url, $args );
$response = $this->request( $url, $args );
if ( is_wp_error( $response ) ) {
if ( is_wp_error( $response ) ) {
$error = new RuntimeException(
'Could not create order tracking information.'
);
@ -322,8 +321,8 @@ class OrderTrackingEndpoint {
'status' => $data['status'],
);
if ( ! empty( $data['status'] ) ) {
$tracking_info['status'] = $data['status'];
if ( ! empty( $data['tracking_number'] ) ) {
$tracking_info['tracking_number'] = $data['tracking_number'];
}
if ( ! empty( $data['carrier'] ) ) {

View file

@ -63,14 +63,6 @@ class OrderTrackingModule implements ModuleInterface {
$settings->persist();
}
/**
* The settings listener.
*
* @var SettingsListener $listener
*/
$listener = $c->get( 'wcgateway.settings.listener' );
$listener->listen_for_tracking_enabled();
$tracking_enabled = $settings->has( 'tracking_enabled' ) && $settings->get( 'tracking_enabled' );
if ( ! $tracking_enabled ) {

View file

@ -316,6 +316,7 @@ class WCGatewayModule implements ModuleInterface {
*/
$listener->listen_for_merchant_id();
$listener->listen_for_vaulting_enabled();
$listener->listen_for_tracking_enabled();
}
);