$viewModel Read-only view-model array. */ function affilun_template( string $key, array $viewModel ): void { $resolver = apply_filters( 'affilun_template_resolver', null ); if ( ! $resolver instanceof \Affilun\Application\Render\Template\TemplateResolver ) { // No resolver registered — silent no-op per §13.3 graceful degradation. return; } try { $templateKey = \Affilun\Application\Render\Template\TemplateKey::fromString( $key ); $resolvedPath = $resolver->resolve( $templateKey ); } catch ( \Throwable $e ) { // §23.1 一般ユーザー向け: never expose internal errors from a template helper. return; } // Read-only contract: $viewModel is passed by value from the caller; the // static closure isolates the include scope so renderer-internal locals // ($resolver, $templateKey, $resolvedPath, $e) cannot leak into the // template's variable namespace. ( // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed -- $viewModel is consumed by the required template file via local scope, not by the closure body. static function ( string $__aflPath, array $viewModel ): void { require $__aflPath; } )( $resolvedPath, $viewModel ); } } // phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound