Skip to content

Commit 8248dbe

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 222548c commit 8248dbe

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)
@@ -156,7 +156,7 @@ final protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $cu
156156
*
157157
* @return void|int Optionally returns a stack pointer. The sniff will not be
158158
* called again on the current file until the returned stack
159-
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
159+
* pointer is reached. Return `$phpcsFile->numTokens` to skip
160160
* the rest of the file.
161161
*/
162162
final protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
@@ -187,7 +187,7 @@ final protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
187187
*
188188
* @return void|int Optionally returns a stack pointer. The sniff will not be
189189
* called again on the current file until the returned stack
190-
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
190+
* pointer is reached. Return `$phpcsFile->numTokens` to skip
191191
* the rest of the file.
192192
*/
193193
abstract protected function processMemberVar(File $phpcsFile, $stackPtr);
@@ -202,7 +202,7 @@ abstract protected function processMemberVar(File $phpcsFile, $stackPtr);
202202
*
203203
* @return void|int Optionally returns a stack pointer. The sniff will not be
204204
* called again on the current file until the returned stack
205-
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
205+
* pointer is reached. Return `$phpcsFile->numTokens` to skip
206206
* the rest of the file.
207207
*/
208208
abstract protected function processVariable(File $phpcsFile, $stackPtr);
@@ -221,7 +221,7 @@ abstract protected function processVariable(File $phpcsFile, $stackPtr);
221221
*
222222
* @return void|int Optionally returns a stack pointer. The sniff will not be
223223
* called again on the current file until the returned stack
224-
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
224+
* pointer is reached. Return `$phpcsFile->numTokens` to skip
225225
* the rest of the file.
226226
*/
227227
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)