1Pretty printer generates least-parentheses output 2----- 3<?php 4 5echo 'abc' . 'cde' . 'fgh'; 6echo 'abc' . ('cde' . 'fgh'); 7 8echo ('abc' . 1) + 2 . 'fgh'; 9echo 'abc' . (1 + 2) . 'fgh'; 10 11echo 1 * 2 + 3 / 4 % 5 . 6; 12echo 1 * (2 + 3) / (4 % (5 . 6)); 13 14$a = $b = $c = $d = $f && true; 15($a = $b = $c = $d = $f) && true; 16$a = $b = $c = $d = $f and true; 17$a = $b = $c = $d = ($f and true); 18 19$a ? $b : $c ? $d : $e ? $f : $g; 20$a ? $b : ($c ? $d : ($e ? $f : $g)); 21$a ? $b ? $c : $d : $f; 22$a === $b ? $c : $d; 23 24$a ?? $b ?? $c; 25($a ?? $b) ?? $c; 26$a ?? ($b ? $c : $d); 27$a || ($b ?? $c); 28 29(1 > 0) > (1 < 0); 30++$a + $b; 31$a + $b++; 32 33$a ** $b ** $c; 34($a ** $b) ** $c; 35-1 ** 2; 36 37yield from $a and yield from $b; 38yield from ($a and yield from $b); 39 40print ($a and print $b); 41clone ($a + $b); 42(throw $a) + $b; 43 44-(-$a); 45+(+$a); 46-(--$a); 47+(++$a); 48-(--$a)**$b; 49+(++$a)**$b; 50 51!$a = $b; 52++$a ** $b; 53$a ** $b++; 54$a . ($b = $c) . $d; 55!($a = $b) || $c; 56(fn() => $a) || $b; 57($a = $b and $c) + $d; 58$a ** ($b instanceof $c); 59($a = $b) instanceof $c; 60[$a and $b => $c]; 61// TODO: This prints redundant parentheses 62[include $a => $c]; 63----- 64echo 'abc' . 'cde' . 'fgh'; 65echo 'abc' . ('cde' . 'fgh'); 66echo 'abc' . 1 + 2 . 'fgh'; 67echo 'abc' . (1 + 2) . 'fgh'; 68echo 1 * 2 + 3 / 4 % 5 . 6; 69echo 1 * (2 + 3) / (4 % (5 . 6)); 70$a = $b = $c = $d = $f && true; 71($a = $b = $c = $d = $f) && true; 72$a = $b = $c = $d = $f and true; 73$a = $b = $c = $d = ($f and true); 74(($a ? $b : $c) ? $d : $e) ? $f : $g; 75$a ? $b : ($c ? $d : ($e ? $f : $g)); 76$a ? $b ? $c : $d : $f; 77$a === $b ? $c : $d; 78$a ?? $b ?? $c; 79($a ?? $b) ?? $c; 80$a ?? ($b ? $c : $d); 81$a || ($b ?? $c); 82(1 > 0) > (1 < 0); 83++$a + $b; 84$a + $b++; 85$a ** $b ** $c; 86($a ** $b) ** $c; 87-1 ** 2; 88yield from $a and yield from $b; 89yield from ($a and yield from $b); 90print ($a and print $b); 91clone ($a + $b); 92(throw $a) + $b; 93-(-$a); 94+(+$a); 95-(--$a); 96+(++$a); 97-(--$a ** $b); 98+(++$a ** $b); 99!$a = $b; 100++$a ** $b; 101$a ** $b++; 102$a . ($b = $c) . $d; 103!($a = $b) || $c; 104(fn() => $a) || $b; 105($a = $b and $c) + $d; 106$a ** ($b instanceof $c); 107($a = $b) instanceof $c; 108[$a and $b => $c]; 109// TODO: This prints redundant parentheses 110[(include $a) => $c]; 111