Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function render(\Magento\Framework\DataObject $row)
{
if ($data = (string)$this->_getValue($row)) {
$currency_code = $this->_getCurrencyCode($row);
$data = floatval($data) * $this->_getRate($row);
$data = (float)$data * $this->_getRate($row);
$sign = (bool)(int)$this->getColumn()->getShowNumberSign() && $data > 0 ? '+' : '';
$data = sprintf("%f", $data);
$data = $this->_localeCurrency->getCurrency($currency_code)->toCurrency($data);
Expand Down Expand Up @@ -118,10 +118,10 @@ protected function _getCurrencyCode($row)
protected function _getRate($row)
{
if ($rate = $this->getColumn()->getRate()) {
return floatval($rate);
return (float)$rate;
}
if ($rate = $row->getData($this->getColumn()->getRateField())) {
return floatval($rate);
return (float)$rate;
}
return $this->_defaultBaseCurrency->getRate($this->_getCurrencyCode($row));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function render(\Magento\Framework\DataObject $row)
return $data;
}

$data = floatval($data) * $this->_getRate($row);
$data = (float)$data * $this->_getRate($row);
$data = sprintf("%f", $data);
$data = $this->_localeCurrency->getCurrency($currencyCode)->toCurrency($data);
return $data;
Expand Down Expand Up @@ -94,10 +94,10 @@ protected function _getCurrencyCode($row)
protected function _getRate($row)
{
if ($rate = $this->getColumn()->getRate()) {
return floatval($rate);
return (float)$rate;
}
if ($rate = $row->getData($this->getColumn()->getRateField())) {
return floatval($rate);
return (float)$rate;
}
return 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function create(
) {
$arguments['bundleProduct'] = $bundleProduct;
$arguments['saleableItem'] = $selection;
$arguments['quantity'] = $quantity ? floatval($quantity) : 1.;
$arguments['quantity'] = $quantity ? (float)$quantity : 1.;

return $this->objectManager->create(self::SELECTION_CLASS_DEFAULT, $arguments);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ public function getForceChildItemQtyChanges($product)
*/
public function prepareQuoteItemQty($qty, $product)
{
return floatval($qty);
return (float)$qty;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function getCount($range)
/**
* Check and set correct variable values to prevent SQL-injections
*/
$range = floatval($range);
$range = (float)$range;
if ($range == 0) {
$range = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Pricing/Price/RegularPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function getValue()
if ($this->value === null) {
$price = $this->product->getPrice();
$priceInCurrentCurrency = $this->priceCurrency->convertAndRound($price);
$this->value = $priceInCurrentCurrency ? floatval($priceInCurrentCurrency) : false;
$this->value = $priceInCurrentCurrency ? (float)$priceInCurrentCurrency : false;
}
return $this->value;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Pricing/Price/TierPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function __construct(
GroupManagementInterface $groupManagement,
CustomerGroupRetrieverInterface $customerGroupRetriever = null
) {
$quantity = floatval($quantity) ? $quantity : 1;
$quantity = (float)$quantity ? $quantity : 1;
parent::__construct($saleableItem, $quantity, $calculator, $priceCurrency);
$this->customerSession = $customerSession;
$this->groupManagement = $groupManagement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function testGetMaxPrice()
$this->productCollection->expects($this->once())
->method('getMaxPrice')
->will($this->returnValue($maxPrice));
$this->assertSame(floatval($maxPrice), $this->target->getMaxPrice());
$this->assertSame((float)$maxPrice, $this->target->getMaxPrice());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogInventory/Model/Stock/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function getStockStatusChangedAuto()
*/
public function getQty()
{
return null === $this->_getData(static::QTY) ? null : floatval($this->_getData(static::QTY));
return null === $this->_getData(static::QTY) ? null : (float)$this->_getData(static::QTY);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function getValue()
{
if (null === $this->value) {
if ($this->product->hasData(self::PRICE_CODE)) {
$this->value = floatval($this->product->getData(self::PRICE_CODE)) ?: false;
$this->value = (float)$this->product->getData(self::PRICE_CODE) ?: false;
} else {
$this->value = $this->getRuleResource()
->getRulePrice(
Expand All @@ -98,7 +98,7 @@ public function getValue()
$this->customerSession->getCustomerGroupId(),
$this->product->getId()
);
$this->value = $this->value ? floatval($this->value) : false;
$this->value = $this->value ? (float)$this->value : false;
}
if ($this->value) {
$this->value = $this->priceCurrency->convertAndRound($this->value);
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Checkout/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function getPriceInclTax($item)
}
$qty = $item->getQty() ? $item->getQty() : ($item->getQtyOrdered() ? $item->getQtyOrdered() : 1);
$taxAmount = $item->getTaxAmount() + $item->getDiscountTaxCompensation();
$price = floatval($qty) ? ($item->getRowTotal() + $taxAmount) / $qty : 0;
$price = (float)$qty ? ($item->getRowTotal() + $taxAmount) / $qty : 0;
return $this->priceCurrency->round($price);
}

Expand All @@ -194,7 +194,7 @@ public function getBasePriceInclTax($item)
{
$qty = $item->getQty() ? $item->getQty() : ($item->getQtyOrdered() ? $item->getQtyOrdered() : 1);
$taxAmount = $item->getBaseTaxAmount() + $item->getBaseDiscountTaxCompensation();
$price = floatval($qty) ? ($item->getBaseRowTotal() + $taxAmount) / $qty : 0;
$price = (float)$qty ? ($item->getBaseRowTotal() + $taxAmount) / $qty : 0;
return $this->priceCurrency->round($price);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ protected function _cmp($elementA, $elementB)
{
$sortIndexA = 0;
if ($this->_hasValue('sortOrder', $elementA)) {
$sortIndexA = floatval($elementA['sortOrder']);
$sortIndexA = (float)$elementA['sortOrder'];
}
$sortIndexB = 0;
if ($this->_hasValue('sortOrder', $elementB)) {
$sortIndexB = floatval($elementB['sortOrder']);
$sortIndexB = (float)$elementB['sortOrder'];
}

if ($sortIndexA == $sortIndexB) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Directory/Model/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function convert($price, $toCurrency = null)
if ($toCurrency === null) {
return $price;
} elseif ($rate = $this->getRate($toCurrency)) {
return floatval($price) * floatval($rate);
return (float)$price * (float)$rate;
}

throw new \Exception(__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function getValue()
if ($this->value === null) {
$price = $this->product->getPrice();
$priceInCurrentCurrency = $this->priceCurrency->convertAndRound($price);
$this->value = $priceInCurrentCurrency ? floatval($priceInCurrentCurrency) : false;
$this->value = $priceInCurrentCurrency ? (float)$priceInCurrentCurrency : false;
}
return $this->value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function render(\Magento\Framework\DataObject $row)
return $data;
}

$data = floatval($data) * $this->_getRate($row);
$data = (float)$data * $this->_getRate($row);
$data = sprintf("%f", $data);
$data = $this->_localeCurrency->getCurrency($currencyCode)->toCurrency($data);
return $data;
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Sales/Model/Order/StateResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private function isOrderClosed(OrderInterface $order, $arguments)
{
/** @var $order Order|OrderInterface */
$forceCreditmemo = in_array(self::FORCED_CREDITMEMO, $arguments);
if (floatval($order->getTotalRefunded()) || !$order->getTotalRefunded() && $forceCreditmemo) {
if ((float)$order->getTotalRefunded() || !$order->getTotalRefunded() && $forceCreditmemo) {
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function check(Order $order)
$order->setState(Order::STATE_COMPLETE)
->setStatus($order->getConfig()->getStateDefaultStatus(Order::STATE_COMPLETE));
}
} elseif (floatval($order->getTotalRefunded())
} elseif ((float)$order->getTotalRefunded()
|| !$order->getTotalRefunded() && $order->hasForcedCanCreditmemo()
) {
if ($order->getState() !== Order::STATE_CLOSED) {
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Tax/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ protected function calculateTaxForItems(EntityInterface $order, EntityInterface
$orderItemId = $orderItem->getId();
$orderItemTax = $orderItem->getTaxAmount();
$itemTax = $item->getTaxAmount();
if (!$itemTax || !floatval($orderItemTax)) {
if (!$itemTax || !(float)$orderItemTax) {
continue;
}
//An invoiced item or credit memo item can have a different qty than its order item qty
Expand Down Expand Up @@ -761,7 +761,7 @@ protected function calculateTaxForItems(EntityInterface $order, EntityInterface
$shippingTaxAmount = $salesItem->getShippingTaxAmount();
$originalShippingTaxAmount = $order->getShippingTaxAmount();
if ($shippingTaxAmount && $originalShippingTaxAmount &&
$shippingTaxAmount != 0 && floatval($originalShippingTaxAmount)
$shippingTaxAmount != 0 && (float)$originalShippingTaxAmount
) {
//An invoice or credit memo can have a different qty than its order
$shippingRatio = $shippingTaxAmount / $originalShippingTaxAmount;
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Ups/Model/Carrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ protected function _parseXmlResponse($xmlResponse)

if ($successConversion) {
$costArr[$code] = $cost;
$priceArr[$code] = $this->getMethodPrice(floatval($cost), $code);
$priceArr[$code] = $this->getMethodPrice((float)$cost, $code);
}
}
}
Expand Down