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()}. The primary constructor validates exactly like {@see fromArray()} does: `id` and `interface` must be non-empty. There is no "trusted, pre-validated" construction path — hand-building a record is validated identically to parsing one from a manifest.
CapabilitySuggestion::__construct()
public function __construct(string $id, string $interface, string $constraint = '*', ?string $fallback = null):Parameters
| Name | Type | Description |
|---|---|---|
| $id | string | |
| $interface | string | |
| $constraint | string | |
| $fallback | ?string |
Throws
\InvalidArgumentException If `id` or `interface` is empty.
CapabilitySuggestion::fromArray()
public static function fromArray(array $record): selfBuild a suggestion record from a decoded `suggests` manifest entry. Coerces raw (possibly untyped) array values to their expected shape — defaulting `constraint` to `*` and normalizing an empty `fallback` to null; validation of the result (`id`/`interface` non-empty) happens in the constructor, not here.
Parameters
| Name | Type | Description |
|---|---|---|
| $record | array<string, mixed> |
Throws
\InvalidArgumentException If `id` or `interface` is empty.
CapabilitySuggestion::fromInterface()
public static function fromInterface(string $interface): selfWrap a legacy bare-FQCN declaration as an any-version suggestion.
Parameters
| Name | Type | Description |
|---|---|---|
| $interface | string |
CapabilitySuggestion::parse()
public static function parse(array|string $record): selfParse 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
| Name | Type | Description |
|---|---|---|
| $record | (string | array<string, mixed>) |