packages/BetterPhpDocParser/src/Printer/PhpDocInfoPrinter.php
public function printFormatPreserving(PhpDocInfo $phpDocInfo): string
    {
        $this->attributeAwarePhpDocNode = $phpDocInfo->getPhpDocNode();
        $this->tokens = $phpDocInfo->getTokens();
        $this->tokenCount = count($phpDocInfo->getTokens());
        $this->phpDocInfo = $phpDocInfo;

        $this->currentTokenPosition = 0;
        $this->removedNodePositions = [];

        return $this->printPhpDocNode($this->attributeAwarePhpDocNode);
    }
public function printFormatPreserving(PhpDocInfo $phpDocInfo): string
    {
        $this->attributeAwarePhpDocNode = $phpDocInfo->getPhpDocNode();
        $this->tokens = $phpDocInfo->getTokens();
        $this->tokenCount = count($phpDocInfo->getTokens());
        $this->phpDocInfo = $phpDocInfo;

        $this->currentTokenPosition = 0;
        $this->removedNodePositions = [];

        return $this->printPhpDocNode($this->attributeAwarePhpDocNode);
    }
public function printFormatPreserving ( PhpDocInfo $ phpDocInfo ) : string { $ this -> attributeAwarePhpDocNode = $ phpDocInfo -> getPhpDocNode ( ) ; $ this -> tokens = $ phpDocInfo -> getTokens ( ) ; $ this -> tokenCount = count ( $ phpDocInfo -> getTokens ( ) ) ; $ this -> phpDocInfo = $ phpDocInfo ; $ this -> currentTokenPosition = 0 ; $ this -> removedNodePositions = [ ] ; return $ this -> printPhpDocNode ( $ this -> attributeAwarePhpDocNode ) ; }
As in php-parser

ref: https://github.com/nikic/PHP-Parser/issues/487#issuecomment-375986259
- Tokens[node.startPos .. subnode1.startPos]
- Print(subnode1)
- Tokens[subnode1.endPos .. subnode2.startPos]
- Print(subnode2)
- Tokens[subnode2.endPos .. node.endPos]
As in php - parser