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

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

Merged

Conversation

danilopinotti
Copy link
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
Copy link

maxddev commented Sep 30, 2022

@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
Copy link
Contributor Author

danilopinotti commented Sep 30, 2022

@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