|
15 | 15 | * * |
16 | 16 | * ********************************************** * |
17 | 17 | * * |
18 | | -* This standard enforces the following rules: * |
| 18 | +* This standard enforces the following rules: * |
19 | 19 | * * |
20 | | -* - Use `bool` type name instead of `boolean` in both * |
21 | | -* docblocks and PHP type declarations. * |
| 20 | +* - Use `bool` and `int` type names instead of `boolean` * |
| 21 | +* and `integer` in all code contexts. * |
22 | 22 | * * |
23 | | -* - Use `int` type name instead of `integer` in both * |
24 | | -* docblocks and PHP type declarations. * |
| 23 | +* - Require 1 single empty line before `@return` tag. * |
25 | 24 | * * |
26 | | -* - Require 1 single empty line before `@return` tag. * |
| 25 | +* - Require 1 single space between all @-tags' elements * |
| 26 | +* (type, variable, etc.). * |
27 | 27 | * * |
28 | | -* - Require 1 single space between each all @-tags' * |
29 | | -* elements (type, variable, etc.). * |
30 | | -* * |
31 | | -* - Require a `@return` tag except when the return type is * |
| 28 | +* - Require a `@return` tag except when the return type is * |
32 | 29 | * `void`. * |
33 | 30 | * * |
34 | 31 | **************************************************************** |
|
42 | 39 | <!-- Show sniff codes --> |
43 | 40 | <arg value="s"/> |
44 | 41 |
|
| 42 | + <!-- yCodeTech sniffs are included by default, so no need to include them here. --> |
45 | 43 |
|
46 | | - <!-- Include base PSR-12 standard but exclude some rules --> |
47 | | - <rule ref="PSR12"> |
48 | | - <!-- Disable namespace requirement --> |
49 | | - <exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/> |
50 | | - <!-- Disable PSR12's type casts short names sniff, as we'll use our own implementation. --> |
51 | | - <exclude name="PSR12.Keywords.ShortFormTypeKeywords"/> |
52 | | - |
53 | | - <!-- Disable Squiz's space after close brace sniff. Allows newlines in between if...else braces. --> |
54 | | - <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace"></exclude> |
55 | | - <!-- Disable Generic's line endings sniff. Allows different EOL characters. --> |
56 | | - <exclude name="Generic.Files.LineEndings.InvalidEOLChar"></exclude> |
57 | | - <!-- Disable PSR2's end file newline sniff. --> |
58 | | - <exclude name="PSR2.Files.EndFileNewline.NoneFound"></exclude> |
| 44 | + <!-- Cherrypick sniffs from other standards. --> |
59 | 45 |
|
60 | | - </rule> |
61 | | - |
62 | | - <!-- Docblock formatting --> |
| 46 | + <!-- Include Generic Docblock sniff, and exclude specific violations. --> |
63 | 47 | <rule ref="Generic.Commenting.DocComment"> |
| 48 | + <!-- This is disabled because the indentation/spacing is fixed the yCodeTech standard. --> |
64 | 49 | <exclude name="Generic.Commenting.DocComment.TagValueIndent"/> |
| 50 | + |
| 51 | + <!-- This is disabled because the it might interfere with yCodeTech's @return new line rules. So at the moment all non-param tags can be grouped with @param, but this may change in the future. --> |
65 | 52 | <exclude name="Generic.Commenting.DocComment.NonParamGroup"/> |
| 53 | + |
| 54 | + <!-- Allow other @tags to be first in a docblock. --> |
| 55 | + <exclude name="Generic.Commenting.DocComment.ParamNotFirst"/> |
| 56 | + </rule> |
| 57 | + |
| 58 | + <!-- Line endings must be CRLF (\r\n) --> |
| 59 | + <rule ref="Generic.Files.LineEndings"> |
| 60 | + <properties> |
| 61 | + <property name="eolChar" value="\r\n" /> |
| 62 | + </properties> |
66 | 63 | </rule> |
67 | 64 |
|
68 | | - <!-- Type hints --> |
| 65 | + <!-- Type hints must be lowercase. --> |
69 | 66 | <rule ref="Generic.PHP.LowerCaseType"/> |
70 | | - |
71 | | - <!-- Custom yCodeTech sniffs --> |
72 | | - <!-- Disallow long type names in both docblocks and PHP type declarations --> |
73 | | - <rule ref="yCodeTech.Types.DisallowTypeLongNames"/> |
74 | | - |
75 | | - <!-- Docblock formatting and spacing rules --> |
76 | | - <rule ref="yCodeTech.Commenting.DocblockFormat"/> |
77 | | - |
78 | | - <!-- Function comment requirements --> |
79 | | - <rule ref="yCodeTech.Commenting.FunctionComment"/> |
| 67 | + |
| 68 | + <!-- Keywords must be lowercase. --> |
| 69 | + <rule ref="Generic.PHP.LowerCaseKeyword"/> |
| 70 | + |
| 71 | + <!-- `true`, `false` and `null` constants must always be lowercase. --> |
| 72 | + <rule ref="Generic.PHP.LowerCaseConstant"/> |
| 73 | + |
| 74 | + <!-- The code should use valid PHP syntax (ie. missing semicolons, etc.). --> |
| 75 | + <rule ref="Generic.PHP.Syntax"/> |
| 76 | + |
| 77 | + <!-- No superfluous (unnecessary) whitespace is allowed. --> |
| 78 | + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/> |
| 79 | + |
| 80 | + <!-- Duplicate return tags are not allowed. --> |
| 81 | + <rule ref="Squiz.Commenting.FunctionComment.DuplicateReturn"/> |
| 82 | + |
| 83 | + <!-- The type in the @return tag is missing. --> |
| 84 | + <rule ref="Squiz.Commenting.FunctionComment.MissingReturnType"/> |
| 85 | + |
| 86 | + <!-- Exception type missing for @throws tag. --> |
| 87 | + <rule ref="Squiz.Commenting.FunctionComment.InvalidThrows"/> |
| 88 | + |
| 89 | + <!-- Parameter type missing for @param tag. --> |
| 90 | + <rule ref="Squiz.Commenting.FunctionComment.MissingParamType"/> |
| 91 | + |
| 92 | + <!-- Parameter name (variable) missing for @param tag. --> |
| 93 | + <rule ref="Squiz.Commenting.FunctionComment.MissingParamName"/> |
| 94 | + |
| 95 | + <!-- @param name casing must match the variable name casing. --> |
| 96 | + <rule ref="Squiz.Commenting.FunctionComment.ParamNameNoCaseMatch"/> |
| 97 | + |
| 98 | + <!-- @param comments must start with a capital letter. --> |
| 99 | + <rule ref="Squiz.Commenting.FunctionComment.ParamCommentNotCapital"/> |
| 100 | + |
| 101 | + <!-- @param tag missing for the function parameter. --> |
| 102 | + <rule ref="Squiz.Commenting.FunctionComment.MissingParamTag"/> |
80 | 103 | </ruleset> |
0 commit comments