mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Fix psalm
This commit is contained in:
parent
5852e45178
commit
1942acf67b
2 changed files with 4 additions and 7 deletions
|
@ -17,6 +17,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Factory\WebhookEventFactory;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\WebhookFactory;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WP_Error;
|
||||
|
||||
/**
|
||||
* Class WebhookEndpoint
|
||||
|
@ -193,7 +194,7 @@ class WebhookEndpoint {
|
|||
);
|
||||
$response = $this->request( $url, $args );
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
if ( $response instanceof WP_Error ) {
|
||||
throw new RuntimeException(
|
||||
__( 'Not able to delete the webhook.', 'woocommerce-paypal-payments' )
|
||||
);
|
||||
|
@ -201,10 +202,7 @@ class WebhookEndpoint {
|
|||
|
||||
$status_code = (int) wp_remote_retrieve_response_code( $response );
|
||||
if ( 204 !== $status_code ) {
|
||||
$json = null;
|
||||
if ( is_array( $response ) ) {
|
||||
$json = json_decode( $response['body'] );
|
||||
}
|
||||
$json = json_decode( $response['body'] ) ?? null;
|
||||
throw new PayPalApiException(
|
||||
$json,
|
||||
$status_code
|
||||
|
|
|
@ -112,8 +112,7 @@ class PaymentCaptureRefunded implements RequestHandler {
|
|||
'amount' => $request['resource']['amount']['value'],
|
||||
)
|
||||
);
|
||||
if ( is_wp_error( $refund ) ) {
|
||||
assert( $refund instanceof WP_Error );
|
||||
if ( $refund instanceof WP_Error ) {
|
||||
$message = sprintf(
|
||||
'Order %1$s could not be refunded. %2$s',
|
||||
(string) $wc_order->get_id(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue