Skip to content

fix: keep parens around include/require when invoked or used as a lookup target - #2545

Open
benjaminkincses wants to merge 3 commits into
prettier:mainfrom
benjaminkincses:fix/2333-include-parens
Open

benjaminkincses wants to merge 3 commits into
prettier:mainfrom
benjaminkincses:fix/2333-include-parens

Conversation

@benjaminkincses

Copy link
Copy Markdown
Contributor

Fixes #2333

(include 'file.php')() lost its parens and came out as include "file.php"(). Same for require, include_once and require_once, and for lookups on the result (->prop, ["key"], ?->method(), ::CONSTANT).

needs-parens now keeps the parens when an include node is the what of a call or lookup.

Verified: new fixture tests/include/invoke.php covers the four constructs plus the lookup cases. Full jest suite passes (600 tests), no other snapshot changes. AST_COMPARE=1 passes on the include, call and clone suites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant