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
4 changes: 2 additions & 2 deletions app/code/Magento/Backend/Block/Widget/Button/ButtonList.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public function getItems()
*/
public function sortButtons(Item $itemA, Item $itemB)
{
$sortOrderA = (int) $itemA->getSortOrder();
$sortOrderB = (int) $itemB->getSortOrder();
$sortOrderA = (int)$itemA->getSortOrder();
$sortOrderB = (int)$itemB->getSortOrder();

if ($sortOrderA == $sortOrderB) {
return 0;
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Model/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function add(Item $item, $parentId = null, $index = null)
}
$parentItem->getChildren()->add($item, null, $index);
} else {
$index = (int) $index;
$index = (int)$index;
if (!isset($this[$index])) {
$this->offsetSet($index, $item);
$this->_logger->info(
Expand Down
10 changes: 5 additions & 5 deletions app/code/Magento/Backup/Model/Config/Backend/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ public function afterSave()

if ($enabled) {
$cronExprArray = [
(int) $time[1], # Minute
(int) $time[0], # Hour
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
'*', # Month of the Year
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week
(int)$time[1], # Minute
(int)$time[0], # Hour
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
'*', # Month of the Year
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week
];
$cronExprString = implode(' ', $cronExprArray);
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Bundle/Model/Product/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public function updateQtyOption($options, \Magento\Framework\DataObject $option,
foreach ($options as $quoteItemOption) {
if ($quoteItemOption->getCode() == 'selection_qty_' . $selection->getSelectionId()) {
if ($optionUpdateFlag) {
$quoteItemOption->setValue((int) $quoteItemOption->getValue());
$quoteItemOption->setValue((int)$quoteItemOption->getValue());
} else {
$quoteItemOption->setValue($value);
}
Expand All @@ -561,7 +561,7 @@ public function updateQtyOption($options, \Magento\Framework\DataObject $option,
*/
public function prepareQuoteItemQty($qty, $product)
{
return (int) $qty;
return (int)$qty;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ protected function _prepareForm()
*/
protected function _getSetId()
{
return (int) $this->getRequest()->getParam('id') > 0
? (int) $this->getRequest()->getParam('id')
return (int)$this->getRequest()->getParam('id') > 0
? (int)$this->getRequest()->getParam('id')
: $this->_typeFactory->create()->load(
$this->_coreRegistry->registry('entityType')
)->getDefaultAttributeSetId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function getFieldSuffix()
public function getStoreId()
{
$storeId = $this->getRequest()->getParam('store');
return (int) $storeId;
return (int)$storeId;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ public function getRowCount()
*/
public function setColumnCount($columns)
{
if ((int) $columns > 0) {
$this->_columnCount = (int) $columns;
if ((int)$columns > 0) {
$this->_columnCount = (int)$columns;
}
return $this;
}
Expand Down Expand Up @@ -214,8 +214,8 @@ public function getIterableItem()
*/
public function setItemLimit($type, $limit)
{
if ((int) $limit > 0) {
$this->_itemLimits[$type] = (int) $limit;
if ((int)$limit > 0) {
$this->_itemLimits[$type] = (int)$limit;
}
return $this;
}
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(),
(int) $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 @@ -721,7 +721,7 @@ public function getParentId()
return $parentId;
}
$parentIds = $this->getParentIds();
return (int) 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 = (int)$attribute->nodeValue;
$nodeValue = (int)$attribute->nodeValue;
} else {
$nodeValue = $attribute->nodeValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function getColumns()
public function getMainStoreTable($storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID)
{
if (is_string($storeId)) {
$storeId = (int) $storeId;
$storeId = (int)$storeId;
}

$suffix = sprintf('store_%d', $storeId);
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 ((int) $product) {
$this->setProductId((int) $product);
} elseif ((int)$product) {
$this->setProductId((int)$product);
}

return $this;
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/Product/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ public function resize()
*/
public function rotate($angle)
{
$angle = (int) $angle;
$angle = (int)$angle;
$this->getImageProcessor()->rotate($angle);
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 @@ -101,11 +101,11 @@ public function validateUserValue($values)
$this->setUserValue(
[
'date' => isset($value['date']) ? $value['date'] : '',
'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,
'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 (int) $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 && (int) $tierPrice['website_id'] === (int) $websiteId
&& $tierPrice['all_groups'] == 1 && (int)$tierPrice['website_id'] === (int)$websiteId
) {
unset($prices[$key]);
} elseif ($tierPrice['price_qty'] == $qty && $tierPrice['cust_group'] == $customerGroupId
&& (int) $tierPrice['website_id'] === (int) $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) && (int) $price['cust_group'] === (int) $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((int) $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 @@ -666,7 +666,7 @@ public function getProductCount($category)
$bind = ['category_id' => (int)$category->getId()];
$counts = $this->getConnection()->fetchOne($select, $bind);

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

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ protected function getItemsPerPage()
if ($this->_itemsPerPage === null) {
$memoryLimitConfigValue = trim(ini_get('memory_limit'));
$lastMemoryLimitLetter = strtolower($memoryLimitConfigValue[strlen($memoryLimitConfigValue) - 1]);
$memoryUsage = memory_get_usage(true);
$memoryLimit = (int) $memoryLimitConfigValue;
switch ($lastMemoryLimitLetter) {
case 'g':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function initialize(
/**
* if option's qty was updates we also need to update quote item qty
*/
$quoteItem->setData('qty', (int) $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 @@ -115,13 +115,13 @@ public function checkQuoteItemQty(StockItemInterface $stockItem, $qty, $summaryQ
$result->setItemIsQtyDecimal($stockItem->getIsQtyDecimal());
if (!$stockItem->getIsQtyDecimal()) {
$result->setHasQtyOptionUpdate(true);
$qty = (int) $qty;
$qty = (int)$qty;
/**
* Adding stock data to quote item
*/
$result->setItemQty($qty);
$qty = $this->getNumber($qty);
$origQty = (int) $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),
(int) $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 @@ -44,6 +44,6 @@ protected function _getElementHtml(AbstractElement $element)
$format = $this->_localeDate->getDateTimeFormat(
\IntlDateFormatter::MEDIUM
);
return $this->dateTimeFormatter->formatObject($this->_localeDate->date((int) $element->getValue()), $format);
return $this->dateTimeFormatter->formatObject($this->_localeDate->date((int)$element->getValue()), $format);
}
}
10 changes: 5 additions & 5 deletions app/code/Magento/Config/Model/Config/Backend/Currency/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public function afterSave()
$frequencyMonthly = \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY;

$cronExprArray = [
(int) $time[1], # Minute
(int) $time[0], # Hour
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
'*', # Month of the Year
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week
(int)$time[1], # Minute
(int)$time[0], # Hour
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
'*', # Month of the Year
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week
];

$cronExprString = implode(' ', $cronExprArray);
Expand Down
10 changes: 5 additions & 5 deletions app/code/Magento/Config/Model/Config/Backend/Log/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public function afterSave()

if ($enabled) {
$cronExprArray = [
(int) $time[1], # Minute
(int) $time[0], # Hour
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
'*', # Month of the Year
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week
(int)$time[1], # Minute
(int)$time[0], # Hour
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
'*', # Month of the Year
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week
];
$cronExprString = implode(' ', $cronExprArray);
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ public function afterSave()
$frequency = $this->getData('groups/productalert_cron/fields/frequency/value');

$cronExprArray = [
(int) $time[1], //Minute
(int) $time[0], //Hour
(int)$time[1], //Minute
(int)$time[0], //Hour
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY ? '1' : '*', //Day of the Month
'*', //Month of the Year
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_WEEKLY ? '1' : '*', //Day of the Week
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Cron/Model/Config/Backend/Sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public function afterSave()
$frequency = $this->getData('groups/generate/fields/frequency/value');

$cronExprArray = [
(int) $time[1], //Minute
(int) $time[0], //Hour
(int)$time[1], //Minute
(int)$time[0], //Hour
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY ? '1' : '*', //Day of the Month
'*', //Month of the Year
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_WEEKLY ? '1' : '*', //# Day of the Week
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ protected function getOnlineMinutesInterval()
'customer/online_customers/online_minutes_interval',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
return (int) $configValue > 0 ? (int) $configValue : self::DEFAULT_ONLINE_MINUTES_INTERVAL;
return (int)$configValue > 0 ? (int)$configValue : self::DEFAULT_ONLINE_MINUTES_INTERVAL;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Customer/Model/Renderer/Region.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function render(AbstractElement $element)
$regionCollection = self::$_regionCollections[$countryId];
}

$regionId = (int) $element->getForm()->getElement('region_id')->getValue();
$regionId = (int)$element->getForm()->getElement('region_id')->getValue();

$htmlAttributes = $element->getHtmlAttributes();
foreach ($htmlAttributes as $key => $attribute) {
Expand Down
9 changes: 4 additions & 5 deletions app/code/Magento/Customer/Model/Visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,10 @@ public function clean()
*/
public function getOnlineInterval()
{
$configValue = (int)
$this->scopeConfig->getValue(
static::XML_PATH_ONLINE_INTERVAL,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$configValue = (int)$this->scopeConfig->getValue(
static::XML_PATH_ONLINE_INTERVAL,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
return $configValue ?: static::DEFAULT_ONLINE_MINUTES_INTERVAL;
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Directory/Block/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function getRegionHtmlSelect()
)->setClass(
'required-entry validate-state'
)->setValue(
(int) $this->getRegionId()
(int)$this->getRegionId()
)->setOptions(
$options
)->getHtml();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function loadByCode(AbstractModel $object, $entityTypeId, $code)
*/
private function _getMaxSortOrder(AbstractModel $object)
{
if ((int) $object->getAttributeGroupId() > 0) {
if ((int)$object->getAttributeGroupId() > 0) {
$connection = $this->getConnection();
$bind = [
':attribute_set_id' => $object->getAttributeSetId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ protected function getProductInfo(\Magento\Framework\DataObject $buyRequest, $pr
if ($isStrictProcessMode && !$subProduct->getQty()) {
return __('Please specify the quantity of product(s).')->render();
}
$productsInfo[$subProduct->getId()] = (int) $subProduct->getQty();
$productsInfo[$subProduct->getId()] = (int)$subProduct->getQty();
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Paypal/Model/Api/AbstractApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,11 +578,11 @@ protected function _buildQuery($request)
* Paypal note: The value for quantity must be a positive integer. Null, zero, or negative numbers are not allowed.
*
* @param float|string|int $value
* @return string
* @return int
*/
protected function _filterQty($value)
{
return (int) $value;
return (int)$value;
}

/**
Expand Down
Loading