Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Avoid class loading issues as signature of App class has changed
Browse files Browse the repository at this point in the history
  • Loading branch information
T2L committed Jul 7, 2022
1 parent ce3347b commit 5b7ffbf
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Composer/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,17 @@ public function activate(Composer $composer, IOInterface $io): void {
$classLoader = new ClassLoader();
$configInstallManager = new InstallManager($composer, $io, $config, $classLoader);
$configUpdateManager = new UpdateManager($composer, $io, $config, $classLoader);
$this->setApp(new App($configInstallManager, $configUpdateManager));

// Avoid issues when App is already loaded with a different parameters set.
$constructor = new \ReflectionMethod(App::class, '__construct');
$parameters = $constructor->getParameters();
if ((string) $parameters[0]->getType() !== Composer::class) {
$this->setApp(new App($configInstallManager, $configUpdateManager));
}
else {
// @phpstan-ignore-next-line
$this->setApp(new App($composer, $io, $configInstallManager, $configUpdateManager));
}
}

/**
Expand Down

0 comments on commit 5b7ffbf

Please sign in to comment.