Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squiz.Commenting.ClosingDeclarationComment - add missing .fixed file for test-suite, and fix a bug found during #340

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading