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

Breadcrumb

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

function PrettyPrinterAbstract::pInfixOp

Pretty-print an infix operation while taking precedence into account.

Parameters

string $class Node class of operator:

Node $leftNode Left-hand side node:

string $operatorString String representation of the operator:

Node $rightNode Right-hand side node:

int $precedence Precedence of parent operator:

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

Return value

string Pretty printed infix operation

28 calls to PrettyPrinterAbstract::pInfixOp()
Standard::pExpr_BinaryOp_BitwiseAnd in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php
Standard::pExpr_BinaryOp_BitwiseOr in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php
Standard::pExpr_BinaryOp_BitwiseXor in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php
Standard::pExpr_BinaryOp_BooleanAnd in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php
Standard::pExpr_BinaryOp_BooleanOr in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php

... See full list

File

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

Class

PrettyPrinterAbstract

Namespace

PhpParser

Code

protected function pInfixOp(string $class, Node $leftNode, string $operatorString, Node $rightNode, int $precedence, int $lhsPrecedence) : string {
    list($opPrecedence, $newPrecedenceLHS, $newPrecedenceRHS) = $this->precedenceMap[$class];
    $prefix = '';
    $suffix = '';
    if ($opPrecedence >= $precedence) {
        $prefix = '(';
        $suffix = ')';
        $lhsPrecedence = self::MAX_PRECEDENCE;
    }
    return $prefix . $this->p($leftNode, $newPrecedenceLHS, $newPrecedenceLHS) . $operatorString . $this->p($rightNode, $newPrecedenceRHS, $lhsPrecedence) . $suffix;
}

API Navigation

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