Fix psalm errors

This commit is contained in:
Narek Zakarian 2023-08-31 17:49:08 +04:00
parent f869f98ac1
commit c0166ee9ba
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7

View file

@ -53,7 +53,7 @@ class ItemFactory {
* @var \WC_Product $product * @var \WC_Product $product
*/ */
$quantity = (int) $item['quantity']; $quantity = (int) $item['quantity'];
$image = wp_get_attachment_image_src( $product->get_image_id(), 'full' ); $image = wp_get_attachment_image_src( (int) $product->get_image_id(), 'full' );
$price = (float) $item['line_subtotal'] / (float) $item['quantity']; $price = (float) $item['line_subtotal'] / (float) $item['quantity'];
return new Item( return new Item(
@ -131,7 +131,7 @@ class ItemFactory {
$quantity = (int) $item->get_quantity(); $quantity = (int) $item->get_quantity();
$price_without_tax = (float) $order->get_item_subtotal( $item, false ); $price_without_tax = (float) $order->get_item_subtotal( $item, false );
$price_without_tax_rounded = round( $price_without_tax, 2 ); $price_without_tax_rounded = round( $price_without_tax, 2 );
$image = wp_get_attachment_image_src( $product->get_image_id(), 'full' ); $image = $product instanceof WC_Product ? wp_get_attachment_image_src( (int) $product->get_image_id(), 'full' ) : '';
return new Item( return new Item(
mb_substr( $item->get_name(), 0, 127 ), mb_substr( $item->get_name(), 0, 127 ),
@ -141,7 +141,7 @@ class ItemFactory {
null, null,
$product instanceof WC_Product ? $product->get_sku() : '', $product instanceof WC_Product ? $product->get_sku() : '',
( $product instanceof WC_Product && $product->is_virtual() ) ? Item::DIGITAL_GOODS : Item::PHYSICAL_GOODS, ( $product instanceof WC_Product && $product->is_virtual() ) ? Item::DIGITAL_GOODS : Item::PHYSICAL_GOODS,
$product->get_permalink(), $product instanceof WC_Product ? $product->get_permalink() : '',
$image[0] ?? '' $image[0] ?? ''
); );
} }