Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This pull request:
Summary
The existing Robo DI container adds a reference to the $input and $output objects. Application::run() also takes $input and $output as parameters. What happens, then, if you want to call Application::run() multiple times with different $input and $output objects?
The answer is that some of the code will use the correct $input and $output objects, but other code will use whatever $input and $output were injected into the DI container, which would produce incorrect results. It would be better to simply not have any reference to $input and $output in the DI container at all; however, a lot of objects inject the logger, which needs $output, and a lot of commands implement IOAwareInterface, which has references to both.
This PR allows commands to take a SymfonyStyle object as a parameter, so that they do not need to use $this->io() any longer. Efforts are also made to keep the IO object updated when Application::run() is called for use by legacy applications. Some updates may be needed to "Robo as a Framework" applications in order for the legacy support to work right; however, legacy applications will not behave any worse than they currently do (references to $input and $output for IOAwareInterface objects will come from the DI container if the updates are not made).
Maybe in Robo 2.x we might be able to not inject $input and $output into the DI container at all, and require classes to either use SymfonyStyle parameter injection, or use IOAwareInterface. Direct access to OutputAwareInterface / InputAwareInterface is deprecated.
We also use the logger manager to remove references to $output from the logger. We create a logger at Application::run() time, when $output is available, and add that to the logger manager.