Skip to content

Commit

Permalink
Ignore psalm undefined class
Browse files Browse the repository at this point in the history
  • Loading branch information
jimjasson committed Jul 9, 2024
1 parent 4a21184 commit 375cba1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions includes/multi-currency/Compatibility/WooCommerceProductAddOns.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ public function get_item_data( $addon_data, $addon, $cart_item ): array {
$value .= '';
} elseif ( 'custom_price' === $addon['field_type'] && $addon['price'] ) {
if ( class_exists( '\WC_Product_Addons_Helper' ) ) {
// phpcs:ignore
/**
* @psalm-suppress UndefinedClass
*/
$addon_price = wc_price( \WC_Product_Addons_Helper::get_product_addon_price_for_display( $addon['price'], $cart_item['data'], true ) );
/* translators: %1$s custom addon price in cart */
$value .= sprintf( _x( ' (%1$s)', 'custom price addon price in cart', 'woocommerce-payments' ), $addon_price );
Expand All @@ -141,6 +145,10 @@ public function get_item_data( $addon_data, $addon, $cart_item ): array {
// Quantity/multiplier add on needs to be split, calculated, then multiplied by input value.
$addon_price = $this->multi_currency->get_price( $addon['price'] / $addon['value'], 'product' ) * $addon['value'];
}
// phpcs:ignore
/**
* @psalm-suppress UndefinedClass
*/
$addon_price = wc_price( \WC_Product_Addons_Helper::get_product_addon_price_for_display( $addon_price, $cart_item['data'] ) );
/* translators: %1$s flat fee addon price in order */
$value .= sprintf( _x( ' (+ %1$s)', 'flat fee addon price in cart', 'woocommerce-payments' ), $addon_price );
Expand All @@ -152,6 +160,10 @@ public function get_item_data( $addon_data, $addon, $cart_item ): array {
// Quantity/multiplier add on needs to be split, calculated, then multiplied by input value.
$addon_price = $this->multi_currency->get_price( $addon['price'] / $addon['value'], 'product' ) * $addon['value'];
}
// phpcs:ignore
/**
* @psalm-suppress UndefinedClass
*/
$addon_price = wc_price( \WC_Product_Addons_Helper::get_product_addon_price_for_display( $addon_price, $cart_item['data'] ) );
/* translators: %1$s addon price in order */
$value .= sprintf( _x( ' (%1$s)', 'quantity based addon price in cart', 'woocommerce-payments' ), $addon_price );
Expand Down Expand Up @@ -297,6 +309,10 @@ public function order_line_item_meta( array $meta_data, array $addon, \WC_Order_
$addon_price = $this->multi_currency->get_price( $addon['price'], 'product' );
}
if ( class_exists( '\WC_Product_Addons_Helper' ) ) {
// phpcs:ignore
/**
* @psalm-suppress UndefinedClass
*/
$price = html_entity_decode(
wp_strip_all_tags( wc_price( \WC_Product_Addons_Helper::get_product_addon_price_for_display( $addon_price, $values['data'] ) ) ),
ENT_QUOTES,
Expand Down

0 comments on commit 375cba1

Please sign in to comment.