mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-01 08:50:50 +00:00
a3e534ff19
db2e76b99c
load stubs in config
57 lines
1.8 KiB
PHP
57 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\RectorInstaller;
|
|
|
|
use Composer\Composer;
|
|
use Composer\EventDispatcher\EventSubscriberInterface;
|
|
use Composer\IO\IOInterface;
|
|
use Composer\Plugin\PluginInterface;
|
|
use Composer\Script\Event;
|
|
use Composer\Script\ScriptEvents;
|
|
final class Plugin implements \Composer\Plugin\PluginInterface, \Composer\EventDispatcher\EventSubscriberInterface
|
|
{
|
|
/**
|
|
* @param \Composer\Composer $composer
|
|
* @param \Composer\IO\IOInterface $io
|
|
*/
|
|
public function activate($composer, $io) : void
|
|
{
|
|
}
|
|
/**
|
|
* @param \Composer\Composer $composer
|
|
* @param \Composer\IO\IOInterface $io
|
|
*/
|
|
public function deactivate($composer, $io) : void
|
|
{
|
|
}
|
|
/**
|
|
* @param \Composer\Composer $composer
|
|
* @param \Composer\IO\IOInterface $io
|
|
*/
|
|
public function uninstall($composer, $io) : void
|
|
{
|
|
}
|
|
/**
|
|
* @param \Composer\Script\Event $event
|
|
*/
|
|
public function process($event) : void
|
|
{
|
|
$io = $event->getIO();
|
|
$composer = $event->getComposer();
|
|
$installationManager = $composer->getInstallationManager();
|
|
$repositoryManager = $composer->getRepositoryManager();
|
|
$localRepository = $repositoryManager->getLocalRepository();
|
|
$configurationFile = __DIR__ . '/GeneratedConfig.php';
|
|
$pluginInstaller = new \Rector\RectorInstaller\PluginInstaller(new \Rector\RectorInstaller\LocalFilesystem(), $localRepository, $io, $installationManager, new \Composer\Util\Filesystem(), $configurationFile);
|
|
$pluginInstaller->install();
|
|
}
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public static function getSubscribedEvents() : array
|
|
{
|
|
return [\Composer\Script\ScriptEvents::POST_INSTALL_CMD => 'process', \Composer\Script\ScriptEvents::POST_UPDATE_CMD => 'process'];
|
|
}
|
|
}
|