Skip to content

Commit

Permalink
Upgrade to v8
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Oct 12, 2020
1 parent 33829b4 commit 9fe2448
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
43 changes: 38 additions & 5 deletions HardMode/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ruleset
name="HardMode"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
xsi:noNamespaceSchemaLocation="../vendor/squizlabs/php_codesniffer/phpcs.xsd">

<!-- Import the Doctrine coding standard -->
<rule ref="Doctrine"/>
Expand Down Expand Up @@ -62,8 +62,19 @@
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses">
<severity>0</severity>
</rule>
<rule ref="PSR12.Classes.ClassInstantiation.MissingParentheses">
<severity>0</severity>
</rule>
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithoutParentheses"/>

<!-- Do not require an empty line after if/for/etc. -->
<rule ref="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountAfterControlStructure">
<severity>0</severity>
</rule>
<rule ref="SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing.IncorrectLinesCountBeforeControlStructure">
<severity>0</severity>
</rule>

<!-- Do not require closures not referencing $this be static -->
<rule ref="SlevomatCodingStandard.Functions.StaticClosure">
<severity>0</severity>
Expand Down Expand Up @@ -93,6 +104,10 @@
<property name="newlinesCountAfterDeclare" value="2"/>
</properties>
</rule>
<!-- Declare strict type on the same line as opening tag -->
<rule ref="PSR12.Files.OpenTag.NotAlone">
<severity>0</severity>
</rule>

<!-- Require no space before colon in return types -->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing">
Expand All @@ -117,13 +132,18 @@
</rule>

<!-- More lax rules about `array` type-hints (no need to always detail what's in the array) -->
<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingTraversablePropertyTypeHintSpecification">
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification">
<severity>0</severity>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingTraversableParameterTypeHintSpecification">
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification">
<severity>0</severity>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingTraversableReturnTypeHintSpecification">
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification">
<severity>0</severity>
</rule>

<!-- Anonymous classes -->
<rule ref="PSR12.Classes.AnonClassDeclaration.SpaceAfterKeyword">
<severity>0</severity>
</rule>

Expand All @@ -136,9 +156,22 @@
<exclude-pattern type="relative">tests/*</exclude-pattern>
</rule>

<!-- For short anonymous classes in tests -->
<rule ref="Squiz.WhiteSpace.FunctionSpacing.Before">
<exclude-pattern type="relative">tests/*</exclude-pattern>
</rule>

<!-- Do not enforce return types in tests else it crowds the test methods with `: void` -->
<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint">
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
<exclude-pattern type="relative">tests/*</exclude-pattern>
</rule>


<!-- ########################-->
<!-- For PHP 7.4+ only -->
<!-- ########################-->
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint">
<severity>0</severity>
</rule>

</ruleset>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"description": "Hard mode for PHP",
"license": "MIT",
"require": {
"doctrine/coding-standard": "^6.0"
"doctrine/coding-standard": "^8.0"
}
}

0 comments on commit 9fe2448

Please sign in to comment.