Documentation

NodeDumper
in package

Table of Contents

Constants

IGNORE_ATTRIBUTES  = ['comments' => true, 'startLine' => true, 'endLine' => true, 'startFilePos' => true, 'endFilePos' => true, 'startTokenPos' => true, 'endTokenPos' => true]

Properties

$code  : string|null
$dumpComments  : bool
$dumpOtherAttributes  : bool
$dumpPositions  : bool
$nl  : string
$res  : string

Methods

__construct()  : mixed
Constructs a NodeDumper.
dump()  : string
Dumps a node or array.
dumpFlags()  : string
dumpPosition()  : string|null
Dump node position, if possible.
dumpRecursive()  : void
dumpArrayKind()  : string
dumpEnum()  : string
dumpIncludeType()  : string
dumpIntKind()  : string
dumpListKind()  : string
dumpStringKind()  : string
dumpUseType()  : string
toColumn()  : int

Constants

IGNORE_ATTRIBUTES

private mixed IGNORE_ATTRIBUTES = ['comments' => true, 'startLine' => true, 'endLine' => true, 'startFilePos' => true, 'endFilePos' => true, 'startTokenPos' => true, 'endTokenPos' => true]

Properties

$dumpOtherAttributes

private bool $dumpOtherAttributes

Methods

__construct()

Constructs a NodeDumper.

public __construct([array<string|int, mixed> $options = [] ]) : mixed

Supported options:

  • bool dumpComments: Whether comments should be dumped.
  • bool dumpPositions: Whether line/offset information should be dumped. To dump offset information, the code needs to be passed to dump().
  • bool dumpOtherAttributes: Whether non-comment, non-position attributes should be dumped.
Parameters
$options : array<string|int, mixed> = []

Options (see description)

dump()

Dumps a node or array.

public dump(array<string|int, mixed>|Node $node[, string|null $code = null ]) : string
Parameters
$node : array<string|int, mixed>|Node

Node or array to dump

$code : string|null = null

Code corresponding to dumped AST. This only needs to be passed if the dumpPositions option is enabled and the dumping of node offsets is desired.

Return values
string

Dumped value

dumpFlags()

protected dumpFlags(int $flags) : string
Parameters
$flags : int
Return values
string

dumpPosition()

Dump node position, if possible.

protected dumpPosition(Node $node) : string|null
Parameters
$node : Node

Node for which to dump position

Return values
string|null

Dump of position, or null if position information not available

dumpRecursive()

protected dumpRecursive(mixed $node[, bool $indent = true ]) : void
Parameters
$node : mixed
$indent : bool = true

dumpArrayKind()

private dumpArrayKind(int $kind) : string
Parameters
$kind : int
Return values
string

dumpEnum()

private dumpEnum(int $value, array<int, string> $map) : string
Parameters
$value : int
$map : array<int, string>
Return values
string

dumpIncludeType()

private dumpIncludeType(int $type) : string
Parameters
$type : int
Return values
string

dumpIntKind()

private dumpIntKind(int $kind) : string
Parameters
$kind : int
Return values
string

dumpListKind()

private dumpListKind(int $kind) : string
Parameters
$kind : int
Return values
string

dumpStringKind()

private dumpStringKind(int $kind) : string
Parameters
$kind : int
Return values
string

dumpUseType()

private dumpUseType(int $type) : string
Parameters
$type : int
Return values
string

toColumn()

private toColumn(string $code, int $pos) : int
Parameters
$code : string
$pos : int
Return values
int

        
On this page

Search results