code: private function replaceClassKeywords(Tokens $tokens, $namespaceNumber = -1)
      {
          $namespaceIndexes = array_keys($tokens->findGivenKind(T_NAMESPACE));
  
          // Namespace blocks
          if (\count($namespaceIndexes) && isset($namespaceIndexes[$namespaceNumber])) {
              $startIndex = $namespaceIndexes[$namespaceNumber];
  
              $namespaceBlockStartIndex = $tokens->getNextTokenOfKind($startIndex, [';', '{']);
              $endIndex = $tokens[$namespaceBlockStartIndex]->equals('{')
                  ? $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $namespaceBlockStartIndex)
                  : $tokens->getNextTokenOfKind($namespaceBlockStartIndex, [T_NAMESPACE]);
              $endIndex = $endIndex ?: $tokens->count() - 1;
          } elseif (-1 === $namespaceNumber) { // Out of any namespace block
              $startIndex = 0;
              $endIndex = \count($namespaceIndexes) ? $namespaceIndexes[0] : $tokens->count() - 1;
          } else {
              return;
          }
  
          $this->storeImports($tokens, $startIndex, $endIndex);
          $tokens->rewind();
          $this->replaceClassKeywordsSection($tokens, $startIndex, $endIndex);
          $this->replaceClassKeywords($tokens, $namespaceNumber + 1);
      }
docs: Replaces ::class keyword, namespace by namespace.
  
  It uses recursive method to get rid of token index changes.
  
  @param Tokens $tokens
  @param int    $namespaceNumber