Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Sniffs/AbstractScopeSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ final public function register()
*
* @return void|int Optionally returns a stack pointer. The sniff will not be
* called again on the current file until the returned stack
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
* pointer is reached. Return `$phpcsFile->numTokens` to skip
* the rest of the file.
* @see processTokenWithinScope()
*/
Expand Down Expand Up @@ -164,7 +164,7 @@ final public function process(File $phpcsFile, $stackPtr)
*
* @return void|int Optionally returns a stack pointer. The sniff will not be
* called again on the current file until the returned stack
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
* pointer is reached. Return `$phpcsFile->numTokens` to skip
* the rest of the file.
*/
abstract protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope);
Expand All @@ -180,7 +180,7 @@ abstract protected function processTokenWithinScope(File $phpcsFile, $stackPtr,
*
* @return void|int Optionally returns a stack pointer. The sniff will not be
* called again on the current file until the returned stack
* pointer is reached. Return (count($tokens) + 1) to skip
* pointer is reached. Return `$phpcsFile->numTokens` to skip
* the rest of the file.
*/
abstract protected function processTokenOutsideScope(File $phpcsFile, $stackPtr);
Expand Down
10 changes: 5 additions & 5 deletions src/Sniffs/AbstractVariableSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __construct()
*
* @return void|int Optionally returns a stack pointer. The sniff will not be
* called again on the current file until the returned stack
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
* pointer is reached. Return `$phpcsFile->numTokens` to skip
* the rest of the file.
*/
final protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
Expand Down Expand Up @@ -156,7 +156,7 @@ final protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $cu
*
* @return void|int Optionally returns a stack pointer. The sniff will not be
* called again on the current file until the returned stack
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
* pointer is reached. Return `$phpcsFile->numTokens` to skip
* the rest of the file.
*/
final protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
Expand Down Expand Up @@ -187,7 +187,7 @@ final protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
*
* @return void|int Optionally returns a stack pointer. The sniff will not be
* called again on the current file until the returned stack
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
* pointer is reached. Return `$phpcsFile->numTokens` to skip
* the rest of the file.
*/
abstract protected function processMemberVar(File $phpcsFile, $stackPtr);
Expand All @@ -202,7 +202,7 @@ abstract protected function processMemberVar(File $phpcsFile, $stackPtr);
*
* @return void|int Optionally returns a stack pointer. The sniff will not be
* called again on the current file until the returned stack
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
* pointer is reached. Return `$phpcsFile->numTokens` to skip
* the rest of the file.
*/
abstract protected function processVariable(File $phpcsFile, $stackPtr);
Expand All @@ -221,7 +221,7 @@ abstract protected function processVariable(File $phpcsFile, $stackPtr);
*
* @return void|int Optionally returns a stack pointer. The sniff will not be
* called again on the current file until the returned stack
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
* pointer is reached. Return `$phpcsFile->numTokens` to skip
* the rest of the file.
*/
abstract protected function processVariableInString(File $phpcsFile, $stackPtr);
Expand Down
2 changes: 1 addition & 1 deletion src/Sniffs/Sniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function register();
*
* @return void|int Optionally returns a stack pointer. The sniff will not be
* called again on the current file until the returned stack
* pointer is reached. Return (count($tokens) + 1) to skip
* pointer is reached. Return `$phpcsFile->numTokens` to skip
* the rest of the file.
*/
public function process(File $phpcsFile, $stackPtr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function process(File $phpcsFile, $stackPtr)
// tag in short open tags and scan run with short_open_tag=Off.
// Bow out completely as any further detection will be unreliable
// and create incorrect fixes or cause fixer conflicts.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

unset($nextNonEmpty, $start);
Expand Down
6 changes: 3 additions & 3 deletions src/Standards/Generic/Sniffs/Debug/CSSLintSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function process(File $phpcsFile, $stackPtr)
{
$csslintPath = Config::getExecutablePath('csslint');
if ($csslintPath === null) {
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

$fileName = $phpcsFile->getFilename();
Expand All @@ -61,7 +61,7 @@ public function process(File $phpcsFile, $stackPtr)
exec($cmd, $output, $retval);

if (is_array($output) === false) {
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

$count = count($output);
Expand Down Expand Up @@ -90,7 +90,7 @@ public function process(File $phpcsFile, $stackPtr)
}//end for

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
6 changes: 3 additions & 3 deletions src/Standards/Generic/Sniffs/Debug/ClosureLinterSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function process(File $phpcsFile, $stackPtr)
{
$lintPath = Config::getExecutablePath('gjslint');
if ($lintPath === null) {
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

$fileName = $phpcsFile->getFilename();
Expand All @@ -79,7 +79,7 @@ public function process(File $phpcsFile, $stackPtr)
exec($cmd, $output, $retval);

if (is_array($output) === false) {
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

foreach ($output as $finding) {
Expand Down Expand Up @@ -111,7 +111,7 @@ public function process(File $phpcsFile, $stackPtr)
}//end foreach

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
8 changes: 4 additions & 4 deletions src/Standards/Generic/Sniffs/Debug/ESLintSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function process(File $phpcsFile, $stackPtr)
{
$eslintPath = Config::getExecutablePath('eslint');
if ($eslintPath === null) {
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

$filename = $phpcsFile->getFilename();
Expand All @@ -86,13 +86,13 @@ public function process(File $phpcsFile, $stackPtr)

if ($code <= 0) {
// No errors, continue.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

$data = json_decode(implode("\n", $stdout));
if (json_last_error() !== JSON_ERROR_NONE) {
// Ignore any errors.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

// Data is a list of files, but we only pass a single one.
Expand All @@ -107,7 +107,7 @@ public function process(File $phpcsFile, $stackPtr)
}

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
4 changes: 2 additions & 2 deletions src/Standards/Generic/Sniffs/Debug/JSHintSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function process(File $phpcsFile, $stackPtr)
$rhinoPath = Config::getExecutablePath('rhino');
$jshintPath = Config::getExecutablePath('jshint');
if ($jshintPath === null) {
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

$fileName = $phpcsFile->getFilename();
Expand Down Expand Up @@ -89,7 +89,7 @@ public function process(File $phpcsFile, $stackPtr)
}

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Generic/Sniffs/Files/EndFileNewlineSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function process(File $phpcsFile, $stackPtr)
}

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function process(File $phpcsFile, $stackPtr)
}

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Generic/Sniffs/Files/ExecutableFileSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function process(File $phpcsFile, $stackPtr)
}

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
6 changes: 3 additions & 3 deletions src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function process(File $phpcsFile, $stackPtr)

if ($found === $this->eolChar) {
// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

// Check for single line files without an EOL. This is a very special
Expand All @@ -79,7 +79,7 @@ public function process(File $phpcsFile, $stackPtr)
if ($tokens[$lastToken]['line'] === 1
&& $tokens[$lastToken]['content'] !== "\n"
) {
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}
}

Expand Down Expand Up @@ -140,7 +140,7 @@ public function process(File $phpcsFile, $stackPtr)
}//end if

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Generic/Sniffs/Files/LineLengthSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function process(File $phpcsFile, $stackPtr)
$this->checkLineLength($phpcsFile, $tokens, $i);

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function process(File $phpcsFile, $stackPtr)
{
$filename = $phpcsFile->getFilename();
if ($filename === 'STDIN') {
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

$filename = basename($filename);
Expand All @@ -62,7 +62,7 @@ public function process(File $phpcsFile, $stackPtr)
}

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Generic/Sniffs/PHP/SyntaxSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function process(File $phpcsFile, $stackPtr)
}

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function process(File $phpcsFile, $stackPtr)
}//end for

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function process(File $phpcsFile, $stackPtr)
$properties = $this->getProperties($path);
if ($properties === null) {
// Not under version control.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

$allProperties = ($properties + $this->properties);
Expand Down Expand Up @@ -101,7 +101,7 @@ public function process(File $phpcsFile, $stackPtr)
}//end foreach

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function process(File $phpcsFile, $stackPtr)
}//end for

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function process(File $phpcsFile, $stackPtr)
}//end for

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
10 changes: 5 additions & 5 deletions src/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,18 @@ public function process(File $phpcsFile, $stackPtr)

if ($tokens[$commentStart]['code'] === T_CLOSE_TAG) {
// We are only interested if this is the first open tag.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
} else if ($tokens[$commentStart]['code'] === T_COMMENT) {
$error = 'You must use "/**" style comments for a file comment';
$phpcsFile->addError($error, $errorToken, 'WrongStyle');
$phpcsFile->recordMetric($stackPtr, 'File has doc comment', 'yes');
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
} else if ($commentStart === false
|| $tokens[$commentStart]['code'] !== T_DOC_COMMENT_OPEN_TAG
) {
$phpcsFile->addError('Missing file doc comment', $errorToken, 'Missing');
$phpcsFile->recordMetric($stackPtr, 'File has doc comment', 'no');
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

$commentEnd = $tokens[$commentStart]['comment_closer'];
Expand Down Expand Up @@ -178,7 +178,7 @@ public function process(File $phpcsFile, $stackPtr)
if (in_array($tokens[$nextToken]['code'], $ignore, true) === true) {
$phpcsFile->addError('Missing file doc comment', $stackPtr, 'Missing');
$phpcsFile->recordMetric($stackPtr, 'File has doc comment', 'no');
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;
}

$phpcsFile->recordMetric($stackPtr, 'File has doc comment', 'yes');
Expand All @@ -205,7 +205,7 @@ public function process(File $phpcsFile, $stackPtr)
$this->processTags($phpcsFile, $stackPtr, $commentStart);

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
2 changes: 1 addition & 1 deletion src/Standards/PSR1/Sniffs/Files/SideEffectsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function process(File $phpcsFile, $stackPtr)
}

// Ignore the rest of the file.
return ($phpcsFile->numTokens + 1);
return $phpcsFile->numTokens;

}//end process()

Expand Down
Loading