Skip to content

ValidatorPlanBuilder

Walks a parsed validators.xml document and builds a format-independent ValidatorPlan (see Quiote\Validator\Compiler\Ir).

Keeping the traversal separate from code emission lets the same walk feed multiple back-ends — the runtime cache emitter and the fluent-source emitter — without duplicating XML-interpretation logic.

A ValidatorPlanBuilder instance is single-use: construct one per document, call build() once. classMap accumulates across the ae:configuration elements of that one document, so validator_definitions are scoped per file.

class ValidatorPlanBuilder

Since1.0.0
SourceValidator/Compiler/ValidatorPlanBuilder.php
ConstantValueDescription
REJECT_MODE_OFF'off'
REJECT_MODE_THROW'throw'Controls how unknown/misspelled validator parameters are handled at plan-build (i.e.
REJECT_MODE_WARN'warn'
MethodDescription
build(XmlConfigDomDocument $document, string $namespace): ValidatorPlanWalks the document once and returns the plan it describes.
collectErrors(XmlConfigDomElement $node, array<string, mixed> $existing = []): array<string, mixed>
getDiagnostics(): array<Diagnostic>

public function build(XmlConfigDomDocument $document, string $namespace): ValidatorPlan

Walks the document once and returns the plan it describes.

The validators XML namespace URI, installed as the document’s default namespace for the duration of the walk.

ParameterTypeDescription
$documentXmlConfigDomDocument
$namespacestringThe validators XML namespace URI, installed as the document’s default namespace for the duration of the walk.

Returns ValidatorPlan

ThrowsWhen
ConfigurationExceptionIf a required attribute is missing, a referenced validator definition cannot be resolved, or — in ‘throw’ reject mode — a validator declares a parameter its class does not accept.

public function collectErrors(XmlConfigDomElement $node, array<string, mixed> $existing = []): array<string, mixed>

ParameterTypeDescription
$nodeXmlConfigDomElement
$existingarray``<``string``, ``mixed``>

Returns array``<``string``, ``mixed``>

public function getDiagnostics(): array<Diagnostic>

Returns array``<Diagnostic> — Every diagnostic recorded during the last build(). Populated in ‘warn’ mode; in ‘throw’ mode only diagnostics from nodes visited before the fatal one are ever recorded, since the exception aborts the walk immediately.