Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CommentAnnotatingVisitor.php

function CommentAnnotatingVisitor::__construct

Create a comment annotation visitor.

Parameters

Token[] $tokens Token array:

File

vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php, line 23

Class

CommentAnnotatingVisitor

Namespace

PhpParser\NodeVisitor

Code

public function __construct(array $tokens) {
    $this->tokens = $tokens;
    // Collect positions of comments. We use this to avoid traversing parts of the AST where
    // there are no comments.
    foreach ($tokens as $i => $token) {
        if ($token->id === \T_COMMENT || $token->id === \T_DOC_COMMENT) {
            $this->commentPositions[] = $i;
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal