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

Breadcrumb

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

function PrettyPrinterAbstract::preprocessNodes

Preprocesses the top-level nodes to initialize pretty printer state.

Parameters

Node[] $nodes Array of nodes:

2 calls to PrettyPrinterAbstract::preprocessNodes()
PrettyPrinterAbstract::prettyPrint in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php
Pretty prints an array of statements.
PrettyPrinterAbstract::printFormatPreserving in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php
Perform a format-preserving pretty print of an AST.

File

vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php, line 313

Class

PrettyPrinterAbstract

Namespace

PhpParser

Code

protected function preprocessNodes(array $nodes) : void {
    
    /* We can use semicolon-namespaces unless there is a global namespace declaration */
    $this->canUseSemicolonNamespaces = true;
    foreach ($nodes as $node) {
        if ($node instanceof Stmt\Namespace_ && null === $node->name) {
            $this->canUseSemicolonNamespaces = false;
            break;
        }
    }
}

API Navigation

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