Skip to content

Commit 5e59b86

Browse files
committed
Generic/JumbledIncrementer: improve variable name
`$diff` was misleading as array_intersect() does not return the difference between two arrays. `$commonIncrementers` should be more meaningful as the variable holds the incrementers that the inner and the outer for loops have in common.
1 parent 893dc57 commit 5e59b86

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Standards/Generic/Sniffs/CodeAnalysis/JumbledIncrementerSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ public function process(File $phpcsFile, $stackPtr)
8585
}
8686

8787
$inner = $this->findIncrementers($tokens, $tokens[$start]);
88-
$diff = array_intersect($outer, $inner);
88+
$commonIncrementers = array_intersect($outer, $inner);
8989

90-
if (count($diff) !== 0) {
90+
if (count($commonIncrementers) !== 0) {
9191
$error = 'Loop incrementor (%s) jumbling with inner loop';
92-
$data = [join(', ', $diff)];
92+
$data = [join(', ', $commonIncrementers)];
9393
$phpcsFile->addWarning($error, $stackPtr, 'Found', $data);
9494
}
9595
}

0 commit comments

Comments
 (0)