mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-03 08:37:53 +08:00
Remove param types on closures to avoid third party issues
This commit is contained in:
parent
ff37f4f584
commit
1ce7a1ca2e
1 changed files with 27 additions and 4 deletions
|
@ -360,7 +360,16 @@ class PayUponInvoice {
|
|||
|
||||
add_filter(
|
||||
'woocommerce_gateway_description',
|
||||
function( string $description, string $id ): string {
|
||||
/**
|
||||
* Param types removed to avoid third-party issues.
|
||||
*
|
||||
* @psalm-suppress MissingClosureParamType
|
||||
*/
|
||||
function( $description, $id ): string {
|
||||
if ( ! is_string( $description ) || ! is_string( $id ) ) {
|
||||
return $description;
|
||||
}
|
||||
|
||||
if ( PayUponInvoiceGateway::ID === $id ) {
|
||||
ob_start();
|
||||
|
||||
|
@ -423,7 +432,16 @@ class PayUponInvoice {
|
|||
|
||||
add_action(
|
||||
'woocommerce_after_checkout_validation',
|
||||
function( array $fields, WP_Error $errors ) {
|
||||
/**
|
||||
* Param types removed to avoid third-party issues.
|
||||
*
|
||||
* @psalm-suppress MissingClosureParamType
|
||||
*/
|
||||
function( $fields, WP_Error $errors ) {
|
||||
if ( ! is_array( $fields ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Missing
|
||||
$payment_method = wc_clean( wp_unslash( $_POST['payment_method'] ?? '' ) );
|
||||
if ( PayUponInvoiceGateway::ID !== $payment_method ) {
|
||||
|
@ -458,8 +476,13 @@ class PayUponInvoice {
|
|||
|
||||
add_filter(
|
||||
'woocommerce_available_payment_gateways',
|
||||
function ( array $methods ): array {
|
||||
if ( State::STATE_ONBOARDED !== $this->state->current_state() ) {
|
||||
/**
|
||||
* Param types removed to avoid third-party issues.
|
||||
*
|
||||
* @psalm-suppress MissingClosureParamType
|
||||
*/
|
||||
function ( $methods ): array {
|
||||
if ( ! is_array( $methods ) || State::STATE_ONBOARDED !== $this->state->current_state() ) {
|
||||
return $methods;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue