Requirement
API reference › Foxy › Native › Requirement
Represents one dependency requirement fed to the native resolver: a package name, its npm specification, and the manifest or package that declared it.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$name readonly constructor | string | Package name, scoped names included (@scope/name). | Requirement |
$optional readonly constructor | bool | Whether an unsatisfiable requirement is skipped with a warning instead of failing. Default: false. | Requirement |
$optionalRoot readonly constructor | string| | Selection (name@version) of the optional package whose subtree declared the requirement, or null outside any optional subtree. Default: null. | Requirement |
$source readonly constructor | string | Declaring origin: '' for the root manifest, the local package name, or name@version. | Requirement |
$spec readonly constructor | string | Npm specification as written by the declaring manifest (range, version, or dist-tag). | Requirement |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Describes one dependency constraint for the native resolver. | Requirement |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(string $name, string $spec, string $source, bool $optional = false, string|null $optionalRoot = null)Describes one dependency constraint for the native resolver.
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | Package name, scoped names included (@scope/name). |
$spec | string | Npm specification as written by the declaring manifest (range, version, or dist-tag). |
$source | string | Declaring origin: '' for the root manifest, the local package name, or name@version. |
$optional | bool | Whether an unsatisfiable requirement is skipped with a warning instead of failing. |
$optionalRoot | string| | Selection (name@version) of the optional package whose subtree declared the requirement, or null outside any optional subtree. |