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

Invoked import/require callable removes necessary parentheses #2333

Open
adamaveray opened this issue Feb 22, 2024 · 0 comments
Open

Invoked import/require callable removes necessary parentheses #2333

adamaveray opened this issue Feb 22, 2024 · 0 comments
Labels

Comments

@adamaveray
Copy link
Contributor

An imported or required file returning a callable value cannot be immediately invoked as Prettier is stripping the surrounding parentheses.

(The below example assumes file.php contains e.g. <?php return function() { echo 'Hello world'; };)

@prettier/plugin-php v0.22.2
Playground link

Input:

<?php
(include 'file.php')();
(require 'file.php')();

Output:

<?php
include "file.php"();
require "file.php"();

Expected behavior:

<?php
(include 'file.php')();
(require 'file.php')();
@cseufert cseufert added the bug label Apr 4, 2024
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