Skip to content

IDeclarationConfigHandler

A config handler whose compiled artifact is a declaration — data — plus the code that applies that data to runtime state.

ConfigCache::load() reads the artifact’s value and hands it to IDeclarationConfigHandler::apply(). The artifact itself never runs statements, so a poisoned cache entry can only produce wrong configuration, never execution: the code that acts on the declaration is this class, shipped with the framework or the package, not a string in the cache.

A declaration arrives from the cache or from a hand-authored .php/.yaml source, so IDeclarationConfigHandler::apply() is a trust boundary: validate the shape and throw ConfigurationException rather than assuming what the compiler produced.

interface IDeclarationConfigHandler

Implemented byMiddlewareConfigHandler, PluginConfigHandler, SettingConfigHandler
Since4.0.0
SourceConfig/IDeclarationConfigHandler.php
MethodDescription
apply(mixed $declaration, string $sourceRef): voidApply a compiled declaration to runtime state.

abstract public function apply(mixed $declaration, string $sourceRef): void

Apply a compiled declaration to runtime state.

The configuration file the declaration came from, for diagnostics.

ParameterTypeDescription
$declarationmixedThe value the compiled configuration returned.
$sourceRefstringThe configuration file the declaration came from, for diagnostics.
ThrowsWhen
ConfigurationExceptionIf the declaration is not the shape this handler compiles.