Skip to content

Commit 109bcf1

Browse files
authored
Merge pull request #10 from vossik/update
fixed sniffs conflict, readme
2 parents 32ccf27 + be51329 commit 109bcf1

File tree

2 files changed

+42
-38
lines changed

2 files changed

+42
-38
lines changed

InfinityloopCodingStandard/ruleset.xml

+24-23
Original file line numberDiff line numberDiff line change
@@ -333,18 +333,18 @@
333333
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
334334
<rule ref="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing">
335335
<properties>
336-
<property name="tokensToCheck" type="array">
337-
<element value="T_SWITCH"/>
338-
<element value="T_TRY"/>
339-
<element value="T_IF"/>
340-
<element value="T_FOR"/>
341-
<element value="T_FOREACH"/>
342-
<element value="T_WHILE"/>
336+
<property name="linesCountBefore" value="1"/>
337+
<property name="linesCountBeforeFirst" value="0"/>
338+
<property name="linesCountAfter" value="1"/>
339+
<property name="linesCountAfterLast" value="0"/>
340+
<property name="controlStructures" type="array">
341+
<element value="switch"/>
342+
<element value="try"/>
343+
<element value="if"/>
344+
<element value="for"/>
345+
<element value="foreach"/>
346+
<element value="while"/>
343347
</property>
344-
<property name="linesCountBeforeControlStructure" value="1"/>
345-
<property name="linesCountBeforeFirstControlStructure" value="0"/>
346-
<property name="linesCountAfterControlStructure" value="1"/>
347-
<property name="linesCountAfterLastControlStructure" value="0"/>
348348
</properties>
349349
</rule>
350350
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowContinueWithoutIntegerOperandInSwitch"/>
@@ -356,20 +356,21 @@
356356
</rule>
357357
<rule ref="SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing">
358358
<properties>
359-
<property name="tokensToCheck" type="array">
360-
<element value="T_GOTO"/>
361-
<element value="T_THROW"/>
362-
<element value="T_YIELD"/>
363-
<element value="T_YIELD_FROM"/>
364-
<element value="T_CONTINUE"/>
365-
<element value="T_BREAK"/>
366-
<element value="T_RETURN"/>
359+
<property name="linesCountBefore" value="1"/>
360+
<property name="linesCountBeforeFirst" value="0"/>
361+
<property name="linesCountAfter" value="1"/>
362+
<property name="linesCountAfterLast" value="0"/>
363+
<property name="linesCountAfterWhenLastInCaseOrDefault" value="0"/>
364+
<property name="linesCountAfterWhenLastInLastCaseOrDefault" value="0"/>
365+
<property name="jumpStatements" type="array">
366+
<element value="goto"/>
367+
<element value="throw"/>
368+
<element value="yield"/>
369+
<element value="continue"/>
370+
<element value="break"/>
371+
<element value="return"/>
367372
</property>
368373
</properties>
369-
<property name="linesCountBeforeControlStructure" value="1"/>
370-
<property name="linesCountBeforeFirstControlStructure" value="0"/>
371-
<property name="linesCountAfterControlStructure" value="0"/>
372-
<property name="linesCountAfterLastControlStructure" value="0"/>
373374
</rule>
374375
<rule ref="SlevomatCodingStandard.ControlStructures.RequireMultiLineTernaryOperator">
375376
<properties>

README.md

+18-15
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Infinityloop Coding-Standard
22

3-
Custom PHP 7.4 ruleset for [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
4-
5-
It is designed for PHP 7.4 because of its specific property spacing, which is not plausible without typed properties.
3+
Custom PHP 8.0 ruleset for [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
64

75
## Features
86

@@ -107,6 +105,7 @@ Detailed list of Slevomat sniffs with configured settings. Some sniffs are not i
107105
- ignoreStandaloneIfInScope: true
108106
- ignoreOneLineTrailingIf: true
109107
- SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator
108+
- SlevomatCodingStandard.ControlStructures.RequireNullSafeObjectOperator
110109
- SlevomatCodingStandard.Functions.StaticClosure
111110
- SlevomatCodingStandard.Operators.DisallowEqualOperators
112111
- SlevomatCodingStandard.Operators.RequireOnlyStandaloneIncrementAndDecrementOperators
@@ -122,9 +121,6 @@ Excluded sniffs:
122121

123122
#### Cleaning
124123

125-
- SlevomatCodingStandard.Classes.UnusedPrivateElements
126-
- alwaysUsedPropertiesAnnotations: false
127-
- alwaysUsedPropertiesSuffixes: false
128124
- SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure
129125
- SlevomatCodingStandard.Functions.UselessParameterDefaultValue
130126
- SlevomatCodingStandard.Namespaces.UnusedUses
@@ -144,6 +140,7 @@ Excluded sniffs:
144140
- ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach: true
145141
- SlevomatCodingStandard.Variables.UselessVariable
146142
- SlevomatCodingStandard.Exceptions.DeadCatch
143+
- SlevomatCodingStandard.Exceptions.RequireNonCapturingCatch
147144

148145
Excluded sniffs:
149146

@@ -171,14 +168,16 @@ Excluded sniffs:
171168
- linesCountBeforeFirstControlStructure: 0
172169
- linesCountAfterControlStructure: 1
173170
- linesCountAfterLastControlStructure: 0
174-
- tokensToCheck: [T_SWITCH, T_TRY, T_IF, T_FOR, T_FOREACH, T_WHILE]
171+
- controlStructures: [switch, try, if, for, foreach, while]
175172
- SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing
176173
- allowSingleLineYieldStacking: whether or not to allow multiple yield/yield from statements in a row without blank lines.
177-
- linesCountBeforeControlStructure: 1
178-
- linesCountBeforeFirstControlStructure: 0
179-
- linesCountAfterControlStructure: 0
180-
- linesCountAfterLastControlStructure: 0
181-
- tokensToCheck: default
174+
- linesCountBefore: 1
175+
- linesCountBeforeFirst: 0
176+
- linesCountAfter: 0
177+
- linesCountAfterLast: 0
178+
- linesCountAfterWhenLastInCaseOrDefault: 0
179+
- linesCountAfterWhenLastInLastCaseOrDefault: 0
180+
- jumpStatements: [goto, throw, yield, continue, break, return]
182181
- SlevomatCodingStandard.ControlStructures.LanguageConstructWithParentheses
183182
- SlevomatCodingStandard.ControlStructures.NewWithParentheses
184183
- SlevomatCodingStandard.ControlStructures.RequireMultiLineTernaryOperator
@@ -188,7 +187,8 @@ Excluded sniffs:
188187
- ignoreMultiLine: false
189188
- SlevomatCodingStandard.ControlStructures.DisallowYodaComparison
190189
- SlevomatCodingStandard.Functions.DisallowArrowFunction
191-
- SlevomatCodingStandard.Functions.TrailingCommaInCall
190+
- SlevomatCodingStandard.Functions.RequireTrailingCommaInCall
191+
- SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration
192192
- SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses
193193
- psr12Compatible: true
194194
- caseSensitive: true
@@ -220,9 +220,11 @@ Excluded sniffs:
220220
- SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue
221221
- SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing
222222
- SlevomatCodingStandard.TypeHints.PropertyTypeHintSpacing
223+
- SlevomatCodingStandard.TypeHints.UnionTypeHintFormat
224+
- withSpaces: no
225+
- shortNullable: yes
226+
- nullPosition: last
223227
- SlevomatCodingStandard.Namespaces.DisallowGroupUse
224-
- SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameAfterKeyword
225-
- keywordsToCheck: T_EXTENDS, T_IMPLEMENETS, T_USE, T_NEW, T_THROW
226228
- SlevomatCodingStandard.Namespaces.FullyQualifiedExceptions
227229
- specialExceptionNames: false
228230
- ignoredNames: default
@@ -237,6 +239,7 @@ Excluded sniffs:
237239
- SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation
238240
- SlevomatCodingStandard.Commenting.ForbiddenAnnotations
239241
- forbiddenAnnotations: @author, @created, @version, @package, @copyright, @license, @throws
242+
- SlevomatCodingStandard.Classes.RequireConstructorPropertyPromotion
240243
- SlevomatCodingStandard.Commenting.EmptyComment
241244
- SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration
242245
- SlevomatCodingStandard.Commenting.UselessFunctionDocComment

0 commit comments

Comments
 (0)