@@ -74,7 +74,7 @@ class ScopeIndentSniff implements Sniff
7474 * or PHP open/close tags can escape from here and have their own
7575 * rules elsewhere.
7676 *
77- * @var int[]
77+ * @var array< int, int|string>
7878 */
7979 public $ ignoreIndentationTokens = [];
8080
@@ -153,6 +153,7 @@ public function process(File $phpcsFile, $stackPtr)
153153 $ setIndents = [];
154154 $ disableExactStack = [];
155155 $ disableExactEnd = 0 ;
156+ $ tokenIndent = 0 ;
156157
157158 $ tokens = $ phpcsFile ->getTokens ();
158159 $ first = $ phpcsFile ->findFirstOnLine (T_INLINE_HTML , $ stackPtr );
@@ -189,11 +190,6 @@ public function process(File $phpcsFile, $stackPtr)
189190 $ checkAnnotations = $ phpcsFile ->config ->annotations ;
190191
191192 for ($ i = ($ stackPtr + 1 ); $ i < $ phpcsFile ->numTokens ; $ i ++) {
192- if ($ i === false ) {
193- // Something has gone very wrong; maybe a parse error.
194- break ;
195- }
196-
197193 if ($ checkAnnotations === true
198194 && $ tokens [$ i ]['code ' ] === T_PHPCS_SET
199195 && isset ($ tokens [$ i ]['sniffCode ' ]) === true
@@ -1573,7 +1569,7 @@ protected function adjustIndent(File $phpcsFile, $stackPtr, $length, $change)
15731569 $ padding = '' ;
15741570 if ($ length > 0 ) {
15751571 if ($ this ->tabIndent === true ) {
1576- $ numTabs = floor ($ length / $ this ->tabWidth );
1572+ $ numTabs = ( int ) floor ($ length / $ this ->tabWidth );
15771573 if ($ numTabs > 0 ) {
15781574 $ numSpaces = ($ length - ($ numTabs * $ this ->tabWidth ));
15791575 $ padding = str_repeat ("\t" , $ numTabs ).str_repeat (' ' , $ numSpaces );
@@ -1611,7 +1607,7 @@ protected function adjustIndent(File $phpcsFile, $stackPtr, $length, $change)
16111607 $ padding = ($ length + $ change );
16121608 if ($ padding > 0 ) {
16131609 if ($ this ->tabIndent === true ) {
1614- $ numTabs = floor ($ padding / $ this ->tabWidth );
1610+ $ numTabs = ( int ) floor ($ padding / $ this ->tabWidth );
16151611 $ numSpaces = ($ padding - ($ numTabs * $ this ->tabWidth ));
16161612 $ padding = str_repeat ("\t" , $ numTabs ).str_repeat (' ' , $ numSpaces );
16171613 } else {
0 commit comments