mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Fix Psalm errors
This commit is contained in:
parent
407f526064
commit
763d4a6482
1 changed files with 25 additions and 24 deletions
|
@ -256,7 +256,7 @@ return array(
|
|||
'axo.shipping-wc-enabled-locations' => static function ( ContainerInterface $container ): array {
|
||||
$default_zone = new \WC_Shipping_Zone( 0 );
|
||||
|
||||
$is_method_enabled = fn( $method) => $method->enabled === 'yes';
|
||||
$is_method_enabled = fn( \WC_Shipping_Method $method): bool => $method->enabled === 'yes';
|
||||
|
||||
$is_default_zone_enabled = ! empty(
|
||||
array_filter(
|
||||
|
@ -271,20 +271,21 @@ return array(
|
|||
|
||||
$shipping_zones = \WC_Shipping_Zones::get_zones();
|
||||
|
||||
$get_zone_locations = fn($zone) =>
|
||||
$get_zone_locations = fn( \WC_Shipping_Zone $zone): array =>
|
||||
! empty( array_filter( $zone->get_shipping_methods(), $is_method_enabled ) )
|
||||
? array_map(
|
||||
fn($location) => $location->code,
|
||||
fn( object $location): string => $location->code,
|
||||
$zone->get_zone_locations()
|
||||
)
|
||||
: [];
|
||||
: array();
|
||||
|
||||
$enabled_locations = array_unique(
|
||||
array_merge(
|
||||
...array_map(
|
||||
$get_zone_locations,
|
||||
array_map(
|
||||
fn( $zone) => $zone instanceof \WC_Shipping_Zone ? $zone : new \WC_Shipping_Zone( $zone['id'] ),
|
||||
fn( $zone): \WC_Shipping_Zone =>
|
||||
$zone instanceof \WC_Shipping_Zone ? $zone : new \WC_Shipping_Zone( $zone['id'] ),
|
||||
$shipping_zones
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue