-
Notifications
You must be signed in to change notification settings - Fork 11k
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.5] If applied this commit adds the blade directive for the Switch statement #19758
Conversation
good news i like it will come handy. |
Does this support double cases?
|
@josephzidell yes it does. |
That is really helpful. Thanks! |
@nunomaduro cheers :) Thank you too for laravel zero Nuno ❤️ |
Remarkable thanks community |
protected function compileCase($value) | ||
{ | ||
if ($this->firstCaseInSwitch) { | ||
$this->firstCaseInSwitch = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This'll break with multiple switch statements in a file, right? It'll print <?php switch($x): <?php case...
.
Can the firstCaseInSwitch
be removed and have compileSwitch
just close the ?>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danharper Implemented the firstCaseInSwitch
because of the following as worded in the PHP docs:
Warning
Any output (including whitespace) between a switch statement and the first case will result in a syntax error
Trying to fix the issue you just found out about multiple switch statements in a file, any help or suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also noticed this and submitted a PR already: #19760. I should have mentioned that here.
Nice PR, but has made me think at what point do we just start writing vanilla php in these templates? Wondering that it seems a like we're creating our own language subset that's less flexible? |
This is nice addition to Laravel 5.5, here is how it works on Laravel 5.5 https://goo.gl/3L4D52 |
How to use: