Skip to content

Commit

Permalink
Merge pull request #32 from bmitch/redundant
Browse files Browse the repository at this point in the history
Remove redundant code
  • Loading branch information
bmitch authored Dec 6, 2016
2 parents 8160d5c + e3d5ed6 commit 0886c4b
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 0886c4b

Please sign in to comment.