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
10 changes: 5 additions & 5 deletions app/code/Magento/Bundle/Model/Product/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

namespace Magento\Bundle\Model\Product;

use Magento\Framework\App\ObjectManager;
use Magento\Bundle\Model\ResourceModel\Selection\Collection as Selections;
use Magento\Bundle\Model\ResourceModel\Selection\Collection\FilterApplier as SelectionCollectionFilterApplier;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\Serialize\Serializer\Json;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Bundle\Model\ResourceModel\Selection\Collection\FilterApplier as SelectionCollectionFilterApplier;
use Magento\Bundle\Model\ResourceModel\Selection\Collection as Selections;

/**
* Bundle Type Model
Expand Down Expand Up @@ -537,7 +537,7 @@ public function updateQtyOption($options, \Magento\Framework\DataObject $option,
foreach ($options as $quoteItemOption) {
if ($quoteItemOption->getCode() == 'selection_qty_' . $selection->getSelectionId()) {
if ($optionUpdateFlag) {
$quoteItemOption->setValue(intval($quoteItemOption->getValue()));
$quoteItemOption->setValue((int) $quoteItemOption->getValue());
} else {
$quoteItemOption->setValue($value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function getCacheKeyInfo()
[
$this->getDisplayType(),
$this->getProductsPerPage(),
intval($this->getRequest()->getParam($this->getData('page_var_name'), 1)),
(int) $this->getRequest()->getParam($this->getData('page_var_name'), 1),
$this->serializer->serialize($this->getRequest()->getParams())
]
);
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ public function getParentId()
return $parentId;
}
$parentIds = $this->getParentIds();
return intval(array_pop($parentIds));
return (int) array_pop($parentIds);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/ImageExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function process(\DOMElement $mediaNode, $mediaParentTag)
if ($attributeTagName === 'background') {
$nodeValue = $this->processImageBackground($attribute->nodeValue);
} elseif ($attributeTagName === 'width' || $attributeTagName === 'height') {
$nodeValue = intval($attribute->nodeValue);
$nodeValue = (int) $attribute->nodeValue;
} else {
$nodeValue = $attribute->nodeValue;
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/Model/Product/Compare/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ public function addProductData($product)
{
if ($product instanceof Product) {
$this->setProductId($product->getId());
} elseif (intval($product)) {
$this->setProductId(intval($product));
} elseif ((int) $product) {
$this->setProductId((int) $product);
}

return $this;
Expand Down
10 changes: 5 additions & 5 deletions app/code/Magento/Catalog/Model/Product/Option/Type/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ public function validateUserValue($values)
$this->setUserValue(
[
'date' => isset($value['date']) ? $value['date'] : '',
'year' => isset($value['year']) ? intval($value['year']) : 0,
'month' => isset($value['month']) ? intval($value['month']) : 0,
'day' => isset($value['day']) ? intval($value['day']) : 0,
'hour' => isset($value['hour']) ? intval($value['hour']) : 0,
'minute' => isset($value['minute']) ? intval($value['minute']) : 0,
'year' => isset($value['year']) ? (int) $value['year'] : 0,
'month' => isset($value['month']) ? (int) $value['month'] : 0,
'day' => isset($value['day']) ? (int) $value['day'] : 0,
'hour' => isset($value['hour']) ? (int) $value['hour'] : 0,
'minute' => isset($value['minute']) ? (int) $value['minute'] : 0,
'day_part' => isset($value['day_part']) ? $value['day_part'] : '',
'date_internal' => isset($value['date_internal']) ? $value['date_internal'] : '',
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,6 @@ protected function isInRange($value, array $range)
*/
protected function isNegative($value)
{
return intval($value) < 0;
return (int) $value < 0;
}
}
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/Model/Product/PriceModifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public function removeTierPrice(\Magento\Catalog\Model\Product $product, $custom

foreach ($prices as $key => $tierPrice) {
if ($customerGroupId == 'all' && $tierPrice['price_qty'] == $qty
&& $tierPrice['all_groups'] == 1 && intval($tierPrice['website_id']) === intval($websiteId)
&& $tierPrice['all_groups'] == 1 && (int) $tierPrice['website_id'] === (int) $websiteId
) {
unset($prices[$key]);
} elseif ($tierPrice['price_qty'] == $qty && $tierPrice['cust_group'] == $customerGroupId
&& intval($tierPrice['website_id']) === intval($websiteId)
&& (int) $tierPrice['website_id'] === (int) $websiteId
) {
unset($prices[$key]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function getList($sku, $customerGroupId)

$prices = [];
foreach ($product->getData('tier_price') as $price) {
if ((is_numeric($customerGroupId) && intval($price['cust_group']) === intval($customerGroupId))
if ((is_numeric($customerGroupId) && (int) $price['cust_group'] === (int) $customerGroupId)
|| ($customerGroupId === 'all' && $price['all_groups'])
) {
/** @var \Magento\Catalog\Api\Data\ProductTierPriceInterface $tierPrice */
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/Product/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public function getTypesByPriority()

$types = $this->getTypes();
foreach ($types as $typeId => $typeInfo) {
$priority = isset($typeInfo['index_priority']) ? abs(intval($typeInfo['index_priority'])) : 0;
$priority = isset($typeInfo['index_priority']) ? abs((int) $typeInfo['index_priority']) : 0;
if (!empty($typeInfo['composite'])) {
$compositePriority[$typeId] = $priority;
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/ResourceModel/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ public function getProductCount($category)
$bind = ['category_id' => (int)$category->getId()];
$counts = $this->getConnection()->fetchOne($select, $bind);

return intval($counts);
return (int) $counts;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function getMainTable()
public function getMainStoreTable($storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID)
{
if (is_string($storeId)) {
$storeId = intval($storeId);
$storeId = (int) $storeId;
}

if ($storeId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function initialize(
/**
* if option's qty was updates we also need to update quote item qty
*/
$quoteItem->setData('qty', intval($qty));
$quoteItem->setData('qty', (int) $qty);
}
if ($result->getMessage() !== null) {
$option->setMessage($result->getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
use Magento\Catalog\Model\ProductFactory;
use Magento\CatalogInventory\Api\Data\StockItemInterface;
use Magento\CatalogInventory\Model\Spi\StockStateProviderInterface;
use Magento\Framework\DataObject\Factory as ObjectFactory;
use Magento\Framework\Locale\FormatInterface;
use Magento\Framework\Math\Division as MathDivision;
use Magento\Framework\DataObject\Factory as ObjectFactory;

/**
* Interface StockStateProvider
Expand Down Expand Up @@ -113,13 +113,13 @@ public function checkQuoteItemQty(StockItemInterface $stockItem, $qty, $summaryQ
$result->setItemIsQtyDecimal($stockItem->getIsQtyDecimal());
if (!$stockItem->getIsQtyDecimal()) {
$result->setHasQtyOptionUpdate(true);
$qty = intval($qty);
$qty = (int) $qty;
/**
* Adding stock data to quote item
*/
$result->setItemQty($qty);
$qty = $this->getNumber($qty);
$origQty = intval($origQty);
$origQty = (int) $origQty;
$result->setOrigQty($origQty);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function getCacheKeyInfo()
$this->_storeManager->getStore()->getId(),
$this->_design->getDesignTheme()->getId(),
$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP),
intval($this->getRequest()->getParam($this->getData('page_var_name'), 1)),
(int) $this->getRequest()->getParam($this->getData('page_var_name'), 1),
$this->getProductsPerPage(),
$conditions,
$this->json->serialize($this->getRequest()->getParams()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(
protected function _getElementHtml(AbstractElement $element)
{
return $this->dateTimeFormatter->formatObject(
$this->_localeDate->date(intval($element->getValue())),
$this->_localeDate->date((int) $element->getValue()),
$this->_localeDate->getDateTimeFormat(\IntlDateFormatter::MEDIUM)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ protected function _getElementHtml(AbstractElement $element)
$format = $this->_localeDate->getDateTimeFormat(
\IntlDateFormatter::MEDIUM
);
return $this->dateTimeFormatter->formatObject($this->_localeDate->date(intval($element->getValue())), $format);
return $this->dateTimeFormatter->formatObject($this->_localeDate->date((int) $element->getValue()), $format);
}
}