Skip to content

Commit c1d7b61

Browse files
authored
1 parent 84e999f commit c1d7b61

File tree

9 files changed

+21
-10
lines changed

9 files changed

+21
-10
lines changed

.rector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
CodeQuality\Equal\UseIdenticalOverEqualWithSameTypeRector::class, # todo: TMP
5252
CodeQuality\Expression\InlineIfToExplicitIfRector::class, # todo: TMP (!?!)
5353
CodeQuality\Expression\TernaryFalseExpressionToIfRector::class, # todo: TMP (!?!)
54-
CodeQuality\For_\ForRepeatedCountToOwnVariableRector::class, # todo: TMP
5554
CodeQuality\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector::class, # todo: TMP
5655
CodeQuality\FuncCall\SimplifyRegexPatternRector::class, # todo: TMP
5756
CodeQuality\FunctionLike\SimplifyUselessVariableRector::class, # todo: TMP

app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
373373
$this->setInterval([$from, $to]);
374374

375375
$priorFilters = [];
376-
for ($i = 1; $i < count($filterParams); ++$i) {
376+
$counter = count($filterParams);
377+
for ($i = 1; $i < $counter; ++$i) {
377378
$priorFilter = $this->_validateFilter($filterParams[$i]);
378379
if ($priorFilter) {
379380
$priorFilters[] = $priorFilter;

app/code/core/Mage/Core/functions.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ function mageDelTree($path)
227227
function mageParseCsv($string, $delimiter = ',', $enclosure = '"', $escape = '\\')
228228
{
229229
$elements = explode($delimiter, $string);
230-
for ($i = 0; $i < count($elements); $i++) {
230+
$counter = count($elements);
231+
for ($i = 0; $i < $counter; $i++) {
231232
$nquotes = substr_count($elements[$i], $enclosure);
232233
if ($nquotes % 2 == 1) {
233234
for ($j = $i + 1; $j < count($elements); $j++) {

app/code/core/Mage/Paypal/Model/Report/Settlement.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,19 @@ public function parseCsv($localCsv, $format = 'new')
267267
case 'CH': // Section columns.
268268
// In case ever the column order is changed, we will have the items recorded properly
269269
// anyway. We have named, not numbered columns.
270-
for ($i = 1; $i < count($line); $i++) {
270+
$counter = count($line);
271+
// Section columns.
272+
// In case ever the column order is changed, we will have the items recorded properly
273+
// anyway. We have named, not numbered columns.
274+
for ($i = 1; $i < $counter; $i++) {
271275
$sectionColumns[$line[$i]] = $i;
272276
}
273277
$flippedSectionColumns = array_flip($sectionColumns);
274278
break;
275279
case 'SB': // Section body.
276280
$bodyItem = [];
277-
for ($i = 1; $i < count($line); $i++) {
281+
$counter = count($line);
282+
for ($i = 1; $i < $counter; $i++) {
278283
$bodyItem[$rowMap[$flippedSectionColumns[$i]]] = $line[$i];
279284
}
280285
$this->_rows[] = $bodyItem;

lib/Mage/Archive.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ public function pack($source, $destination = 'packed.tgz', $skipRoot = false)
100100
{
101101
$archivers = $this->_getArchivers($destination);
102102
$interimSource = '';
103-
for ($i = 0; $i < count($archivers); $i++) {
103+
$counter = count($archivers);
104+
for ($i = 0; $i < $counter; $i++) {
104105
if ($i == (count($archivers) - 1)) {
105106
$packed = $destination;
106107
} else {

lib/Mage/System/Ftp.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public function mkdirRecursive($path, $mode = 0777)
6363
$dir = explode('/', $path);
6464
$path = '';
6565
$ret = true;
66-
for ($i = 0; $i < count($dir); $i++) {
66+
$counter = count($dir);
67+
for ($i = 0; $i < $counter; $i++) {
6768
$path .= '/' . $dir[$i];
6869
if (!@ftp_chdir($this->_conn, $path)) {
6970
@ftp_chdir($this->_conn, '/');

lib/Magento/Profiler/OutputAbstract.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ private function _getSortedTimers()
115115

116116
$prevTimerId = $timerIds[0];
117117
$result = [$prevTimerId];
118-
for ($i = 1; $i < count($timerIds); $i++) {
118+
$counter = count($timerIds);
119+
for ($i = 1; $i < $counter; $i++) {
119120
$timerId = $timerIds[$i];
120121
/* Skip already added timer */
121122
if (!$timerId) {

lib/Varien/Filter/Template.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ protected function _getVariable($value, $default = '{no_value_defined}')
269269
$last = 0;
270270
/** @var Mage_Adminhtml_Model_Email_PathValidator $emailPathValidator */
271271
$emailPathValidator = $this->getEmailPathValidator();
272-
for ($i = 0; $i < count($stackVars); $i++) {
272+
$counter = count($stackVars);
273+
for ($i = 0; $i < $counter; $i++) {
273274
if ($i == 0 && isset($this->_templateVars[$stackVars[$i]['name']])) {
274275
// Getting of template value
275276
$stackVars[$i]['variable'] = & $this->_templateVars[$stackVars[$i]['name']];

lib/Varien/Io/Abstract.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ public function getCleanPath($path)
7272

7373
$pathParts = explode('/', $pathTokP);
7474
$realPathParts = [];
75+
$counter = count($pathParts);
7576

76-
for ($i = 0, $realPathParts = []; $i < count($pathParts); $i++) {
77+
for ($i = 0, $realPathParts = []; $i < $counter; $i++) {
7778
if ($pathParts[$i] == '.') {
7879
continue;
7980
} elseif ($pathParts[$i] == '..') {

0 commit comments

Comments
 (0)