All rules

Sheath rule

blade-prefer-endsection

Close a @section with @endsection rather than its @stop alias.
Package
Core
Category
Blade
Default severity
info by default
Auto-fix
Auto-fix available

. 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 migration preset rather than recommended.

#Related Rules