code: protected function applyFix(\SplFileInfo $file, Tokens $tokens)
      {
          for ($index = \count($tokens) - 1; 0 <= $index; --$index) {
              $token = $tokens[$index];
  
              if (!$token->isGivenKind(T_NAMESPACE)) {
                  continue;
              }
  
              $beforeNamespaceIndex = $index - 1;
              $beforeNamespace = $tokens[$beforeNamespaceIndex];
  
              if (!$beforeNamespace->isWhitespace()) {
                  if (!self::endsWithWhitespace($beforeNamespace->getContent())) {
                      $tokens->insertAt($index, new Token([T_WHITESPACE, $this->whitespacesConfig->getLineEnding()]));
                  }
  
                  continue;
              }
  
              $lastNewline = strrpos($beforeNamespace->getContent(), "\n");
  
              if (false === $lastNewline) {
                  $beforeBeforeNamespace = $tokens[$index - 2];
  
                  if (self::endsWithWhitespace($beforeBeforeNamespace->getContent())) {
                      $tokens->clearAt($beforeNamespaceIndex);
                  } else {
                      $tokens[$beforeNamespaceIndex] = new Token([T_WHITESPACE, ' ']);
                  }
              } else {
                  $tokens[$beforeNamespaceIndex] = new Token([T_WHITESPACE, substr($beforeNamespace->getContent(), 0, $lastNewline + 1)]);
              }
          }
      }
docs: {@inheritdoc}