code: private function getElements(Tokens $tokens, $startIndex)
      {
          static $elementTokenKinds = [CT::T_USE_TRAIT, T_CONST, T_VARIABLE, T_FUNCTION];
  
          ++$startIndex;
          $elements = [];
  
          while (true) {
              $element = [
                  'start' => $startIndex,
                  'visibility' => 'public',
                  'static' => false,
              ];
  
              for ($i = $startIndex;; ++$i) {
                  $token = $tokens[$i];
  
                  // class end
                  if ($token->equals('}')) {
                      return $elements;
                  }
  
                  if ($token->isGivenKind(T_STATIC)) {
                      $element['static'] = true;
  
                      continue;
                  }
  
                  if ($token->isGivenKind([T_PROTECTED, T_PRIVATE])) {
                      $element['visibility'] = strtolower($token->getContent());
  
                      continue;
                  }
  
                  if (!$token->isGivenKind($elementTokenKinds)) {
                      continue;
                  }
  
                  $type = $this->detectElementType($tokens, $i);
                  if (\is_array($type)) {
                      $element['type'] = $type[0];
                      $element['name'] = $type[1];
                  } else {
                      $element['type'] = $type;
                  }
  
                  if ('property' === $element['type']) {
                      $element['name'] = $tokens[$i]->getContent();
                  } elseif (\in_array($element['type'], ['use_trait', 'constant', 'method', 'magic'], true)) {
                      $element['name'] = $tokens[$tokens->getNextMeaningfulToken($i)]->getContent();
                  }
  
                  $element['end'] = $this->findElementEnd($tokens, $i);
  
                  break;
              }
  
              $elements[] = $element;
              $startIndex = $element['end'] + 1;
          }
      }
docs: @param Tokens $tokens
  @param int    $startIndex
  
  @return array[]