code: public function process(Tokens $tokens, Token $token, $index)
      {
          if (!$token->isComment()) {
              return;
          }
  
          $content = $token->getContent();
          $trimmedContent = rtrim($content);
  
          // nothing trimmed, nothing to do
          if ($content === $trimmedContent) {
              return;
          }
  
          $whitespaces = substr($content, \strlen($trimmedContent));
  
          $tokens[$index] = new Token([$token->getId(), $trimmedContent]);
  
          if (isset($tokens[$index + 1]) && $tokens[$index + 1]->isWhitespace()) {
              $tokens[$index + 1] = new Token([T_WHITESPACE, $whitespaces.$tokens[$index + 1]->getContent()]);
          } else {
              $tokens->insertAt($index + 1, new Token([T_WHITESPACE, $whitespaces]));
          }
      }
docs: {@inheritdoc}