-
Notifications
You must be signed in to change notification settings - Fork 4
/
phpcs.xml
150 lines (139 loc) · 5.75 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?xml version="1.0"?>
<ruleset name="G2_Ruleset">
<description>Coding Standards for Gallery 2 Community Edition</description>
<!-- GENERAL:
- Rules basically follow PSR2
- php-cs-fixer should be run after this as neither gives satisfactory results alone.
- Finally, after php-cs-fixer, a small subset of rules is run to finalise style structure
-->
<!-- Assume UTF-8 -->
<config name="encoding" value="utf-8" />
<!-- ARGS -->
<arg name="tab-width" value="4" />
<arg name="extensions" value="php,inc,class,css,js,xml,xaml,html" />
<arg name="ignore" value="*g2data/*,*/lib/composer/*,*/dev_vendor/*,*/dev_scripts/*,*MANIFEST*,*GNUmakefile*" />
<!-- Load WordPress Standards -->
<config name="installed_paths" value="dev_vendor/wp-coding-standards/wpcs" />
<!-- APPLY PSR2 RULES WITH SOME EXCEPTIONS -->
<rule ref="PSR2">
<!-- PSR2 EXCEPTION: Allow Tab Indents -->
<exclude name="Generic.WhiteSpace.DisallowTabIndent" />
<!-- PSR2 EXCEPTION: Put Class Opening Braces on the Same Line -->
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
<!-- PSR2 EXCEPTION: Allow Property Declarations to Start with an Underscore -->
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
<!-- PSR2 EXCEPTION: Allow Method Declarations to Start with an Underscore -->
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
</rule>
<!-- APPLY ADDITIONAL SELECTED WORDPRESS RULES -->
<rule ref="WordPress.WhiteSpace.DisallowInlineTabs" />
<rule ref="WordPress.Arrays.CommaAfterArrayItem" />
<rule ref="WordPress.Arrays.ArrayIndentation" />
<rule ref="WordPress.WhiteSpace.PrecisionAlignment" />
<rule ref="WordPress.PHP.TypeCasts" />
<rule ref="WordPress.Arrays.ArrayDeclarationSpacing">
<properties>
<property name="allow_single_item_single_line_associative_arrays" value="false" />
</properties>
</rule>
<!-- APPLY ADDITIONAL SELECTED GENERIC RULES -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent" />
<rule ref="Generic.Formatting.NoSpaceAfterCast" />
<rule ref="Generic.PHP.LowerCaseType" />
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" />
<rule ref="Generic.NamingConventions.ConstructorName" />
<rule ref="Generic.PHP.DisallowAlternativePHPTags" />
<rule ref="Generic.Classes.OpeningBraceSameLine" />
<rule ref="Generic.ControlStructures.InlineControlStructure" />
<rule ref="Generic.PHP.Syntax" />
<rule ref="Generic.Strings.UnnecessaryStringConcat">
<properties>
<property name="allowMultiline" value="true" />
</properties>
</rule>
<rule ref="Generic.Files.LineLength">
<properties>
<property name="ignoreComments" value="true" />
<property name="lineLimit" value="100" />
<property name="absoluteLineLimit" value="120" />
</properties>
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="exact" value="false" />
<property name="indent" value="4" />
<property name="tabIndent" value="true" />
<property name="ignoreIndentationTokens" type="array" value="T_HEREDOC, T_NOWDOC, T_INLINE_HTML" />
</properties>
</rule>
<rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing">
<properties>
<property name="spacing" value="0" />
<property name="ignoreNewlines" value="true" />
</properties>
</rule>
<rule ref="Generic.Formatting.SpaceAfterNot">
<properties>
<property name="spacing" value="0" />
</properties>
</rule>
<!-- APPLY ADDITIONAL SELECTED SQUIZ RULES -->
<rule ref="Squiz.PHP.InnerFunctions" />
<rule ref="Squiz.Scope.StaticThisUsage" />
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing" />
<rule ref="Squiz.WhiteSpace.OperatorSpacing" />
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing" />
<rule ref="Squiz.PHP.DisallowMultipleAssignments" />
<rule ref="Squiz.WhiteSpace.SemicolonSpacing" />
<rule ref="Squiz.Classes.SelfMemberReference">
<exclude name="Squiz.Classes.SelfMemberReference.NotUsed" />
</rule>
<rule ref="Squiz.Strings.DoubleQuoteUsage">
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar" />
</rule>
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration">
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
</rule>
<rule ref="Squiz.PHP.EmbeddedPhp">
<exclude name="Squiz.PHP.EmbeddedPhp.SpacingBefore" />
<exclude name="Squiz.PHP.EmbeddedPhp.Indent" />
<exclude name="Squiz.PHP.EmbeddedPhp.OpenTagIndent" />
<exclude name="Squiz.PHP.EmbeddedPhp.SpacingAfter" />
</rule>
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1" />
<property name="requiredSpacesAfterOpen" value="0" />
<property name="requiredSpacesBeforeClose" value="0" />
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
<properties>
<property name="spacing" value="1" />
<property name="spacingBeforeFirst" value="0" />
<property name="spacingAfterLast" value="0" />
</properties>
</rule>
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1" />
<property name="ignoreNewlines" value="true" />
</properties>
</rule>
<!-- APPLY ADDITIONAL SELECTED PEAR RULES -->
<rule ref="PEAR.Commenting.InlineComment" />
<rule ref="PEAR.ControlStructures.MultiLineCondition" />
<rule ref="PEAR.Files.IncludingFile" />
<rule ref="PEAR.Formatting.MultiLineAssignment" />
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" />
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace" />
<rule ref="PEAR.Functions.FunctionCallSignature">
<properties>
<property name="requiredSpacesAfterOpen" value="0" />
<property name="requiredSpacesBeforeClose" value="0" />
<property name="allowMultipleArguments" value="false" />
</properties>
</rule>
<!-- APPLY ADDITIONAL SELECTED PSR12 RULES -->
<rule ref="PSR12.Keywords.ShortFormTypeKeywords" />
</ruleset>