@@ -72,17 +72,9 @@ public function process(File $phpcsFile, $stackPtr)
7272 }
7373
7474 $ openingBrace = $ tokens [$ stackPtr ]['scope_opener ' ];
75- $ closeBracket = $ tokens [$ stackPtr ]['parenthesis_closer ' ];
76- if ($ tokens [$ stackPtr ]['code ' ] === T_CLOSURE ) {
77- $ use = $ phpcsFile ->findNext (T_USE , ($ closeBracket + 1 ), $ tokens [$ stackPtr ]['scope_opener ' ]);
78- if ($ use !== false ) {
79- $ openBracket = $ phpcsFile ->findNext (T_OPEN_PARENTHESIS , ($ use + 1 ));
80- $ closeBracket = $ tokens [$ openBracket ]['parenthesis_closer ' ];
81- }
82- }
8375
8476 // Find the end of the function declaration.
85- $ prev = $ phpcsFile ->findPrevious (Tokens::$ emptyTokens , ($ openingBrace - 1 ), $ closeBracket , true );
77+ $ prev = $ phpcsFile ->findPrevious (Tokens::$ emptyTokens , ($ openingBrace - 1 ), null , true );
8678
8779 $ functionLine = $ tokens [$ prev ]['line ' ];
8880 $ braceLine = $ tokens [$ openingBrace ]['line ' ];
@@ -99,7 +91,6 @@ public function process(File $phpcsFile, $stackPtr)
9991 $ error = 'Opening brace should be on the same line as the declaration ' ;
10092 $ fix = $ phpcsFile ->addFixableError ($ error , $ openingBrace , 'BraceOnNewLine ' );
10193 if ($ fix === true ) {
102- $ prev = $ phpcsFile ->findPrevious (Tokens::$ emptyTokens , ($ openingBrace - 1 ), $ closeBracket , true );
10394 $ phpcsFile ->fixer ->beginChangeset ();
10495 $ phpcsFile ->fixer ->addContent ($ prev , ' { ' );
10596 $ phpcsFile ->fixer ->replaceToken ($ openingBrace , '' );
@@ -168,7 +159,7 @@ public function process(File $phpcsFile, $stackPtr)
168159 $ data = [$ length ];
169160 $ fix = $ phpcsFile ->addFixableError ($ error , $ openingBrace , 'SpaceBeforeBrace ' , $ data );
170161 if ($ fix === true ) {
171- if ($ length === 0 || $ length === ' \t ' ) {
162+ if ($ length === 0 ) {
172163 $ phpcsFile ->fixer ->addContentBefore ($ openingBrace , ' ' );
173164 } else {
174165 $ phpcsFile ->fixer ->replaceToken (($ openingBrace - 1 ), ' ' );
0 commit comments