Skip to content

Commit e233c2d

Browse files
author
Stanislav Idolov
authored
ENGCOM-3190: Replace intval() function by using direct type casting to (int) #18608
2 parents c6d0987 + 712830e commit e233c2d

File tree

31 files changed

+49
-53
lines changed

31 files changed

+49
-53
lines changed

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ protected function _prepareForm()
8181
*/
8282
protected function _getSetId()
8383
{
84-
return intval(
84+
return (int)(
8585
$this->getRequest()->getParam('id')
86-
) > 0 ? intval(
86+
) > 0 ? (int)(
8787
$this->getRequest()->getParam('id')
8888
) : $this->_typeFactory->create()->load(
8989
$this->_coreRegistry->registry('entityType')

app/code/Magento/Catalog/Model/ProductLink/CollectionProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public function getCollection(\Magento\Catalog\Model\Product $product, $type)
5858
}
5959

6060
usort($sorterItems, function ($itemA, $itemB) {
61-
$posA = intval($itemA['position']);
62-
$posB = intval($itemB['position']);
61+
$posA = (int)$itemA['position'];
62+
$posB = (int)$itemB['position'];
6363

6464
return $posA <=> $posB;
6565
});

app/code/Magento/CatalogImportExport/Model/Export/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ protected function getItemsPerPage()
806806
// Maximal Products limit
807807
$maxProductsLimit = 5000;
808808

809-
$this->_itemsPerPage = intval(
809+
$this->_itemsPerPage = (int)(
810810
($memoryLimit * $memoryUsagePercent - memory_get_usage(true)) / $memoryPerProduct
811811
);
812812
if ($this->_itemsPerPage < $minProductsLimit) {

app/code/Magento/Config/Model/Config/Backend/Currency/Cron.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public function afterSave()
5959
$frequencyMonthly = \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY;
6060

6161
$cronExprArray = [
62-
intval($time[1]), # Minute
63-
intval($time[0]), # Hour
62+
(int)$time[1], # Minute
63+
(int)$time[0], # Hour
6464
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
6565
'*', # Month of the Year
6666
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week

app/code/Magento/Config/Model/Config/Backend/Log/Cron.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public function afterSave()
7373

7474
if ($enabled) {
7575
$cronExprArray = [
76-
intval($time[1]), # Minute
77-
intval($time[0]), # Hour
76+
(int)$time[1], # Minute
77+
(int)$time[0], # Hour
7878
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
7979
'*', # Month of the Year
8080
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week

app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public function afterSave()
7272
$frequency = $this->getData('groups/productalert_cron/fields/frequency/value');
7373

7474
$cronExprArray = [
75-
intval($time[1]), //Minute
76-
intval($time[0]), //Hour
75+
(int)$time[1], //Minute
76+
(int)$time[0], //Hour
7777
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY ? '1' : '*', //Day of the Month
7878
'*', //Month of the Year
7979
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_WEEKLY ? '1' : '*', //Day of the Week

app/code/Magento/Cron/Model/Config/Backend/Sitemap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public function afterSave()
7070
$frequency = $this->getData('groups/generate/fields/frequency/value');
7171

7272
$cronExprArray = [
73-
intval($time[1]), //Minute
74-
intval($time[0]), //Hour
73+
(int)$time[1], //Minute
74+
(int)$time[0], //Hour
7575
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY ? '1' : '*', //Day of the Month
7676
'*', //Month of the Year
7777
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_WEEKLY ? '1' : '*', //# Day of the Week

app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ protected function getOnlineMinutesInterval()
461461
'customer/online_customers/online_minutes_interval',
462462
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
463463
);
464-
return intval($configValue) > 0 ? intval($configValue) : self::DEFAULT_ONLINE_MINUTES_INTERVAL;
464+
return (int)$configValue > 0 ? (int)$configValue : self::DEFAULT_ONLINE_MINUTES_INTERVAL;
465465
}
466466

467467
/**

app/code/Magento/Customer/Model/Renderer/Region.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function render(AbstractElement $element)
8080
$regionCollection = self::$_regionCollections[$countryId];
8181
}
8282

83-
$regionId = intval($element->getForm()->getElement('region_id')->getValue());
83+
$regionId = (int)$element->getForm()->getElement('region_id')->getValue();
8484

8585
$htmlAttributes = $element->getHtmlAttributes();
8686
foreach ($htmlAttributes as $key => $attribute) {

app/code/Magento/Customer/Model/Visitor.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,9 @@ public function clean()
320320
*/
321321
public function getOnlineInterval()
322322
{
323-
$configValue = intval(
324-
$this->scopeConfig->getValue(
325-
static::XML_PATH_ONLINE_INTERVAL,
326-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
327-
)
323+
$configValue = (int)$this->scopeConfig->getValue(
324+
static::XML_PATH_ONLINE_INTERVAL,
325+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
328326
);
329327
return $configValue ?: static::DEFAULT_ONLINE_MINUTES_INTERVAL;
330328
}

0 commit comments

Comments
 (0)