-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpcs.xml
More file actions
86 lines (77 loc) · 3.96 KB
/
phpcs.xml
File metadata and controls
86 lines (77 loc) · 3.96 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
<?xml version="1.0"?>
<ruleset name="Circul8 Coding Standards">
<!-- Scan directory -->
<file>src</file>
<!-- Scan only PHP files -->
<arg name="extensions" value="php"/>
<!-- Exclude files? -->
<exclude-pattern>vendor</exclude-pattern>
<!-- Show colors in console -->
<arg value="-colors"/>
<!-- Show sniff codes in all reports -->
<arg value="ns"/>
<!-- We use 4-width tab //-->
<arg name="tab-width" value="4"/>
<!-- We use tabs -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
<rule ref="Squiz.WhiteSpace.FunctionSpacing" >
<properties>
<property name="spacing" value="2" /><!-- Add 2 lines at the beginning of each method -->
<property name="spacingBeforeFirst" value="1" /><!-- Expect no new line after last method -->
<property name="spacingAfterLast" value="1" /><!-- Expect no new line after last method -->
</properties>
</rule>
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/ruleset.xml">
<!-- Allow new Class; instead of new Class(); //-->
<exclude name="SlevomatCodingStandard.ControlStructures.NewWithParentheses.MissingParentheses"/>
<!-- Allow Exceptions naming, eg: CustomException. //-->
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
<!-- Allow AbstractClass naming, eg: AbstractCustomClass. //-->
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<!-- Allow echo() instead of \echo() //-->
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions"/>
<!-- Allow usage of classes listed in "use" statement //-->
<exclude name="SlevomatCodingStandard.Namespaces.UseOnlyWhitelistedNamespaces"/>
<!-- Disallow yoda comparisons (42 === $value) //-->
<exclude name="SlevomatCodingStandard.ControlStructures.RequireYodaComparison"/>
<!-- Disallow one line property annotations //-->
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment"/>
<!-- Allow short ternary operator "something ?: else" //-->
<exclude name="SlevomatCodingStandard.ControlStructures.DisallowShortTernaryOperator.DisallowedShortTernaryOperator"/>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
<properties>
<!-- Force \Exception instead of Exception //-->
<property name="allowFullyQualifiedGlobalClasses" value="true"/>
<!-- Force \JSON_PRETTY_PRINT instead of JSON_PRETTY_PRINT //-->
<property name="allowFullyQualifiedGlobalConstants" value="true"/>
<!-- Force \Exceptions instead of Exception //-->
<property name="allowFullyQualifiedExceptions" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.TraitUseSpacing">
<properties>
<!-- Force 2 lines after last trait use //-->
<property name="linesCountAfterLastUse" value="2"/>
<!-- Force 1 lines after last trait use if the trait is the only use. //-->
<property name="linesCountAfterLastUseWhenLastInClass" value="1"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable">
<properties>
<!-- Do not alert unused values in forach loops //-->
<property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly">
<exclude-pattern>app/Exceptions/Handler.php</exclude-pattern>
</rule>
<!-- Edit if necessary
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array" value="app=>YourApp,tests=>Tests"/>
</properties>
</rule>
//-->
</ruleset>