Skip to content

Commit a3e4b50

Browse files
committed
Generic/UnnecessaryStringConcat: remove unnecessary condition
Both in PHP and JS there is not a scenario where there is no non-empty token before T_STRING_CONCAT or T_PLUS. There will always be at least the T_OPEN_TAG token. So checking if `$prev` is `false` is not necessary. `$prev` will never be `false`.
1 parent ec82f6c commit a3e4b50

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Standards/Generic/Sniffs/Strings/UnnecessaryStringConcatSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function process(File $phpcsFile, $stackPtr)
8484

8585
$prev = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
8686
$next = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
87-
if ($prev === false || $next === false) {
87+
if ($next === false) {
8888
return;
8989
}
9090

0 commit comments

Comments
 (0)