function NodeDumper::dumpPosition
Dump node position, if possible.
Parameters
Node $node Node for which to dump position:
Return value
string|null Dump of position, or null if position information not available
1 call to NodeDumper::dumpPosition()
- NodeDumper::dumpRecursive in vendor/
nikic/ php-parser/ lib/ PhpParser/ NodeDumper.php
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ NodeDumper.php, line 270
Class
Namespace
PhpParserCode
protected function dumpPosition(Node $node) : ?string {
if (!$node->hasAttribute('startLine') || !$node->hasAttribute('endLine')) {
return null;
}
$start = $node->getStartLine();
$end = $node->getEndLine();
if ($node->hasAttribute('startFilePos') && $node->hasAttribute('endFilePos') && null !== $this->code) {
$start .= ':' . $this->toColumn($this->code, $node->getStartFilePos());
$end .= ':' . $this->toColumn($this->code, $node->getEndFilePos());
}
return "[{$start} - {$end}]";
}