From 9841b6f36e16d2c809dd81bc1c1555e1f1e364b5 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 28 May 2012 00:10:02 +0200 Subject: [PATCH] Extend proper method to register commands at startup --- src/Composer/Console/Application.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 1174c2c90..30f232acd 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -64,7 +64,6 @@ class Application extends BaseApplication */ public function doRun(InputInterface $input, OutputInterface $output) { - $this->registerCommands(); $this->io = new ConsoleIO($input, $output, $this->getHelperSet()); if (version_compare(PHP_VERSION, '5.3.2', '<')) { @@ -106,22 +105,25 @@ class Application extends BaseApplication /** * Initializes all the composer commands */ - protected function registerCommands() + protected function getDefaultCommands() { - $this->add(new Command\AboutCommand()); - $this->add(new Command\DependsCommand()); - $this->add(new Command\InitCommand()); - $this->add(new Command\InstallCommand()); - $this->add(new Command\CreateProjectCommand()); - $this->add(new Command\UpdateCommand()); - $this->add(new Command\SearchCommand()); - $this->add(new Command\ValidateCommand()); - $this->add(new Command\ShowCommand()); - $this->add(new Command\RequireCommand()); + $commands = parent::getDefaultCommands(); + $commands[] = new Command\AboutCommand(); + $commands[] = new Command\DependsCommand(); + $commands[] = new Command\InitCommand(); + $commands[] = new Command\InstallCommand(); + $commands[] = new Command\CreateProjectCommand(); + $commands[] = new Command\UpdateCommand(); + $commands[] = new Command\SearchCommand(); + $commands[] = new Command\ValidateCommand(); + $commands[] = new Command\ShowCommand(); + $commands[] = new Command\RequireCommand(); if ('phar:' === substr(__FILE__, 0, 5)) { - $this->add(new Command\SelfUpdateCommand()); + $commands[] = new Command\SelfUpdateCommand(); } + + return $commands; } /**