Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parentheses around nested ternary expressions are removed, causing syntax error in PHP 8.0 #2115

Open
villermen opened this issue Nov 28, 2022 · 0 comments
Labels

Comments

@villermen
Copy link

villermen commented Nov 28, 2022

@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 (?:).

@cseufert cseufert added the bug label Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants