src/PhpToZephir/Converter/Printer/Expr/TernaryPrinter.php
public function convert(Expr\Ternary $node, $returnAsArray = false)
    {
        // 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.

        $collected = $this->assignManipulator->collectAssignInCondition($node->cond);
        $node->cond = $this->assignManipulator->transformAssignInConditionTest($node->cond);

        $collected->setExpr($this->dispatcher->pInfixOp('Expr_Ternary',
            $node->cond, ' ?'.(null !== $node->if ? ' '.$this->dispatcher->p($node->if).' ' : ' ' . $this->dispatcher->p($node->cond)).' : ', $node->else
        ));

        if ($returnAsArray === true) {
            return $collected;
        } else {
            return $collected->getCollected()." ".$collected->getExpr();
        }
    }
public function convert(Expr\Ternary $node, $returnAsArray = false)
    {
        // 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.

        $collected = $this->assignManipulator->collectAssignInCondition($node->cond);
        $node->cond = $this->assignManipulator->transformAssignInConditionTest($node->cond);

        $collected->setExpr($this->dispatcher->pInfixOp('Expr_Ternary',
            $node->cond, ' ?'.(null !== $node->if ? ' '.$this->dispatcher->p($node->if).' ' : ' ' . $this->dispatcher->p($node->cond)).' : ', $node->else
        ));

        if ($returnAsArray === true) {
            return $collected;
        } else {
            return $collected->getCollected()." ".$collected->getExpr();
        }
    }
@param Expr\Ternary $node
@param string       $returnAsArray

@return string