diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
index afc5f13938c..700d3b3b17d 100644
--- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
+++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
@@ -215,7 +215,7 @@ public function getChartUrl($directUrl = true)
$dateStart->addMonth(1);
break;
}
- foreach (array_keys($this->getAllSeries()) as $index) {
+ foreach ($this->getAllSeries() as $index => $serie) {
if (in_array($d, $this->_axisLabels['x'])) {
$datas[$index][] = (float)array_shift($this->_allSeries[$index]);
} else {
@@ -328,7 +328,7 @@ public function getChartUrl($directUrl = true)
if (count($this->_axisLabels)) {
$params['chxt'] = implode(',', array_keys($this->_axisLabels));
$indexid = 0;
- foreach (array_keys($this->_axisLabels) as $idx) {
+ foreach ($this->_axisLabels as $idx => $labels) {
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 20bb44f96f4..d4872f9158d 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 (array_keys($parentArr) as $key) {
+ foreach ($parentArr as $key => $value) {
$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 efc441c2365..180a228a288 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 (array_keys($data) as $name) {
+ foreach ($data as $name => $value) {
$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 2a585eb5b7d..1e8e12f3dd4 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 (array_keys($this->_columns) as $key) {
+ foreach ($this->_columns as $key => $value) {
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 33442aa26b1..d0c60a17406 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 (array_keys($websites) as $websiteId) {
+ foreach ($websites as $websiteId => $website) {
if (!in_array($websiteId, $websiteIds)) {
unset($websites[$websiteId]);
}
@@ -140,7 +140,7 @@ public function getStores($group)
}
$stores = $group->getStores();
if ($storeIds = $this->getStoreIds()) {
- foreach (array_keys($stores) as $storeId) {
+ foreach ($stores as $storeId => $store) {
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 fc959e184ff..9e369a45972 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 (array_keys($this->_children) as $alias) {
+ foreach ($this->_children as $alias => $child) {
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 955c2f871b0..a91f22b905a 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 (array_keys($formValues) as $key) {
+ foreach ($formValues as $key => $value) {
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 5b701ae5133..af36a237924 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 (array_keys($data) as $columnId) {
+ foreach ($data as $columnId => $value) {
$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 9bdad27dbbf..1fe5f9905b6 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 (array_keys($action) as $attribute) {
+ foreach ($action as $attribute => $value) {
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 ca58c8f7fc6..94e9fae48a6 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 (array_keys($this->_tabPositions) as $tabId) {
+ foreach ($this->_tabPositions as $tabId => $position) {
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 92bfd9d0639..e79b3daedc4 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 (array_keys($parentArr) as $key) {
+ foreach ($parentArr as $key => $value) {
$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 cefef4dd4f6..3494dfceb14 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 (array_keys($data) as $attribute) {
+ foreach ($data as $attribute => $value) {
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 f58a244ca00..1016b87c227 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 (array_keys($operations) as $operation) {
+ foreach ($operations as $operation => $operationLabel) {
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 f757413be4b..586f1db4acd 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 (array_keys($attributes) as $code) {
+ foreach ($attributes as $code => $label) {
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 5ff10b609dc..58cd0b2c7c9 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 (array_keys($result) as $k) {
+ foreach ($result as $k => $a) {
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 df7d7f731c9..62e6d7f86ae 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 (array_keys($price) as $index) {
+ foreach ($price as $index => $value) {
$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 7e962fb0b72..3a03e409ef5 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 (array_keys($table) as $column) {
+ foreach ($table as $column => $columnData) {
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 2cdbe2eec65..f1d8d4a5ced 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 (array_keys($checkout->getStepData()) as $step) {
+ foreach ($checkout->getStepData() as $step => $data) {
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 da23ea014ad..db49ed16933 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 (array_keys($mapping) as $key) {
+ foreach ($mapping as $key => $value) {
$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 d3c9a73ac45..73029d7952c 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_keys($array) as $key) {
+ foreach ($array as $key => $value) {
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 9965019bf1e..fe97c2c491f 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 (array_keys($types) as $type) {
+ foreach ($types as $type => $flag) {
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 2d14731992b..9bedeaf8621 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 (array_keys($disallowedBlockConfig) as $blockName) {
+ foreach ($disallowedBlockConfig as $blockName => $value) {
$this->_disallowedBlock[] = $blockName;
}
}
diff --git a/app/code/core/Mage/Core/Model/Locale.php b/app/code/core/Mage/Core/Model/Locale.php
index 2a0c44563c3..d3b70a7c1cd 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 (array_keys($locales) as $code) {
+ foreach ($locales as $code => $active) {
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 1a173c94d99..3bc190114c0 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 (array_keys($debugData) as $key) {
+ foreach ($debugData as $key => $value) {
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 929f39be12c..a9bae5f2912 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 (array_keys($queryParams) as $key) {
+ foreach ($queryParams as $key => $value) {
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 f6c14bf4b9a..80bf9ce24de 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 (array_keys($queryParams) as $key) {
+ foreach ($queryParams as $key => $value) {
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 9f779558882..63120a58f38 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 (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
+ foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
if (isset($data[$attributeCode])) {
$row[$attributeCode] = $data[$attributeCode];
}
@@ -89,7 +89,7 @@ public function create($customerId, $addressData)
$address = Mage::getModel('customer/address');
- foreach (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
+ foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
if (isset($addressData[$attributeCode])) {
$address->setData($attributeCode, $addressData[$attributeCode]);
}
@@ -141,7 +141,7 @@ public function info($addressId)
$result[$attributeAlias] = $address->getData($attributeCode);
}
- foreach (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
+ foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
$result[$attributeCode] = $address->getData($attributeCode);
}
@@ -169,7 +169,7 @@ public function update($addressId, $addressData)
$this->_fault('not_exists');
}
- foreach (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
+ foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
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 901b932eef7..8616fec57a1 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 (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
+ foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
if (isset($addressData->$attributeCode)) {
$address->setData($attributeCode, $addressData->$attributeCode);
}
@@ -92,7 +92,7 @@ public function info($addressId)
$result[$attributeAlias] = $address->getData($attributeCode);
}
- foreach (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
+ foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
$result[$attributeCode] = $address->getData($attributeCode);
}
@@ -120,7 +120,7 @@ public function update($addressId, $addressData)
$this->_fault('not_exists');
}
- foreach (array_keys($this->getAllowedAttributes($address)) as $attributeCode) {
+ foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
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 f8daaa27a89..16853c6c60e 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 (array_keys($this->getAllowedAttributes($customer, $attributes)) as $attributeCode) {
+ foreach ($this->getAllowedAttributes($customer, $attributes) as $attributeCode => $attribute) {
$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 (array_keys($this->getAllowedAttributes($customer)) as $attributeCode) {
+ foreach ($this->getAllowedAttributes($customer) as $attributeCode => $attribute) {
if (isset($data[$attributeCode])) {
$row[$attributeCode] = $data[$attributeCode];
}
@@ -149,7 +149,7 @@ public function update($customerId, $customerData)
$this->_fault('not_exists');
}
- foreach (array_keys($this->getAllowedAttributes($customer)) as $attributeCode) {
+ foreach ($this->getAllowedAttributes($customer) as $attributeCode => $attribute) {
if (isset($customerData[$attributeCode])) {
$customer->setData($attributeCode, $customerData[$attributeCode]);
}
diff --git a/app/code/core/Mage/Dataflow/Model/Batch.php b/app/code/core/Mage/Dataflow/Model/Batch.php
index 1235b8f468f..1f727062e73 100644
--- a/app/code/core/Mage/Dataflow/Model/Batch.php
+++ b/app/code/core/Mage/Dataflow/Model/Batch.php
@@ -92,12 +92,12 @@ public function getFieldList()
*/
public function parseFieldList($row)
{
- foreach (array_keys($row) as $fieldName) {
+ foreach ($row as $fieldName => $value) {
if (!in_array($fieldName, $this->_fieldList)) {
$this->_fieldList[$fieldName] = $fieldName;
}
}
- unset($fieldName, $row);
+ unset($fieldName, $value, $row);
}
/**
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 fdf30b8c5f6..1a15c400f15 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 (array_keys($line) as $j) {
+ foreach ($line as $j => $f) {
$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 01c39e4c918..25c93a56c2e 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 (array_keys($this->getAttributesByTable()) as $table) {
+ foreach ($this->getAttributesByTable() as $table => $attributes) {
$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 1ecb2e87b92..91b578e810a 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 (array_keys($this->_storeIdToCode) as &$storeId) {
+ foreach ($this->_storeIdToCode as $storeId => &$storeCode) {
$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 (array_keys($rowMultiselects[$productId][$storeId]) as $attrKey) {
+ foreach ($rowMultiselects[$productId][$storeId] as $attrKey => $attrVal) {
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 (array_keys($rowMultiselects[$productId][$storeId]) as $attrKey) {
+ foreach ($rowMultiselects[$productId][$storeId] as $attrKey => $attrVal) {
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 a80445efc8b..3ad37c5afb3 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 (array_keys($this->_multiSelectAttributes) as $attrCode) {
+ foreach ($this->_multiSelectAttributes as $attrCode => $attribute) {
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 ce5f1e8327f..2acd52bbc58 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 (array_keys($customOptionsProducts) as $key) {
+ foreach ($customOptionsProducts as $key => $value) {
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 d4dc4468a17..2035a5be359 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 (array_keys($previous) as $key) {
+ foreach ($previous as $key => $value) {
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 25791d2f5f8..9f0789c1ea3 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 (array_keys($this->_databases) as $type) {
+ foreach ($this->_databases as $type => $blockData) {
$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 7c31a5007ab..033d8db36a4 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 (array_keys($this->_getOptions()) as $name) {
+ foreach ($this->_getOptions() as $name => $option) {
$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 33b6de0c2ea..40155d07e4a 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 (array_keys($configExt) as $name) {
+ foreach ($configExt as $name => $value) {
$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 aacfd69b27e..b52e2f367eb 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 (array_keys($this->_links) as $k) {
+ foreach ($this->_links as $k => $v) {
$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 c32a8b69385..5659e2caac3 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 (array_keys($transactionDetails) as $key) {
+ foreach ($transactionDetails as $key => $value) {
$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 08a12b4c037..5435e7f4a75 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 (array_keys($types) as $code) {
+ foreach ($types as $code => $name) {
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 fed881ddeae..a7f9071c590 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 (array_keys($this->getPaymentMethods($store)) as $code) {
+ foreach ($this->getPaymentMethods($store) as $code => $methodConfig) {
$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 (array_keys($this->getPaymentMethods($store)) as $code) {
+ foreach ($this->getPaymentMethods($store) as $code => $data) {
$paymentMethodModelClassName = $this->getMethodModelClassName($code);
if (!$paymentMethodModelClassName) {
continue;
@@ -244,7 +244,7 @@ public function getPaymentMethodList($sorted = true, $asLabelValue = false, $wit
}
if ($asLabelValue) {
$labelValues = [];
- foreach (array_keys($methods) as $code) {
+ foreach ($methods as $code => $title) {
$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 fca1a3d661e..ec75245e7e2 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 (array_keys($rows) as $key) {
+ foreach ($rows as $key => $row) {
/*
* Converting dates
*/
diff --git a/app/code/core/Mage/Reports/Model/Totals.php b/app/code/core/Mage/Reports/Model/Totals.php
index 6b98422fdee..33f899cc705 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 (array_keys($columns) as $field) {
+ foreach ($columns as $field => $a) {
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 d8cb87fb7f4..a810922d2f7 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 (array_keys($this->getAttributeOption()) as $attr) {
+ foreach ($this->getAttributeOption() as $attr => $dummy) {
$this->setAttribute($attr);
break;
}
- foreach (array_keys($this->getOperatorOption()) as $operator) {
+ foreach ($this->getOperatorOption() as $operator => $dummy) {
$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 e31fbdda29c..d2e67c86270 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 (array_keys($options) as $attr) {
+ foreach ($options as $attr => $dummy) {
$this->setAttribute($attr);
break;
}
}
if ($options = $this->getOperatorOptions()) {
- foreach (array_keys($options) as $operator) {
+ foreach ($options as $operator => $dummy) {
$this->setOperator($operator);
break;
}
@@ -503,7 +503,7 @@ public function getTypeElementHtml()
public function getAttributeElement()
{
if (is_null($this->getAttribute())) {
- foreach (array_keys($this->getAttributeOption()) as $k) {
+ foreach ($this->getAttributeOption() as $k => $v) {
$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 1d9b0093d13..79d4e693c38 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 (array_keys($options) as $aggregator) {
+ foreach ($options as $aggregator => $dummy) {
$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 713bee21bab..52bf6a9b347 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 (array_keys($this->_columns) as $key) {
+ foreach ($this->_columns as $key => $value) {
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 a9971351972..323ce47e00f 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 (array_keys($columns) as $k) {
+ foreach ($columns as $k => $v) {
$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 f2972e84cc9..1bf6ed99bf1 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 (array_keys($this->_totals) as $key) {
+ foreach ($this->_totals as $key => $value) {
$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 9525a968c57..43d089aa854 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 (array_keys($attributes) as $code) {
+foreach ($attributes as $code => $params) {
$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 69722481f54..3e9e34ea693 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 (array_keys($attributesIds) as $attributeCode) {
+foreach ($attributesIds as $attributeCode => $attributeId) {
$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 bc7ad148a12..fa06daacb29 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 (array_keys($tmp) as $i) {
+ foreach ($tmp as $i => $price) {
$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 a2de68080cc..c86d4d5eee1 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 (array_keys($tagNamesArr) as $key) {
+ foreach ($tagNamesArr as $key => $tagName) {
$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 833837c75b6..54b26c441f7 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 (array_keys($tagNamesArr) as $key) {
+ foreach ($tagNamesArr as $key => $tagName) {
$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 f6ed065e028..ed49099010c 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 (array_keys($data) as $i) {
+ foreach ($data as $i => $row) {
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 1344cfc1a92..9683e4322cd 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 (array_keys($this->tabs) as $tabName) {
+ foreach ($this->tabs as $tabName => $tab) {
$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 657f84a8239..3346dcc17a8 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 (array_keys($this->childrenForm) as $key) {
+ foreach ($this->childrenForm as $key => $value) {
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 (array_keys($this->childrenForm) as $key) {
+ foreach ($this->childrenForm as $key => $value) {
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 565b823b7c5..584a8f25fbc 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 (array_keys($tabs) as $tabName) {
+ foreach ($tabs as $tabName => $fields) {
$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 a0c24f0c42d..8d9596cda76 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 (array_keys($this->tabs) as $tabName) {
+ foreach ($this->tabs as $tabName => $tabData) {
$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 (array_keys($this->tabs) as $tabName) {
+ foreach ($this->tabs as $tabName => $tab) {
$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 eb79bfc90ef..e4777d9f973 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 (array_keys($selections) as $key) {
+ foreach ($selections as $key => $selection) {
$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 (array_keys($bundleData) as $key) {
+ foreach ($bundleData as $key => $option) {
$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 16d05ab359c..6b18d2b8ea3 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 (array_keys($originalProductAssignedProducts) as $key) {
+ foreach ($originalProductAssignedProducts as $key => $product) {
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 23d27ff801b..68f2f85b69a 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 (array_keys($data) as $key) {
+ foreach ($data as $key => $field) {
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 baf99e0e016..c1b61df6d23 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 (array_keys($this->expectedPrices) as $priceType) {
+ foreach ($this->expectedPrices as $priceType => $prices) {
$actualPrices[$priceType] = $this->{'get' . ucfirst($priceType) . 'Price'}();
}
diff --git a/lib/Varien/Convert/Parser/Csv.php b/lib/Varien/Convert/Parser/Csv.php
index 4550d155691..f857c3b85a8 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 (array_keys($line) as $j) {
+ foreach ($line as $j => $f) {
$fields[$j] = 'column' . ($j + 1);
}
}
@@ -87,7 +87,7 @@ public function parseTest()
$fields = $line;
continue;
} else {
- foreach (array_keys($line) as $j) {
+ foreach ($line as $j => $f) {
$fields[$j] = 'column' . ($j + 1);
}
}
diff --git a/lib/Varien/Db/Statement/Pdo/Mysql.php b/lib/Varien/Db/Statement/Pdo/Mysql.php
index d5f83882237..b23cb8435fa 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 (array_keys($params) as $k) {
+ foreach ($params as $k => $v) {
if (!is_int($k)) {
$isPositionalBind = false;
break;
diff --git a/lib/Varien/Http/Adapter/Curl.php b/lib/Varien/Http/Adapter/Curl.php
index 1e9fd81f16b..56e9359a23f 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 (array_keys($this->_config) as $param) {
+ foreach ($this->_config as $param => $curlOption) {
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 968d5b0fc02..bfd0f11bcff 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 (array_keys($this->_oldFieldsMap) as $key) {
+ foreach ($this->_oldFieldsMap as $key => $newFieldName) {
unset($this->_data[$key]);
}
} else {
diff --git a/lib/Varien/Object/Cache.php b/lib/Varien/Object/Cache.php
index 24047b87356..11b6cc23775 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 (array_keys($this->_references) as $r) {
+ foreach ($this->_references as $r => $dummy) {
unset($this->_references[$r]);
}
unset($this->_objectReferences[$idx]);
diff --git a/phpstan.dist.baseline.neon b/phpstan.dist.baseline.neon
index 52c437a2709..58d3dfd945d 100644
--- a/phpstan.dist.baseline.neon
+++ b/phpstan.dist.baseline.neon
@@ -3365,6 +3365,11 @@ 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