code: public function isBeforeStructuralElement(Tokens $tokens, $index)
      {
          $token = $tokens[$index];
  
          if (!$token->isGivenKind([T_COMMENT, T_DOC_COMMENT])) {
              throw new \InvalidArgumentException('Given index must point to a comment.');
          }
  
          $nextIndex = $index;
          do {
              $nextIndex = $tokens->getNextMeaningfulToken($nextIndex);
          } while (null !== $nextIndex && $tokens[$nextIndex]->equals('('));
  
          if (null === $nextIndex || $tokens[$nextIndex]->equals('}')) {
              return false;
          }
  
          $nextToken = $tokens[$nextIndex];
  
          if ($this->isStructuralElement($nextToken)) {
              return true;
          }
  
          if ($this->isValidControl($tokens, $token, $nextIndex)) {
              return true;
          }
  
          if ($this->isValidVariable($tokens, $nextIndex)) {
              return true;
          }
  
          if ($this->isValidLanguageConstruct($tokens, $token, $nextIndex)) {
              return true;
          }
  
          return false;
      }
docs: Check if comment at given index precedes structural element.
  
  @see https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md#3-definitions
  
  @param Tokens $tokens
  @param int    $index
  
  @return bool