plugin-php
plugin-php copied to clipboard
Invoked import/require callable removes necessary parentheses
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')();