Merge pull request #1056 from woocommerce/PCP-778-1-9-0-type-check-error-conflict-with-german-market

Type check error conflict with German Market (778)
This commit is contained in:
Emili Castells 2022-12-14 09:44:19 +01:00 committed by GitHub
commit b1b058655a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}