Skip to content

Commit be33885

Browse files
committed
*Sniff::process(): update documentation
As the tokens stack indexes are 0-based and a token count is 1-based, it is sufficient to return the token count to skip the rest of the file.
1 parent 451a701 commit be33885

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Sniffs/AbstractScopeSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ final public function register()
123123
*
124124
* @return void|int Optionally returns a stack pointer. The sniff will not be
125125
* called again on the current file until the returned stack
126-
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
126+
* pointer is reached. Return `$phpcsFile->numTokens` to skip
127127
* the rest of the file.
128128
* @see processTokenWithinScope()
129129
*/
@@ -164,7 +164,7 @@ final public function process(File $phpcsFile, $stackPtr)
164164
*
165165
* @return void|int Optionally returns a stack pointer. The sniff will not be
166166
* called again on the current file until the returned stack
167-
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
167+
* pointer is reached. Return `$phpcsFile->numTokens` to skip
168168
* the rest of the file.
169169
*/
170170
abstract protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope);
@@ -180,7 +180,7 @@ abstract protected function processTokenWithinScope(File $phpcsFile, $stackPtr,
180180
*
181181
* @return void|int Optionally returns a stack pointer. The sniff will not be
182182
* called again on the current file until the returned stack
183-
* pointer is reached. Return (count($tokens) + 1) to skip
183+
* pointer is reached. Return `$phpcsFile->numTokens` to skip
184184
* the rest of the file.
185185
*/
186186
abstract protected function processTokenOutsideScope(File $phpcsFile, $stackPtr);

src/Sniffs/AbstractVariableSniff.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function __construct()
7272
*
7373
* @return void|int Optionally returns a stack pointer. The sniff will not be
7474
* called again on the current file until the returned stack
75-
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
75+
* pointer is reached. Return `$phpcsFile->numTokens` to skip
7676
* the rest of the file.
7777
*/
7878
final protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
@@ -150,7 +150,7 @@ final protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $cu
150150
*
151151
* @return void|int Optionally returns a stack pointer. The sniff will not be
152152
* called again on the current file until the returned stack
153-
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
153+
* pointer is reached. Return `$phpcsFile->numTokens` to skip
154154
* the rest of the file.
155155
*/
156156
final protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
@@ -181,7 +181,7 @@ final protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
181181
*
182182
* @return void|int Optionally returns a stack pointer. The sniff will not be
183183
* called again on the current file until the returned stack
184-
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
184+
* pointer is reached. Return `$phpcsFile->numTokens` to skip
185185
* the rest of the file.
186186
*/
187187
abstract protected function processMemberVar(File $phpcsFile, $stackPtr);
@@ -196,7 +196,7 @@ abstract protected function processMemberVar(File $phpcsFile, $stackPtr);
196196
*
197197
* @return void|int Optionally returns a stack pointer. The sniff will not be
198198
* called again on the current file until the returned stack
199-
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
199+
* pointer is reached. Return `$phpcsFile->numTokens` to skip
200200
* the rest of the file.
201201
*/
202202
abstract protected function processVariable(File $phpcsFile, $stackPtr);
@@ -215,7 +215,7 @@ abstract protected function processVariable(File $phpcsFile, $stackPtr);
215215
*
216216
* @return void|int Optionally returns a stack pointer. The sniff will not be
217217
* called again on the current file until the returned stack
218-
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
218+
* pointer is reached. Return `$phpcsFile->numTokens` to skip
219219
* the rest of the file.
220220
*/
221221
abstract protected function processVariableInString(File $phpcsFile, $stackPtr);

src/Sniffs/Sniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function register();
7171
*
7272
* @return void|int Optionally returns a stack pointer. The sniff will not be
7373
* called again on the current file until the returned stack
74-
* pointer is reached. Return (count($tokens) + 1) to skip
74+
* pointer is reached. Return `$phpcsFile->numTokens` to skip
7575
* the rest of the file.
7676
*/
7777
public function process(File $phpcsFile, $stackPtr);

0 commit comments

Comments
 (0)