-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathphpcs.xml.dist
More file actions
80 lines (71 loc) · 3.21 KB
/
Copy pathphpcs.xml.dist
File metadata and controls
80 lines (71 loc) · 3.21 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
<?xml version="1.0"?>
<ruleset name="Riskified PHP SDK">
<description>Coding standard (PSR-12) and PHP 7.0+ runtime compatibility for the Riskified PHP SDK.</description>
<file>src</file>
<file>tests</file>
<arg name="extensions" value="php"/>
<arg name="colors"/>
<!-- Show sniff codes (s) and progress (p) so violations are easy to silence/fix. -->
<arg value="sp"/>
<!-- Warnings are reported but do not fail the build (non-zero exit). -->
<config name="ignore_warnings_on_exit" value="1"/>
<!-- Layout / formatting standard, applied to both production and test code. -->
<rule ref="PSR12">
<!-- Deviation from PSR-12: keep opening braces on the same line (K&R) for both
functions/methods and classes/interfaces/traits. -->
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/>
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/>
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
<!-- Allow empty class/interface bodies on a single line: class Foo {} -->
<exclude name="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore"/>
</rule>
<!-- Enforce same-line (K&R) opening braces. -->
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie"/>
<rule ref="Generic.Classes.OpeningBraceSameLine"/>
<!--
Runtime compatibility: production code must stay valid for every PHP version
from 7.0 upwards. Test code is intentionally excluded - it runs on modern PHP
via PHPUnit 10.
-->
<config name="testVersion" value="7.0-"/>
<rule ref="PHPCompatibility">
<include-pattern>src/*</include-pattern>
</rule>
<!-- Tier 1: bug catchers -->
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
<rule ref="Squiz.PHP.NonExecutableCode"/>
<rule ref="Generic.PHP.NoSilencedErrors"/>
<!-- Tier 2: discourage risky / legacy constructs -->
<rule ref="Squiz.PHP.Eval"/>
<rule ref="Generic.PHP.BacktickOperator"/>
<rule ref="Generic.PHP.DeprecatedFunctions">
<type>warning</type>
</rule>
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="sizeof" value="count"/>
<element key="create_function" value="null"/>
</property>
</properties>
</rule>
<!-- Tier 3: hygiene metrics, warnings only (never fail the build) -->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>
<rule ref="Generic.Metrics.CyclomaticComplexity">
<type>warning</type>
</rule>
<rule ref="Generic.Metrics.NestingLevel">
<type>warning</type>
</rule>
<rule ref="Generic.Commenting.Todo"/>
</ruleset>