Skip to content

Commit

Permalink
Code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed Sep 2, 2024
1 parent e67fe56 commit c52b6ed
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ public function process(File $phpcsFile, $stackPtr)
$phpcsFile->fixer->beginChangeset();
if ($tokens[$next]['line'] > ($tokens[$parenOpener]['line'] + 1)) {
for ($i = ($parenOpener + 1); $i < $next; $i++) {
if ($tokens[$next]['line'] === $tokens[$i]['line']) {
break;
}

$phpcsFile->fixer->replaceToken($i, '');
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,35 @@ $expr2 &&
// structure body
};

// Ensure the sniff handles too many newlines (not just too few). This was copied from src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.inc
// Ensure the sniff handles too many newlines (not just too few).
for (


$i = 0
$i = 0;
$i < 10;
$i++


;
) {}

// Ensure the sniff does not remove indentation whitespace when comments are involved.
for (

$i < 10

// comment.
$i = 0;
$i < 10;
$i++
) {}

;
// The sniff treats a comment (ie non-whitespace) as content, but only at the
// start / end of the control structure. So the inner-whitespace here is
// intentionally ignored by this sniff. Additionally, the comment is not indented
// by this sniff when fixing.
for (// comment.


$i = 0;
$i < 10;
$i++


) {}
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,30 @@ match (
// structure body
};

// Ensure the sniff handles too many newlines (not just too few). This was copied from src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.inc
// Ensure the sniff handles too many newlines (not just too few).
for (
$i = 0


;


$i < 10
$i = 0;
$i < 10;
$i++
) {}

// Ensure the sniff does not remove indentation whitespace when comments are involved.
for (
// comment.
$i = 0;
$i < 10;
$i++
) {}

;
// The sniff treats a comment (ie non-whitespace) as content, but only at the
// start / end of the control structure. So the inner-whitespace here is
// intentionally ignored by this sniff. Additionally, the comment is not indented
// by this sniff when fixing.
for (
// comment.


$i = 0;
$i < 10;
$i++
) {}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public function getErrorList()
97 => 1,
98 => 2,
106 => 1,
121 => 1,
111 => 1,
117 => 1,
127 => 1,
];

}//end getErrorList()
Expand Down

0 comments on commit c52b6ed

Please sign in to comment.