Skip to content

Commit

Permalink
Remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
bmitch committed Dec 6, 2016
1 parent 8160d5c commit e3d5ed6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Codor/Sniffs/Files/ReturnNullSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,15 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$returnTokenIndex = $stackPtr;

$returnValueToken = '';
for ($index = $returnTokenIndex; $index < count($tokens); $index++) {
$numberOfTokens = count($tokens);

for ($index = $returnTokenIndex; $index < $numberOfTokens; $index++) {
if ($tokens[$index]['type'] === 'T_SEMICOLON') {
$returnValueToken = $tokens[$index - 1];
break;
}
}

if ($returnValueToken == '') {
return;
}

if ($returnValueToken['type'] === 'T_NULL') {
$error = "Return null value found.";
$phpcsFile->addError($error, $stackPtr);
Expand Down

0 comments on commit e3d5ed6

Please sign in to comment.