function CommentAnnotatingVisitor::__construct
Create a comment annotation visitor.
Parameters
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ NodeVisitor/ CommentAnnotatingVisitor.php, line 23
Class
Namespace
PhpParser\NodeVisitorCode
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;
}
}
}