prettier / prettier/plugin-php
Invoked import/require callable removes necessary parentheses
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1.9k
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Description
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')();
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue provides a minimal PHP input, incorrect formatted output, and expected output, but names no source file or test path. Start by locating the formatter logic for parenthesized include/require expressions followed by invocation, then add regression coverage that preserves the parentheses and verifies the shown expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100