Skip to content

Commit

Permalink
Merge pull request #340 from fredden/missing-fixed-file/Squiz.Comment…
Browse files Browse the repository at this point in the history
…ing.ClosingDeclarationComment

`Squiz.Commenting.ClosingDeclarationComment` - add missing `.fixed` file for test-suite, and fix a bug found during
  • Loading branch information
jrfnl authored Feb 15, 2024
2 parents 3e582fe + 66e87a1 commit 4bbc820
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 1 deletion.
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
@@ -0,0 +1,85 @@
<?php

function __construct()
{
}//end __construct()

function myFunction()
{
}//end myFunction()

function ourFunction()
{
}//end ourFunction()

function yourFunction()
{
}//end yourFunction()

class TestClass
{
function __construct()
{
}//end __construct()

function myFunction()
{
}//end myFunction()

function yourFunction()
{
}//end yourFunction()

}//end class

abstract class TestClass
{
abstract function myFunction();

function ourFunction()
{
}//end ourFunction()

function yourFunction()
{
}//end yourFunction()

}//end class

interface TestClass
{
function myFunction();
function ourFunction();
function yourFunction();

}//end interface

class TestClass
{
}//end class

abstract class TestClass
{
}//end class

interface TestClass
{
}//end interface

class MyClass
{
public function myFunction();
}//end class

// Closures don't need end comments.
echo preg_replace_callback('~-([a-z])~', function ($match) { return strtoupper($match[1]); }, 'hello-world');

class TestClass
{
}//end class

enum MissingClosingComment {
}//end enum

enum HasClosingComment {
}//end enum

0 comments on commit 4bbc820

Please sign in to comment.