Add abandoned flag to show/outdated commands package lists (#10485)

To synchronize `abandoned` information with JSON APIs and the `composer.json` information of a package, we should return the following types: `bool|non-empty-string`.
This will either state if a package is abandoned and, if there is a replacement declared, what replacement package should be used instead.

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
main
Maximilian Bösing 2 years ago committed by GitHub
parent 3ae111140f
commit 1704466b74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -461,8 +461,10 @@ EOT
$packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
}
$packageIsAbandoned = false;
if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
$replacement = is_string($latestPackage->getReplacementPackage())
$replacementPackageName = $latestPackage->getReplacementPackage();
$replacement = $replacementPackageName !== null
? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
: 'No replacement was suggested';
$packageWarning = sprintf(
@ -471,7 +473,10 @@ EOT
$replacement
);
$packageViewData['warning'] = $packageWarning;
$packageIsAbandoned = $replacementPackageName ?? true;
}
$packageViewData['abandoned'] = $packageIsAbandoned;
} else {
$packageViewData['name'] = $package;
$nameLength = max($nameLength, strlen($package));

Loading…
Cancel
Save