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

Breadcrumb

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

function Comment::jsonSerialize

Same name in this branch
  1. 11.1.x vendor/mck89/peast/lib/Peast/Syntax/Node/Comment.php \Peast\Syntax\Node\Comment::jsonSerialize()

Return value

array{nodeType:string, text:mixed, line:mixed, filePos:mixed}

File

vendor/nikic/php-parser/lib/PhpParser/Comment.php, line 194

Class

Comment

Namespace

PhpParser

Code

public function jsonSerialize() : array {
    // Technically not a node, but we make it look like one anyway
    $type = $this instanceof Comment\Doc ? 'Comment_Doc' : 'Comment';
    return [
        'nodeType' => $type,
        'text' => $this->text,
        // TODO: Rename these to include "start".
'line' => $this->startLine,
        'filePos' => $this->startFilePos,
        'tokenPos' => $this->startTokenPos,
        'endLine' => $this->endLine,
        'endFilePos' => $this->endFilePos,
        'endTokenPos' => $this->endTokenPos,
    ];
}
RSS feed
Powered by Drupal