|
3 | 3 | namespace Drupal\Composer\Plugin\Scaffold;
|
4 | 4 |
|
5 | 5 | use Composer\Composer;
|
6 |
| -use Composer\DependencyResolver\Operation\OperationInterface; |
7 | 6 | use Composer\Installer\PackageEvent;
|
8 | 7 | use Composer\IO\IOInterface;
|
9 | 8 | use Composer\Package\PackageInterface;
|
@@ -101,8 +100,7 @@ public function event(PackageEvent $event) {
|
101 | 100 | // which of the newly-installed packages have scaffold operations, and
|
102 | 101 | // whether or not they are allowed to scaffold by the allowed-packages
|
103 | 102 | // option in the root-level composer.json file.
|
104 |
| - $operationType = $this->getOperationType($operation); |
105 |
| - $package = $operationType === 'update' ? $operation->getTargetPackage() : $operation->getPackage(); |
| 103 | + $package = $operation->getOperationType() === 'update' ? $operation->getTargetPackage() : $operation->getPackage(); |
106 | 104 | if (ScaffoldOptions::hasOptions($package->getExtra())) {
|
107 | 105 | $this->newPackages[$package->getName()] = $package;
|
108 | 106 | }
|
@@ -181,26 +179,6 @@ protected function evaluateNewPackages(array $allowed_packages) {
|
181 | 179 | return $allowed_packages;
|
182 | 180 | }
|
183 | 181 |
|
184 |
| - /** |
185 |
| - * Determine the type of the provided operation. |
186 |
| - * |
187 |
| - * Adjusts API used for Composer 1 or Composer 2. |
188 |
| - * |
189 |
| - * @param \Composer\DependencyResolver\Operation\OperationInterface $operation |
190 |
| - * The operation object. |
191 |
| - * |
192 |
| - * @return string |
193 |
| - * The operation type. |
194 |
| - */ |
195 |
| - protected function getOperationType(OperationInterface $operation) { |
196 |
| - // Use Composer 2 method. |
197 |
| - if (method_exists($operation, 'getOperationType')) { |
198 |
| - return $operation->getOperationType(); |
199 |
| - } |
200 |
| - // Fallback to Composer 1 method. |
201 |
| - return $operation->getJobType(); |
202 |
| - } |
203 |
| - |
204 | 182 | /**
|
205 | 183 | * Retrieves a package from the current composer process.
|
206 | 184 | *
|
|
0 commit comments