Fix potential type error on woocommerce_available_payment_gateways hook handler.

This commit is contained in:
Pedro Silva 2024-01-24 10:59:33 +00:00
parent 4183689a68
commit f8a872c382
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
2 changed files with 21 additions and 2 deletions

View file

@ -158,7 +158,16 @@ class WcSubscriptionsModule implements ModuleInterface {
add_filter(
'woocommerce_available_payment_gateways',
function( array $methods ) use ( $c ) : array {
/**
* Param types removed to avoid third-party issues.
*
* @psalm-suppress MissingClosureParamType
*/
function( $methods ) use ( $c ) {
if ( ! is_array( $methods ) ) {
return $methods;
}
if ( ! is_wc_endpoint_url( 'order-pay' ) ) {
return $methods;
}