Skip to content

Commit 070e498

Browse files
committed
Merge remote-tracking branch 'SilinMykola/php8-compatibility/fix-api-functional-tests' into platform-health
2 parents 794c8a0 + 676c0ba commit 070e498

File tree

8 files changed

+12
-13
lines changed

8 files changed

+12
-13
lines changed

app/code/Magento/Directory/Model/PriceCurrency.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ protected function getStore($scope = null)
152152
*/
153153
public function round($price)
154154
{
155-
return round($price, 2);
155+
return round((float) $price, 2);
156156
}
157157

158158
/**

app/code/Magento/SalesGraphQl/Model/OrderItem/DataProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ private function getDiscountDetails(OrderInterface $associatedOrder, OrderItemIn
227227
$discounts [] = [
228228
'label' => $associatedOrder->getDiscountDescription() ?? __('Discount'),
229229
'amount' => [
230-
'value' => abs($orderItem->getDiscountAmount()) ?? 0,
230+
'value' => abs((float) $orderItem->getDiscountAmount()),
231231
'currency' => $associatedOrder->getOrderCurrencyCode()
232232
]
233233
];

app/code/Magento/SalesGraphQl/Model/Resolver/CreditMemo/CreditMemoItems.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private function formatDiscountDetails(
148148
$discounts[] = [
149149
'label' => $associatedOrder->getDiscountDescription() ?? __('Discount'),
150150
'amount' => [
151-
'value' => abs($creditmemoItem->getDiscountAmount()) ?? 0,
151+
'value' => abs((float) $creditmemoItem->getDiscountAmount()),
152152
'currency' => $associatedOrder->getOrderCurrencyCode()
153153
]
154154
];

app/code/Magento/SalesGraphQl/Model/Resolver/CreditMemo/CreditMemoTotal.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function resolve(
106106
)
107107
],
108108
'adjustment' => [
109-
'value' => abs($creditMemo->getAdjustment()),
109+
'value' => abs((float) $creditMemo->getAdjustment()),
110110
'currency' => $currency
111111
]
112112
];
@@ -132,7 +132,7 @@ private function getShippingDiscountDetails(CreditmemoInterface $creditmemoModel
132132
if ($calculatedCreditmemoShippingDiscount != 0) {
133133
$shippingDiscounts[] = [
134134
'amount' => [
135-
'value' => sprintf('%.2f', abs($calculatedCreditmemoShippingDiscount)),
135+
'value' => sprintf('%.2f', abs((float) $calculatedCreditmemoShippingDiscount)),
136136
'currency' => $creditmemoModel->getOrderCurrencyCode()
137137
]
138138
];
@@ -153,7 +153,7 @@ private function getDiscountDetails(CreditmemoInterface $creditmemo): array
153153
$discounts[] = [
154154
'label' => $creditmemo->getDiscountDescription() ?? __('Discount'),
155155
'amount' => [
156-
'value' => abs($creditmemo->getDiscountAmount()),
156+
'value' => abs((float) $creditmemo->getDiscountAmount()),
157157
'currency' => $creditmemo->getOrderCurrencyCode()
158158
]
159159
];

app/code/Magento/SalesGraphQl/Model/Resolver/Invoice/InvoiceItems.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private function formatDiscountDetails(OrderInterface $associatedOrder, InvoiceI
146146
$discounts[] = [
147147
'label' => $associatedOrder->getDiscountDescription() ?? __('Discount'),
148148
'amount' => [
149-
'value' => abs($invoiceItem->getDiscountAmount()) ?? 0,
149+
'value' => abs((float) $invoiceItem->getDiscountAmount()),
150150
'currency' => $associatedOrder->getOrderCurrencyCode()
151151
]
152152
];

app/code/Magento/SalesGraphQl/Model/Resolver/Invoice/InvoiceTotal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private function getDiscountDetails(InvoiceInterface $invoice): array
150150
$discounts[] = [
151151
'label' => $invoice->getDiscountDescription() ?? __('Discount'),
152152
'amount' => [
153-
'value' => abs($invoice->getDiscountAmount()),
153+
'value' => abs((float) $invoice->getDiscountAmount()),
154154
'currency' => $invoice->getOrderCurrencyCode()
155155
]
156156
];

app/code/Magento/SalesGraphQl/Model/Resolver/OrderTotal.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private function getDiscountDetails(OrderInterface $order): array
123123
$orderDiscounts[] = [
124124
'label' => $order->getDiscountDescription() ?? __('Discount'),
125125
'amount' => [
126-
'value' => abs($order->getDiscountAmount()),
126+
'value' => abs((float) $order->getDiscountAmount()),
127127
'currency' => $order->getOrderCurrencyCode()
128128
]
129129
];
@@ -196,7 +196,7 @@ private function getShippingDiscountDetails(OrderInterface $order): array
196196
[
197197
'label' => $order->getDiscountDescription() ?? __('Discount'),
198198
'amount' => [
199-
'value' => abs($order->getShippingDiscountAmount()),
199+
'value' => abs((float) $order->getShippingDiscountAmount()),
200200
'currency' => $order->getOrderCurrencyCode()
201201
]
202202
];

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductPriceTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,6 @@ public function priceDataProvider() : array
414414
];
415415
}
416416

417-
418417
/**
419418
* Check the pricing for a grouped product with simple products having special price set
420419
*
@@ -750,7 +749,7 @@ public function testConfigurableProductWithVariantsHavingSpecialAndTierPrices()
750749
"value" => $configurableProductVariants[$key]->getPrice()
751750
],
752751
"final_price" => [
753-
"value" => round($configurableProductVariants[$key]->getSpecialPrice(), 2)
752+
"value" => round((float) $configurableProductVariants[$key]->getSpecialPrice(), 2)
754753
],
755754
"discount" => [
756755
"amount_off" => ($regularPrice[$key] - $finalPrice[$key]),
@@ -762,7 +761,7 @@ public function testConfigurableProductWithVariantsHavingSpecialAndTierPrices()
762761
"value" => $configurableProductVariants[$key]->getPrice()
763762
],
764763
"final_price" => [
765-
"value" => round($configurableProductVariants[$key]->getSpecialPrice(), 2)
764+
"value" => round((float) $configurableProductVariants[$key]->getSpecialPrice(), 2)
766765
],
767766
"discount" => [
768767
"amount_off" => $regularPrice[$key] - $finalPrice[$key],

0 commit comments

Comments
 (0)