code: private function transformIntoCurlyCloseBrace(Tokens $tokens, Token $token, $index)
      {
          if (!$token->isGivenKind(T_CURLY_OPEN)) {
              return;
          }
  
          $level = 1;
          $nestIndex = $index;
  
          while (0 < $level) {
              ++$nestIndex;
  
              // we count all kind of {
              if ($tokens[$nestIndex]->equals('{')) {
                  ++$level;
  
                  continue;
              }
  
              // we count all kind of }
              if ($tokens[$nestIndex]->equals('}')) {
                  --$level;
              }
          }
  
          $tokens[$nestIndex] = new Token([CT::T_CURLY_CLOSE, '}']);
      }
docs: Transform closing `}` for T_CURLY_OPEN into CT::T_CURLY_CLOSE.
  
  This should be done at very beginning of curly braces transformations.
  
  @param Tokens $tokens
  @param Token  $token
  @param int    $index