Allow Composer to be used without running the application
For [Humbug Box](https://github.com/humbug/box/blob/master/src/Composer/ComposerOrchestrator.php#L30) we are using Composer to dump the autoload. To do so I'm using the `Composer` class from the application: ```php $composer = (new ComposerApplication())->getComposer(); ``` If you do so however this is going to fail because `Application#io` is null instead of being a `IOInterface` instance. Indeed it is initialised only when the application is run. So one solution is to initialised it with a dummy IO and the right IO object will be set when the application is run as usual.pull/7212/head
parent
4d8b9be5b6
commit
b7ab081519
|
@ -12,6 +12,7 @@
|
|||
|
||||
namespace Composer\Console;
|
||||
|
||||
use Composer\IO\NullIO;
|
||||
use Composer\Util\Platform;
|
||||
use Composer\Util\Silencer;
|
||||
use Symfony\Component\Console\Application as BaseApplication;
|
||||
|
@ -85,6 +86,8 @@ class Application extends BaseApplication
|
|||
});
|
||||
}
|
||||
|
||||
$this->io = new NullIO();
|
||||
|
||||
parent::__construct('Composer', Composer::VERSION);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue