Skip to content

Commit

Permalink
EarlyExitSniff: fixed internal exception
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Feb 6, 2018
1 parent 549a623 commit 9c4c42a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private function processIf(\PHP_CodeSniffer\Files\File $phpcsFile, int $ifPointe
$tokens = $phpcsFile->getTokens();

$nextPointer = TokenHelper::findNextExcluding($phpcsFile, T_WHITESPACE, $tokens[$ifPointer]['scope_closer'] + 1);
if ($tokens[$nextPointer]['code'] !== T_CLOSE_CURLY_BRACKET) {
if ($nextPointer === null || $tokens[$nextPointer]['code'] !== T_CLOSE_CURLY_BRACKET) {
return;
}

Expand Down
4 changes: 4 additions & 0 deletions tests/Sniffs/ControlStructures/data/earlyExitNoErrors.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,7 @@ function () {
break;
}
}

if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
define('PHPUNIT_COMPOSER_INSTALL', __DIR__ . '/autoload.php');
}

0 comments on commit 9c4c42a

Please sign in to comment.