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

[Formatting Bug]: #929

Closed
fh32000 opened this issue May 9, 2024 · 1 comment
Closed

[Formatting Bug]: #929

fh32000 opened this issue May 9, 2024 · 1 comment
Assignees
Labels
bug Something isn't working Stale

Comments

@fh32000
Copy link

fh32000 commented May 9, 2024

Version

1.41.1

Template before formatting

<html>
  <head></head>
  <body>
    @php($notification = App\Models\Notification::whereBetween('created_at', [auth('seller')->user()->created_at, Carbon::now()])->where('sent_to', 'seller')->whereDoesntHave('notificationSeenBy')->count())
  </body>
</html>

Template after formatting

<html>
    <head></head>
    <body>
        @php(
    $notification = App\Models\Notification::whereBetween('created_at', [auth('seller')->user()->created_at, Carbon::now()])->where('sent_to', 'seller')->whereDoesntHave('notificationSeenBy')->count(),
)
    </body>
</html>

Expected Behaviour

Relevant log output
The error encountered during runtime due to the added comma results in a PHP syntax error:

PHP Parse error:  syntax error, unexpected ',', expecting ')' in /path/to/file.blade.php on line 1

Additional Context

Laravel Version: v10.48.9
Issue occurs in a development environment using Laravel Blade files, specifically impacting PHP expressions wrapped in @php directives.
Steps to Reproduce

Use a Blade file with a complex @php directive containing multiple chained method calls.
Format the file using the blade-formatter with the specified configuration.
Observe the introduction of a comma at the end of the PHP expression, leading to syntax errors.

Relevant log output

node_modules/.bin/blade-formatter  resources/views/app.blade.php 

<html>
    <head></head>
    <body>
        @php(
    $notification = App\Models\Notification::whereBetween('created_at', [auth('seller')->user()->created_at, Carbon::now()])->where('sent_to', 'seller')->whereDoesntHave('notificationSeenBy')->count(),
)
    </body>
</html>
@fh32000 fh32000 added the bug Something isn't working label May 9, 2024
Copy link
Contributor

github-actions bot commented Jul 9, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Jul 9, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

2 participants