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

[5.3] Fix foreach blade compiler #15485

Merged
merged 5 commits into from
Sep 18, 2016
Merged

[5.3] Fix foreach blade compiler #15485

merged 5 commits into from
Sep 18, 2016

Conversation

ElfSundae
Copy link
Contributor

New line in @foreach and @forelse should be allowed:

@foreach([
    'foo'
] as $var)

@endforeach

And this feature is also supported before 5.3

I removed amiss i regex modifier and added s modifier.

@ElfSundae
Copy link
Contributor Author

To fix tests, I bring i back.

@themsaid
Copy link
Member

themsaid commented Sep 18, 2016

Yeah i is indeed necessary as some people write as in lowercase and others in uppercase, thus why we use it.

Can you please write a test to make sure your change solves the issue and that it won't get broken after any later changes?

@GrahamCampbell
Copy link
Member

GrahamCampbell commented Sep 18, 2016

Can you please write a test to make sure your change solves the issue and that it won't get broken after any later changes?

Yes, please write a test or two.

@ElfSundae
Copy link
Contributor Author

added

@@ -624,7 +624,7 @@ protected function compileForelse($expression)
{
$empty = '$__empty_'.++$this->forelseCounter;

preg_match('/\( *(.*) +as *([^\)]*)/', $expression, $matches);
preg_match('/\( *(.*) +as *([^\)]*)/s', $expression, $matches);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add the i here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

@taylorotwell taylorotwell merged commit c3e446e into laravel:5.3 Sep 18, 2016
@ElfSundae ElfSundae deleted the fix-blade-compiler branch September 19, 2016 14:24
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.

4 participants