Skip to content

Commit

Permalink
Use instanceof to check if the operation
Browse files Browse the repository at this point in the history
Using getOperationType isn't a good idea as it would break with composer 1. This method would work for both composer 1 and 2.
  • Loading branch information
hussainweb committed Sep 12, 2020
1 parent 907ed7b commit 22397c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Patches.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function gatherPatches(PackageEvent $event) {
$operations = $event->getOperations();
$this->io->write('<info>Gathering patches for dependencies. This might take a minute.</info>');
foreach ($operations as $operation) {
if ($operation->getOperationType() == 'install' || $operation->getOperationType() == 'update') {
if ($operation instanceof InstallOperation || $operation instanceof UpdateOperation) {
$package = $this->getPackageFromOperation($operation);
$extra = $package->getExtra();
if (isset($extra['patches'])) {
Expand Down

0 comments on commit 22397c8

Please sign in to comment.