Skip to content

CompilationResult

The outcome of compiling one ValidatorSource through an emitter: the artifact (null if a fatal diagnostic prevented emission) plus every diagnostic recorded along the way.

A future CLI reports diagnostics and decides the process exit code from this; ValidatorCompiler itself never throws for ordinary (non-crashing) problems in ‘warn’ mode.

final class CompilationResult

Since1.0.0
SourceValidator/Compiler/CompilationResult.php
PropertyTypeDescription
$artifact?EmittedArtifactreadonly.
$diagnosticsarrayreadonly.

public function __construct(?EmittedArtifact $artifact, array<Diagnostic> $diagnostics): mixed

ParameterTypeDescription
$artifact?EmittedArtifact
$diagnosticsarray``<Diagnostic>

Returns mixed

MethodDescription
hasErrors(): boolReports whether any recorded diagnostic is of error severity.

public function hasErrors(): bool

Reports whether any recorded diagnostic is of error severity.

Warnings and lesser severities do not count, so a result can carry diagnostics and still answer false. A true here means the artifact, if one was emitted at all, should not be trusted.

Returns bool