Skip to content

Commit

Permalink
CS/QA: remove unused foreach keys from report code
Browse files Browse the repository at this point in the history
As the array format is now documented, these unused variables are no longer needed for documentation purposes.

Co-authored-by: Klaus Purer <klaus.purer@protonmail.ch>
  • Loading branch information
jrfnl and klausi committed Jun 7, 2024
1 parent 3107205 commit 52c891a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Reports/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,

// Determine the longest error message we will be showing.
$maxErrorLength = 0;
foreach ($report['messages'] as $line => $lineErrors) {
foreach ($lineErrors as $column => $colErrors) {
foreach ($report['messages'] as $lineErrors) {
foreach ($lineErrors as $colErrors) {
foreach ($colErrors as $error) {
$length = strlen($error['message']);
if ($showSources === true) {
Expand Down Expand Up @@ -265,7 +265,7 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,

echo str_repeat('-', $width).PHP_EOL;

foreach ($lineErrors as $column => $colErrors) {
foreach ($lineErrors as $colErrors) {
foreach ($colErrors as $error) {
$padding = ($maxLineNumLength - strlen($line));
echo 'LINE '.str_repeat(' ', $padding).$line.': ';
Expand Down
6 changes: 3 additions & 3 deletions src/Reports/Full.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,

// Make sure the report width isn't too big.
$maxErrorLength = 0;
foreach ($report['messages'] as $line => $lineErrors) {
foreach ($lineErrors as $column => $colErrors) {
foreach ($report['messages'] as $lineErrors) {
foreach ($lineErrors as $colErrors) {
foreach ($colErrors as $error) {
// Start with the presumption of a single line error message.
$length = strlen($error['message']);
Expand Down Expand Up @@ -139,7 +139,7 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
$beforeAfterLength = strlen($beforeMsg.$afterMsg);

foreach ($report['messages'] as $line => $lineErrors) {
foreach ($lineErrors as $column => $colErrors) {
foreach ($lineErrors as $colErrors) {
foreach ($colErrors as $error) {
$errorMsg = wordwrap(
$error['message'],
Expand Down
4 changes: 2 additions & 2 deletions src/Reports/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,

$sources = [];

foreach ($report['messages'] as $line => $lineErrors) {
foreach ($lineErrors as $column => $colErrors) {
foreach ($report['messages'] as $lineErrors) {
foreach ($lineErrors as $colErrors) {
foreach ($colErrors as $error) {
$src = $error['source'];
if (isset($sources[$src]) === false) {
Expand Down
2 changes: 1 addition & 1 deletion src/Reports/VersionControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,

$praiseCache[$author]['bad']++;

foreach ($lineErrors as $column => $colErrors) {
foreach ($lineErrors as $colErrors) {
foreach ($colErrors as $error) {
$authorCache[$author]++;

Expand Down

0 comments on commit 52c891a

Please sign in to comment.