plugin-php
plugin-php copied to clipboard
Parentheses around nested ternary expressions are removed, causing syntax error in PHP 8.0
@prettier/plugin-php v0.19.2 Playground link
Input:
<?php
var_dump((1 ? 2 : 3) ?: 4);
Output:
<?php
var_dump(1 ? 2 : 3 ?: 4);
Leads to this syntax error in PHP 8.1:
Nested ternary expressions are deprecated since PHP 7.4
Note: It does work as expected when you don't make use of a shorthand ternary operator (?:).
The issue is still present in @prettier/plugin-php v0.22.4, is there any chance it gets fixed soon ?