Skip to content

Commit 63e36b5

Browse files
committed
Add configuration for PHP Codesniffer.
1 parent ea1dc1c commit 63e36b5

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.config/phpcs.xml.dist

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0"?>
2+
<ruleset
3+
xsi:noNamespaceSchemaLocation="https://schema.phpcodesniffer.com/phpcs.xsd"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
name="PDS Interop PHP Solid Server"
6+
>
7+
<description>PHP coding standards for the PDS Interop PHP Solid Server project</description>
8+
9+
<!-- Show sniff codes in all reports, and progress when running -->
10+
<arg value="sp"/>
11+
12+
<!-- Strip the file paths down to the relevant bit. -->
13+
<arg name="basepath" value="../"/>
14+
<arg name="extensions" value="php"/>
15+
<arg name="colors"/>
16+
17+
<file>.</file>
18+
<exclude-pattern>*(.config|vendor|persistent-storage)/*</exclude-pattern>
19+
20+
<rule ref="PHPCompatibility"/>
21+
<config name="testVersion" value="8.0-"/>
22+
23+
<!-- Set indent for `break` to 0 so it aligns with `case` and `default` -->
24+
<rule ref="PSR2">
25+
<exclude name="PSR2.ControlStructures.SwitchDeclaration"/>
26+
<exclude name="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed"/>
27+
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/>
28+
</rule>
29+
30+
<!-- Enforce the use of tabs for indentation -->
31+
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
32+
33+
<!-- Include the whole PSR-12 standard -->
34+
<rule ref="PSR12">
35+
<!-- Enforce the use of tabs for indentation -->
36+
<exclude name="Generic.WhiteSpace.DisallowTabIndent.NonIndentTabsUsed"/>
37+
<exclude name="Generic.WhiteSpace.DisallowTabIndent.TabsUsed"/>
38+
39+
<!-- Do not align multiple statements, to reduce noise in diffs -->
40+
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSame"/>
41+
</rule>
42+
43+
<!-- Have 12 chars padding maximum and always show as errors -->
44+
<rule ref="Generic.Formatting.MultipleStatementAlignment">
45+
<properties>
46+
<property name="maxPadding" value="12"/>
47+
<property name="error" value="true"/>
48+
</properties>
49+
</rule>
50+
</ruleset>

0 commit comments

Comments
 (0)