forked from silverstripe/developer-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpcs.xml
98 lines (81 loc) · 5.07 KB
/
phpcs.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?xml version="1.0"?>
<ruleset name="Extended PSR12 for documentation code blocks">
<description>A sensible set of rules for producing clear documentation of PHP code</description>
<rule ref="PSR12">
<!-- These rules aren't compatible with sniffing markdown -->
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/>
<exclude name="PSR12.Files.FileHeader.HeaderPosition"/>
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/>
<!-- Allow non camel cased method names - some base SS method names are PascalCase or snake_case -->
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
</rule>
<!-- Prefer short arrays, i.e. [] instead of array() -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
<!-- Require a trailing comma after the last element of a multi-line array -->
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma" />
<!-- Disallow trailing commas basically everywhere else -->
<rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInCall" />
<rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInClosureUse" />
<rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInDeclaration" />
<!-- Require visibility for constants -->
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility" />
<!-- Enforce a blank line between classes, properties, etc -->
<rule ref="SlevomatCodingStandard.Classes.ClassMemberSpacing" />
<rule ref="SlevomatCodingStandard.Classes.MethodSpacing" />
<rule ref="SlevomatCodingStandard.Classes.PropertySpacing" />
<rule ref="SlevomatCodingStandard.Classes.EnumCaseSpacing" />
<!-- Enforce clean spacing around property typehints -->
<rule ref="SlevomatCodingStandard.Classes.PropertyDeclaration" />
<!-- Enforce blank line after namespace -->
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceSpacing">
<properties>
<property name="linesCountBeforeNamespace" value="0"/>
<property name="linesCountBAfterNamespace" value="1"/>
</properties>
</rule>
<!-- Disable constructor property promotion, because it makes it harder to see what properties exist -->
<rule ref="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion" />
<!-- Disallow public properties -->
<rule ref="SlevomatCodingStandard.Classes.ForbiddenPublicProperty" />
<!-- No comma-separated "use" for traits -->
<rule ref="SlevomatCodingStandard.Classes.TraitUseDeclaration" />
<!-- Commands can't be on the same line as code, 'cause that's hard to read -->
<rule ref="SlevomatCodingStandard.Commenting.DisallowCommentAfterCode" />
<!-- No empty comments -->
<rule ref="SlevomatCodingStandard.Commenting.EmptyComment" />
<!-- no useless PHPDocs -->
<rule ref="SlevomatCodingStandard.Commenting.UselessFunctionDocComment" />
<rule ref="SlevomatCodingStandard.Commenting.UselessInheritDocComment" />
<!-- No assigning variables inside a conditional statement -->
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition" />
<!-- Must use parenthesis when instatiating with "new" keyword -->
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses" />
<!-- No yoda comparisons -->
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison" />
<!-- General tidyup of unnecessary or unreachable code -->
<rule ref="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn" />
<rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator" />
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch" />
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly" />
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace" />
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses" />
<!-- Method bodies must at least have a comment - if no-op, use "// ..." -->
<rule ref="SlevomatCodingStandard.Functions.DisallowEmptyFunction" />
<!-- Order use statements alphabetically for better readability -->
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
<properties>
<property name="caseSensitive" type="bool" value="true"/>
</properties>
</rule>
<!-- General QA of use statements -->
<rule ref="SlevomatCodingStandard.Namespaces.DisallowGroupUse" />
<rule ref="SlevomatCodingStandard.Namespaces.MultipleUsesPerLine" />
<!-- Must only have one namespace declaration per code block -->
<rule ref="SlevomatCodingStandard.Namespaces.RequireOneNamespaceInFile" />
<!-- Use statement must not start with backslash -->
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash" />
<!-- Don't have unnecessary spaces just to line things up horizontally -->
<rule ref="SlevomatCodingStandard.Whitespaces.DuplicateSpaces" />
<!-- Don't allow deprecated "${...}" syntax for variable substitution in strings -->
<rule ref="SlevomatCodingStandard.Strings.DisallowVariableParsing" />
</ruleset>