public static function initializePackageManagement(Bootstrap $bootstrap)
{
$packageManager = new PackageManager();
$bootstrap->setEarlyInstance(PackageManagerInterface::class, $packageManager);
// The package:rescan must happen as early as possible, compiletime alone is not enough.
if (isset($_SERVER['argv'][1]) && in_array($_SERVER['argv'][1], ['neos.flow:package:rescan', 'flow:package:rescan'])) {
$packageManager->rescanPackages();
}
$packageManager->initialize($bootstrap);
$bootstrap->getEarlyInstance(ClassLoader::class)->setPackages($packageManager->getActivePackages());
}