Skip to content

Commit d6998ac

Browse files
committed
Generic/UnusedFunctionParameter: remove unreacheable if condition
At this point in the code, there should always be a non-empty token after the return statement and thus the if condition will never be true. If there is a syntax error and there is nothing after the return, the code will never reach this point as in the beginning of the method the code checks if `$token['scope_opener']` is set and this only happens when there is also a scope_closer.
1 parent ee237b4 commit d6998ac

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

src/Standards/Generic/Sniffs/CodeAnalysis/UnusedFunctionParameterSniff.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ public function process(File $phpcsFile, $stackPtr)
174174
// A return statement as the first content indicates an interface method.
175175
if ($code === T_RETURN) {
176176
$firstNonEmptyTokenAfterReturn = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true);
177-
if ($firstNonEmptyTokenAfterReturn === false && $implements !== false) {
178-
return;
179-
}
180177

181178
// There is a return.
182179
if ($tokens[$firstNonEmptyTokenAfterReturn]['code'] === T_SEMICOLON && $implements !== false) {

0 commit comments

Comments
 (0)