Skip to content

Commit 70f8f2c

Browse files
rodrigoprimojrfnl
authored andcommitted
Generic/OpeningFunctionBraceKernighanRichie: remove repeated call to findPrevious()
This commit removes a repeated call to findPrevious() to get the pointer to the end of the function declaration. The same `$prev` variable that was defined a few lines above can be reused and there is no need to define it again calling `findPrevious()` with exactly the same parameters.
1 parent a13cdfd commit 70f8f2c

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceKernighanRitchieSniff.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ public function process(File $phpcsFile, $stackPtr)
9999
$error = 'Opening brace should be on the same line as the declaration';
100100
$fix = $phpcsFile->addFixableError($error, $openingBrace, 'BraceOnNewLine');
101101
if ($fix === true) {
102-
$prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($openingBrace - 1), $closeBracket, true);
103102
$phpcsFile->fixer->beginChangeset();
104103
$phpcsFile->fixer->addContent($prev, ' {');
105104
$phpcsFile->fixer->replaceToken($openingBrace, '');

0 commit comments

Comments
 (0)