Custom CodeSniffer rules
, (*1)
Annotations
ForceMultipleLinesSniff, (*2)
Warn if phpdoc is single line (unless its on variable), (*3)
Disallowed:, (*4)
/** @property-read $bar */
class Foo
{
/** @var Bar */
public $bar;
}
Allowed:, (*5)
/**
* @property-read $bar
*/
class Foo
{
/**
* @var Bar
*/
public $bar;
}
NullFirstSniff, (*6)
Disallowed:, (*7)
/** @property-read Foo|NULL $bar */
Allowed:, (*8)
/** @property-read NULL|Foo $bar */
SeparateInjectSniff, (*9)
@inject
must not be on same line as @var
., (*10)
ControlStructures
SeparateBracketsSniff, (*11)
force newline before opening curly bracket of if
, else
, elseif
, foreach
and for
blocks:, (*12)
if (...)
{
return TRUE;
}
Debug
ClassDebuggerCallSniff, (*13)
Warn if methods dump
, barDump
, firelog
or timer
are called on Debugger
class., (*14)
DebugFunctionCallSniff, (*15)
Warn if function d
, dd
, de
, dump
, var_dump
, error_log
, or print_r
is called., (*16)
UseInAlphabeticalOrderSniff, (*17)
UseWithoutStartingSeparator, (*18)
Warn on use \Foo\Bar;
, suggest use Foo\Bar
instead., (*19)
MVC
AbstractOrFinalPresenterSniff, (*20)
Nette Presenter classes must be either abstract or final., (*21)
Namespaces
UseDeclarationSniff, (*22)
Use declarations must be right after namespace declaration,
separated by exactly one empty line. There must be exactly
one use per declaration. There must be exactly two empty lines
after last use declaration., (*23)
Newlines
NamespaceNewlinesSniff, (*24)
Namespace declaration must be directly under php opening tag,
separated by exactly one empty line. There must be exactly one
empty line between namespace declaration and first use declaration.
If no use declaration follows, there must be two lines after
namespace declaration., (*25)
<?php
namespace Foo;
use Bar;
class Quaz {}
UseNewlinesSniff, (*26)
Use declarations must have no empty newlines in between., (*27)
PHP
KeywordCaseSniff, (*28)
Checks that all constructs but logical operators are lowercase.
(e.g.: foreach
instead of ForEach
), (*29)
UpperCaseBooleanConstantSniff
UpperCaseNullConstantSniff, (*30)
TRUE && FALSE && NULL;
Strings
ConcatenationSpacingSniff, (*31)
Concatenation operator (.
) must be separated by exacly one
space on both sides., (*32)
Variables
VariableNameSniff, (*33)
Enforce camelCase and deny leading underscore., (*34)
WhiteSpace
CommaSpacingSniff, (*35)
Ensures there is no whitespaces before and exactly one space after each comma., (*36)
ListSpacingSniff, (*37)
Disallows:, (*38)
list ($a, $b);
Allows, (*39)
list($a, $b);