@@ -10,12 +10,8 @@ class MemberVarSpacingSniff extends \PHP_CodeSniffer\Sniffs\AbstractVariableSnif
10
10
public int $ spacingBeforeFirst = 1 ;
11
11
public bool $ ignoreFirstMemberVar = false ;
12
12
13
- /**
14
- * @return int|void
15
- */
16
13
//@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
19
15
{
20
16
$ tokens = $ phpcsFile ->getTokens ();
21
17
@@ -25,7 +21,7 @@ protected function processMemberVar(\PHP_CodeSniffer\Files\File $phpcsFile, $sta
25
21
$ startOfStatement = $ phpcsFile ->findPrevious ($ validPrefixes , $ stackPtr - 1 , null , false , null , true );
26
22
27
23
if ($ startOfStatement === false ) {
28
- return ;
24
+ return null ;
29
25
}
30
26
31
27
$ endOfStatement = $ phpcsFile ->findNext (\T_SEMICOLON , $ stackPtr + 1 , null , false , null , true );
@@ -97,13 +93,13 @@ protected function processMemberVar(\PHP_CodeSniffer\Files\File $phpcsFile, $sta
97
93
&& isset ($ tokens [$ prev ]['scope_condition ' ]) === true
98
94
&& $ tokens [$ tokens [$ prev ]['scope_condition ' ]]['code ' ] === \T_FUNCTION
99
95
) {
100
- return ;
96
+ return null ;
101
97
}
102
98
103
99
$ prevVar = $ phpcsFile ->findPrevious (\T_VARIABLE , $ first - 1 );
104
100
105
101
if ($ this ->ignoreFirstMemberVar && $ tokens [$ prevVar ]['code ' ] !== \T_VARIABLE ) {
106
- return ;
102
+ return null ;
107
103
}
108
104
109
105
if ($ tokens [$ prev ]['code ' ] === \T_OPEN_CURLY_BRACKET
@@ -131,7 +127,7 @@ protected function processMemberVar(\PHP_CodeSniffer\Files\File $phpcsFile, $sta
131
127
return $ endOfStatement ;
132
128
}
133
129
134
- return ;
130
+ return null ;
135
131
}
136
132
137
133
$ data = [
0 commit comments