Skip to content

Commit af7f3c2

Browse files
authored
Merge pull request #95 from PHPCSStandards/feature/various-return-eof-ptr
Various sniffs: always return EOF pointer
2 parents 4ee1d72 + 84ff93d commit af7f3c2

File tree

10 files changed

+18
-18
lines changed

10 files changed

+18
-18
lines changed

src/Standards/Generic/Sniffs/Debug/CSSLintSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ public function register()
4444
* @param int $stackPtr The position in the stack where
4545
* the token was found.
4646
*
47-
* @return void
47+
* @return int
4848
*/
4949
public function process(File $phpcsFile, $stackPtr)
5050
{
5151
$csslintPath = Config::getExecutablePath('csslint');
5252
if ($csslintPath === null) {
53-
return;
53+
return ($phpcsFile->numTokens + 1);
5454
}
5555

5656
$fileName = $phpcsFile->getFilename();
@@ -59,7 +59,7 @@ public function process(File $phpcsFile, $stackPtr)
5959
exec($cmd, $output, $retval);
6060

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

6565
$count = count($output);

src/Standards/Generic/Sniffs/Debug/ClosureLinterSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ public function register()
6060
* @param int $stackPtr The position in the stack where
6161
* the token was found.
6262
*
63-
* @return void
63+
* @return int
6464
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If jslint.js could not be run
6565
*/
6666
public function process(File $phpcsFile, $stackPtr)
6767
{
6868
$lintPath = Config::getExecutablePath('gjslint');
6969
if ($lintPath === null) {
70-
return;
70+
return ($phpcsFile->numTokens + 1);
7171
}
7272

7373
$fileName = $phpcsFile->getFilename();
@@ -77,7 +77,7 @@ public function process(File $phpcsFile, $stackPtr)
7777
exec($cmd, $output, $retval);
7878

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

8383
foreach ($output as $finding) {

src/Standards/Generic/Sniffs/Debug/ESLintSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ public function register()
5151
* @param int $stackPtr The position in the stack where
5252
* the token was found.
5353
*
54-
* @return void
54+
* @return int
5555
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If jshint.js could not be run
5656
*/
5757
public function process(File $phpcsFile, $stackPtr)
5858
{
5959
$eslintPath = Config::getExecutablePath('eslint');
6060
if ($eslintPath === null) {
61-
return;
61+
return ($phpcsFile->numTokens + 1);
6262
}
6363

6464
$filename = $phpcsFile->getFilename();

src/Standards/Generic/Sniffs/Debug/JSHintSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ public function register()
4545
* @param int $stackPtr The position in the stack where
4646
* the token was found.
4747
*
48-
* @return void
48+
* @return int
4949
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If jshint.js could not be run
5050
*/
5151
public function process(File $phpcsFile, $stackPtr)
5252
{
5353
$rhinoPath = Config::getExecutablePath('rhino');
5454
$jshintPath = Config::getExecutablePath('jshint');
5555
if ($jshintPath === null) {
56-
return;
56+
return ($phpcsFile->numTokens + 1);
5757
}
5858

5959
$fileName = $phpcsFile->getFilename();

src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function process(File $phpcsFile, $stackPtr)
7979
if ($tokens[$lastToken]['line'] === 1
8080
&& $tokens[$lastToken]['content'] !== "\n"
8181
) {
82-
return;
82+
return ($phpcsFile->numTokens + 1);
8383
}
8484
}
8585

src/Standards/Generic/Sniffs/Files/LowercasedFilenameSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function process(File $phpcsFile, $stackPtr)
4444
{
4545
$filename = $phpcsFile->getFilename();
4646
if ($filename === 'STDIN') {
47-
return;
47+
return ($phpcsFile->numTokens + 1);
4848
}
4949

5050
$filename = basename($filename);

src/Standards/PSR12/Sniffs/Files/OpenTagSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function process(File $phpcsFile, $stackPtr)
5454
$next = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
5555
if ($next === false) {
5656
// Empty file.
57-
return;
57+
return $phpcsFile->numTokens;
5858
}
5959

6060
if ($tokens[$next]['line'] === $tokens[$stackPtr]['line']) {

src/Standards/Squiz/Sniffs/Debug/JSLintSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ public function register()
4444
* @param int $stackPtr The position in the stack where
4545
* the token was found.
4646
*
47-
* @return void
47+
* @return int
4848
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If jslint.js could not be run
4949
*/
5050
public function process(File $phpcsFile, $stackPtr)
5151
{
5252
$rhinoPath = Config::getExecutablePath('rhino');
5353
$jslintPath = Config::getExecutablePath('jslint');
5454
if ($rhinoPath === null || $jslintPath === null) {
55-
return;
55+
return ($phpcsFile->numTokens + 1);
5656
}
5757

5858
$fileName = $phpcsFile->getFilename();

src/Standards/Squiz/Sniffs/Debug/JavaScriptLintSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ public function register()
4545
* @param int $stackPtr The position in the stack where
4646
* the token was found.
4747
*
48-
* @return void
48+
* @return int
4949
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If Javascript Lint ran into trouble.
5050
*/
5151
public function process(File $phpcsFile, $stackPtr)
5252
{
5353
$jslPath = Config::getExecutablePath('jsl');
5454
if ($jslPath === null) {
55-
return;
55+
return ($phpcsFile->numTokens + 1);
5656
}
5757

5858
$fileName = $phpcsFile->getFilename();

src/Standards/Zend/Sniffs/Debug/CodeAnalyzerSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function process(File $phpcsFile, $stackPtr)
4646
{
4747
$analyzerPath = Config::getExecutablePath('zend_ca');
4848
if ($analyzerPath === null) {
49-
return;
49+
return ($phpcsFile->numTokens + 1);
5050
}
5151

5252
$fileName = $phpcsFile->getFilename();

0 commit comments

Comments
 (0)