CS fixes, made EventDispatcher optional in factory method
parent
2b2f7e1748
commit
5f2e42ec46
|
@ -18,7 +18,6 @@ use Composer\Installer\ProjectInstaller;
|
|||
use Composer\IO\IOInterface;
|
||||
use Composer\Repository\ComposerRepository;
|
||||
use Composer\Repository\FilesystemRepository;
|
||||
use Composer\Script\EventDispatcher;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
@ -119,8 +118,7 @@ EOT
|
|||
chdir($directory);
|
||||
|
||||
$composer = Factory::create($io);
|
||||
$eventDispatcher = new EventDispatcher($composer, $io);
|
||||
$installer = Installer::create($io, $composer, $eventDispatcher);
|
||||
$installer = Installer::create($io, $composer);
|
||||
|
||||
$installer->run($preferSource);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Command;
|
||||
|
||||
use Composer\Installer;
|
||||
use Composer\Script\EventDispatcher;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
@ -52,15 +51,14 @@ EOT
|
|||
{
|
||||
$composer = $this->getComposer();
|
||||
$io = $this->getApplication()->getIO();
|
||||
$eventDispatcher = new EventDispatcher($composer, $io);
|
||||
$install = Installer::create($io, $composer, $eventDispatcher);
|
||||
$install = Installer::create($io, $composer);
|
||||
|
||||
return $install->run(
|
||||
(Boolean)$input->getOption('prefer-source'),
|
||||
(Boolean)$input->getOption('dry-run'),
|
||||
(Boolean)$input->getOption('verbose'),
|
||||
(Boolean)$input->getOption('no-install-recommends'),
|
||||
(Boolean)$input->getOption('install-suggests')
|
||||
(Boolean) $input->getOption('prefer-source'),
|
||||
(Boolean) $input->getOption('dry-run'),
|
||||
(Boolean) $input->getOption('verbose'),
|
||||
(Boolean) $input->getOption('no-install-recommends'),
|
||||
(Boolean) $input->getOption('install-suggests')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,46 +33,44 @@ use Composer\Repository\RepositoryManager;
|
|||
use Composer\Script\EventDispatcher;
|
||||
use Composer\Script\ScriptEvents;
|
||||
|
||||
/**
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @author Beau Simensen <beau@dflydev.com>
|
||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*/
|
||||
class Installer
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var IOInterface
|
||||
*/
|
||||
protected $io;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var PackageInterface
|
||||
*/
|
||||
protected $package;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var DownloadManager
|
||||
*/
|
||||
protected $downloadManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var RepositoryManager
|
||||
*/
|
||||
protected $repositoryManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Locker
|
||||
*/
|
||||
protected $locker;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var InstallationManager
|
||||
*/
|
||||
protected $installationManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var EventDispatcher
|
||||
*/
|
||||
protected $eventDispatcher;
|
||||
|
@ -102,12 +100,12 @@ class Installer
|
|||
/**
|
||||
* Run installation (or update)
|
||||
*
|
||||
* @param bool $preferSource
|
||||
* @param bool $dryRun
|
||||
* @param bool $verbose
|
||||
* @param bool $noInstallRecommends
|
||||
* @param bool $installSuggests
|
||||
* @param bool $update
|
||||
* @param Boolean $preferSource
|
||||
* @param Boolean $dryRun
|
||||
* @param Boolean $verbose
|
||||
* @param Boolean $noInstallRecommends
|
||||
* @param Boolean $installSuggests
|
||||
* @param Boolean $update
|
||||
* @param RepositoryInterface $additionalInstalledRepository
|
||||
*/
|
||||
public function run($preferSource = false, $dryRun = false, $verbose = false, $noInstallRecommends = false, $installSuggests = false, $update = false, RepositoryInterface $additionalInstalledRepository = null)
|
||||
|
@ -322,8 +320,10 @@ class Installer
|
|||
* @param EventDispatcher $eventDispatcher
|
||||
* @return Installer
|
||||
*/
|
||||
static public function create(IOInterface $io, Composer $composer, EventDispatcher $eventDispatcher)
|
||||
static public function create(IOInterface $io, Composer $composer, EventDispatcher $eventDispatcher = null)
|
||||
{
|
||||
$eventDispatcher = $eventDispatcher ?: new EventDispatcher($composer, $io);
|
||||
|
||||
return new static(
|
||||
$io,
|
||||
$composer->getPackage(),
|
||||
|
|
Loading…
Reference in New Issue