Stillat / blade-parser-typescript

A Laravel Blade parser, compiler, and static analyzer written in TypeScript.
https://stillat.com
MIT License
90 stars 3 forks source link

Chained method calls in foreach corrupts blade view #116

Open mortenscheel opened 2 months ago

mortenscheel commented 2 months ago

Example:

@foreach (collect()->where('foo', 'bar')->where('bar', 'foo') as $item)
    <!-- body -->
@endforeach

Formatted:

@foreach (collect()->where('foo', 'bar')->where('bar', 'foo')as $item)
    <!-- body -->
@endforeach

The space before as has been removed. Running php artisan view:cache fails:

Illuminate\Contracts\View\ViewCompilationException

Malformed @foreach statement.