public __construct(array $options = [])

Constructs a NodeDumper.

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.
  • param array $options Options (see description)
public dump( $node, ?string $code = NULL) : string

Dumps a node or array.

  • param array|\Node $node Node or array to dump
  • param string|null $code 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 string Dumped value
protected dumpFlags(int $flags) : string
protected dumpPosition(PhpParser\Node $node) : ?string

Dump node position, if possible.

  • param \Node $node Node for which to dump position
  • return string|null Dump of position, or null if position information not available
protected dumpRecursive( $node, bool $indent = true) : void
  • param mixed $node
private PhpParser\NodeDumper::IGNORE_ATTRIBUTES = ['comments' => true, 'startLine' => true, 'endLine' => true, 'startFilePos' => true, 'endFilePos' => true, 'startTokenPos' => true, 'endTokenPos' => true]
private ?string $code
private bool $dumpComments
private bool $dumpOtherAttributes
private bool $dumpPositions
private string $nl
private string $res
private dumpArrayKind(int $kind) : string
private dumpEnum(int $value, array $map) : string
  • param array<int,string> $map
private dumpIncludeType(int $type) : string
private dumpIntKind(int $kind) : string
private dumpListKind(int $kind) : string
private dumpStringKind(int $kind) : string
private dumpUseType(int $type) : string
private toColumn(string $code, int $pos) : int
© 2024 Bruce Wells
Search Namespaces \ Classes