Skip to content

Commit 3d7eaf6

Browse files
authored
Rector: CQ - UnusedForeachValueToArrayKeysRector (#1)
* Rector: CQ - UnusedForeachValueToArrayKeysRector See Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector * fixes + phpstan See fix at rector: rectorphp/rector-src#6164
1 parent fae22f5 commit 3d7eaf6

File tree

71 files changed

+91
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+91
-96
lines changed

app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public function getChartUrl($directUrl = true)
215215
$dateStart->addMonth(1);
216216
break;
217217
}
218-
foreach ($this->getAllSeries() as $index => $serie) {
218+
foreach (array_keys($this->getAllSeries()) as $index) {
219219
if (in_array($d, $this->_axisLabels['x'])) {
220220
$datas[$index][] = (float)array_shift($this->_allSeries[$index]);
221221
} else {
@@ -328,7 +328,7 @@ public function getChartUrl($directUrl = true)
328328
if (count($this->_axisLabels)) {
329329
$params['chxt'] = implode(',', array_keys($this->_axisLabels));
330330
$indexid = 0;
331-
foreach ($this->_axisLabels as $idx => $labels) {
331+
foreach (array_keys($this->_axisLabels) as $idx) {
332332
if ($idx === 'x') {
333333
/**
334334
* Format date

app/code/core/Mage/Adminhtml/Block/Page/Menu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ protected function _buildMenuArray(Varien_Simplexml_Element $parent, $path = '',
164164

165165
uasort($parentArr, [$this, '_sortMenu']);
166166

167-
foreach ($parentArr as $key => $value) {
167+
foreach (array_keys($parentArr) as $key) {
168168
$last = $key;
169169
}
170170
if (isset($last)) {

app/code/core/Mage/Adminhtml/Block/Report/Grid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ protected function _prepareCollection()
207207
*/
208208
protected function _setFilterValues($data)
209209
{
210-
foreach ($data as $name => $value) {
210+
foreach (array_keys($data) as $name) {
211211
$this->setFilter($name, $data[$name]);
212212
}
213213
return $this;

app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Child/Grid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected function _prepareColumns()
6262
{
6363
$result = parent::_prepareColumns();
6464

65-
foreach ($this->_columns as $key => $value) {
65+
foreach (array_keys($this->_columns) as $key) {
6666
if (in_array($key, $this->_columnsToRemove)) {
6767
unset($this->_columns[$key]);
6868
} else {

app/code/core/Mage/Adminhtml/Block/Store/Switcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function getWebsites()
7373
{
7474
$websites = Mage::app()->getWebsites();
7575
if ($websiteIds = $this->getWebsiteIds()) {
76-
foreach ($websites as $websiteId => $website) {
76+
foreach (array_keys($websites) as $websiteId) {
7777
if (!in_array($websiteId, $websiteIds)) {
7878
unset($websites[$websiteId]);
7979
}
@@ -140,7 +140,7 @@ public function getStores($group)
140140
}
141141
$stores = $group->getStores();
142142
if ($storeIds = $this->getStoreIds()) {
143-
foreach ($stores as $storeId => $store) {
143+
foreach (array_keys($stores) as $storeId) {
144144
if (!in_array($storeId, $storeIds)) {
145145
unset($stores[$storeId]);
146146
}

app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public function getButtonsHtml($area = null)
194194
{
195195
if ($this->_buttonsHtml === null) {
196196
$this->_buttonsHtml = parent::getButtonsHtml();
197-
foreach ($this->_children as $alias => $child) {
197+
foreach (array_keys($this->_children) as $alias) {
198198
if (str_contains($alias, '_button')) {
199199
$this->unsetChild($alias);
200200
}

app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function _prepareForm()
6161
'description' => $model->getDescription(),
6262
];
6363
if ($sessionData = Mage::getSingleton('adminhtml/session')->getData('urlrewrite_data', true)) {
64-
foreach ($formValues as $key => $value) {
64+
foreach (array_keys($formValues) as $key) {
6565
if (isset($sessionData[$key])) {
6666
$formValues[$key] = $sessionData[$key];
6767
}

app/code/core/Mage/Adminhtml/Block/Widget/Grid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ public function getColumns()
481481
*/
482482
protected function _setFilterValues($data)
483483
{
484-
foreach ($data as $columnId => $value) {
484+
foreach (array_keys($data) as $columnId) {
485485
$column = $this->getColumn($columnId);
486486
if ($column instanceof Mage_Adminhtml_Block_Widget_Grid_Column
487487
&& (!empty($data[$columnId]) || strlen($data[$columnId]) > 0)

app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected function _toLinkHtml($action, Varien_Object $row)
109109
*/
110110
protected function _transformActionData(&$action, &$actionCaption, Varien_Object $row)
111111
{
112-
foreach ($action as $attribute => $value) {
112+
foreach (array_keys($action) as $attribute) {
113113
if (isset($action[$attribute]) && !is_array($action[$attribute])) {
114114
$this->getColumn()->setFormat($action[$attribute]);
115115
$action[$attribute] = parent::render($row);

app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ protected function _reorderTabs()
256256
asort($this->_tabPositions);
257257

258258
$ordered = [];
259-
foreach ($this->_tabPositions as $tabId => $position) {
259+
foreach (array_keys($this->_tabPositions) as $tabId) {
260260
if (isset($this->_tabs[$tabId])) {
261261
$tab = $this->_tabs[$tabId];
262262
$ordered[$tabId] = $tab;

0 commit comments

Comments
 (0)