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
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ PrettyPrinterAbstract.php, line 385
Class
Namespace
PhpParserCode
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;
}