Skip to content

[9.x] Improve Blade compilation exception messages - #44134

Merged
taylorotwell merged 6 commits into
laravel:9.xfrom
danilopinotti:blade-compilation-exceptions-9x
Sep 15, 2022
Merged

[9.x] Improve Blade compilation exception messages#44134
taylorotwell merged 6 commits into
laravel:9.xfrom
danilopinotti:blade-compilation-exceptions-9x

Conversation

@danilopinotti

Copy link
Copy Markdown
Contributor

Problem

Currently, when we write a @foreach or @forelse the wrong way, the exception message is not descriptive. e.g:

Code:

@foreach
TEST
@endforeach

Exception:
image

The main objective of this PR is to improve this message:
image

In an actual situation, it occurred for a beginner developer to take hours to discover the problem since the stacktrace also doesn't make it easy to debug issues in rendering views.

@taylorotwell
taylorotwell merged commit d00f8df into laravel:9.x Sep 15, 2022
@danilopinotti
danilopinotti deleted the blade-compilation-exceptions-9x branch September 15, 2022 13:49
@maxddev

maxddev commented Sep 30, 2022

Copy link
Copy Markdown

@danilopinotti

Because the regex quantifier after "as" was changed from * to +, if the foreach statement is multiline, this now throws an error:

@foreach ($foo as
$bar)

Should this be considered?

@danilopinotti

danilopinotti commented Sep 30, 2022

Copy link
Copy Markdown
Contributor Author

@danilopinotti

Because the regex quantifier after "as" was changed from * to +, if the foreach statement is multiline, this now throws an error:

@foreach ($foo as
$bar)

Should this be considered?

I wasnt considering. I will submit a PR fixing it

EDIT

I submitted a PR fixing this issue:
#44410

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants