code: protected function applyFix(\SplFileInfo $file, Tokens $tokens)
      {
          for ($index = $tokens->count() - 1; $index >= 0; --$index) {
              $token = $tokens[$index];
  
              if (!$token->isGivenKind(T_FUNCTION)) {
                  continue;
              }
  
              $startParenthesisIndex = $tokens->getNextTokenOfKind($index, ['(', ';', [T_CLOSE_TAG]]);
              if (!$tokens[$startParenthesisIndex]->equals('(')) {
                  continue;
              }
  
              $endParenthesisIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $startParenthesisIndex);
  
              for ($iter = $endParenthesisIndex - 1; $iter > $startParenthesisIndex; --$iter) {
                  if (!$tokens[$iter]->isGivenKind(T_VARIABLE)) {
                      continue;
                  }
  
                  // skip ... before $variable for variadic parameter
                  $prevNonWhitespaceIndex = $tokens->getPrevNonWhitespace($iter);
                  if ($tokens[$prevNonWhitespaceIndex]->isGivenKind(T_ELLIPSIS)) {
                      $iter = $prevNonWhitespaceIndex;
                  }
  
                  // skip & before $variable for parameter passed by reference
                  $prevNonWhitespaceIndex = $tokens->getPrevNonWhitespace($iter);
                  if ($tokens[$prevNonWhitespaceIndex]->equals('&')) {
                      $iter = $prevNonWhitespaceIndex;
                  }
  
                  if (!$tokens[$iter - 1]->equalsAny([[T_WHITESPACE], [T_COMMENT], [T_DOC_COMMENT], '(', ','])) {
                      $tokens->insertAt($iter, new Token([T_WHITESPACE, ' ']));
                  }
              }
          }
      }
docs: {@inheritdoc}