From 76015cc576f3564d9e6e63e68d77588de23888ae Mon Sep 17 00:00:00 2001 From: Shin Kojima Date: Fri, 15 Mar 2024 10:16:38 +0900 Subject: [PATCH] `@parent` directive does not require arguments > [BLADE_V013] Required arguments missing for [@parent] on line 4 @parent directive is just a placeholder that does not have any arguments. I feel the need for tests against official documentation, but the official documentation is more focused on use cases rather than specifications, so there's currently no clear guidance on how to construct tests. See also: * https://github.com/laravel/framework/blob/2af985e2c26496f2870535b9079dbb207b1dde9a/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php#L61-L71 * https://laravel.com/docs/10.x/blade#extending-a-layout ~~~ @extends('layouts.app') @section('title', 'Page Title') @section('sidebar') @parent

This is appended to the master sidebar.

@endsection @section('content')

This is my body content.

@endsection ~~~ --- src/Compiler/Concerns/CompilesLayouts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/Concerns/CompilesLayouts.php b/src/Compiler/Concerns/CompilesLayouts.php index c24e7cd..cab3429 100644 --- a/src/Compiler/Concerns/CompilesLayouts.php +++ b/src/Compiler/Concerns/CompilesLayouts.php @@ -45,7 +45,7 @@ protected function compileSection(DirectiveNode $node): string return "startSection{$this->getDirectiveArgs($node)}; ?>"; } - #[CompilesDirective(StructureType::Terminator, ArgumentRequirement::Required)] + #[CompilesDirective(StructureType::Terminator, ArgumentRequirement::NoArguments)] protected function compileParent(): string { $escapedLastSection = strtr($this->lastSection, ['\\' => '\\\\', "'" => "\\'"]);