镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Invoked import/require callable removes necessary parentheses #2333

Open

Description

@adamaveray

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')();

Activity

  1. tobia commented on Nov 26, 2024

    @tobia

    Possibly related to #2409

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions