protected function manipulateRootPackage(array $packages, int $type, array $requires): array
    {
        if ($type === self::ADD) {
            foreach ($packages as $packageName => $version) {
                $requires[$packageName] = new Link(
                    '__root__',
                    $packageName,
                    (new VersionParser())->parseConstraints($version),
                    'relates to',
                    $version
                );
            }
        } elseif ($type === self::REMOVE) {
            foreach ($packages as $packageName => $version) {
                unset($requires[$packageName]);
            }
        }

        return $requires;
    }