Skip to content

Commit

Permalink
Add new sniffs
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoll committed Dec 13, 2023
1 parent 72f7fea commit 9c196cc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions MO4/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,24 @@
<!-- Require exactly one blank line after trait use -->
<rule ref="PSR12.Traits.UseDeclaration"/>

<!-- Forbid whitespace between array access operator and the variable or between array access operators. -->
<rule ref="SlevomatCodingStandard.Arrays.ArrayAccess"/>
<!-- Sort attributes alphabetically -->
<rule ref="SlevomatCodingStandard.Attributes.AttributesOrder">
<properties>
<property name="orderAlphabetically" value="true"/>
</properties>
</rule>
<!-- Attributes should be adjoined to the PHP element they belong to -->
<!-- disabled as comments on their own line are getting auto"fixed" away -->
<!-- <rule ref="SlevomatCodingStandard.Attributes.AttributeAndTargetSpacing"/> -->
<!-- Disallow multiple attributes inside one #[] -->
<rule ref="SlevomatCodingStandard.Attributes.DisallowAttributesJoining"/>
<!-- Require only one attribute per line -->
<rule ref="SlevomatCodingStandard.Attributes.DisallowMultipleAttributesPerLine"/>
<!-- Require PHPDoc always before attributes -->
<rule ref="SlevomatCodingStandard.Attributes.RequireAttributeAfterDocComment"/>

<!-- Force Enum Spacing-->
<rule ref="SlevomatCodingStandard.Classes.BackedEnumTypeSpacing"/>
<!-- Require presence of constant visibility -->
Expand All @@ -101,6 +119,15 @@
<property name="linesCountBeforeClosingBrace" value="0"/>
</properties>
</rule>
<!-- Forbid empty lines around Enum cases -->
<rule ref="SlevomatCodingStandard.Classes.EnumCaseSpacing">
<properties>
<property name="minLinesCountBeforeWithComment" value="0"/>
<property name="maxLinesCountBeforeWithComment" value="0"/>
<property name="minLinesCountBeforeWithoutComment" value="0"/>
<property name="maxLinesCountBeforeWithoutComment" value="0"/>
</properties>
</rule>
<!-- Forbid properties to be public -->
<rule ref="SlevomatCodingStandard.Classes.ForbiddenPublicProperty">
<properties>
Expand Down Expand Up @@ -144,6 +171,8 @@
<property name="ignoreMultiLine" value="true"/>
</properties>
</rule>
<!-- Enforce consistent spacing of named arguments -->
<rule ref="SlevomatCodingStandard.Functions.NamedArgumentSpacing"/>
<!-- Require static closures for microoptimization -->
<rule ref="SlevomatCodingStandard.Functions.StaticClosure"/>
<!-- Forbid unused function parameters -->
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"php": "~7.2 || ~8.0",
"dealerdirect/phpcodesniffer-composer-installer": "~0.7 || ~1.0",
"escapestudios/symfony2-coding-standard": "^3.10.0",
"slevomat/coding-standard": "^8.4",
"slevomat/coding-standard": "^8.14",
"squizlabs/php_codesniffer": "^3.6.2"
},
"require-dev": {
Expand Down

0 comments on commit 9c196cc

Please sign in to comment.