@@ -74,7 +74,7 @@ class ScopeIndentSniff implements Sniff
74
74
* or PHP open/close tags can escape from here and have their own
75
75
* rules elsewhere.
76
76
*
77
- * @var int[]
77
+ * @var array< int, int|string>
78
78
*/
79
79
public $ ignoreIndentationTokens = [];
80
80
@@ -153,6 +153,7 @@ public function process(File $phpcsFile, $stackPtr)
153
153
$ setIndents = [];
154
154
$ disableExactStack = [];
155
155
$ disableExactEnd = 0 ;
156
+ $ tokenIndent = 0 ;
156
157
157
158
$ tokens = $ phpcsFile ->getTokens ();
158
159
$ first = $ phpcsFile ->findFirstOnLine (T_INLINE_HTML , $ stackPtr );
@@ -189,11 +190,6 @@ public function process(File $phpcsFile, $stackPtr)
189
190
$ checkAnnotations = $ phpcsFile ->config ->annotations ;
190
191
191
192
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
-
197
193
if ($ checkAnnotations === true
198
194
&& $ tokens [$ i ]['code ' ] === T_PHPCS_SET
199
195
&& isset ($ tokens [$ i ]['sniffCode ' ]) === true
@@ -1573,7 +1569,7 @@ protected function adjustIndent(File $phpcsFile, $stackPtr, $length, $change)
1573
1569
$ padding = '' ;
1574
1570
if ($ length > 0 ) {
1575
1571
if ($ this ->tabIndent === true ) {
1576
- $ numTabs = floor ($ length / $ this ->tabWidth );
1572
+ $ numTabs = ( int ) floor ($ length / $ this ->tabWidth );
1577
1573
if ($ numTabs > 0 ) {
1578
1574
$ numSpaces = ($ length - ($ numTabs * $ this ->tabWidth ));
1579
1575
$ padding = str_repeat ("\t" , $ numTabs ).str_repeat (' ' , $ numSpaces );
@@ -1611,7 +1607,7 @@ protected function adjustIndent(File $phpcsFile, $stackPtr, $length, $change)
1611
1607
$ padding = ($ length + $ change );
1612
1608
if ($ padding > 0 ) {
1613
1609
if ($ this ->tabIndent === true ) {
1614
- $ numTabs = floor ($ padding / $ this ->tabWidth );
1610
+ $ numTabs = ( int ) floor ($ padding / $ this ->tabWidth );
1615
1611
$ numSpaces = ($ padding - ($ numTabs * $ this ->tabWidth ));
1616
1612
$ padding = str_repeat ("\t" , $ numTabs ).str_repeat (' ' , $ numSpaces );
1617
1613
} else {
0 commit comments