Skip to content
docsv0.13.1

ContractResolver

ContractResolver - Validates and orders plugins by their contracts. Handles: - Validation of required dependencies (fail-fast on missing) - Warning for missing suggested dependencies - Topological sorting for proper load order Capability entries come in BOTH real shapes: legacy bare FQCN strings (matched verbatim, exactly as before) and canonical records — a `provides` record registers under both its `id` and its `interface`; a `requires`/`suggests` record is satisfied by its `id`, its `interface`, or any `oneOf` alternative (the same identity posture core's CapabilityGraphChecker adjudicated in T1).

ContractResolver::__construct()

public function __construct(?Psr\Log\LoggerInterface $logger = null):

Parameters

Parameters of __construct()
NameTypeDescription
$logger?Psr\Log\LoggerInterface

ContractResolver::validate()

Deprecated
public function validate(array $plugins): void

Validate that all required dependencies are satisfied.

Deprecated: Superseded by milpa/resolver: {@see \Milpa\Resolver\Engine\GraphResolver::resolve()} reaches the same verdict through the report — a required capability with no provider lands in `missing[]` and blocks the graph (status `blocked`), with a learnable error attached ({@see \Milpa\Resolver\Report\ResolutionReport::firstLearnableLine()}) instead of a bare RuntimeException.

Parameters

Parameters of validate()
NameTypeDescription
$pluginsarray<array{name?: string, provides?: array<int, (string | array<string, mixed>)>, requires?: array<int, (string | array<string, mixed>)>, suggests?: array<int, (string | array<string, mixed>)>}>

Throws

\RuntimeException if a required dependency is missing

ContractResolver::getLoadOrder()

Deprecated
public function getLoadOrder(array $plugins): array

Sort plugins by dependency order (topological sort). Plugins with no dependencies come first.

Deprecated: Superseded by milpa/resolver: the same Kahn pass lives in {@see \Milpa\Resolver\Engine\GraphResolver} (semantics replicated exactly) and its verdict travels as the report's `loadOrder[]` ({@see \Milpa\Resolver\Report\ResolutionReport}) — the SAME resolution that gates the graph also orders it. A dependency cycle becomes a learnable `MILPA_DEPENDENCY_CYCLE` conflict on the report instead of a RuntimeException.

Parameters

Parameters of getLoadOrder()
NameTypeDescription
$pluginsarray<array{name: string, class: string, provides?: array<string>, requires?: array<string>}>

ContractResolver::getAvailableContracts()

public function getAvailableContracts(array $plugins): array

Get all available contracts from plugins.

Parameters

Parameters of getAvailableContracts()
NameTypeDescription
$pluginsarray<array{name?: string, provides?: array<string>}>

Returns

Map of contract => providing plugin name