Remove OperationInterface::getReason, closes #9230, closes #9263

main
Jordi Boggiano 4 years ago
parent d204eb4814
commit 09ef026d43
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -28,6 +28,7 @@
- packages are now wrapped into a `"packages"` top level key instead of the whole file being the package array
- packages now contain an `"installed-path"` key which lists where they were installed
- there is a top level `"dev"` key which stores whether dev requirements were installed or not
- Removed `OperationInterface::getReason` as it the data was not accurate. There is no replacement available.
- `PreFileDownloadEvent` now receives an `HttpDownloader` instance instead of `RemoteFilesystem`, and that instance cannot be overridden by listeners anymore
- `VersionSelector::findBestCandidate`'s third argument (phpVersion) was removed in favor of passing in a complete PlatformRepository instance into the constructor
- `InitCommand::determineRequirements`'s fourth argument (phpVersion) should now receive a complete PlatformRepository instance or null if platform requirements are to be ignored

@ -19,7 +19,7 @@ use Composer\Package\PackageInterface;
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class InstallOperation extends SolverOperation
class InstallOperation implements OperationInterface
{
protected $package;
@ -27,12 +27,9 @@ class InstallOperation extends SolverOperation
* Initializes operation.
*
* @param PackageInterface $package package instance
* @param string $reason operation reason
*/
public function __construct(PackageInterface $package, $reason = null)
public function __construct(PackageInterface $package)
{
parent::__construct($reason);
$this->package = $package;
}

@ -20,7 +20,7 @@ use Composer\Package\PackageInterface;
*
* @author Nils Adermann <naderman@naderman.de>
*/
class MarkAliasInstalledOperation extends SolverOperation
class MarkAliasInstalledOperation implements OperationInterface
{
protected $package;
@ -28,12 +28,9 @@ class MarkAliasInstalledOperation extends SolverOperation
* Initializes operation.
*
* @param AliasPackage $package package instance
* @param string $reason operation reason
*/
public function __construct(AliasPackage $package, $reason = null)
public function __construct(AliasPackage $package)
{
parent::__construct($reason);
$this->package = $package;
}

@ -20,7 +20,7 @@ use Composer\Package\PackageInterface;
*
* @author Nils Adermann <naderman@naderman.de>
*/
class MarkAliasUninstalledOperation extends SolverOperation
class MarkAliasUninstalledOperation implements OperationInterface
{
protected $package;
@ -28,12 +28,9 @@ class MarkAliasUninstalledOperation extends SolverOperation
* Initializes operation.
*
* @param AliasPackage $package package instance
* @param string $reason operation reason
*/
public function __construct(AliasPackage $package, $reason = null)
public function __construct(AliasPackage $package)
{
parent::__construct($reason);
$this->package = $package;
}

@ -26,13 +26,6 @@ interface OperationInterface
*/
public function getOperationType();
/**
* Returns operation reason.
*
* @return string
*/
public function getReason();
/**
* Serializes the operation in a human readable format
*

@ -1,45 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\DependencyResolver\Operation;
use Composer\Package\PackageInterface;
/**
* Abstract solver operation class.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
abstract class SolverOperation implements OperationInterface
{
protected $reason;
/**
* Initializes operation.
*
* @param string $reason operation reason
*/
public function __construct($reason = null)
{
$this->reason = $reason;
}
/**
* Returns operation reason.
*
* @return string
*/
public function getReason()
{
return $this->reason;
}
}

@ -19,7 +19,7 @@ use Composer\Package\PackageInterface;
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class UninstallOperation extends SolverOperation
class UninstallOperation implements OperationInterface
{
protected $package;
@ -27,12 +27,9 @@ class UninstallOperation extends SolverOperation
* Initializes operation.
*
* @param PackageInterface $package package instance
* @param string $reason operation reason
*/
public function __construct(PackageInterface $package, $reason = null)
public function __construct(PackageInterface $package)
{
parent::__construct($reason);
$this->package = $package;
}

@ -20,7 +20,7 @@ use Composer\Package\Version\VersionParser;
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class UpdateOperation extends SolverOperation
class UpdateOperation implements OperationInterface
{
protected $initialPackage;
protected $targetPackage;
@ -30,12 +30,9 @@ class UpdateOperation extends SolverOperation
*
* @param PackageInterface $initial initial package
* @param PackageInterface $target target package (updated)
* @param string $reason update reason
*/
public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
public function __construct(PackageInterface $initial, PackageInterface $target)
{
parent::__construct($reason);
$this->initialPackage = $initial;
$this->targetPackage = $target;
}

@ -158,10 +158,10 @@ class Transaction
}
foreach ($removeMap as $name => $package) {
array_unshift($operations, new Operation\UninstallOperation($package, null));
array_unshift($operations, new Operation\UninstallOperation($package));
}
foreach ($removeAliasMap as $nameVersion => $package) {
$operations[] = new Operation\MarkAliasUninstalledOperation($package, null);
$operations[] = new Operation\MarkAliasUninstalledOperation($package);
}
$operations = $this->movePluginsToFront($operations);

@ -124,7 +124,7 @@ class InstallationManagerTest extends TestCase
$manager->addInstaller($installer);
$package = $this->createPackageMock();
$operation = new InstallOperation($package, 'test');
$operation = new InstallOperation($package);
$package
->expects($this->once())
@ -153,7 +153,7 @@ class InstallationManagerTest extends TestCase
$initial = $this->createPackageMock();
$target = $this->createPackageMock();
$operation = new UpdateOperation($initial, $target, 'test');
$operation = new UpdateOperation($initial, $target);
$initial
->expects($this->once())
@ -221,7 +221,7 @@ class InstallationManagerTest extends TestCase
->method('install')
->with($this->repository, $target);
$operation = new UpdateOperation($initial, $target, 'test');
$operation = new UpdateOperation($initial, $target);
$manager->update($this->repository, $operation);
}
@ -232,7 +232,7 @@ class InstallationManagerTest extends TestCase
$manager->addInstaller($installer);
$package = $this->createPackageMock();
$operation = new UninstallOperation($package, 'test');
$operation = new UninstallOperation($package);
$package
->expects($this->once())

Loading…
Cancel
Save