function Printer::printFormatPreserving
File
-
vendor/
phpstan/ phpdoc-parser/ src/ Printer/ Printer.php, line 164
Class
Namespace
PHPStan\PhpDocParser\PrinterCode
public function printFormatPreserving(PhpDocNode $node, PhpDocNode $originalNode, TokenIterator $originalTokens) : string {
$this->differ = new Differ(static function ($a, $b) {
if ($a instanceof Node && $b instanceof Node) {
return $a === $b->getAttribute(Attribute::ORIGINAL_NODE);
}
return false;
});
$tokenIndex = 0;
$result = $this->printArrayFormatPreserving($node->children, $originalNode->children, $originalTokens, $tokenIndex, PhpDocNode::class, 'children');
if ($result !== null) {
return $result . $originalTokens->getContentBetween($tokenIndex, $originalTokens->getTokenCount());
}
return $this->print($node);
}