Skip to content

Commit e45d6da

Browse files
committed
Debug/TokenList: simplify skipping the rest of the file
This commit updates the sniff to use `return $phpcsFile->numTokens` instead of `return ($phpcsFile->numTokens + 1)`. If a sniff file contains 50 tokens, the last `$stackPtr` will be 49, so returning `50` will already get us passed the end of the token stack and the `+ 1` is redundant.
1 parent 311c824 commit e45d6da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

PHPCSDebug/Sniffs/Debug/TokenListSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function process(File $phpcsFile, $stackPtr)
139139
}
140140

141141
// Only do this once per file.
142-
return ($phpcsFile->numTokens + 1);
142+
return $phpcsFile->numTokens;
143143
}
144144

145145
/**

0 commit comments

Comments
 (0)