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:
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
Namespace
PhpParserCode
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;
}