Skip to content

Commit 872e489

Browse files
author
Stanislav Idolov
authored
ENGCOM-2927: [2.3] changed intval($val) to (int) $val, since (int) $val is faster. #17946
2 parents 4648798 + 0a39b78 commit 872e489

File tree

8 files changed

+13
-15
lines changed

8 files changed

+13
-15
lines changed

app/code/Magento/Backend/Block/Widget/Button/ButtonList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ public function getItems()
127127
*/
128128
public function sortButtons(Item $itemA, Item $itemB)
129129
{
130-
$sortOrderA = intval($itemA->getSortOrder());
131-
$sortOrderB = intval($itemB->getSortOrder());
130+
$sortOrderA = (int) $itemA->getSortOrder();
131+
$sortOrderB = (int) $itemB->getSortOrder();
132132

133133
if ($sortOrderA == $sortOrderB) {
134134
return 0;

app/code/Magento/Backend/Model/Menu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function add(Item $item, $parentId = null, $index = null)
8383
}
8484
$parentItem->getChildren()->add($item, null, $index);
8585
} else {
86-
$index = intval($index);
86+
$index = (int) $index;
8787
if (!isset($this[$index])) {
8888
$this->offsetSet($index, $item);
8989
$this->_logger->info(

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

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

7777
if ($enabled) {
7878
$cronExprArray = [
79-
intval($time[1]), # Minute
80-
intval($time[0]), # Hour
79+
(int) $time[1], # Minute
80+
(int) $time[0], # Hour
8181
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
8282
'*', # Month of the Year
8383
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week

app/code/Magento/Bundle/Model/Product/Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ public function updateQtyOption($options, \Magento\Framework\DataObject $option,
559559
*/
560560
public function prepareQuoteItemQty($qty, $product)
561561
{
562-
return intval($qty);
562+
return (int) $qty;
563563
}
564564

565565
/**

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function getFieldSuffix()
7474
public function getStoreId()
7575
{
7676
$storeId = $this->getRequest()->getParam('store');
77-
return intval($storeId);
77+
return (int) $storeId;
7878
}
7979

8080
/**

app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
namespace Magento\Catalog\Block\Product\ProductList;
88

99
use Magento\Catalog\Model\ResourceModel\Product\Collection;
10-
use Magento\Framework\View\Element\AbstractBlock;
1110

1211
/**
1312
* Catalog product upsell items block
@@ -170,8 +169,8 @@ public function getRowCount()
170169
*/
171170
public function setColumnCount($columns)
172171
{
173-
if (intval($columns) > 0) {
174-
$this->_columnCount = intval($columns);
172+
if ((int) $columns > 0) {
173+
$this->_columnCount = (int) $columns;
175174
}
176175
return $this;
177176
}
@@ -213,8 +212,8 @@ public function getIterableItem()
213212
*/
214213
public function setItemLimit($type, $limit)
215214
{
216-
if (intval($limit) > 0) {
217-
$this->_itemLimits[$type] = intval($limit);
215+
if ((int) $limit > 0) {
216+
$this->_itemLimits[$type] = (int) $limit;
218217
}
219218
return $this;
220219
}

app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
namespace Magento\Catalog\Model\Indexer\Category\Flat;
88

99
use Magento\Framework\App\ResourceConnection;
10-
use Magento\Framework\EntityManager\MetadataPool;
1110

1211
class AbstractAction
1312
{
@@ -111,7 +110,7 @@ public function getColumns()
111110
public function getMainStoreTable($storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID)
112111
{
113112
if (is_string($storeId)) {
114-
$storeId = intval($storeId);
113+
$storeId = (int) $storeId;
115114
}
116115

117116
$suffix = sprintf('store_%d', $storeId);

app/code/Magento/Catalog/Model/Product/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ public function resize()
484484
*/
485485
public function rotate($angle)
486486
{
487-
$angle = intval($angle);
487+
$angle = (int) $angle;
488488
$this->getImageProcessor()->rotate($angle);
489489
return $this;
490490
}

0 commit comments

Comments
 (0)