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 Jul 2, 2024
1 parent e9762c6 commit 0c345b3
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 @@ -119,8 +119,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 @@ -262,7 +262,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 @@ -61,8 +61,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 @@ -138,7 +138,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 @@ -39,8 +39,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 @@ -65,7 +65,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 0c345b3

Please sign in to comment.