Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Printer.php

function Printer::printFormatPreserving

File

vendor/phpstan/phpdoc-parser/src/Printer/Printer.php, line 164

Class

Printer
Inspired by https://github.com/nikic/PHP-Parser/tree/36a6dcd04e7b0285e8f0868f44bd49…

Namespace

PHPStan\PhpDocParser\Printer

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal