Skip to content

Commit

Permalink
Auto-fix PEAR.Commenting.FunctionComment.SpacingAfter
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed Oct 29, 2023
1 parent 321d252 commit a69c1d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,14 @@ public function process(File $phpcsFile, $stackPtr)
&& $tokens[$i]['line'] !== $tokens[($i + 1)]['line']
) {
$error = 'There must be no blank lines after the function comment';
$phpcsFile->addError($error, $commentEnd, 'SpacingAfter');
$fix = $phpcsFile->addFixableError($error, $commentEnd, 'SpacingAfter');

if ($fix === true) {
for (; $i < $stackPtr && $tokens[$i]['content'] === $phpcsFile->eolChar; $i++) {
$phpcsFile->fixer->replaceToken($i, '');
}
}

break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ class Something implements JsonSerializable {
*
* @return mixed
*/

#[ReturnTypeWillChange]
public function blankLineDetectionA() {}

Expand All @@ -463,16 +462,13 @@ class Something implements JsonSerializable {
* @return mixed
*/
#[ReturnTypeWillChange]

public function blankLineDetectionB() {}

/**
* Blank line between both docblock and attribute and attribute and function declaration.
*
* @return mixed
*/

#[ReturnTypeWillChange]

public function blankLineDetectionC() {}
}

0 comments on commit a69c1d6

Please sign in to comment.