PHP-Parser icon indicating copy to clipboard operation
PHP-Parser copied to clipboard

Reproducer for a bug with format-preserving printer that loses parentheses around BooleanNot expressions

Open maks-rafalko opened this issue 3 months ago • 2 comments

This is only a reproducer for the issue reported in #1119

maks-rafalko avatar Oct 18 '25 23:10 maks-rafalko

PHP-Parser 5 uses a different way to handle operator precedence in the pretty printer, and it doesn't interact with formatting preservation properly :/

nikic avatar Oct 19 '25 14:10 nikic

This looks pretty tricky. Previously responsibility for printing the parentheses was with the parent node, now it's with the child. Which only works properly if the child is printed without formatting.

nikic avatar Oct 19 '25 14:10 nikic