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

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 @@ -102,7 +102,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$error = 'Block comments must be ended with */';
$fix = $phpcsFile->addFixableError($error, $end, 'WrongEnd');
if ($fix === true) {
$phpcsFile->fixer->replaceToken($stackPtr, '*/');
$phpcsFile->fixer->replaceToken($end, '*/');
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
<?php

/*
Comments need to be indented 4 space.
*/

/*
same with multi-line
comments.
*/

/*
But they can:
- be indented more than 4
- but not less than 4
*/

/*
- This is valid:
Not indented correctly.
*/

/*
Comments need to be indented 4 space.
*/

/*
Comments need to be indented 4 space.
Comments need to be indented 4 space.
Comments need to be indented 4 space.
Comments need to be indented 4 space.

Comments need to be indented 4 space.
Comments need to be indented 4 space.
*/

/*
Block comments require a blank
line after them.
*/
$code = 'should not be here';

/*
Closing comment not aligned
*/

/*
Closing comment not aligned
*/

/* Not allowed */

/* Not allowed
either.
*/

/* */

$code = 'should not be here';
/*

Block comments require a blank
line before them. */

/*
*/

/** Not allowed */

/** Not allowed
either.
**/

/*
no capital
letter.
*/

echo 'hi';

function func()
{
echo 1;
/**
test
here
**/
echo 'test';
/**
Test
here
**/

}//end func()

public static function test()
{
/*
Block comments do not require a blank line before them
if they are after T_OPEN_CURLY_BRACKET.
*/

$code = '';

}//end test()


public static function test()
{

/*
Block comments do not require a blank line before them
if they are after T_OPEN_CURLY_BRACKET.
*/

$code = '';

}//end test()

class MyClass
{

/**
* Comment should be ignored.
*
* @var integer
* @since 4.0.0
*/
const LEFT = 1;

}

/**
* Comment should be ignored.
*
*/
final class MyClass
{
/**
* Comment should be ignored.
*
*/
final public function test() {}
}

switch ($var) {
case 'foo':
/*
Foo comment.
This is a multiple
line comment for Foo.
*/

echo 'Foo';
break;

default:

/*
Foo comment.
This is a multiple
line comment for Foo.
*/

echo 'Default';
break;
}//end switch

/**
* Comment should be ignored in PHP 5.4.
*
*/
trait MyTrait {

}

/*
这是一条测试评论.
*/

/*Channels::includeSystem('Permission');
if (Permission::hasPermission($projectid, 'project.metadata.add') === FALSE) {
throw new PermissionException(_('You do not have permission to add metadata field'));
}*/

/*
Comment goes here
*/
$two = (1 + 1); // I'm not a comment closer!

class Foo
{

/**
* Comment here.
*
* @var array
*/
var $bar = array();

}