refactor: update `SyncHelper::downloadAndInstallPackageSync` (#11496)
* refactor: Widen `SyncHelper::downloadAndInstallPackageSync` parameter signature * chore: bump `PluginInterface::PLUGIN_API_VERSION` to `2.6.0`pull/11497/head
parent
8c18de5a41
commit
16bdfe4dae
|
@ -32,7 +32,7 @@ interface PluginInterface
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PLUGIN_API_VERSION = '2.3.0';
|
public const PLUGIN_API_VERSION = '2.6.0';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply plugin modifications to Composer
|
* Apply plugin modifications to Composer
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
namespace Composer\Util;
|
namespace Composer\Util;
|
||||||
|
|
||||||
use Composer\Downloader\DownloaderInterface;
|
use Composer\Downloader\DownloaderInterface;
|
||||||
|
use Composer\Downloader\DownloadManager;
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
use React\Promise\PromiseInterface;
|
use React\Promise\PromiseInterface;
|
||||||
|
|
||||||
|
@ -23,14 +24,16 @@ class SyncHelper
|
||||||
*
|
*
|
||||||
* This executes all the required steps and waits for promises to complete
|
* 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 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 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 string $path The installation path for the package
|
||||||
* @param PackageInterface $package the package to install
|
* @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 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';
|
$type = $prevPackage !== null ? 'update' : 'install';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue