Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 32ccf27

Browse files
authored
Merge pull request #8 from vossik/update
added sniffs for php 8
2 parents 1fbe30c + 43c2a37 commit 32ccf27

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

‎InfinityloopCodingStandard/Sniffs/WhiteSpace/MemberVarSpacingSniff.php‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@ class MemberVarSpacingSniff extends \PHP_CodeSniffer\Sniffs\AbstractVariableSnif
1010
public int $spacingBeforeFirst = 1;
1111
public bool $ignoreFirstMemberVar = false;
1212

13-
/**
14-
* @return int|void
15-
*/
1613
//@phpcs:ignore Squiz.Commenting.FunctionComment.ScalarTypeHintMissing
17-
//@phpcs:ignore SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint
18-
protected function processMemberVar(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr)
14+
protected function processMemberVar(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) : ?int
1915
{
2016
$tokens = $phpcsFile->getTokens();
2117

@@ -25,7 +21,7 @@ protected function processMemberVar(\PHP_CodeSniffer\Files\File $phpcsFile, $sta
2521
$startOfStatement = $phpcsFile->findPrevious($validPrefixes, $stackPtr - 1, null, false, null, true);
2622

2723
if ($startOfStatement === false) {
28-
return;
24+
returnnull;
2925
}
3026

3127
$endOfStatement = $phpcsFile->findNext(\T_SEMICOLON, $stackPtr + 1, null, false, null, true);
@@ -97,13 +93,13 @@ protected function processMemberVar(\PHP_CodeSniffer\Files\File $phpcsFile, $sta
9793
&& isset($tokens[$prev]['scope_condition']) === true
9894
&& $tokens[$tokens[$prev]['scope_condition']]['code'] === \T_FUNCTION
9995
) {
100-
return;
96+
returnnull;
10197
}
10298

10399
$prevVar = $phpcsFile->findPrevious(\T_VARIABLE, $first - 1);
104100

105101
if ($this->ignoreFirstMemberVar && $tokens[$prevVar]['code'] !== \T_VARIABLE) {
106-
return;
102+
returnnull;
107103
}
108104

109105
if ($tokens[$prev]['code'] === \T_OPEN_CURLY_BRACKET
@@ -131,7 +127,7 @@ protected function processMemberVar(\PHP_CodeSniffer\Files\File $phpcsFile, $sta
131127
return $endOfStatement;
132128
}
133129

134-
return;
130+
returnnull;
135131
}
136132

137133
$data = [

‎InfinityloopCodingStandard/ruleset.xml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@
308308
</property>
309309
</properties>
310310
</rule>
311+
<rule ref="SlevomatCodingStandard.Classes.RequireConstructorPropertyPromotion"/>
311312
<rule ref="SlevomatCodingStandard.Commenting.EmptyComment"/>
312313
<rule ref="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration"/>
313314
<rule ref="SlevomatCodingStandard.Commenting.UselessInheritDocComment"/>
@@ -389,8 +390,10 @@
389390
</properties>
390391
</rule>
391392
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator"/>
393+
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullSafeObjectOperator"/>
392394
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/>
393395
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly"/>
396+
<rule ref="SlevomatCodingStandard.Exceptions.RequireNonCapturingCatch"/>
394397
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
395398
<properties>
396399
<property name="psr12Compatible" value="true"/>
@@ -455,6 +458,13 @@
455458
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition"/>
456459
<rule ref="SlevomatCodingStandard.TypeHints.DisallowArrayTypeHintSyntax"/>
457460
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHintSpacing"/>
461+
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
462+
<properties>
463+
<property name="withSpaces" value="no"/>
464+
<property name="shortNullable" value="yes"/>
465+
<property name="nullPosition" value="last"/>
466+
</properties>
467+
</rule>
458468
<rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation"/>
459469
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma">
460470
<properties>
@@ -469,6 +479,7 @@
469479
<rule ref="SlevomatCodingStandard.Functions.UselessParameterDefaultValue"/>
470480
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/>
471481
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall"/>
482+
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration"/>
472483
<rule ref="SlevomatCodingStandard.Numbers.DisallowNumericLiteralSeparator"/>
473484
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
474485
<rule ref="SlevomatCodingStandard.Operators.RequireCombinedAssignmentOperator"/>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /