mikulas / code-sniffs
Code sniffer rules for Clevis coding standard
Installs: 1 249
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- squizlabs/php_codesniffer: ~1.5.3
Requires (Dev)
- nette/tester: ~1.2
README
Annotations
ForceMultipleLinesSniff
Warn if phpdoc is single line (unless its on variable)
Disallowed:
/** @property-read $bar */ class Foo { /** @var Bar */ public $bar; }
Allowed:
/** * @property-read $bar */ class Foo { /** * @var Bar */ public $bar; }
NullFirstSniff
Disallowed:
/** @property-read Foo|NULL $bar */
Allowed:
/** @property-read NULL|Foo $bar */
SeparateInjectSniff
@inject
must not be on same line as @var
.
ControlStructures
SeparateBracketsSniff
force newline before opening curly bracket of if
, else
, elseif
, foreach
and for
blocks:
if (...) { return TRUE; }
Debug
ClassDebuggerCallSniff
Warn if methods dump
, barDump
, firelog
or timer
are called on Debugger
class.
DebugFunctionCallSniff
Warn if function d
, dd
, de
, dump
, var_dump
, error_log
, or print_r
is called.
Formatting
UseInAlphabeticalOrderSniff
UseWithoutStartingSeparator
Warn on use \Foo\Bar;
, suggest use Foo\Bar
instead.
MVC
AbstractOrFinalPresenterSniff
Nette Presenter classes must be either abstract or final.
Namespaces
UseDeclarationSniff
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.
Newlines
NamespaceNewlinesSniff
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.
<?php namespace Foo; use Bar; class Quaz {}
UseNewlinesSniff
Use declarations must have no empty newlines in between.
PHP
KeywordCaseSniff
Checks that all constructs but logical operators are lowercase.
(e.g.: foreach
instead of ForEach
)
UpperCaseBooleanConstantSniff UpperCaseNullConstantSniff
TRUE && FALSE && NULL;
Strings
ConcatenationSpacingSniff
Concatenation operator (.
) must be separated by exacly one
space on both sides.
Variables
VariableNameSniff
Enforce camelCase and deny leading underscore.
WhiteSpace
CommaSpacingSniff
Ensures there is no whitespaces before and exactly one space after each comma.
ListSpacingSniff
Disallows:
list ($a, $b);
Allows
list($a, $b);