Skip to content

Commit

Permalink
Avoid adding extra newlines when adding a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed Feb 15, 2024
1 parent 392b2b5 commit 66e87a1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function process(File $phpcsFile, $stackPtr)
} else {
$fix = $phpcsFile->addFixableError('Expected %s', $closingBracket, 'Missing', $data);
if ($fix === true) {
$phpcsFile->fixer->replaceToken($closingBracket, '}'.$comment.$phpcsFile->eolChar);
$phpcsFile->fixer->replaceToken($closingBracket, '}'.$comment);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,14 @@ class TestClass
{
}//end class


abstract class TestClass
{
}//end class


interface TestClass
{
}//end interface


class MyClass
{
public function myFunction();
Expand All @@ -84,6 +81,5 @@ class TestClass
enum MissingClosingComment {
}//end enum


enum HasClosingComment {
}//end enum

0 comments on commit 66e87a1

Please sign in to comment.