diff --git a/lib/PhpParser/PrettyPrinterAbstract.php b/lib/PhpParser/PrettyPrinterAbstract.php index 8303c427aa..17f27a15ea 100644 --- a/lib/PhpParser/PrettyPrinterAbstract.php +++ b/lib/PhpParser/PrettyPrinterAbstract.php @@ -76,7 +76,7 @@ abstract class PrettyPrinterAbstract implements PrettyPrinter { BinaryOp\BooleanAnd::class => [120, 121, 120], BinaryOp\BooleanOr::class => [130, 131, 130], BinaryOp\Coalesce::class => [140, 140, 141], - Expr\Ternary::class => [150, -1, -1], + Expr\Ternary::class => [150, 150, 150], Expr\Assign::class => [160, -1, -1], Expr\AssignRef::class => [160, -1, -1], AssignOp\Plus::class => [160, -1, -1], diff --git a/test/code/prettyPrinter/expr/parentheses.test b/test/code/prettyPrinter/expr/parentheses.test index 6468949bf7..be9a776481 100644 --- a/test/code/prettyPrinter/expr/parentheses.test +++ b/test/code/prettyPrinter/expr/parentheses.test @@ -19,6 +19,7 @@ $a = $b = $c = $d = ($f and true); $a ? $b : $c ? $d : $e ? $f : $g; $a ? $b : ($c ? $d : ($e ? $f : $g)); $a ? $b ? $c : $d : $f; +$a === $b ? $c : $d; $a ?? $b ?? $c; ($a ?? $b) ?? $c; @@ -73,6 +74,7 @@ $a = $b = $c = $d = ($f and true); (($a ? $b : $c) ? $d : $e) ? $f : $g; $a ? $b : ($c ? $d : ($e ? $f : $g)); $a ? $b ? $c : $d : $f; +$a === $b ? $c : $d; $a ?? $b ?? $c; ($a ?? $b) ?? $c; $a ?? ($b ? $c : $d);