Skip to content

Commit 86cb183

Browse files
committed
Auto-fix PEAR.Commenting.FunctionComment.SpacingAfter
1 parent 8dfb632 commit 86cb183

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/Standards/PEAR/Sniffs/Commenting/FunctionCommentSniff.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ public function process(File $phpcsFile, $stackPtr)
129129
&& $tokens[$i]['line'] !== $tokens[($i + 1)]['line']
130130
) {
131131
$error = 'There must be no blank lines after the function comment';
132-
$phpcsFile->addError($error, $commentEnd, 'SpacingAfter');
132+
$fix = $phpcsFile->addFixableError($error, $commentEnd, 'SpacingAfter');
133+
134+
if ($fix === true) {
135+
$phpcsFile->fixer->replaceToken($i, '');
136+
}
137+
133138
break;
134139
}
135140
}

src/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.inc.fixed

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,6 @@ class Something implements JsonSerializable {
453453
*
454454
* @return mixed
455455
*/
456-
457456
#[ReturnTypeWillChange]
458457
public function blankLineDetectionA() {}
459458

@@ -463,16 +462,13 @@ class Something implements JsonSerializable {
463462
* @return mixed
464463
*/
465464
#[ReturnTypeWillChange]
466-
467465
public function blankLineDetectionB() {}
468466

469467
/**
470468
* Blank line between both docblock and attribute and attribute and function declaration.
471469
*
472470
* @return mixed
473471
*/
474-
475472
#[ReturnTypeWillChange]
476-
477473
public function blankLineDetectionC() {}
478474
}

0 commit comments

Comments
 (0)