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

Breadcrumb

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

function PrettyPrinterAbstract::pPostfixOp

Pretty-print a postfix operation while taking precedence into account.

Parameters

string $class Node class of operator:

string $operatorString String representation of the operator:

Node $node Node:

int $precedence Precedence of parent operator:

int $lhsPrecedence Precedence for unary operator on LHS of binary operator:

Return value

string Pretty printed postfix operation

1 call to PrettyPrinterAbstract::pPostfixOp()
Standard::pExpr_Instanceof in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php

File

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

Class

PrettyPrinterAbstract

Namespace

PhpParser

Code

protected function pPostfixOp(string $class, Node $node, string $operatorString, int $precedence, int $lhsPrecedence) : string {
    $opPrecedence = $this->precedenceMap[$class][0];
    $prefix = '';
    $suffix = '';
    if ($opPrecedence >= $precedence) {
        $prefix = '(';
        $suffix = ')';
        $lhsPrecedence = self::MAX_PRECEDENCE;
    }
    if ($opPrecedence < $lhsPrecedence) {
        $lhsPrecedence = $opPrecedence;
    }
    return $prefix . $this->p($node, $opPrecedence, $lhsPrecedence) . $operatorString . $suffix;
}

API Navigation

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