Skip to content

fix: handle assignref in needsParens like assign#2465

Draft
jorgsowa wants to merge 1 commit intoprettier:mainfrom
jorgsowa:fix/assignref-missing-in-needs-parens
Draft

fix: handle assignref in needsParens like assign#2465
jorgsowa wants to merge 1 commit intoprettier:mainfrom
jorgsowa:fix/assignref-missing-in-needs-parens

Conversation

@jorgsowa
Copy link
Collaborator

assignref was missing from the needsParens switch, falling through to return false. This caused parens to be dropped in contexts where they change semantics, e.g. $a = ($b =& $var) + 5 became $a = $b = &$var + 5.

@jorgsowa jorgsowa marked this pull request as ready for review March 23, 2026 21:23
@jorgsowa jorgsowa marked this pull request as draft March 23, 2026 21:23
@jorgsowa jorgsowa force-pushed the fix/assignref-missing-in-needs-parens branch from 6a136b4 to 420d7d6 Compare March 23, 2026 21:26
assignref was missing from the needsParens switch, falling through
to return false. This caused parens to be dropped in contexts where
they change semantics, e.g. $a = ($b =& $var) + 5 became
$a = $b = &$var + 5.
@jorgsowa jorgsowa force-pushed the fix/assignref-missing-in-needs-parens branch from 420d7d6 to 86ce94e Compare March 23, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant