forked from roots/sage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphpcs.xml
92 lines (83 loc) · 3.96 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
<?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>
<!-- 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"/>
<!-- Disallow indentation correction. Prevents wrong indentations with php in html. -->
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact"/>
<!-- 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" />
<exclude name="PSR12.Classes.ClosingBrace.StatementAfter" />
<exclude name="Generic.Files.LineEndings.InvalidEOLChar" />
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
</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>
<!-- 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.Arrays.ArrayDeclaration.LastElementNoKeySpecified" />
</rule>
</ruleset>