diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
index c8e7af75b29..96ef44e3c65 100644
--- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
+++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
@@ -216,7 +216,7 @@ public function getChartUrl($directUrl = true)
$dateStart->addMonth(1);
break;
}
- foreach ($this->getAllSeries() as $index => $serie) {
+ foreach (array_keys($this->getAllSeries()) as $index) {
if (in_array($d, $this->_axisLabels['x'])) {
$datas[$index][] = (float)array_shift($this->_allSeries[$index]);
} else {
@@ -324,7 +324,7 @@ public function getChartUrl($directUrl = true)
if (count($this->_axisLabels)) {
$params['chxt'] = implode(',', array_keys($this->_axisLabels));
$indexid = 0;
- foreach ($this->_axisLabels as $idx => $labels) {
+ foreach (array_keys($this->_axisLabels) as $idx) {
if ($idx === 'x') {
/**
* Format date
diff --git a/app/code/core/Mage/Adminhtml/Block/Page/Menu.php b/app/code/core/Mage/Adminhtml/Block/Page/Menu.php
index d4872f9158d..20bb44f96f4 100644
--- a/app/code/core/Mage/Adminhtml/Block/Page/Menu.php
+++ b/app/code/core/Mage/Adminhtml/Block/Page/Menu.php
@@ -164,7 +164,7 @@ protected function _buildMenuArray(Varien_Simplexml_Element $parent, $path = '',
uasort($parentArr, [$this, '_sortMenu']);
- foreach ($parentArr as $key => $value) {
+ foreach (array_keys($parentArr) as $key) {
$last = $key;
}
if (isset($last)) {
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Grid.php
index 180a228a288..efc441c2365 100644
--- a/app/code/core/Mage/Adminhtml/Block/Report/Grid.php
+++ b/app/code/core/Mage/Adminhtml/Block/Report/Grid.php
@@ -207,7 +207,7 @@ protected function _prepareCollection()
*/
protected function _setFilterValues($data)
{
- foreach ($data as $name => $value) {
+ foreach (array_keys($data) as $name) {
$this->setFilter($name, $data[$name]);
}
return $this;
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Child/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Child/Grid.php
index 1e8e12f3dd4..2a585eb5b7d 100644
--- a/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Child/Grid.php
+++ b/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Child/Grid.php
@@ -62,7 +62,7 @@ protected function _prepareColumns()
{
$result = parent::_prepareColumns();
- foreach ($this->_columns as $key => $value) {
+ foreach (array_keys($this->_columns) as $key) {
if (in_array($key, $this->_columnsToRemove)) {
unset($this->_columns[$key]);
} else {
diff --git a/app/code/core/Mage/Adminhtml/Block/Store/Switcher.php b/app/code/core/Mage/Adminhtml/Block/Store/Switcher.php
index d0c60a17406..33442aa26b1 100644
--- a/app/code/core/Mage/Adminhtml/Block/Store/Switcher.php
+++ b/app/code/core/Mage/Adminhtml/Block/Store/Switcher.php
@@ -73,7 +73,7 @@ public function getWebsites()
{
$websites = Mage::app()->getWebsites();
if ($websiteIds = $this->getWebsiteIds()) {
- foreach ($websites as $websiteId => $website) {
+ foreach (array_keys($websites) as $websiteId) {
if (!in_array($websiteId, $websiteIds)) {
unset($websites[$websiteId]);
}
@@ -140,7 +140,7 @@ public function getStores($group)
}
$stores = $group->getStores();
if ($storeIds = $this->getStoreIds()) {
- foreach ($stores as $storeId => $store) {
+ foreach (array_keys($stores) as $storeId) {
if (!in_array($storeId, $storeIds)) {
unset($stores[$storeId]);
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php
index 9e369a45972..fc959e184ff 100644
--- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php
+++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php
@@ -194,7 +194,7 @@ public function getButtonsHtml($area = null)
{
if ($this->_buttonsHtml === null) {
$this->_buttonsHtml = parent::getButtonsHtml();
- foreach ($this->_children as $alias => $child) {
+ foreach (array_keys($this->_children) as $alias) {
if (str_contains($alias, '_button')) {
$this->unsetChild($alias);
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php
index a91f22b905a..955c2f871b0 100644
--- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php
+++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php
@@ -61,7 +61,7 @@ protected function _prepareForm()
'description' => $model->getDescription(),
];
if ($sessionData = Mage::getSingleton('adminhtml/session')->getData('urlrewrite_data', true)) {
- foreach ($formValues as $key => $value) {
+ foreach (array_keys($formValues) as $key) {
if (isset($sessionData[$key])) {
$formValues[$key] = $sessionData[$key];
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
index b770eb17ac7..1d44dfbcb30 100644
--- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
+++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
@@ -481,7 +481,7 @@ public function getColumns()
*/
protected function _setFilterValues($data)
{
- foreach ($data as $columnId => $value) {
+ foreach (array_keys($data) as $columnId) {
$column = $this->getColumn($columnId);
if ($column instanceof Mage_Adminhtml_Block_Widget_Grid_Column
&& (!empty($data[$columnId]) || strlen($data[$columnId]) > 0)
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php
index 1fe5f9905b6..9bdad27dbbf 100644
--- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php
+++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php
@@ -109,7 +109,7 @@ protected function _toLinkHtml($action, Varien_Object $row)
*/
protected function _transformActionData(&$action, &$actionCaption, Varien_Object $row)
{
- foreach ($action as $attribute => $value) {
+ foreach (array_keys($action) as $attribute) {
if (isset($action[$attribute]) && !is_array($action[$attribute])) {
$this->getColumn()->setFormat($action[$attribute]);
$action[$attribute] = parent::render($row);
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php
index 94e9fae48a6..ca58c8f7fc6 100644
--- a/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php
+++ b/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php
@@ -256,7 +256,7 @@ protected function _reorderTabs()
asort($this->_tabPositions);
$ordered = [];
- foreach ($this->_tabPositions as $tabId => $position) {
+ foreach (array_keys($this->_tabPositions) as $tabId) {
if (isset($this->_tabs[$tabId])) {
$tab = $this->_tabs[$tabId];
$ordered[$tabId] = $tab;
diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Admin/Page.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Admin/Page.php
index e79b3daedc4..92bfd9d0639 100644
--- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Admin/Page.php
+++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Admin/Page.php
@@ -109,7 +109,7 @@ protected function _buildMenuArray(?Varien_Simplexml_Element $parent = null, $pa
uasort($parentArr, [$this, '_sortMenu']);
- foreach ($parentArr as $key => $value) {
+ foreach (array_keys($parentArr) as $key) {
$last = $key;
}
if (isset($last)) {
diff --git a/app/code/core/Mage/Api2/Model/Acl/Filter.php b/app/code/core/Mage/Api2/Model/Acl/Filter.php
index 3494dfceb14..cefef4dd4f6 100644
--- a/app/code/core/Mage/Api2/Model/Acl/Filter.php
+++ b/app/code/core/Mage/Api2/Model/Acl/Filter.php
@@ -61,7 +61,7 @@ public function __construct(Mage_Api2_Model_Resource $resource)
*/
protected function _filter(array $allowedAttributes, array $data)
{
- foreach ($data as $attribute => $value) {
+ foreach (array_keys($data) as $attribute) {
if (!in_array($attribute, $allowedAttributes)) {
unset($data[$attribute]);
}
diff --git a/app/code/core/Mage/Api2/Model/Acl/Filter/Attribute/ResourcePermission.php b/app/code/core/Mage/Api2/Model/Acl/Filter/Attribute/ResourcePermission.php
index 1016b87c227..f58a244ca00 100644
--- a/app/code/core/Mage/Api2/Model/Acl/Filter/Attribute/ResourcePermission.php
+++ b/app/code/core/Mage/Api2/Model/Acl/Filter/Attribute/ResourcePermission.php
@@ -103,7 +103,7 @@ public function getResourcesPermissions()
$resourceModel->setResourceType($resource)
->setUserType($this->_userType);
- foreach ($operations as $operation => $operationLabel) {
+ foreach (array_keys($operations) as $operation) {
if (!$this->_hasEntityOnlyAttributes
&& $config->getResourceEntityOnlyAttributes($resource, $this->_userType, $operation)
) {
diff --git a/app/code/core/Mage/Catalog/Model/Api2/Product.php b/app/code/core/Mage/Catalog/Model/Api2/Product.php
index 586f1db4acd..f757413be4b 100644
--- a/app/code/core/Mage/Catalog/Model/Api2/Product.php
+++ b/app/code/core/Mage/Catalog/Model/Api2/Product.php
@@ -42,7 +42,7 @@ public function getAvailableAttributes($userType, $operation)
}
$excludedAttrs = $this->getExcludedAttributes($userType, $operation);
$includedAttrs = $this->getIncludedAttributes($userType, $operation);
- foreach ($attributes as $code => $label) {
+ foreach (array_keys($attributes) as $code) {
if (in_array($code, $excludedAttrs) || ($includedAttrs && !in_array($code, $includedAttrs))) {
unset($attributes[$code]);
}
diff --git a/app/code/core/Mage/Catalog/Model/Category.php b/app/code/core/Mage/Catalog/Model/Category.php
index 58cd0b2c7c9..5ff10b609dc 100644
--- a/app/code/core/Mage/Catalog/Model/Category.php
+++ b/app/code/core/Mage/Catalog/Model/Category.php
@@ -346,7 +346,7 @@ public function getAttributes($noDesignAttributes = false)
->getSortedAttributes();
if ($noDesignAttributes) {
- foreach ($result as $k => $a) {
+ foreach (array_keys($result) as $k) {
if (in_array($k, $this->_designAttributes)) {
unset($result[$k]);
}
diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Price.php b/app/code/core/Mage/Catalog/Model/Product/Type/Price.php
index 62e6d7f86ae..df7d7f731c9 100644
--- a/app/code/core/Mage/Catalog/Model/Product/Type/Price.php
+++ b/app/code/core/Mage/Catalog/Model/Product/Type/Price.php
@@ -300,7 +300,7 @@ public function getFormatedTierPrice($qty, $product)
{
$price = $product->getTierPrice($qty);
if (is_array($price)) {
- foreach ($price as $index => $value) {
+ foreach (array_keys($price) as $index) {
$price[$index]['formated_price'] = Mage::app()->getStore()->convertPrice(
$price[$index]['website_price'],
true
diff --git a/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php b/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php
index 3a03e409ef5..7e962fb0b72 100644
--- a/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php
+++ b/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php
@@ -1152,7 +1152,7 @@ protected function _prepareDataForAllFields($category, $replaceFields = [])
$table = $this->_getReadAdapter()->describeTable($table);
$data = [];
$idFieldName = Mage::getSingleton('catalog/category')->getIdFieldName();
- foreach ($table as $column => $columnData) {
+ foreach (array_keys($table) as $column) {
if ($column != $idFieldName || $category->getData($column) !== null) {
if (array_key_exists($column, $replaceFields)) {
$value = $category->getData($replaceFields[$column]);
diff --git a/app/code/core/Mage/Checkout/Model/Type/Onepage.php b/app/code/core/Mage/Checkout/Model/Type/Onepage.php
index f1d8d4a5ced..2cdbe2eec65 100644
--- a/app/code/core/Mage/Checkout/Model/Type/Onepage.php
+++ b/app/code/core/Mage/Checkout/Model/Type/Onepage.php
@@ -119,7 +119,7 @@ public function initCheckout()
$checkout = $this->getCheckout();
$customerSession = $this->getCustomerSession();
if (is_array($checkout->getStepData())) {
- foreach ($checkout->getStepData() as $step => $data) {
+ foreach (array_keys($checkout->getStepData()) as $step) {
if (!($step === 'login' || $customerSession->isLoggedIn() && $step === 'billing')) {
$checkout->setStepData($step, 'allow', false);
}
diff --git a/app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php b/app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php
index db49ed16933..da23ea014ad 100644
--- a/app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php
+++ b/app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php
@@ -136,7 +136,7 @@ public function attachProductChildrenAttributeMapping(array $parentProducts, $st
} // end looping child products
} // end looping attributes
- foreach ($mapping as $key => $value) {
+ foreach (array_keys($mapping) as $key) {
$mapping[$key]['product_ids'] = array_unique($mapping[$key]['product_ids']);
}
diff --git a/app/code/core/Mage/Core/Helper/Data.php b/app/code/core/Mage/Core/Helper/Data.php
index 73029d7952c..d3c9a73ac45 100644
--- a/app/code/core/Mage/Core/Helper/Data.php
+++ b/app/code/core/Mage/Core/Helper/Data.php
@@ -603,7 +603,7 @@ public function assocToXml(array $array, $rootName = '_')
<$rootName>$rootName>
XML;
$xml = new SimpleXMLElement($xmlstr);
- foreach ($array as $key => $value) {
+ foreach (array_keys($array) as $key) {
if (is_numeric($key)) {
throw new Exception('Array root keys must not be numeric.');
}
diff --git a/app/code/core/Mage/Core/Model/Cache.php b/app/code/core/Mage/Core/Model/Cache.php
index fe97c2c491f..9965019bf1e 100644
--- a/app/code/core/Mage/Core/Model/Cache.php
+++ b/app/code/core/Mage/Core/Model/Cache.php
@@ -625,7 +625,7 @@ public function getInvalidatedTypes()
$types = $this->_getInvalidatedTypes();
if ($types) {
$allTypes = $this->getTypes();
- foreach ($types as $type => $flag) {
+ foreach (array_keys($types) as $type) {
if (isset($allTypes[$type]) && $this->canUse($type)) {
$invalidatedTypes[$type] = $allTypes[$type];
}
diff --git a/app/code/core/Mage/Core/Model/Layout/Validator.php b/app/code/core/Mage/Core/Model/Layout/Validator.php
index 9bedeaf8621..2d14731992b 100644
--- a/app/code/core/Mage/Core/Model/Layout/Validator.php
+++ b/app/code/core/Mage/Core/Model/Layout/Validator.php
@@ -108,7 +108,7 @@ public function getDisallowedBlocks()
if (!count($this->_disallowedBlock)) {
$disallowedBlockConfig = $this->_getDisallowedBlockConfigValue();
if (is_array($disallowedBlockConfig)) {
- foreach ($disallowedBlockConfig as $blockName => $value) {
+ foreach (array_keys($disallowedBlockConfig) as $blockName) {
$this->_disallowedBlock[] = $blockName;
}
}
diff --git a/app/code/core/Mage/Core/Model/Locale.php b/app/code/core/Mage/Core/Model/Locale.php
index d3b70a7c1cd..2a0c44563c3 100644
--- a/app/code/core/Mage/Core/Model/Locale.php
+++ b/app/code/core/Mage/Core/Model/Locale.php
@@ -247,7 +247,7 @@ protected function _getOptionLocales($translatedName = false)
}
}
- foreach ($locales as $code => $active) {
+ foreach (array_keys($locales) as $code) {
if (strstr($code, '_')) {
if (!in_array($code, $allowed)) {
continue;
diff --git a/app/code/core/Mage/Core/Model/Log/Adapter.php b/app/code/core/Mage/Core/Model/Log/Adapter.php
index 3bc190114c0..1a173c94d99 100644
--- a/app/code/core/Mage/Core/Model/Log/Adapter.php
+++ b/app/code/core/Mage/Core/Model/Log/Adapter.php
@@ -115,7 +115,7 @@ public function setFilterDataKeys($keys)
protected function _filterDebugData($debugData)
{
if (is_array($debugData) && is_array($this->_debugReplacePrivateDataKeys)) {
- foreach ($debugData as $key => $value) {
+ foreach (array_keys($debugData) as $key) {
if (in_array($key, $this->_debugReplacePrivateDataKeys)) {
$debugData[$key] = '****';
} else {
diff --git a/app/code/core/Mage/Core/Model/Url/Rewrite.php b/app/code/core/Mage/Core/Model/Url/Rewrite.php
index a9bae5f2912..929f39be12c 100644
--- a/app/code/core/Mage/Core/Model/Url/Rewrite.php
+++ b/app/code/core/Mage/Core/Model/Url/Rewrite.php
@@ -319,7 +319,7 @@ protected function _getQueryString()
$queryParams = [];
parse_str($_SERVER['QUERY_STRING'], $queryParams);
$hasChanges = false;
- foreach ($queryParams as $key => $value) {
+ foreach (array_keys($queryParams) as $key) {
if (substr($key, 0, 3) === '___') {
unset($queryParams[$key]);
$hasChanges = true;
diff --git a/app/code/core/Mage/Core/Model/Url/Rewrite/Request.php b/app/code/core/Mage/Core/Model/Url/Rewrite/Request.php
index 80bf9ce24de..f6c14bf4b9a 100644
--- a/app/code/core/Mage/Core/Model/Url/Rewrite/Request.php
+++ b/app/code/core/Mage/Core/Model/Url/Rewrite/Request.php
@@ -306,7 +306,7 @@ protected function _getQueryString()
$queryParams = [];
parse_str($_SERVER['QUERY_STRING'], $queryParams);
$hasChanges = false;
- foreach ($queryParams as $key => $value) {
+ foreach (array_keys($queryParams) as $key) {
if (substr($key, 0, 3) === '___') {
unset($queryParams[$key]);
$hasChanges = true;
diff --git a/app/code/core/Mage/Customer/Model/Address/Api.php b/app/code/core/Mage/Customer/Model/Address/Api.php
index 63120a58f38..9f779558882 100644
--- a/app/code/core/Mage/Customer/Model/Address/Api.php
+++ b/app/code/core/Mage/Customer/Model/Address/Api.php
@@ -55,7 +55,7 @@ public function items($customerId)
$row[$attributeAlias] = $data[$attributeCode] ?? null;
}
- foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
+ foreach (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
if (isset($data[$attributeCode])) {
$row[$attributeCode] = $data[$attributeCode];
}
@@ -89,7 +89,7 @@ public function create($customerId, $addressData)
$address = Mage::getModel('customer/address');
- foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
+ foreach (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
if (isset($addressData[$attributeCode])) {
$address->setData($attributeCode, $addressData[$attributeCode]);
}
@@ -141,7 +141,7 @@ public function info($addressId)
$result[$attributeAlias] = $address->getData($attributeCode);
}
- foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
+ foreach (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
$result[$attributeCode] = $address->getData($attributeCode);
}
@@ -169,7 +169,7 @@ public function update($addressId, $addressData)
$this->_fault('not_exists');
}
- foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
+ foreach (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
if (isset($addressData[$attributeCode])) {
$address->setData($attributeCode, $addressData[$attributeCode]);
}
diff --git a/app/code/core/Mage/Customer/Model/Address/Api/V2.php b/app/code/core/Mage/Customer/Model/Address/Api/V2.php
index 8616fec57a1..901b932eef7 100644
--- a/app/code/core/Mage/Customer/Model/Address/Api/V2.php
+++ b/app/code/core/Mage/Customer/Model/Address/Api/V2.php
@@ -40,7 +40,7 @@ public function create($customerId, $addressData)
$address = Mage::getModel('customer/address');
- foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
+ foreach (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
if (isset($addressData->$attributeCode)) {
$address->setData($attributeCode, $addressData->$attributeCode);
}
@@ -92,7 +92,7 @@ public function info($addressId)
$result[$attributeAlias] = $address->getData($attributeCode);
}
- foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
+ foreach (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
$result[$attributeCode] = $address->getData($attributeCode);
}
@@ -120,7 +120,7 @@ public function update($addressId, $addressData)
$this->_fault('not_exists');
}
- foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
+ foreach (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
if (isset($addressData->$attributeCode)) {
$address->setData($attributeCode, $addressData->$attributeCode);
}
diff --git a/app/code/core/Mage/Customer/Model/Customer/Api.php b/app/code/core/Mage/Customer/Model/Customer/Api.php
index 16853c6c60e..f8daaa27a89 100644
--- a/app/code/core/Mage/Customer/Model/Customer/Api.php
+++ b/app/code/core/Mage/Customer/Model/Customer/Api.php
@@ -87,7 +87,7 @@ public function info($customerId, $attributes = null)
$result[$attributeAlias] = $customer->getData($attributeCode);
}
- foreach ($this->getAllowedAttributes($customer, $attributes) as $attributeCode => $attribute) {
+ foreach (array_keys($this->getAllowedAttributes($customer, $attributes)) as $attributeCode) {
$result[$attributeCode] = $customer->getData($attributeCode);
}
@@ -121,7 +121,7 @@ public function items($filters)
foreach ($this->_mapAttributes as $attributeAlias => $attributeCode) {
$row[$attributeAlias] = $data[$attributeCode] ?? null;
}
- foreach ($this->getAllowedAttributes($customer) as $attributeCode => $attribute) {
+ foreach (array_keys($this->getAllowedAttributes($customer)) as $attributeCode) {
if (isset($data[$attributeCode])) {
$row[$attributeCode] = $data[$attributeCode];
}
@@ -149,7 +149,7 @@ public function update($customerId, $customerData)
$this->_fault('not_exists');
}
- foreach ($this->getAllowedAttributes($customer) as $attributeCode => $attribute) {
+ foreach (array_keys($this->getAllowedAttributes($customer)) as $attributeCode) {
if (isset($customerData[$attributeCode])) {
$customer->setData($attributeCode, $customerData[$attributeCode]);
}
diff --git a/app/code/core/Mage/Dataflow/Model/Session/Parser/Csv.php b/app/code/core/Mage/Dataflow/Model/Session/Parser/Csv.php
index 1a15c400f15..fdf30b8c5f6 100644
--- a/app/code/core/Mage/Dataflow/Model/Session/Parser/Csv.php
+++ b/app/code/core/Mage/Dataflow/Model/Session/Parser/Csv.php
@@ -47,7 +47,7 @@ public function parse()
$fields = $line;
continue;
} else {
- foreach ($line as $j => $f) {
+ foreach (array_keys($line) as $j) {
$fields[$j] = 'column' . ($j + 1);
}
}
diff --git a/app/code/core/Mage/Eav/Model/Entity/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Abstract.php
index 25c93a56c2e..01c39e4c918 100644
--- a/app/code/core/Mage/Eav/Model/Entity/Abstract.php
+++ b/app/code/core/Mage/Eav/Model/Entity/Abstract.php
@@ -1594,7 +1594,7 @@ public function delete($object)
];
$this->_getWriteAdapter()->delete($this->getEntityTable(), $where);
$this->loadAllAttributes($object);
- foreach ($this->getAttributesByTable() as $table => $attributes) {
+ foreach (array_keys($this->getAttributesByTable()) as $table) {
$this->_getWriteAdapter()->delete($table, $where);
}
} catch (Exception $e) {
diff --git a/app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php b/app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php
index 91b578e810a..1ecb2e87b92 100644
--- a/app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php
+++ b/app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php
@@ -790,7 +790,7 @@ protected function _prepareExport()
'_custom_option_row_sku', '_custom_option_row_sort'
];
- foreach ($this->_storeIdToCode as $storeId => &$storeCode) {
+ foreach (array_keys($this->_storeIdToCode) as &$storeId) {
$skip = false;
$options = Mage::getResourceModel('catalog/product_option_collection')
->reset()
@@ -961,7 +961,7 @@ protected function _prepareExport()
$dataRow = array_merge($dataRow, array_shift($configurableData[$productId]));
}
if (!empty($rowMultiselects[$productId][$storeId])) {
- foreach ($rowMultiselects[$productId][$storeId] as $attrKey => $attrVal) {
+ foreach (array_keys($rowMultiselects[$productId][$storeId]) as $attrKey) {
if (isset($rowMultiselects[$productId][$storeId][$attrKey])) {
$dataRow[$attrKey] = array_shift($rowMultiselects[$productId][$storeId][$attrKey]);
}
@@ -1039,7 +1039,7 @@ protected function _prepareExport()
$dataRow = array_merge($dataRow, array_shift($configurableData[$productId]));
}
if (!empty($rowMultiselects[$productId][$storeId])) {
- foreach ($rowMultiselects[$productId][$storeId] as $attrKey => $attrVal) {
+ foreach (array_keys($rowMultiselects[$productId][$storeId]) as $attrKey) {
if (isset($rowMultiselects[$productId][$storeId][$attrKey])) {
$dataRow[$attrKey] = array_shift($rowMultiselects[$productId][$storeId][$attrKey]);
}
diff --git a/app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php b/app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php
index 3ad37c5afb3..a80445efc8b 100644
--- a/app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php
+++ b/app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php
@@ -548,7 +548,7 @@ public function getEntityTypeCode()
public function getRowScope(array $rowData)
{
$foundOptions = false;
- foreach ($this->_multiSelectAttributes as $attrCode => $attribute) {
+ foreach (array_keys($this->_multiSelectAttributes) as $attrCode) {
if ($rowData[$attrCode]) {
$foundOptions = true;
}
diff --git a/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php b/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php
index 2acd52bbc58..ce5f1e8327f 100644
--- a/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php
+++ b/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php
@@ -1101,7 +1101,7 @@ protected function _saveCustomOptions()
if ($productIds) { // update product entity table to show that product has options
$customOptionsProducts = $customOptions['product_id'];
- foreach ($customOptionsProducts as $key => $value) {
+ foreach (array_keys($customOptionsProducts) as $key) {
if (!in_array($key, $productIds)) {
unset($customOptionsProducts[$key]);
}
diff --git a/app/code/core/Mage/Index/Model/Event.php b/app/code/core/Mage/Index/Model/Event.php
index 2035a5be359..d4dc4468a17 100644
--- a/app/code/core/Mage/Index/Model/Event.php
+++ b/app/code/core/Mage/Index/Model/Event.php
@@ -157,7 +157,7 @@ protected function _mergeNewDataRecursive($previous, $current)
return $previous;
}
- foreach ($previous as $key => $value) {
+ foreach (array_keys($previous) as $key) {
if (array_key_exists($key, $current) && !is_null($current[$key]) && is_array($previous[$key])) {
if (!is_string($key) || is_array($current[$key])) {
$current[$key] = $this->_mergeNewDataRecursive($previous[$key], $current[$key]);
diff --git a/app/code/core/Mage/Install/Block/Db/Main.php b/app/code/core/Mage/Install/Block/Db/Main.php
index 9f0789c1ea3..25791d2f5f8 100644
--- a/app/code/core/Mage/Install/Block/Db/Main.php
+++ b/app/code/core/Mage/Install/Block/Db/Main.php
@@ -77,7 +77,7 @@ public function getDatabaseBlock($type)
public function getDatabaseBlocks()
{
$databases = [];
- foreach ($this->_databases as $type => $blockData) {
+ foreach (array_keys($this->_databases) as $type) {
$databases[] = $this->getDatabaseBlock($type);
}
return $databases;
diff --git a/app/code/core/Mage/Install/Model/Installer/Console.php b/app/code/core/Mage/Install/Model/Installer/Console.php
index 033d8db36a4..7c31a5007ab 100644
--- a/app/code/core/Mage/Install/Model/Installer/Console.php
+++ b/app/code/core/Mage/Install/Model/Installer/Console.php
@@ -155,7 +155,7 @@ public function setArgs($args = null)
/**
* Set args values
*/
- foreach ($this->_getOptions() as $name => $option) {
+ foreach (array_keys($this->_getOptions()) as $name) {
$this->_args[$name] = $args[$name] ?? '';
}
diff --git a/app/code/core/Mage/Install/Model/Installer/Db/Abstract.php b/app/code/core/Mage/Install/Model/Installer/Db/Abstract.php
index 40155d07e4a..33b6de0c2ea 100644
--- a/app/code/core/Mage/Install/Model/Installer/Db/Abstract.php
+++ b/app/code/core/Mage/Install/Model/Installer/Db/Abstract.php
@@ -136,7 +136,7 @@ public function getRequiredExtensions()
{
$extensions = [];
$configExt = (array)Mage::getConfig()->getNode(sprintf('install/databases/%s/extensions', $this->getModel()));
- foreach ($configExt as $name => $value) {
+ foreach (array_keys($configExt) as $name) {
$extensions[] = $name;
}
return $extensions;
diff --git a/app/code/core/Mage/Page/Block/Template/Links.php b/app/code/core/Mage/Page/Block/Template/Links.php
index b52e2f367eb..aacfd69b27e 100644
--- a/app/code/core/Mage/Page/Block/Template/Links.php
+++ b/app/code/core/Mage/Page/Block/Template/Links.php
@@ -242,7 +242,7 @@ protected function _getNewPosition($position = 0)
}
} else {
$position = 0;
- foreach ($this->_links as $k => $v) {
+ foreach (array_keys($this->_links) as $k) {
$position = $k;
}
$position += 10;
diff --git a/app/code/core/Mage/Paygate/Model/Authorizenet.php b/app/code/core/Mage/Paygate/Model/Authorizenet.php
index 9039d02bade..8b968e48644 100644
--- a/app/code/core/Mage/Paygate/Model/Authorizenet.php
+++ b/app/code/core/Mage/Paygate/Model/Authorizenet.php
@@ -1475,7 +1475,7 @@ protected function _addTransaction(
$payment->setTransactionAdditionalInfo($key, $value);
}
$transaction = $payment->addTransaction($transactionType, null, false, $message);
- foreach ($transactionDetails as $key => $value) {
+ foreach (array_keys($transactionDetails) as $key) {
$payment->unsetData($key);
}
$payment->unsLastTransId();
diff --git a/app/code/core/Mage/Payment/Block/Form/Cc.php b/app/code/core/Mage/Payment/Block/Form/Cc.php
index 5435e7f4a75..08a12b4c037 100644
--- a/app/code/core/Mage/Payment/Block/Form/Cc.php
+++ b/app/code/core/Mage/Payment/Block/Form/Cc.php
@@ -47,7 +47,7 @@ public function getCcAvailableTypes()
$availableTypes = $method->getConfigData('cctypes');
if ($availableTypes) {
$availableTypes = explode(',', $availableTypes);
- foreach ($types as $code => $name) {
+ foreach (array_keys($types) as $code) {
if (!in_array($code, $availableTypes)) {
unset($types[$code]);
}
diff --git a/app/code/core/Mage/Payment/Helper/Data.php b/app/code/core/Mage/Payment/Helper/Data.php
index a7f9071c590..fed881ddeae 100644
--- a/app/code/core/Mage/Payment/Helper/Data.php
+++ b/app/code/core/Mage/Payment/Helper/Data.php
@@ -67,7 +67,7 @@ public function getMethodInstance($code)
public function getStoreMethods($store = null, $quote = null)
{
$res = [];
- foreach ($this->getPaymentMethods($store) as $code => $methodConfig) {
+ foreach (array_keys($this->getPaymentMethods($store)) as $code) {
$prefix = self::XML_PATH_PAYMENT_METHODS . '/' . $code . '/';
if (!$model = Mage::getStoreConfig($prefix . 'model', $store)) {
continue;
@@ -166,7 +166,7 @@ public function getBillingAgreementMethods($store = null, $quote = null)
public function getRecurringProfileMethods($store = null)
{
$result = [];
- foreach ($this->getPaymentMethods($store) as $code => $data) {
+ foreach (array_keys($this->getPaymentMethods($store)) as $code) {
$paymentMethodModelClassName = $this->getMethodModelClassName($code);
if (!$paymentMethodModelClassName) {
continue;
@@ -244,7 +244,7 @@ public function getPaymentMethodList($sorted = true, $asLabelValue = false, $wit
}
if ($asLabelValue) {
$labelValues = [];
- foreach ($methods as $code => $title) {
+ foreach (array_keys($methods) as $code) {
$labelValues[$code] = [];
}
foreach ($methods as $code => $title) {
diff --git a/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement.php b/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement.php
index ec75245e7e2..fca1a3d661e 100644
--- a/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement.php
+++ b/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement.php
@@ -58,7 +58,7 @@ protected function _afterSave(Mage_Core_Model_Abstract $object)
/** @var Mage_Core_Model_Date $date */
$date = Mage::getSingleton('core/date');
- foreach ($rows as $key => $row) {
+ foreach (array_keys($rows) as $key) {
/*
* Converting dates
*/
diff --git a/app/code/core/Mage/Reports/Model/Totals.php b/app/code/core/Mage/Reports/Model/Totals.php
index 33f899cc705..6b98422fdee 100644
--- a/app/code/core/Mage/Reports/Model/Totals.php
+++ b/app/code/core/Mage/Reports/Model/Totals.php
@@ -47,7 +47,7 @@ public function countTotals($grid, $from, $to)
}
$data = $item->getData();
- foreach ($columns as $field => $a) {
+ foreach (array_keys($columns) as $field) {
if ($field !== '') {
$columns[$field]['value'] += $data[$field] ?? 0;
}
diff --git a/app/code/core/Mage/Rule/Model/Action/Abstract.php b/app/code/core/Mage/Rule/Model/Action/Abstract.php
index a810922d2f7..d8cb87fb7f4 100644
--- a/app/code/core/Mage/Rule/Model/Action/Abstract.php
+++ b/app/code/core/Mage/Rule/Model/Action/Abstract.php
@@ -52,11 +52,11 @@ public function __construct()
parent::__construct();
$this->loadAttributeOptions()->loadOperatorOptions()->loadValueOptions();
- foreach ($this->getAttributeOption() as $attr => $dummy) {
+ foreach (array_keys($this->getAttributeOption()) as $attr) {
$this->setAttribute($attr);
break;
}
- foreach ($this->getOperatorOption() as $operator => $dummy) {
+ foreach (array_keys($this->getOperatorOption()) as $operator) {
$this->setOperator($operator);
break;
}
diff --git a/app/code/core/Mage/Rule/Model/Condition/Abstract.php b/app/code/core/Mage/Rule/Model/Condition/Abstract.php
index d2e67c86270..e31fbdda29c 100644
--- a/app/code/core/Mage/Rule/Model/Condition/Abstract.php
+++ b/app/code/core/Mage/Rule/Model/Condition/Abstract.php
@@ -92,13 +92,13 @@ public function __construct()
$this->loadAttributeOptions()->loadOperatorOptions()->loadValueOptions();
if ($options = $this->getAttributeOptions()) {
- foreach ($options as $attr => $dummy) {
+ foreach (array_keys($options) as $attr) {
$this->setAttribute($attr);
break;
}
}
if ($options = $this->getOperatorOptions()) {
- foreach ($options as $operator => $dummy) {
+ foreach (array_keys($options) as $operator) {
$this->setOperator($operator);
break;
}
@@ -503,7 +503,7 @@ public function getTypeElementHtml()
public function getAttributeElement()
{
if (is_null($this->getAttribute())) {
- foreach ($this->getAttributeOption() as $k => $v) {
+ foreach (array_keys($this->getAttributeOption()) as $k) {
$this->setAttribute($k);
break;
}
diff --git a/app/code/core/Mage/Rule/Model/Condition/Combine.php b/app/code/core/Mage/Rule/Model/Condition/Combine.php
index 79d4e693c38..1d9b0093d13 100644
--- a/app/code/core/Mage/Rule/Model/Condition/Combine.php
+++ b/app/code/core/Mage/Rule/Model/Condition/Combine.php
@@ -95,7 +95,7 @@ public function __construct()
$this->loadAggregatorOptions();
if ($options = $this->getAggregatorOptions()) {
- foreach ($options as $aggregator => $dummy) {
+ foreach (array_keys($options) as $aggregator) {
$this->setAggregator($aggregator);
break;
}
diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php b/app/code/core/Mage/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php
index 52bf6a9b347..713bee21bab 100644
--- a/app/code/core/Mage/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php
+++ b/app/code/core/Mage/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php
@@ -125,7 +125,7 @@ protected function _prepareColumns()
{
$result = parent::_prepareColumns();
- foreach ($this->_columns as $key => $value) {
+ foreach (array_keys($this->_columns) as $key) {
if (in_array($key, $this->_columnsToRemove)) {
unset($this->_columns[$key]);
}
diff --git a/app/code/core/Mage/Sales/Model/Resource/Report/Order/Createdat.php b/app/code/core/Mage/Sales/Model/Resource/Report/Order/Createdat.php
index 323ce47e00f..a9971351972 100644
--- a/app/code/core/Mage/Sales/Model/Resource/Report/Order/Createdat.php
+++ b/app/code/core/Mage/Sales/Model/Resource/Report/Order/Createdat.php
@@ -230,7 +230,7 @@ protected function _aggregateByField($aggregationField, $from, $to)
$adapter->query($select->insertFromSelect($this->getMainTable(), array_keys($columns)));
// setup all columns to select SUM() except period, store_id and order_status
- foreach ($columns as $k => $v) {
+ foreach (array_keys($columns) as $k) {
$columns[$k] = new Zend_Db_Expr('SUM(' . $k . ')');
}
$columns['period'] = 'period';
diff --git a/app/code/core/Mage/Sales/Model/Resource/Sale/Collection.php b/app/code/core/Mage/Sales/Model/Resource/Sale/Collection.php
index 1bf6ed99bf1..f2972e84cc9 100644
--- a/app/code/core/Mage/Sales/Model/Resource/Sale/Collection.php
+++ b/app/code/core/Mage/Sales/Model/Resource/Sale/Collection.php
@@ -182,7 +182,7 @@ public function load($printQuery = false, $logQuery = false)
->setWebsiteId(Mage::app()->getStore($storeId)->getWebsiteId())
->setAvgNormalized($v['avgsale'] * $v['num_orders']);
$this->_items[$storeId] = $storeObject;
- foreach ($this->_totals as $key => $value) {
+ foreach (array_keys($this->_totals) as $key) {
$this->_totals[$key] += $storeObject->getData($key);
}
}
diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.13-0.8.14.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.13-0.8.14.php
index 43d089aa854..9525a968c57 100644
--- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.13-0.8.14.php
+++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.13-0.8.14.php
@@ -183,7 +183,7 @@
$select->from(['e' => $this->getTable('sales_order_entity')]);
$attributeIds = [];
-foreach ($attributes as $code => $params) {
+foreach (array_keys($attributes) as $code) {
$attributes[$code] = $installer->getAttribute($orderEntityTypeId, $code);
if ($attributes[$code]['backend_type'] != 'static') {
$select->joinLeft(
diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.50-0.9.51.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.50-0.9.51.php
index 3e9e34ea693..69722481f54 100644
--- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.50-0.9.51.php
+++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.50-0.9.51.php
@@ -46,7 +46,7 @@
");
/* get order_payment attribute codes*/
-foreach ($attributesIds as $attributeCode => $attributeId) {
+foreach (array_keys($attributesIds) as $attributeCode) {
$attributesIds[$attributeCode] = $connection->fetchOne("
SELECT attribute_id
FROM {$this->getTable('eav_attribute')}
diff --git a/app/code/core/Mage/Shipping/Model/Rate/Result.php b/app/code/core/Mage/Shipping/Model/Rate/Result.php
index fa06daacb29..bc7ad148a12 100644
--- a/app/code/core/Mage/Shipping/Model/Rate/Result.php
+++ b/app/code/core/Mage/Shipping/Model/Rate/Result.php
@@ -180,7 +180,7 @@ public function sortRatesByPrice()
natsort($tmp);
- foreach ($tmp as $i => $price) {
+ foreach (array_keys($tmp) as $i) {
$result[] = $this->_rates[$i];
}
diff --git a/app/code/core/Mage/Tag/Helper/Data.php b/app/code/core/Mage/Tag/Helper/Data.php
index c86d4d5eee1..a2de68080cc 100644
--- a/app/code/core/Mage/Tag/Helper/Data.php
+++ b/app/code/core/Mage/Tag/Helper/Data.php
@@ -73,7 +73,7 @@ public function extractTags($tagNamesInString)
*/
public function cleanTags(array $tagNamesArr)
{
- foreach ($tagNamesArr as $key => $tagName) {
+ foreach (array_keys($tagNamesArr) as $key) {
$tagNamesArr[$key] = trim($tagNamesArr[$key], '\'');
$tagNamesArr[$key] = trim($tagNamesArr[$key]);
if ($tagNamesArr[$key] == '') {
diff --git a/app/code/core/Mage/Tag/controllers/IndexController.php b/app/code/core/Mage/Tag/controllers/IndexController.php
index 54b26c441f7..833837c75b6 100644
--- a/app/code/core/Mage/Tag/controllers/IndexController.php
+++ b/app/code/core/Mage/Tag/controllers/IndexController.php
@@ -99,7 +99,7 @@ protected function _extractTags($tagNamesInString)
*/
protected function _cleanTags(array $tagNamesArr)
{
- foreach ($tagNamesArr as $key => $tagName) {
+ foreach (array_keys($tagNamesArr) as $key) {
$tagNamesArr[$key] = trim($tagNamesArr[$key], '\'');
$tagNamesArr[$key] = trim($tagNamesArr[$key]);
if ($tagNamesArr[$key] == '') {
diff --git a/app/code/core/Mage/Weee/Model/Attribute/Backend/Weee/Tax.php b/app/code/core/Mage/Weee/Model/Attribute/Backend/Weee/Tax.php
index ed49099010c..f6ed065e028 100644
--- a/app/code/core/Mage/Weee/Model/Attribute/Backend/Weee/Tax.php
+++ b/app/code/core/Mage/Weee/Model/Attribute/Backend/Weee/Tax.php
@@ -74,7 +74,7 @@ public function afterLoad($object)
{
$data = $this->_getResource()->loadProductData($object, $this->getAttribute());
- foreach ($data as $i => $row) {
+ foreach (array_keys($data) as $i) {
if ($data[$i]['website_id'] == 0) {
$rate = Mage::app()->getStore()->getBaseCurrency()->getRate(Mage::app()->getBaseCurrencyCode());
if ($rate) {
diff --git a/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Catalog/Product/Attribute/Edit/AttributeForm.php b/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Catalog/Product/Attribute/Edit/AttributeForm.php
index 9683e4322cd..1344cfc1a92 100644
--- a/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Catalog/Product/Attribute/Edit/AttributeForm.php
+++ b/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Catalog/Product/Attribute/Edit/AttributeForm.php
@@ -45,7 +45,7 @@ public function getData(FixtureInterface $fixture = null, Element $element = nul
{
$data = [];
if ($fixture === null) {
- foreach ($this->tabs as $tabName => $tab) {
+ foreach (array_keys($this->tabs) as $tabName) {
$this->openTab($tabName);
$tabData = $this->getTabElement($tabName)->getDataFormTab();
$data = array_merge($data, $tabData);
diff --git a/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Catalog/Product/Edit/Tab/Prices.php b/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Catalog/Product/Edit/Tab/Prices.php
index 3346dcc17a8..657f84a8239 100644
--- a/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Catalog/Product/Edit/Tab/Prices.php
+++ b/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Catalog/Product/Edit/Tab/Prices.php
@@ -54,7 +54,7 @@ class Prices extends Tab
public function fillFormTab(array $fields, Element $element = null)
{
$context = $element ? $element : $this->_rootElement;
- foreach ($this->childrenForm as $key => $value) {
+ foreach (array_keys($this->childrenForm) as $key) {
if (isset($fields[$key])) {
$this->fillOptionsPrices([$key => $fields[$key]], $context);
unset($fields[$key]);
@@ -91,7 +91,7 @@ public function getDataFormTab($fields = null, Element $element = null)
{
$result = [];
$context = $element ? $element : $this->_rootElement;
- foreach ($this->childrenForm as $key => $value) {
+ foreach (array_keys($this->childrenForm) as $key) {
if (isset($fields[$key])) {
$result[$key] = $this->getOptionsPrices([$key => $fields[$key]], $context);
unset($fields[$key]);
diff --git a/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Catalog/Product/ProductForm.php b/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Catalog/Product/ProductForm.php
index 584a8f25fbc..565b823b7c5 100644
--- a/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Catalog/Product/ProductForm.php
+++ b/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Catalog/Product/ProductForm.php
@@ -341,7 +341,7 @@ public function getRequireNoticeAttributes(FixtureInterface $product)
{
$data = [];
$tabs = $this->getFieldsByTabs($product);
- foreach ($tabs as $tabName => $fields) {
+ foreach (array_keys($tabs) as $tabName) {
$tab = $this->getTabElement($tabName);
$this->openTab($tabName);
$errors = $tab->getRequireNoticeMessages();
diff --git a/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Widget/FormTabs.php b/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Widget/FormTabs.php
index 8d9596cda76..a0c24f0c42d 100644
--- a/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Widget/FormTabs.php
+++ b/dev/tests/functional/tests/app/Mage/Adminhtml/Test/Block/Widget/FormTabs.php
@@ -135,7 +135,7 @@ protected function fillTabs(array $tabs, Element $element = null)
*/
protected function fillMissedFields()
{
- foreach ($this->tabs as $tabName => $tabData) {
+ foreach (array_keys($this->tabs) as $tabName) {
$tabElement = $this->getTabElement($tabName);
if ($this->openTab($tabName)) {
$mapping = $tabElement->dataMapping($this->unassignedFields);
@@ -174,7 +174,7 @@ public function getData(FixtureInterface $fixture = null, Element $element = nul
$data = [];
if (null === $fixture) {
- foreach ($this->tabs as $tabName => $tab) {
+ foreach (array_keys($this->tabs) as $tabName) {
$this->openTab($tabName);
$tabData = $this->getTabElement($tabName)->getDataFormTab();
$data = array_merge($data, $tabData);
diff --git a/dev/tests/functional/tests/app/Mage/Bundle/Test/Handler/Curl.php b/dev/tests/functional/tests/app/Mage/Bundle/Test/Handler/Curl.php
index e4777d9f973..eb79bfc90ef 100644
--- a/dev/tests/functional/tests/app/Mage/Bundle/Test/Handler/Curl.php
+++ b/dev/tests/functional/tests/app/Mage/Bundle/Test/Handler/Curl.php
@@ -146,7 +146,7 @@ protected function prepareBundleSelections(array $bundleData)
*/
protected function prepareItemSelectionData(array $selections, array $products)
{
- foreach ($selections as $key => $selection) {
+ foreach (array_keys($selections) as $key) {
$selections[$key]['product_id'] = $products[$key]->getId();
unset($selections[$key]['sku']);
$selections[$key]['delete'] = '';
@@ -163,7 +163,7 @@ protected function prepareItemSelectionData(array $selections, array $products)
*/
protected function prepareBundleOptions(array $bundleData)
{
- foreach ($bundleData as $key => $option) {
+ foreach (array_keys($bundleData) as $key) {
$bundleData[$key] = array_intersect_key($bundleData[$key], array_flip($this->optionsFields));
$bundleData[$key]['delete'] = '';
}
diff --git a/dev/tests/functional/tests/app/Mage/Catalog/Test/TestStep/UpdateConfigurableProductStep/DeleteOptionsSubStep.php b/dev/tests/functional/tests/app/Mage/Catalog/Test/TestStep/UpdateConfigurableProductStep/DeleteOptionsSubStep.php
index 6b18d2b8ea3..16d05ab359c 100644
--- a/dev/tests/functional/tests/app/Mage/Catalog/Test/TestStep/UpdateConfigurableProductStep/DeleteOptionsSubStep.php
+++ b/dev/tests/functional/tests/app/Mage/Catalog/Test/TestStep/UpdateConfigurableProductStep/DeleteOptionsSubStep.php
@@ -86,7 +86,7 @@ protected function searchKeysForOption($optionIndex)
{
$keys = [];
$originalProductAssignedProducts = $this->getOriginalProductAssignedProducts();
- foreach ($originalProductAssignedProducts as $key => $product) {
+ foreach (array_keys($originalProductAssignedProducts) as $key) {
if (strpos($key, 'option_key_' . $optionIndex) !== false) {
$keys[] = $key;
}
diff --git a/dev/tests/functional/tests/app/Mage/Customer/Test/Handler/Customer/Curl.php b/dev/tests/functional/tests/app/Mage/Customer/Test/Handler/Customer/Curl.php
index 68f2f85b69a..23d27ff801b 100644
--- a/dev/tests/functional/tests/app/Mage/Customer/Test/Handler/Customer/Curl.php
+++ b/dev/tests/functional/tests/app/Mage/Customer/Test/Handler/Customer/Curl.php
@@ -131,7 +131,7 @@ public function persist(FixtureInterface $customer = null)
*/
protected function checkForUpdateData(array $data)
{
- foreach ($data as $key => $field) {
+ foreach (array_keys($data) as $key) {
if (in_array($key, $this->updatingFields)) {
return true;
}
diff --git a/dev/tests/functional/tests/app/Mage/Weee/Test/Constraint/AssertFptApplied.php b/dev/tests/functional/tests/app/Mage/Weee/Test/Constraint/AssertFptApplied.php
index c1b61df6d23..baf99e0e016 100644
--- a/dev/tests/functional/tests/app/Mage/Weee/Test/Constraint/AssertFptApplied.php
+++ b/dev/tests/functional/tests/app/Mage/Weee/Test/Constraint/AssertFptApplied.php
@@ -145,7 +145,7 @@ protected function clearShoppingCart()
protected function getPrices()
{
$actualPrices = [];
- foreach ($this->expectedPrices as $priceType => $prices) {
+ foreach (array_keys($this->expectedPrices) as $priceType) {
$actualPrices[$priceType] = $this->{'get' . ucfirst($priceType) . 'Price'}();
}
diff --git a/lib/Varien/Convert/Parser/Csv.php b/lib/Varien/Convert/Parser/Csv.php
index f857c3b85a8..4550d155691 100644
--- a/lib/Varien/Convert/Parser/Csv.php
+++ b/lib/Varien/Convert/Parser/Csv.php
@@ -44,7 +44,7 @@ public function parse()
$fields = $line;
continue;
} else {
- foreach ($line as $j => $f) {
+ foreach (array_keys($line) as $j) {
$fields[$j] = 'column' . ($j + 1);
}
}
@@ -87,7 +87,7 @@ public function parseTest()
$fields = $line;
continue;
} else {
- foreach ($line as $j => $f) {
+ foreach (array_keys($line) as $j) {
$fields[$j] = 'column' . ($j + 1);
}
}
diff --git a/lib/Varien/Db/Statement/Pdo/Mysql.php b/lib/Varien/Db/Statement/Pdo/Mysql.php
index b23cb8435fa..d5f83882237 100644
--- a/lib/Varien/Db/Statement/Pdo/Mysql.php
+++ b/lib/Varien/Db/Statement/Pdo/Mysql.php
@@ -33,7 +33,7 @@ public function _executeWithBinding(array $params)
{
// Check whether we deal with named bind
$isPositionalBind = true;
- foreach ($params as $k => $v) {
+ foreach (array_keys($params) as $k) {
if (!is_int($k)) {
$isPositionalBind = false;
break;
diff --git a/lib/Varien/Http/Adapter/Curl.php b/lib/Varien/Http/Adapter/Curl.php
index 56e9359a23f..1e9fd81f16b 100644
--- a/lib/Varien/Http/Adapter/Curl.php
+++ b/lib/Varien/Http/Adapter/Curl.php
@@ -75,7 +75,7 @@ protected function _applyConfig()
$verifyHost = isset($this->_config['verifyhost']) ? $this->_config['verifyhost'] : 0;
curl_setopt($this->_getResource(), CURLOPT_SSL_VERIFYHOST, $verifyHost);
- foreach ($this->_config as $param => $curlOption) {
+ foreach (array_keys($this->_config) as $param) {
if (array_key_exists($param, $this->_allowedParams)) {
curl_setopt($this->_getResource(), $this->_allowedParams[$param], $this->_config[$param]);
}
diff --git a/lib/Varien/Object.php b/lib/Varien/Object.php
index df0cc949853..fb13b89a667 100644
--- a/lib/Varien/Object.php
+++ b/lib/Varien/Object.php
@@ -292,7 +292,7 @@ public function unsetData($key = null)
public function unsetOldData($key = null)
{
if (is_null($key)) {
- foreach ($this->_oldFieldsMap as $key => $newFieldName) {
+ foreach (array_keys($this->_oldFieldsMap) as $key) {
unset($this->_data[$key]);
}
} else {
diff --git a/lib/Varien/Object/Cache.php b/lib/Varien/Object/Cache.php
index 11b6cc23775..24047b87356 100644
--- a/lib/Varien/Object/Cache.php
+++ b/lib/Varien/Object/Cache.php
@@ -241,7 +241,7 @@ public function delete($idx)
}
if (isset($this->_objectReferences[$idx])) {
- foreach ($this->_references as $r => $dummy) {
+ foreach (array_keys($this->_references) as $r) {
unset($this->_references[$r]);
}
unset($this->_objectReferences[$idx]);
diff --git a/phpstan.dist.baseline.neon b/phpstan.dist.baseline.neon
index 9d21613e6e1..d76ae2364c0 100644
--- a/phpstan.dist.baseline.neon
+++ b/phpstan.dist.baseline.neon
@@ -550,6 +550,16 @@ parameters:
count: 1
path: app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php
+ -
+ message: "#^If condition is always true\\.$#"
+ count: 1
+ path: app/code/core/Mage/Api/Block/Adminhtml/Tab/Rolesedit.php
+
+ -
+ message: "#^Call to an undefined method Mage_Api_Model_Resource_Roles_User_Collection\\:\\:setUserFilter\\(\\)\\.$#"
+ count: 1
+ path: app/code/core/Mage/Api/Block/Adminhtml/Tab/Userroles.php
+
-
message: "#^Method Mage_Api_Model_Acl\\:\\:_getRoleRegistry\\(\\) should return Mage_Api_Model_Acl_Role_Registry but returns Zend_Acl_Role_Registry\\.$#"
count: 1
@@ -3225,11 +3235,6 @@ parameters:
count: 1
path: app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php
- -
- message: "#^Offset int\\|string on non\\-empty\\-array\\ in isset\\(\\) always exists and is not nullable\\.$#"
- count: 2
- path: app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php
-
-
message: "#^Variable \\$collection might not be defined\\.$#"
count: 1