Skip to content

ValidatorSourceLocator

Finds validators.xml files on disk, the same way ConfigCache resolves config_handlers.xml’s %core.module_dir%/*/Validate/*.xml pattern for ValidatorConfigHandler — except here the result is handed to a compiler, not compiled into the request-time cache.

Only “leaf” validator files (the per-action Validate/*.xml, or any explicit path given) need to be discovered: each resolves its own parent chain up to the module’s and the framework’s validator definitions when parsed, exactly as XmlConfigParser::run() already does for the runtime path.

class ValidatorSourceLocator

Since1.0.0
SourceValidator/Compiler/ValidatorSourceLocator.php
MethodDescription
defaultRoots(): array<string>The pattern config_handlers.xml maps to ValidatorConfigHandler today.
discover(iterable<string> $roots): array<ValidatorSource>

public static function defaultRoots(): array<string>

The pattern config_handlers.xml maps to ValidatorConfigHandler today.

Returns array``<``string``>

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

Glob patterns, with %directive% tokens (e.g. %core.module_dir%) expanded via Toolkit::expandDirectives().

ParameterTypeDescription
$rootsiterable``<``string``>Glob patterns, with %directive% tokens (e.g. %core.module_dir%) expanded via Toolkit::expandDirectives().

Returns array``<ValidatorSource> — Discovered sources, sorted by path for deterministic ordering.