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

Breadcrumb

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

function Standard::pExpr_Ternary

File

vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php, line 714

Class

Standard

Namespace

PhpParser\PrettyPrinter

Code

protected function pExpr_Ternary(Expr\Ternary $node, int $precedence, int $lhsPrecedence) : string {
    // a bit of cheating: we treat the ternary as a binary op where the ?...: part is the operator.
    // this is okay because the part between ? and : never needs parentheses.
    return $this->pInfixOp(Expr\Ternary::class, $node->cond, ' ?' . (null !== $node->if ? ' ' . $this->p($node->if) . ' ' : '') . ': ', $node->else, $precedence, $lhsPrecedence);
}

API Navigation

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