Skip to content

Commit 605cabf

Browse files
committed
Use PSR12
1 parent b71bab2 commit 605cabf

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

Proton/ruleset.xml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,15 @@
44
Proton PHP Coding Standard
55
</description>
66

7-
<rule ref="PSR2">
7+
<rule ref="PSR12">
88
<!-- Checked by SlevomatCodingStandard.Namespaces.UseSpacing -->
99
<exclude name="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse"/>
1010
<!-- Checked by SlevomatCodingStandard.Namespaces.NamespaceSpacing -->
1111
<exclude name="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter"/>
12+
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/>
13+
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.FirstExpressionLine"/> <!-- Clashes with PSR2 SpacingAfterOpenBrace -->
1214
</rule>
1315

14-
<rule ref="PSR2.Namespaces.UseDeclaration">
15-
<!-- Allows compound namespaces -->
16-
<exclude-pattern>*</exclude-pattern>
17-
</rule>
18-
19-
<rule ref="PSR12.Namespaces.CompoundNamespaceDepth"/>
20-
<rule ref="PSR12.Functions.NullableTypeDeclaration"/>
21-
2216
<rule ref="PEAR.Commenting.InlineComment"/>
2317

2418
<rule ref="Generic.Commenting.Todo"/>
@@ -33,6 +27,7 @@
3327
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
3428
<rule ref="Generic.Classes.DuplicateClassName"/>
3529
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
30+
<rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter"/>
3631
<rule ref="Generic.VersionControl.GitMergeConflict"/>
3732
<rule ref="Generic.Files.OneClassPerFile"/>
3833
<rule ref="Generic.Files.OneInterfacePerFile"/>
@@ -168,6 +163,15 @@
168163
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
169164
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/>
170165

166+
<!-- Require presence of declare(strict_types=1) -->
167+
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
168+
<properties>
169+
<property name="newlinesCountBetweenOpenTagAndDeclare" value="2"/>
170+
<property name="spacesCountAroundEqualsSign" value="0"/>
171+
<property name="newlinesCountAfterDeclare" value="2"/>
172+
</properties>
173+
</rule>
174+
171175
<!-- <rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit">
172176
<properties>
173177
<property name="ignoreStandaloneIfInScope" value="0"/>

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{
22
"name": "protonlabs/php-coding-standard",
3-
"description": "ProtonMail Coding Standard",
3+
"description": "ProtonLabs Coding Standard",
44
"type": "phpcodesniffer-standard",
55
"keywords": [
6-
"php-codesniffer", "coding-standard"
6+
"php-codesniffer",
7+
"coding-standard"
78
],
89
"homepage": "https://github.com/ProtonMail/php-coding-standard",
910
"minimum-stability": "dev",
1011
"prefer-stable": true,
1112
"require": {
1213
"php": "^7.1",
1314
"slevomat/coding-standard": "^5.0",
14-
"squizlabs/php_codesniffer": "^3.4"
15+
"squizlabs/php_codesniffer": "^3.5"
1516
},
1617
"license": "MIT"
1718
}

0 commit comments

Comments
 (0)