diff --git a/src/Composer/Command/RequireCommand.php b/src/Composer/Command/RequireCommand.php index 42cf64d54..b67d087d0 100644 --- a/src/Composer/Command/RequireCommand.php +++ b/src/Composer/Command/RequireCommand.php @@ -51,8 +51,7 @@ EOT protected function execute(InputInterface $input, OutputInterface $output) { - $factory = new Factory; - $file = $factory->getComposerFile(); + $file = Factory::getComposerFile(); if (!file_exists($file)) { $output->writeln(''.$file.' not found.'); diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 65f2dd526..2ab506a9c 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -113,7 +113,7 @@ class Factory return $config; } - public function getComposerFile() + public static function getComposerFile() { return getenv('COMPOSER') ?: 'composer.json'; } @@ -171,7 +171,7 @@ class Factory { // load Composer configuration if (null === $localConfig) { - $localConfig = $this->getComposerFile(); + $localConfig = static::getComposerFile(); } if (is_string($localConfig)) {