mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
🎨 Fix Psalm errors
This commit is contained in:
parent
2b025aa690
commit
ba7b01dfd6
3 changed files with 31 additions and 2 deletions
|
@ -153,3 +153,26 @@ class WP_HTML_Tag_Processor {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WooCommerce Session stubs for Psalm
|
||||||
|
*/
|
||||||
|
class WC_Session {
|
||||||
|
/**
|
||||||
|
* Get session cookie.
|
||||||
|
*
|
||||||
|
* @return string|false
|
||||||
|
*/
|
||||||
|
public function get_session_cookie() {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set customer session cookie.
|
||||||
|
*
|
||||||
|
* @param bool $set Whether to set the cookie.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function set_customer_session_cookie( $set ) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -185,6 +185,11 @@ class Order {
|
||||||
return $this->payment_source;
|
return $this->payment_source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the links.
|
||||||
|
*
|
||||||
|
* @return mixed|null
|
||||||
|
*/
|
||||||
public function links() {
|
public function links() {
|
||||||
return $this->links;
|
return $this->links;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,8 @@ class ReturnUrlEndpoint {
|
||||||
WC()->initialize_session();
|
WC()->initialize_session();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! WC()->session->get_session_cookie() ) {
|
// Set customer session cookie if not already set.
|
||||||
|
if ( WC()->session && ! WC()->session->get_session_cookie() ) {
|
||||||
WC()->session->set_customer_session_cookie( true );
|
WC()->session->set_customer_session_cookie( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ class ReturnUrlEndpoint {
|
||||||
$wc_order_id = (int) $order->purchase_units()[0]->custom_id();
|
$wc_order_id = (int) $order->purchase_units()[0]->custom_id();
|
||||||
$wc_order = wc_get_order( $wc_order_id );
|
$wc_order = wc_get_order( $wc_order_id );
|
||||||
|
|
||||||
if ( ! $wc_order ) {
|
if ( ! $wc_order || ! is_a( $wc_order, \WC_Order::class ) ) {
|
||||||
wc_add_notice( __( 'Order information is missing. Please try placing your order again.', 'woocommerce-paypal-payments' ), 'error' );
|
wc_add_notice( __( 'Order information is missing. Please try placing your order again.', 'woocommerce-paypal-payments' ), 'error' );
|
||||||
wp_safe_redirect( wc_get_checkout_url() );
|
wp_safe_redirect( wc_get_checkout_url() );
|
||||||
exit();
|
exit();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue