forked from damsfx/valet-windows
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathphpcs.xml
More file actions
124 lines (109 loc) · 4.95 KB
/
phpcs.xml
File metadata and controls
124 lines (109 loc) · 4.95 KB
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
<?xml version="1.0"?>
<ruleset name="yCodeTech">
<description>yCodeTech's Coding Standards</description>
<!-- Scan all files in directory -->
<file>.</file>
<!-- Scan only PHP files -->
<arg name="extensions" value="php"/>
<!-- Ignore WordPress and Composer dependencies -->
<exclude-pattern>web/wp</exclude-pattern>
<exclude-pattern>web/app/plugins</exclude-pattern>
<exclude-pattern>web/app/mu-plugins</exclude-pattern>
<exclude-pattern>vendor/</exclude-pattern>
<exclude-pattern>web/app/uploads/</exclude-pattern>
<!-- Show colors in console -->
<arg value="-colors"/>
<!-- Show sniff codes in all reports -->
<arg value="ns"/>
<!-- Allow multiple classes in a single file ONLY for facades.php files,
ie. exclude the file from the sniff. -->
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>*facades.php</exclude-pattern>
</rule>
<!-- Allow closing brace on same line as the content ONLY for facades.php files,
ie. exclude the file from the sniff.
This allows empty class declarations to use only 1 line. -->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore">
<exclude-pattern>*facades.php</exclude-pattern>
</rule>
<!-- Use PSR-2 as a base -->
<rule ref="PSR2">
<!-- Allow tab indent -->
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
<!-- Allow php files to end without blank line -->
<exclude name="PSR2.Files.EndFileNewline"/>
<!-- Allow braces on the same line as the function declaration. -->
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
<!-- Allow inline if statements without braces -->
<exclude name="Generic.ControlStructures.InlineControlStructure" />
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" />
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
<exclude name="PEAR.Functions.ValidDefaultValue.NotAtEnd" />
<!-- Allow same-line function call arguments, ie. prevent 1 argument per line. -->
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" />
<!-- Allow content after a function opening bracket,
ie. allow arguments on same line as the opening bracket. -->
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
<!-- Prevent function closing bracket from being on it's own line. -->
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
<exclude name="Generic.Files.LineLength.TooLong" />
<exclude name="PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose" />
<exclude name="PSR2.Methods.FunctionCallSignature.ContentAfterOpenBracket" />
</rule>
<!-- Allow same line opening brackets for functions -->
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" />
<!-- Allow same line opening brackets for classes -->
<rule ref="Generic.Classes.OpeningBraceSameLine"/>
<!-- Disallow space indent -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<!-- Allow tab indents -->
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="false"/>
<property name="exact" value="true"/>
</properties>
</rule>
<!-- Disallow spaces after opening and closing braces -->
<rule ref="PEAR.Functions.FunctionCallSignature">
<properties>
<property name="requiredSpacesAfterOpen" value="0" />
<property name="requiredSpacesBeforeClose" value="0" />
<property name="allowMultipleArguments" value="false"/>
</properties>
</rule>
<!-- Allow concatenation spacing.
1 space after and 1 space before the concatenation operator (.) -->
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1" />
<property name="ignoreNewlines" value="true" />
</properties>
</rule>
<!-- Disallow unnecessary string concatenation, eg. `"Hello " . "World"`, `"Hello " . $name` ie. Enforces string interpolation (`"Hello $name"`) -->
<rule ref="Generic.Strings.UnnecessaryStringConcat">
<properties>
<property name="allowMultiline" value="true"/>
</properties>
</rule>
<!-- If concatenation is necessary, then it must have correct spacing.
1 space after and 1 space before the concatenation operator (.) -->
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1" />
<property name="ignoreNewlines" value="true" />
</properties>
</rule>
<!-- External standard. https://github.com/JParkinson1991/phpcodesniffer-standards/blob/master/docs/Standards/JPSR12/JPSR12.md -->
<!-- Exclude certain sniffs. -->
<rule ref="JPSR12">
<exclude name="JPSR12.Files" />
<exclude name="JPSR12.Operators.OperatorSpacing" />
<exclude name="JPSR12.Types.DeclareStrictTypes" />
<exclude name="JPSR12.ControlSignatures.MultiKeyword.SingleNewlineRequired" />
</rule>
<!-- My own external standard. https://github.com/yCodeTech/phpcs-standard -->
<!-- Add all yCodeTech sniffs. -->
<rule ref="yCodeTech" />
</ruleset>