1
0
Fork 0

refactor: update `SyncHelper::downloadAndInstallPackageSync` (#11496)

* refactor: Widen `SyncHelper::downloadAndInstallPackageSync` parameter signature

* chore: bump `PluginInterface::PLUGIN_API_VERSION` to `2.6.0`
pull/11497/head
Pol Dellaiera 2023-06-06 23:32:39 +02:00 committed by GitHub
parent 8c18de5a41
commit 16bdfe4dae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -32,7 +32,7 @@ interface PluginInterface
*
* @var string
*/
public const PLUGIN_API_VERSION = '2.3.0';
public const PLUGIN_API_VERSION = '2.6.0';
/**
* Apply plugin modifications to Composer

View File

@ -13,6 +13,7 @@
namespace Composer\Util;
use Composer\Downloader\DownloaderInterface;
use Composer\Downloader\DownloadManager;
use Composer\Package\PackageInterface;
use React\Promise\PromiseInterface;
@ -24,13 +25,15 @@ class SyncHelper
* This executes all the required steps and waits for promises to complete
*
* @param Loop $loop Loop instance which you can get from $composer->getLoop()
* @param DownloaderInterface $downloader Downloader instance you can get from $composer->getDownloadManager()->getDownloader('zip') for example
* @param string $path the installation path for the package
* @param PackageInterface $package the package to install
* @param PackageInterface|null $prevPackage the previous package if this is an update and not an initial installation
* @param DownloaderInterface|DownloadManager $downloader DownloadManager instance or Downloader instance you can get from $composer->getDownloadManager()->getDownloader('zip') for example
* @param string $path The installation path for the package
* @param PackageInterface $package The package to install
* @param PackageInterface|null $prevPackage The previous package if this is an update and not an initial installation
*/
public static function downloadAndInstallPackageSync(Loop $loop, DownloaderInterface $downloader, string $path, PackageInterface $package, ?PackageInterface $prevPackage = null): void
public static function downloadAndInstallPackageSync(Loop $loop, $downloader, string $path, PackageInterface $package, ?PackageInterface $prevPackage = null): void
{
assert($downloader instanceof DownloaderInterface || $downloader instanceof DownloadManager);
$type = $prevPackage !== null ? 'update' : 'install';
try {