Skip to content

ValidationDecision

Immutable value object encapsulating the validation outcome for a request/action.

States: - pending: validation has not yet run (or was invalidated by a forward) - passed: validation executed successfully - failed: validation executed and failed (errors available)

final readonly class ValidationDecision

SourceExecution/ValidationDecision.php
PropertyTypeDescription
$errorsarrayreadonly.
$statestringreadonly.
MethodDescription
failed(array<mixed> $errors = []): ValidationDecision
isFailed(): boolReports whether validation ran and failed; the errors are then on the $errors property.
isPassed(): boolReports whether validation ran and succeeded.
isPending(): boolReports whether validation has not run yet, or was invalidated by a forward.
passed(): ValidationDecisionReturns a decision in the passed state: validation ran successfully, and carries no errors.
pending(): ValidationDecisionReturns a decision in the pending state: validation has not run, and carries no errors.

public static function failed(array<mixed> $errors = []): ValidationDecision

ParameterTypeDescription
$errorsarray``<``mixed``>

Returns ValidationDecision

public function isFailed(): bool

Reports whether validation ran and failed; the errors are then on the $errors property.

Returns bool

public function isPassed(): bool

Reports whether validation ran and succeeded.

Returns bool

public function isPending(): bool

Reports whether validation has not run yet, or was invalidated by a forward.

Returns bool

public static function passed(): ValidationDecision

Returns a decision in the passed state: validation ran successfully, and carries no errors.

Returns ValidationDecision

public static function pending(): ValidationDecision

Returns a decision in the pending state: validation has not run, and carries no errors.

Returns ValidationDecision