Sheath rule
blade-prefer-endsection
Close a
@section with @endsection rather than its @stop alias.
. See Auto-fix.
Part of the migration preset.
#Why
@stop and @endsection compile to the same call. Standardizing on
@endsection avoids mixing two names for the same behavior.
The other section terminators are not aliases and are not replaced:
| Terminator | What it does |
|---|---|
@endsection |
Ends the section |
@stop |
Ends the section (alias) |
@show |
Ends the section and renders it immediately |
@append |
Ends the section, appending to a parent definition |
@overwrite |
Ends the section, replacing any parent definition |
#Examples
#Bad
@section('content')
<p>Hello.</p>
@stop
#Good
@section('content')
<p>Hello.</p>
@endsection
@section('sidebar')
<p>Rendered here.</p>
@show
@section('scripts')
<script src="/a.js"></script>
@append
#Auto-fix
--fix replaces the terminator and nothing else.
{{-- before --}}
@section('content')
<p>Hello.</p>
@stop
{{-- after --}}
@section('content')
<p>Hello.</p>
@endsection
#Notes
- The inline
@section('title', 'Home')form has no terminator and is never reported. - Both spellings work. This consistency check belongs to the
migrationpreset rather thanrecommended.
#Related Rules
- blade-unclosed-directives - block directives must be closed at all