3 Commits
Author SHA1 Message Date
dualfroz 47f29d7f14 Describe this repository 2026-10-22 21:05:39 +02:00
dualfroz 00e7c77eee fix: use PHP 8 concatenation precedence in the pretty printer
The precedence table gave "." the same precedence as "+" and "-", which is
the PHP 7 ordering. PHP 8.0 lowered "." below the arithmetic and shift
operators, so printing ('abc' . 1) + 2 produced 'abc' . 1 + 2, which PHP 8
reparses as 'abc' . (1 + 2). The same applied to "-", "<<" and ">>".

The printer already targets a specific PHP version and already varies
parenthesization by version, so select the concatenation precedence the same
way: for a target of PHP 8.0 or newer, place "." between the shift operators
and the pipe operator, matching the PHP8 block of grammar/php.y. Targets below
8.0 keep the PHP 7 table, which is correct for them and produces unchanged
output.

Fixes #1041
2026-09-03 14:09:59 +02:00
upstream 09376a3b68 Upstream nikic/PHP-Parser state of the touched files before 9f4a64fbfd 2026-09-03 14:09:59 +02:00