Here is the code:
@if (count($errors) > 0)
<div class="errorClass">
@else
<div class="cleanClass">
@endif
<p>Some stuff</p>
</div>
The above code make PhpStorm register that there is an open <div>
. Any way to fix this bug?
This is making it frustrating to use when it comes time to refactor code.
I installed the Blade extension hoping that would help - it didn't. PhpStorm reports:
Element div is not closed.
Any way to make PhpStorm smarter?
(Posted on behalf of the OP).
This works but is not easy to read.
<div
@if (count($errors) > 0)
class="errorClass"
@else
class="cleanClass"
@endif
>
<p>Here is a paragraph</p>
</div>
A simple ternary would do the job better.
//Open as normal
<div class="{{ count($errors) > 0 ? 'errorClass' : 'cleanClass' }}">
<p>This is some text</p>
</div>