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

parentheses bug. #2340

Open
dvlpr91 opened this issue Mar 13, 2024 · 5 comments
Open

parentheses bug. #2340

dvlpr91 opened this issue Mar 13, 2024 · 5 comments
Labels

Comments

@dvlpr91
Copy link

dvlpr91 commented Mar 13, 2024

@prettier/plugin-php v0.22.2
Playground link

Input:

<?php

(require_once __DIR__ . '/../bootstrap/app.php')->handleRequest(Request::capture());

Output:

<?php

require_once __DIR__ . "/../bootstrap/app.php"->handleRequest(
    Request::capture()
);
@vinkla
Copy link

vinkla commented Mar 14, 2024

I'm here to report this issue too. The syntax is taken from Laravel 11's public/index.php file.

@timmylindh
Copy link

Same

@cseufert cseufert added the bug label Apr 4, 2024
@antonioribeiro
Copy link

antonioribeiro commented Jul 29, 2024

Is there are plan to fix this one?

@dvlpr91
Copy link
Author

dvlpr91 commented Aug 5, 2024

// public/index.php

...
// Bootstrap Laravel and handle the request...
$app = require_once __DIR__ . '/../bootstrap/app.php';
$app->handleRequest(Request::capture());
// artisan

...
// Bootstrap Laravel and handle the command...
$app = require_once __DIR__ . '/bootstrap/app.php';
$status = $app->handleCommand(new ArgvInput());
exit($status);

@cay89
Copy link

cay89 commented Aug 15, 2024

It also removes the parentheses from the nameless class definition in Laravel 11 migrations.

There are parentheses after the class keyword:

return new class () extends Migration {

Run Prettier, and they’re gone:

return new class extends Migration {

The PER Coding Style 2.0 requires parentheses when instantiating a new class: https://www.php-fig.org/per/coding-style/#4-classes-properties-and-methods

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

6 participants