|
@@ -317,13 +317,13 @@ final class MethodArgumentSpaceFixer extends AbstractFixer implements Configurat
|
|
|
$indentation = $existingIndentation.$this->whitespacesConfig->getIndent();
|
|
|
$endFunctionIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $startFunctionIndex);
|
|
|
|
|
|
- if (!$this->isNewline($tokens[$endFunctionIndex - 1])) {
|
|
|
- $tokens->ensureWhitespaceAtIndex(
|
|
|
- $endFunctionIndex,
|
|
|
- 0,
|
|
|
- $this->whitespacesConfig->getLineEnding().$existingIndentation
|
|
|
- );
|
|
|
+ $wasWhitespaceBeforeEndFunctionAddedAsNewToken = $tokens->ensureWhitespaceAtIndex(
|
|
|
+ $tokens[$endFunctionIndex - 1]->isWhitespace() ? $endFunctionIndex - 1 : $endFunctionIndex,
|
|
|
+ 0,
|
|
|
+ $this->whitespacesConfig->getLineEnding().$existingIndentation
|
|
|
+ );
|
|
|
|
|
|
+ if ($wasWhitespaceBeforeEndFunctionAddedAsNewToken) {
|
|
|
++$endFunctionIndex;
|
|
|
}
|
|
|
|