From e3d5ed67185278961e60262859c1f3a4b1f4878b Mon Sep 17 00:00:00 2001 From: Bill Mitchell Date: Tue, 6 Dec 2016 23:40:12 +0000 Subject: [PATCH] Remove redundant code --- src/Codor/Sniffs/Files/ReturnNullSniff.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Codor/Sniffs/Files/ReturnNullSniff.php b/src/Codor/Sniffs/Files/ReturnNullSniff.php index 3b0c1ce..dd50ede 100644 --- a/src/Codor/Sniffs/Files/ReturnNullSniff.php +++ b/src/Codor/Sniffs/Files/ReturnNullSniff.php @@ -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);