Skip to content

Commit 09ef026

Browse files
committed
Remove OperationInterface::getReason, closes #9230, closes #9263
1 parent d204eb4 commit 09ef026

10 files changed

Lines changed: 17 additions & 83 deletions

File tree

UPGRADE-2.0.md

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

src/Composer/DependencyResolver/Operation/InstallOperation.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,17 @@
1919
*
2020
* @author Konstantin Kudryashov <ever.zet@gmail.com>
2121
*/
22-
class InstallOperation extends SolverOperation
22+
class InstallOperation implements OperationInterface
2323
{
2424
protected $package;
2525

2626
/**
2727
* Initializes operation.
2828
*
2929
* @param PackageInterface $package package instance
30-
* @param string $reason operation reason
3130
*/
32-
public function __construct(PackageInterface $package, $reason = null)
31+
public function __construct(PackageInterface $package)
3332
{
34-
parent::__construct($reason);
35-
3633
$this->package = $package;
3734
}
3835

src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,17 @@
2020
*
2121
* @author Nils Adermann <naderman@naderman.de>
2222
*/
23-
class MarkAliasInstalledOperation extends SolverOperation
23+
class MarkAliasInstalledOperation implements OperationInterface
2424
{
2525
protected $package;
2626

2727
/**
2828
* Initializes operation.
2929
*
3030
* @param AliasPackage $package package instance
31-
* @param string $reason operation reason
3231
*/
33-
public function __construct(AliasPackage $package, $reason = null)
32+
public function __construct(AliasPackage $package)
3433
{
35-
parent::__construct($reason);
36-
3734
$this->package = $package;
3835
}
3936

src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,17 @@
2020
*
2121
* @author Nils Adermann <naderman@naderman.de>
2222
*/
23-
class MarkAliasUninstalledOperation extends SolverOperation
23+
class MarkAliasUninstalledOperation implements OperationInterface
2424
{
2525
protected $package;
2626

2727
/**
2828
* Initializes operation.
2929
*
3030
* @param AliasPackage $package package instance
31-
* @param string $reason operation reason
3231
*/
33-
public function __construct(AliasPackage $package, $reason = null)
32+
public function __construct(AliasPackage $package)
3433
{
35-
parent::__construct($reason);
36-
3734
$this->package = $package;
3835
}
3936

src/Composer/DependencyResolver/Operation/OperationInterface.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ interface OperationInterface
2626
*/
2727
public function getOperationType();
2828

29-
/**
30-
* Returns operation reason.
31-
*
32-
* @return string
33-
*/
34-
public function getReason();
35-
3629
/**
3730
* Serializes the operation in a human readable format
3831
*

src/Composer/DependencyResolver/Operation/SolverOperation.php

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/Composer/DependencyResolver/Operation/UninstallOperation.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,17 @@
1919
*
2020
* @author Konstantin Kudryashov <ever.zet@gmail.com>
2121
*/
22-
class UninstallOperation extends SolverOperation
22+
class UninstallOperation implements OperationInterface
2323
{
2424
protected $package;
2525

2626
/**
2727
* Initializes operation.
2828
*
2929
* @param PackageInterface $package package instance
30-
* @param string $reason operation reason
3130
*/
32-
public function __construct(PackageInterface $package, $reason = null)
31+
public function __construct(PackageInterface $package)
3332
{
34-
parent::__construct($reason);
35-
3633
$this->package = $package;
3734
}
3835

src/Composer/DependencyResolver/Operation/UpdateOperation.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @author Konstantin Kudryashov <ever.zet@gmail.com>
2222
*/
23-
class UpdateOperation extends SolverOperation
23+
class UpdateOperation implements OperationInterface
2424
{
2525
protected $initialPackage;
2626
protected $targetPackage;
@@ -30,12 +30,9 @@ class UpdateOperation extends SolverOperation
3030
*
3131
* @param PackageInterface $initial initial package
3232
* @param PackageInterface $target target package (updated)
33-
* @param string $reason update reason
3433
*/
35-
public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
34+
public function __construct(PackageInterface $initial, PackageInterface $target)
3635
{
37-
parent::__construct($reason);
38-
3936
$this->initialPackage = $initial;
4037
$this->targetPackage = $target;
4138
}

src/Composer/DependencyResolver/Transaction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ protected function calculateOperations()
158158
}
159159

160160
foreach ($removeMap as $name => $package) {
161-
array_unshift($operations, new Operation\UninstallOperation($package, null));
161+
array_unshift($operations, new Operation\UninstallOperation($package));
162162
}
163163
foreach ($removeAliasMap as $nameVersion => $package) {
164-
$operations[] = new Operation\MarkAliasUninstalledOperation($package, null);
164+
$operations[] = new Operation\MarkAliasUninstalledOperation($package);
165165
}
166166

167167
$operations = $this->movePluginsToFront($operations);

tests/Composer/Test/Installer/InstallationManagerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function testInstall()
124124
$manager->addInstaller($installer);
125125

126126
$package = $this->createPackageMock();
127-
$operation = new InstallOperation($package, 'test');
127+
$operation = new InstallOperation($package);
128128

129129
$package
130130
->expects($this->once())
@@ -153,7 +153,7 @@ public function testUpdateWithEqualTypes()
153153

154154
$initial = $this->createPackageMock();
155155
$target = $this->createPackageMock();
156-
$operation = new UpdateOperation($initial, $target, 'test');
156+
$operation = new UpdateOperation($initial, $target);
157157

158158
$initial
159159
->expects($this->once())
@@ -221,7 +221,7 @@ public function testUpdateWithNotEqualTypes()
221221
->method('install')
222222
->with($this->repository, $target);
223223

224-
$operation = new UpdateOperation($initial, $target, 'test');
224+
$operation = new UpdateOperation($initial, $target);
225225
$manager->update($this->repository, $operation);
226226
}
227227

@@ -232,7 +232,7 @@ public function testUninstall()
232232
$manager->addInstaller($installer);
233233

234234
$package = $this->createPackageMock();
235-
$operation = new UninstallOperation($package, 'test');
235+
$operation = new UninstallOperation($package);
236236

237237
$package
238238
->expects($this->once())

0 commit comments

Comments
 (0)