Fix psalm

This commit is contained in:
Emili Castells Guasch 2023-05-16 11:49:08 +02:00
parent 6f2a47dddb
commit 353ba42cbc
2 changed files with 3 additions and 2 deletions

View file

@ -94,7 +94,7 @@ class PaymentSaleCompleted implements RequestHandler {
foreach ( $subscriptions as $subscription ) {
$parent_order = wc_get_order( $subscription->get_parent() );
$transaction_id = wc_clean( wp_unslash( $request['resource']['id'] ?? '' ) );
if ( $transaction_id && is_a( $parent_order, WC_Order::class ) ) {
if ( $transaction_id && is_string( $transaction_id ) && is_a( $parent_order, WC_Order::class ) ) {
$this->update_transaction_id( $transaction_id, $parent_order, $this->logger );
}
}

View file

@ -12,6 +12,7 @@ namespace WooCommerce\PayPalCommerce\Webhooks\Handler;
use Psr\Log\LoggerInterface;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundMetaTrait;
use WooCommerce\PayPalCommerce\WcGateway\Processor\TransactionIdHandlingTrait;
use WP_Error;
use WP_REST_Request;
use WP_REST_Response;
@ -100,7 +101,7 @@ class PaymentSaleRefunded implements RequestHandler {
)
);
if ( is_wp_error( $refund ) ) {
if ( $refund instanceof WP_Error ) {
$this->logger->warning(
sprintf(
// translators: %s is the order id.