diff options
| author | Andreas Fischer <bantu@phpbb.com> | 2014-06-17 00:42:39 +0200 |
|---|---|---|
| committer | Andreas Fischer <bantu@phpbb.com> | 2014-06-17 00:42:39 +0200 |
| commit | 89af1150718a184249d8040637969b03a3003596 (patch) | |
| tree | 44ebf3864ded8edabde1eae392300911edc3f359 /build/code_sniffer | |
| parent | 4d6afb26380d192efc556640499b6f5c43fbdf3c (diff) | |
| parent | afcca62784b51e34649f44905a27948bc3c8400c (diff) | |
| download | forums-89af1150718a184249d8040637969b03a3003596.tar forums-89af1150718a184249d8040637969b03a3003596.tar.gz forums-89af1150718a184249d8040637969b03a3003596.tar.bz2 forums-89af1150718a184249d8040637969b03a3003596.tar.xz forums-89af1150718a184249d8040637969b03a3003596.zip | |
Merge pull request #2603 from Nicofuma/ticket/12721
[ticket/12721] Improve the code sniffer: simple rules
* Nicofuma/ticket/12721:
[ticket/12721] Update rules descriptions
[ticket/12721] Add Generic.NamingConventions.ConstructorName in strict
[ticket/12721] Add Squiz.Functions.LowercaseFunctionKeywords in legacy
[ticket/12721] Add Squiz.ControlStructures.ForLoopDeclaration in legacy
[ticket/12721] Add Squiz.ControlStructures.ForEachLoopDeclaration
[ticket/12721] Add Squiz.ControlStructures.ElseIfDeclaration in legacy
[ticket/12721] Add Generic.Functions.OpeningFunctionBraceBsdAllman
[ticket/12721] Add Squiz.Arrays.ArrayBracketSpacing in the legacy ruleset
[ticket/12721] Add Generic.Files.LowercasedFilename in the legacy ruleset
Diffstat (limited to 'build/code_sniffer')
| -rw-r--r-- | build/code_sniffer/ruleset-php-legacy.xml | 24 | ||||
| -rw-r--r-- | build/code_sniffer/ruleset-php-strict.xml | 3 |
2 files changed, 27 insertions, 0 deletions
diff --git a/build/code_sniffer/ruleset-php-legacy.xml b/build/code_sniffer/ruleset-php-legacy.xml index 272c4840b6..b0110e8b12 100644 --- a/build/code_sniffer/ruleset-php-legacy.xml +++ b/build/code_sniffer/ruleset-php-legacy.xml @@ -20,6 +20,13 @@ <!-- Call-time pass-by-reference MUST not be used. --> <rule ref="Generic.Functions.CallTimePassByReference.NotAllowed" /> + <!-- Filenames MUST be lowercase. --> + <rule ref="Generic.Files.LowercasedFilename" /> + + <!-- The function brace MUST be on the line following the function declaration + and MUST be indented to the same column as the start of the function declaration. --> + <rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman" /> + <!-- There MUST be exactly one space after a cast. --> <rule ref="Generic.Formatting.SpaceAfterCast" /> @@ -35,6 +42,20 @@ <!-- Each file MUST end with exactly one newline character --> <rule ref="PSR2.Files.EndFileNewline" /> + <!-- When referencing arrays there MUST NOT be any whitespace around the opening bracket + or before the closing bracket. --> + <rule ref="Squiz.Arrays.ArrayBracketSpacing" /> + + <!-- The "else if" statement MUST be written with a space between the words else and if. --> + <rule ref="Squiz.ControlStructures.ElseIfDeclaration" /> + + <!-- There MUST be a space between each element of a foreach loop. --> + <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration" /> + + <!-- In a for loop declaration, there MUST be no space inside the brackets + and there MUST be 0 spaces before and 1 space after semicolons. --> + <rule ref="Squiz.ControlStructures.ForLoopDeclaration" /> + <!-- In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. --> <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"> @@ -44,6 +65,9 @@ </rule> <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint" /> + <!-- All built-in PHP functions MUST be called lowercased. --> + <rule ref="Squiz.Functions.LowercaseFunctionKeywords" /> + <!-- The eval() function MUST NOT be used. --> <rule ref="Squiz.PHP.Eval" /> diff --git a/build/code_sniffer/ruleset-php-strict.xml b/build/code_sniffer/ruleset-php-strict.xml index f2d5b86dd1..c722f7851c 100644 --- a/build/code_sniffer/ruleset-php-strict.xml +++ b/build/code_sniffer/ruleset-php-strict.xml @@ -22,6 +22,9 @@ <!-- PHP keywords MUST be in lower case. --> <rule ref="Generic.PHP.LowerCaseKeyword" /> + <!-- Constructors MUST be called __construct() instead of after the class. --> + <rule ref="Generic.NamingConventions.ConstructorName" /> + <!-- Classes etc. MUST be namespaced --> <rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace" /> |
