44
55namespace InfinityloopCodingStandard \Sniffs \Classes ;
66
7+ use \SlevomatCodingStandard \Helpers \FunctionHelper ;
8+ use \SlevomatCodingStandard \Helpers \SniffSettingsHelper ;
9+ use \SlevomatCodingStandard \Helpers \TokenHelper ;
10+ 711class ConstructorPropertyPromotionSpacingSniff implements \PHP_CodeSniffer \Sniffs \Sniff
812{
913 public const CONSTRUCTOR_PARAMETER_SAME_LINE = 'ConstructorParametersOnSameLine ' ;
@@ -15,19 +19,19 @@ public function register() : array
1519
1620 public function process (\PHP_CodeSniffer \Files \File $ phpcsFile , $ functionPointer ) : void
1721 {
18- if (!\ SlevomatCodingStandard \ Helpers \ SniffSettingsHelper::isEnabledByPhpVersion (null , 80000 )) {
22+ if (!SniffSettingsHelper::isEnabledByPhpVersion (null , 80000 )) {
1923 return ;
2024 }
2125
2226 $ tokens = $ phpcsFile ->getTokens ();
2327
24- $ namePointer = \ SlevomatCodingStandard \ Helpers \ TokenHelper::findNextEffective ($ phpcsFile , $ functionPointer + 1 );
28+ $ namePointer = TokenHelper::findNextEffective ($ phpcsFile , $ functionPointer + 1 );
2529
2630 if (\strtolower ($ tokens [$ namePointer ]['content ' ]) !== '__construct ' ) {
2731 return ;
2832 }
2933
30- if (\ SlevomatCodingStandard \ Helpers \ FunctionHelper::isAbstract ($ phpcsFile , $ functionPointer )) {
34+ if (FunctionHelper::isAbstract ($ phpcsFile , $ functionPointer )) {
3135 return ;
3236 }
3337
@@ -40,13 +44,13 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $functionPointer
4044 $ containsPropertyPromotion = false ;
4145
4246 foreach ($ parameterPointers as $ parameterPointer ) {
43- $ pointerBefore = \ SlevomatCodingStandard \ Helpers \ TokenHelper::findPrevious (
47+ $ pointerBefore = TokenHelper::findPrevious (
4448 $ phpcsFile ,
4549 [\T_COMMA , \T_OPEN_PARENTHESIS ],
4650 $ parameterPointer - 1 ,
4751 );
4852
49- $ visibilityPointer = \ SlevomatCodingStandard \ Helpers \ TokenHelper::findNextEffective ($ phpcsFile , $ pointerBefore + 1 );
53+ $ visibilityPointer = TokenHelper::findNextEffective ($ phpcsFile , $ pointerBefore + 1 );
5054
5155 if (\in_array ($ tokens [$ visibilityPointer ]['code ' ], \PHP_CodeSniffer \Util \Tokens::$ scopeModifiers , true )) {
5256 $ containsPropertyPromotion = true ;
@@ -58,7 +62,7 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $functionPointer
5862 }
5963
6064 if (\count ($ parameterPointers ) === 1 ) {
61- $ pointerBefore = \ SlevomatCodingStandard \ Helpers \ TokenHelper::findPrevious (
65+ $ pointerBefore = TokenHelper::findPrevious (
6266 $ phpcsFile ,
6367 [\T_COMMA , \T_OPEN_PARENTHESIS ],
6468 $ parameterPointers [0 ],
@@ -110,7 +114,7 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $functionPointer
110114
111115 $ phpcsFile ->fixer ->beginChangeset ();
112116
113- $ pointerBefore = \ SlevomatCodingStandard \ Helpers \ TokenHelper::findPrevious (
117+ $ pointerBefore = TokenHelper::findPrevious (
114118 $ phpcsFile ,
115119 [\T_COMMA , \T_OPEN_PARENTHESIS ],
116120 $ parameterPointer - 1 ,
@@ -126,7 +130,7 @@ private function getParameterPointers(\PHP_CodeSniffer\Files\File $phpcsFile, in
126130 {
127131 $ tokens = $ phpcsFile ->getTokens ();
128132
129- return \ SlevomatCodingStandard \ Helpers \ TokenHelper::findNextAll (
133+ return TokenHelper::findNextAll (
130134 $ phpcsFile ,
131135 \T_VARIABLE ,
132136 $ tokens [$ functionPointer ]['parenthesis_opener ' ] + 1 ,
0 commit comments