Skip to content

ValidatorCompiler

Public entrypoint for validator compilation, independent of any CLI.

A future quiote compile validators command is expected to be a thin wrapper: discover()/compile() here, ArtifactWriter (or a —check comparison) for output, print diagnostics, choose an exit code.

class ValidatorCompiler

Since1.0.0
SourceValidator/Compiler/ValidatorCompiler.php
MethodDescription
compile(ValidatorSource $source, EmitterInterface $emitter): CompilationResultConvenience wrapper: parse() + emit() in one call, with diagnostics from both stages merged.
discover(iterable<string> $roots = null): array<ValidatorSource>
emit(ValidatorPlan $plan, EmitterInterface $emitter): EmittedArtifactHands a plan to the given emitter and returns the artifact it produced.
parse(ValidatorSource $source): array{0: ValidatorPlan, 1: Diagnostic[]}Parses a validator source into its format-independent IR.

public function compile(ValidatorSource $source, EmitterInterface $emitter): CompilationResult

Convenience wrapper: parse() + emit() in one call, with diagnostics from both stages merged.

In ‘throw’ mode a ConfigurationException from parse() propagates as normal — compile() only suppresses nothing; it exists purely to save the caller two lines.

ParameterTypeDescription
$sourceValidatorSource
$emitterEmitterInterface

Returns CompilationResult

public function discover(iterable<string> $roots = null): array<ValidatorSource>

Glob patterns; defaults to ValidatorSourceLocator::defaultRoots() when omitted.

ParameterTypeDescription
$rootsiterable``<``string``>Glob patterns; defaults to ValidatorSourceLocator::defaultRoots() when omitted.

Returns array``<ValidatorSource>

public function emit(ValidatorPlan $plan, EmitterInterface $emitter): EmittedArtifact

Hands a plan to the given emitter and returns the artifact it produced.

Nothing is written to disk here, and no diagnostics are collected: this is a straight delegation, kept as a named step so callers can parse once and emit through several back-ends.

ParameterTypeDescription
$planValidatorPlan
$emitterEmitterInterface

Returns EmittedArtifact

public function parse(ValidatorSource $source): array{0: ValidatorPlan, 1: Diagnostic[]}

Parses a validator source into its format-independent IR.

ParameterTypeDescription
$sourceValidatorSource

Returns array{0: ValidatorPlan, 1: Diagnostic[]} — The plan and every diagnostic recorded while building it (empty in ‘throw’ mode unless the source is clean).