Skip to content

Commit 2cb72dd

Browse files
committed
Add more rules
Added: - PEAR.Commenting.InlineComment - Generic.Metrics.CyclomaticComplexity - Generic.CodeAnalysis.UnnecessaryFinalModifier - Generic.Files.OneClassPerFile - Generic.Files.OneInterfacePerFile - Squiz.WhiteSpace.ObjectOperatorSpacing - SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition
1 parent 555f0e9 commit 2cb72dd

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

Proton/ruleset.xml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,23 @@
44
Proton PHP Coding Standard
55
</description>
66

7-
<rule ref="PSR2" />
7+
<rule ref="PSR2">
8+
<!-- Checked by SlevomatCodingStandard.Namespaces.UseSpacing -->
9+
<exclude name="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse"/>
10+
<!-- Checked by SlevomatCodingStandard.Namespaces.NamespaceSpacing -->
11+
<exclude name="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter"/>
12+
</rule>
13+
814
<rule ref="PSR2.Namespaces.UseDeclaration">
915
<!-- Allows compound namespaces -->
1016
<exclude-pattern>*</exclude-pattern>
1117
</rule>
18+
1219
<rule ref="PSR12.Namespaces.CompoundNamespaceDepth"/>
1320
<rule ref="PSR12.Functions.NullableTypeDeclaration"/>
1421

22+
<rule ref="PEAR.Commenting.InlineComment"/>
23+
1524
<rule ref="Generic.Commenting.Todo"/>
1625
<rule ref="Generic.PHP.LowerCaseKeyword"/>
1726
<rule ref="Generic.PHP.DeprecatedFunctions"/>
@@ -21,9 +30,12 @@
2130
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
2231
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
2332
<rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/>
33+
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
2434
<rule ref="Generic.Classes.DuplicateClassName"/>
2535
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
2636
<rule ref="Generic.VersionControl.GitMergeConflict" />
37+
<rule ref="Generic.Files.OneClassPerFile"/>
38+
<rule ref="Generic.Files.OneInterfacePerFile"/>
2739

2840
<!-- All PHP files MUST use the Unix LF (linefeed) line ending only. -->
2941
<rule ref="Generic.Files.LineEndings">
@@ -41,6 +53,12 @@
4153
<element key="print" value="echo"/>
4254
<element key="phpinfo" value="null"/>
4355
<element key="create_function" value="null"/>
56+
<element key="doubleval" value="floatval"/>
57+
<element key="is_real" value="is_float"/>
58+
<element key="is_integer" value="is_int"/>
59+
<element key="is_double" value="is_float"/>
60+
<element key="join" value="implode"/>
61+
<element key="chop" value="rtrim"/>
4462

4563
<!-- Use `::class` keyword -->
4664
<element key="get_called_class" value="`static::class`"/>
@@ -69,8 +87,21 @@
6987
</properties>
7088
</rule>
7189

90+
<rule ref="Generic.Metrics.CyclomaticComplexity">
91+
<properties>
92+
<property name="complexity" value="15"/>
93+
<property name="absoluteComplexity" value="25"/>
94+
</properties>
95+
</rule>
96+
7297
<rule ref="Squiz.PHP.NonExecutableCode"/>
7398
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
99+
<!-- Forbid spaces around `->` operator -->
100+
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
101+
<properties>
102+
<property name="ignoreNewlines" value="true"/>
103+
</properties>
104+
</rule>
74105

75106
<!-- <rule ref="Squiz.Strings.ConcatenationSpacing">
76107
<properties>
@@ -115,6 +146,7 @@
115146
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
116147
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>
117148
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
149+
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition"/>
118150
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenComments"/>
119151
<rule ref="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration"/>
120152
<rule ref="SlevomatCodingStandard.Operators.SpreadOperatorSpacing">
@@ -137,7 +169,7 @@
137169
<!-- <rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/> -->
138170
<!-- <rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"/> -->
139171
<!--<rule ref="SlevomatCodingStandard.Functions.UnusedParameter"/>-->
140-
172+
141173
<!--
142174
If you want to completely disable an error message in a sniff
143175
but you don't want to exclude the whole sniff, you can

0 commit comments

Comments
 (0)