1
0
Fork 0

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

pull/9278/head
Jordi Boggiano 2020-10-12 12:31:54 +02:00
parent d204eb4814
commit 09ef026d43
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
10 changed files with 17 additions and 83 deletions

View File

@ -28,6 +28,7 @@
- packages are now wrapped into a `"packages"` top level key instead of the whole file being the package array - 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 - 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 - 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 - `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 - `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 - `InitCommand::determineRequirements`'s fourth argument (phpVersion) should now receive a complete PlatformRepository instance or null if platform requirements are to be ignored

View File

@ -19,7 +19,7 @@ use Composer\Package\PackageInterface;
* *
* @author Konstantin Kudryashov <ever.zet@gmail.com> * @author Konstantin Kudryashov <ever.zet@gmail.com>
*/ */
class InstallOperation extends SolverOperation class InstallOperation implements OperationInterface
{ {
protected $package; protected $package;
@ -27,12 +27,9 @@ class InstallOperation extends SolverOperation
* Initializes operation. * Initializes operation.
* *
* @param PackageInterface $package package instance * @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; $this->package = $package;
} }

View File

@ -20,7 +20,7 @@ use Composer\Package\PackageInterface;
* *
* @author Nils Adermann <naderman@naderman.de> * @author Nils Adermann <naderman@naderman.de>
*/ */
class MarkAliasInstalledOperation extends SolverOperation class MarkAliasInstalledOperation implements OperationInterface
{ {
protected $package; protected $package;
@ -28,12 +28,9 @@ class MarkAliasInstalledOperation extends SolverOperation
* Initializes operation. * Initializes operation.
* *
* @param AliasPackage $package package instance * @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; $this->package = $package;
} }

View File

@ -20,7 +20,7 @@ use Composer\Package\PackageInterface;
* *
* @author Nils Adermann <naderman@naderman.de> * @author Nils Adermann <naderman@naderman.de>
*/ */
class MarkAliasUninstalledOperation extends SolverOperation class MarkAliasUninstalledOperation implements OperationInterface
{ {
protected $package; protected $package;
@ -28,12 +28,9 @@ class MarkAliasUninstalledOperation extends SolverOperation
* Initializes operation. * Initializes operation.
* *
* @param AliasPackage $package package instance * @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; $this->package = $package;
} }

View File

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

View File

@ -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;
}
}

View File

@ -19,7 +19,7 @@ use Composer\Package\PackageInterface;
* *
* @author Konstantin Kudryashov <ever.zet@gmail.com> * @author Konstantin Kudryashov <ever.zet@gmail.com>
*/ */
class UninstallOperation extends SolverOperation class UninstallOperation implements OperationInterface
{ {
protected $package; protected $package;
@ -27,12 +27,9 @@ class UninstallOperation extends SolverOperation
* Initializes operation. * Initializes operation.
* *
* @param PackageInterface $package package instance * @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; $this->package = $package;
} }

View File

@ -20,7 +20,7 @@ use Composer\Package\Version\VersionParser;
* *
* @author Konstantin Kudryashov <ever.zet@gmail.com> * @author Konstantin Kudryashov <ever.zet@gmail.com>
*/ */
class UpdateOperation extends SolverOperation class UpdateOperation implements OperationInterface
{ {
protected $initialPackage; protected $initialPackage;
protected $targetPackage; protected $targetPackage;
@ -30,12 +30,9 @@ class UpdateOperation extends SolverOperation
* *
* @param PackageInterface $initial initial package * @param PackageInterface $initial initial package
* @param PackageInterface $target target package (updated) * @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->initialPackage = $initial;
$this->targetPackage = $target; $this->targetPackage = $target;
} }

View File

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

View File

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