-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathphpcs.xml
More file actions
118 lines (101 loc) · 4.55 KB
/
Copy pathphpcs.xml
File metadata and controls
118 lines (101 loc) · 4.55 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
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="php-jwt"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<description>PSR-12 plus the project's stricter conventions; see CONTRIBUTING.md.</description>
<file>src</file>
<file>tests</file>
<file>examples</file>
<arg name="basepath" value="."/>
<arg name="extensions" value="php"/>
<arg value="sp"/>
<!-- Project-local sniffs live in phpcs/PhpJwt (the path is relative to this ruleset). -->
<config name="installed_paths" value="phpcs"/>
<rule ref="PSR12"/>
<!-- Trailing inline comments sit exactly one space after the code — no column alignment. -->
<rule ref="PhpJwt.WhiteSpace.SingleSpaceBeforeInlineComment"/>
<!-- Lines are at most 120 characters — code, comments, and docblocks alike; over the limit is an error. -->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120"/>
<property name="absoluteLineLimit" value="120"/>
</properties>
</rule>
<!-- Every file starts with `declare(strict_types=1);`. -->
<rule ref="Generic.PHP.RequireStrictTypes"/>
<!-- Concatenation is spaced: `$a . $b`, never `$a.$b`. -->
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1"/>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<!-- Single quotes unless the string needs interpolation or escape sequences. -->
<rule ref="Squiz.Strings.DoubleQuoteUsage.NotRequired"/>
<!-- Short array syntax only. -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<!-- Casts and `!` hug their operand: `(string)$value`, `!$condition`. -->
<rule ref="Generic.Formatting.SpaceAfterCast">
<properties>
<property name="spacing" value="0"/>
</properties>
</rule>
<rule ref="Generic.Formatting.SpaceAfterNot">
<properties>
<property name="spacing" value="0"/>
</properties>
</rule>
<!-- Dead or degenerate code is an error. -->
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
<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"/>
<!-- Complexity stays low: these thresholds replace the Scrutinizer rating gate. -->
<rule ref="Generic.Metrics.CyclomaticComplexity">
<properties>
<property name="complexity" value="10"/>
<property name="absoluteComplexity" value="15"/>
</properties>
</rule>
<rule ref="Generic.Metrics.NestingLevel">
<properties>
<property name="nestingLevel" value="4"/>
<property name="absoluteNestingLevel" value="6"/>
</properties>
</rule>
<!-- Forbidden constructs. -->
<rule ref="Generic.PHP.BacktickOperator"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.DiscourageGoto">
<type>error</type>
</rule>
<rule ref="Squiz.PHP.Eval"/>
<rule ref="Squiz.PHP.GlobalKeyword"/>
<rule ref="Generic.PHP.DisallowRequestSuperglobal"/>
<rule ref="Squiz.Scope.StaticThisUsage"/>
<!-- No debug output functions; the examples are excluded because print_r is their demo output. -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="sizeof" value="count"/>
<element key="delete" value="unset"/>
<element key="var_dump" value="null"/>
<element key="var_export" value="null"/>
<element key="print_r" value="null"/>
<element key="error_log" value="null"/>
</property>
</properties>
<exclude-pattern>examples/</exclude-pattern>
</rule>
<!-- Lingering task markers fail the build; track work in issues instead. -->
<rule ref="Generic.Commenting.Todo"/>
<rule ref="Generic.Commenting.Fixme"/>
<!-- Tests use snake_case method names by convention (docs/TESTING.md). -->
<rule ref="PSR1.Methods.CamelCapsMethodName">
<exclude-pattern>tests/</exclude-pattern>
</rule>
</ruleset>