Skip to content

Commit

Permalink
Add additional coding standard rules
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Feb 1, 2024
1 parent 955cb6c commit 1640943
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 8 deletions.
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"require-dev": {
"phpunit/phpunit": "^9",
"phpstan/phpstan": "^1",
"squizlabs/php_codesniffer": "^3.8"
"squizlabs/php_codesniffer": "^3.8",
"slevomat/coding-standard": "~8.0"
},
"autoload": {
"psr-4": {
Expand All @@ -29,5 +30,10 @@
"Intervention\\Gif\\Tests\\": "tests"
}
},
"minimum-stability": "stable"
"minimum-stability": "stable",
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
69 changes: 63 additions & 6 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,68 @@
<?xml version="1.0"?>
<ruleset name="Intervention/gif">

<rule ref="PSR12"/>

<ruleset name="Intervention">
<file>src/</file>
<file>tests/</file>
<arg name="colors"/>
<arg value="p"/>

<file>src/</file>
<file>tests/</file>
<rule ref="PSR12"/>
<rule ref="Generic.Arrays.ArrayIndent"/>
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.Formatting.SpaceAfterNot">
<properties>
<property name="spacing" value="0" />
</properties>
</rule>
<rule ref="Generic.Metrics.NestingLevel"/>
<rule ref="SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace"/>
<rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation"/>
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility"/>
<rule ref="SlevomatCodingStandard.Classes.ClassMemberSpacing"/>
<rule ref="SlevomatCodingStandard.Classes.ConstantSpacing"/>
<rule ref="SlevomatCodingStandard.Classes.MethodSpacing"/>
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
<rule ref="SlevomatCodingStandard.Classes.ParentCallSpacing"/>
<rule ref="SlevomatCodingStandard.Classes.PropertyDeclaration"/>
<rule ref="SlevomatCodingStandard.Classes.RequireSelfReference"/>
<rule ref="SlevomatCodingStandard.Classes.TraitUseDeclaration"/>
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array">
<element key="src" value="Intervention\Gif"/>
<element key="tests" value="Intervention\Gif\Tests"/>
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.DisallowGroupUse"/>
<rule ref="SlevomatCodingStandard.Namespaces.MultipleUsesPerLine"/>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing"/>
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/>
<rule ref="SlevomatCodingStandard.Strings.DisallowVariableParsing"/>
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="spacesCountAroundEqualsSign" value="0" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
<properties>
<property name="withSpaces" value="no" />
<property name="nullPosition" value="first" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/>
<rule ref="SlevomatCodingStandard.Whitespaces.DuplicateSpaces"/>
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable"/>
<rule ref="SlevomatCodingStandard.Variables.UselessVariable"/>
</ruleset>

0 comments on commit 1640943

Please sign in to comment.