Verified Commit 45b79c6d authored by Elias Häußler's avatar Elias Häußler 🐛
Browse files

[BUGFIX] Ensure Composer dependencies are loaded

parent 7f2406bb
......@@ -44,6 +44,7 @@ class Plugin implements PluginInterface, EventSubscriberInterface
public function activate(Composer $composer, IOInterface $io): void
{
$this->loadDependencies($composer);
$this->reporter = new Reporter($composer, $io);
}
......@@ -62,4 +63,21 @@ class Plugin implements PluginInterface, EventSubscriberInterface
$this->reporter->report($event->getUpdateCheckResult());
}
}
/**
* Load required Composer dependencies.
*
* Loads all required Composer dependencies to make sure following code can be safely executed.
* This is required as the main autoloader has not yed loaded required functions, but only
* classes. As those functions are required, they have to be loaded manually.
*
* @param Composer $composer
* @see https://github.com/composer/composer/issues/5998#issuecomment-269447326
*/
private function loadDependencies(Composer $composer): void
{
$vendorDir = $composer->getConfig()->get('vendor-dir');
/** @noinspection PhpIncludeInspection */
require $vendorDir . '/autoload.php';
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment