spatie / laravel-blade-comments

Add debug comments to your rendered output
https://freek.dev/2500-a-laravel-package-to-quickly-see-which-html-is-rendered-by-which-blade-view
MIT License
150 stars 9 forks source link

[Bug]: ParseError when using config() value for default in @yield #4

Closed mortenscheel closed 1 year ago

mortenscheel commented 1 year ago

What happened?

This is valid blade:

<title>@yield('title', config('app.name'))</title>

But when laravel-blade-comments is installed, it causes a ParseError that doesn't seem to make much sense. Screenshot: image

How to reproduce the bug

Create a simple blade layout file containing this title tag in the

<title>@yield('title', config('app.name'))</title>

Try to render a blade file that extends the layout.

Note: It doesn't matter if you override the 'title' section in the view or not.

Package Version

1.0.0

PHP Version

8.2.5

Laravel Version

10.11.0

Which operating systems does with happen with?

Linux

Notes

No response

timvandijck commented 1 year ago

Nice catch, looks like the regex is incorrect for @yield that also passes a variable. I'm going to patch this.

timvandijck commented 1 year ago

@mortenscheel I pushed a minor update that should resolve your issue.