Skip to content

Commit 90c5387

Browse files
committed
[2.3] Changed intval($val) to (int) $val, since it is faster:
- changed intval($val) to (int) $val, since it is faster
1 parent 9a6382c commit 90c5387

File tree

17 files changed

+29
-29
lines changed

17 files changed

+29
-29
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
namespace Magento\Bundle\Model\Product;
88

9-
use Magento\Framework\App\ObjectManager;
9+
use Magento\Bundle\Model\ResourceModel\Selection\Collection as Selections;
10+
use Magento\Bundle\Model\ResourceModel\Selection\Collection\FilterApplier as SelectionCollectionFilterApplier;
1011
use Magento\Catalog\Api\ProductRepositoryInterface;
12+
use Magento\Framework\App\ObjectManager;
13+
use Magento\Framework\EntityManager\MetadataPool;
1114
use Magento\Framework\Pricing\PriceCurrencyInterface;
1215
use Magento\Framework\Serialize\Serializer\Json;
13-
use Magento\Framework\EntityManager\MetadataPool;
14-
use Magento\Bundle\Model\ResourceModel\Selection\Collection\FilterApplier as SelectionCollectionFilterApplier;
15-
use Magento\Bundle\Model\ResourceModel\Selection\Collection as Selections;
1616

1717
/**
1818
* Bundle Type Model
@@ -537,7 +537,7 @@ public function updateQtyOption($options, \Magento\Framework\DataObject $option,
537537
foreach ($options as $quoteItemOption) {
538538
if ($quoteItemOption->getCode() == 'selection_qty_' . $selection->getSelectionId()) {
539539
if ($optionUpdateFlag) {
540-
$quoteItemOption->setValue(intval($quoteItemOption->getValue()));
540+
$quoteItemOption->setValue((int) $quoteItemOption->getValue());
541541
} else {
542542
$quoteItemOption->setValue($value);
543543
}

app/code/Magento/Catalog/Block/Product/Widget/NewWidget.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function getCacheKeyInfo()
139139
[
140140
$this->getDisplayType(),
141141
$this->getProductsPerPage(),
142-
intval($this->getRequest()->getParam($this->getData('page_var_name'), 1)),
142+
(int) $this->getRequest()->getParam($this->getData('page_var_name'), 1),
143143
$this->serializer->serialize($this->getRequest()->getParams())
144144
]
145145
);

app/code/Magento/Catalog/Model/Category.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ public function getParentId()
708708
return $parentId;
709709
}
710710
$parentIds = $this->getParentIds();
711-
return intval(array_pop($parentIds));
711+
return (int) array_pop($parentIds);
712712
}
713713

714714
/**

app/code/Magento/Catalog/Model/ImageExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function process(\DOMElement $mediaNode, $mediaParentTag)
3636
if ($attributeTagName === 'background') {
3737
$nodeValue = $this->processImageBackground($attribute->nodeValue);
3838
} elseif ($attributeTagName === 'width' || $attributeTagName === 'height') {
39-
$nodeValue = intval($attribute->nodeValue);
39+
$nodeValue = (int) $attribute->nodeValue;
4040
} else {
4141
$nodeValue = $attribute->nodeValue;
4242
}

app/code/Magento/Catalog/Model/Product/Compare/Item.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ public function addProductData($product)
158158
{
159159
if ($product instanceof Product) {
160160
$this->setProductId($product->getId());
161-
} elseif (intval($product)) {
162-
$this->setProductId(intval($product));
161+
} elseif ((int) $product) {
162+
$this->setProductId((int) $product);
163163
}
164164

165165
return $this;

app/code/Magento/Catalog/Model/Product/Option/Type/Date.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ public function validateUserValue($values)
102102
$this->setUserValue(
103103
[
104104
'date' => isset($value['date']) ? $value['date'] : '',
105-
'year' => isset($value['year']) ? intval($value['year']) : 0,
106-
'month' => isset($value['month']) ? intval($value['month']) : 0,
107-
'day' => isset($value['day']) ? intval($value['day']) : 0,
108-
'hour' => isset($value['hour']) ? intval($value['hour']) : 0,
109-
'minute' => isset($value['minute']) ? intval($value['minute']) : 0,
105+
'year' => isset($value['year']) ? (int) $value['year'] : 0,
106+
'month' => isset($value['month']) ? (int) $value['month'] : 0,
107+
'day' => isset($value['day']) ? (int) $value['day'] : 0,
108+
'hour' => isset($value['hour']) ? (int) $value['hour'] : 0,
109+
'minute' => isset($value['minute']) ? (int) $value['minute'] : 0,
110110
'day_part' => isset($value['day_part']) ? $value['day_part'] : '',
111111
'date_internal' => isset($value['date_internal']) ? $value['date_internal'] : '',
112112
]

app/code/Magento/Catalog/Model/Product/Option/Validator/DefaultValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,6 @@ protected function isInRange($value, array $range)
168168
*/
169169
protected function isNegative($value)
170170
{
171-
return intval($value) < 0;
171+
return (int) $value < 0;
172172
}
173173
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ public function removeTierPrice(\Magento\Catalog\Model\Product $product, $custom
4646

4747
foreach ($prices as $key => $tierPrice) {
4848
if ($customerGroupId == 'all' && $tierPrice['price_qty'] == $qty
49-
&& $tierPrice['all_groups'] == 1 && intval($tierPrice['website_id']) === intval($websiteId)
49+
&& $tierPrice['all_groups'] == 1 && (int) $tierPrice['website_id'] === (int) $websiteId
5050
) {
5151
unset($prices[$key]);
5252
} elseif ($tierPrice['price_qty'] == $qty && $tierPrice['cust_group'] == $customerGroupId
53-
&& intval($tierPrice['website_id']) === intval($websiteId)
53+
&& (int) $tierPrice['website_id'] === (int) $websiteId
5454
) {
5555
unset($prices[$key]);
5656
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function getList($sku, $customerGroupId)
181181

182182
$prices = [];
183183
foreach ($product->getData('tier_price') as $price) {
184-
if ((is_numeric($customerGroupId) && intval($price['cust_group']) === intval($customerGroupId))
184+
if ((is_numeric($customerGroupId) && (int) $price['cust_group'] === (int) $customerGroupId)
185185
|| ($customerGroupId === 'all' && $price['all_groups'])
186186
) {
187187
/** @var \Magento\Catalog\Api\Data\ProductTierPriceInterface $tierPrice */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public function getTypesByPriority()
285285

286286
$types = $this->getTypes();
287287
foreach ($types as $typeId => $typeInfo) {
288-
$priority = isset($typeInfo['index_priority']) ? abs(intval($typeInfo['index_priority'])) : 0;
288+
$priority = isset($typeInfo['index_priority']) ? abs((int) $typeInfo['index_priority']) : 0;
289289
if (!empty($typeInfo['composite'])) {
290290
$compositePriority[$typeId] = $priority;
291291
} else {

0 commit comments

Comments
 (0)