feat(compat): declare core independence with core:"none" (INDEPENDENT status, block inheritance, no warning)
This commit is contained in:
@@ -18,6 +18,7 @@ final class Manifest
|
||||
public readonly ?string $coreTested,
|
||||
public readonly ?string $php,
|
||||
public readonly array $postInstall,
|
||||
public readonly ?bool $coreIndependent = null,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -83,16 +84,23 @@ final class Manifest
|
||||
$postInstall[] = $command;
|
||||
}
|
||||
|
||||
$coreRequires = $coreTested = null;
|
||||
$coreIndependent = null;
|
||||
if (array_key_exists('core', $data)) {
|
||||
[$coreRequires, $coreTested, $coreIndependent] = Component::parseCore($data['core'], "el manifiesto '{$origin}'");
|
||||
}
|
||||
|
||||
return new self(
|
||||
name: $name,
|
||||
version: $version,
|
||||
description: is_string($data['description'] ?? null) ? $data['description'] : '',
|
||||
components: $components,
|
||||
default: $default,
|
||||
coreRequires: $data['core']['requires'] ?? null,
|
||||
coreTested: $data['core']['tested'] ?? null,
|
||||
coreRequires: $coreRequires,
|
||||
coreTested: $coreTested,
|
||||
php: is_string($data['php'] ?? null) ? $data['php'] : null,
|
||||
postInstall: $postInstall,
|
||||
coreIndependent: $coreIndependent,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -140,22 +148,37 @@ final class Manifest
|
||||
return $this->default;
|
||||
}
|
||||
|
||||
public function coreRequirement(?string $component = null): ?string
|
||||
/**
|
||||
* Bloque de core efectivo: si el componente declara `core` (rango o
|
||||
* "none") ese bloque gana por completo; si no, hereda el del paquete.
|
||||
*
|
||||
* @return array{requires: ?string, tested: ?string, independent: ?bool}
|
||||
*/
|
||||
private function coreBlock(?string $component): array
|
||||
{
|
||||
if ($component !== null) {
|
||||
return $this->component($component)->coreRequires ?? $this->coreRequires;
|
||||
$c = $this->component($component);
|
||||
if ($c->coreDeclared) {
|
||||
return ['requires' => $c->coreRequires, 'tested' => $c->coreTested, 'independent' => $c->coreIndependent];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->coreRequires;
|
||||
return ['requires' => $this->coreRequires, 'tested' => $this->coreTested, 'independent' => $this->coreIndependent];
|
||||
}
|
||||
|
||||
public function coreRequirement(?string $component = null): ?string
|
||||
{
|
||||
return $this->coreBlock($component)['requires'];
|
||||
}
|
||||
|
||||
public function testedCore(?string $component = null): ?string
|
||||
{
|
||||
if ($component !== null) {
|
||||
return $this->component($component)->coreTested ?? $this->coreTested;
|
||||
}
|
||||
return $this->coreBlock($component)['tested'];
|
||||
}
|
||||
|
||||
return $this->coreTested;
|
||||
public function coreIndependent(?string $component = null): bool
|
||||
{
|
||||
return $this->coreBlock($component)['independent'] === true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user