Skip to content
docs

CapabilitySuggestion

A `suggests` capability record — an OPTIONAL dependency. A missing suggested capability MUST NOT fail boot; `fallback` names the graceful-degradation path (e.g. "noop" / a null-object strategy). Legacy bare-FQCN declarations are accepted via {@see fromInterface()}.

CapabilitySuggestion::__construct()

public function __construct(string $id, string $interface, string $constraint = '*', ?string $fallback = null):

Parameters

Parámetros de __construct()
NombreTipoDescripción
$idstring
$interfacestring
$constraintstring
$fallback?string

CapabilitySuggestion::fromArray()

public static function fromArray(array $record): self

Build a suggestion record from a decoded `suggests` manifest entry, validating `id` and `interface`, defaulting `constraint` to `*`, and normalizing an empty `fallback` to null.

Parameters

Parámetros de fromArray()
NombreTipoDescripción
$recordarray<string, mixed>

Throws

\InvalidArgumentException If `id` or `interface` is empty.

CapabilitySuggestion::fromInterface()

public static function fromInterface(string $interface): self

Wrap a legacy bare-FQCN declaration as an any-version suggestion.

Parameters

Parámetros de fromInterface()
NombreTipoDescripción
$interfacestring

CapabilitySuggestion::parse()

public static function parse(array|string $record): self

Parse a `suggests` manifest entry in either the legacy bare-FQCN string form or the structured-record array form, dispatching to {@see fromInterface()} or {@see fromArray()}.

Parameters

Parámetros de parse()
NombreTipoDescripción
$record(string | array<string, mixed>)