8000 [Console] Fix bug with $output overloading by wouterj · Pull Request #16621 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] Fix bug with $output overloading #16621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix bug with $output overloading
  • Loading branch information
wouterj committed Nov 21, 2015
commit 43d525e7dc8feb1b723dcea211f3b04696ea225e
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ protected function configure()
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $cliOutput)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not named according to the parent definition. Also inheritdoc will not work this way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, and it makes more sense to me to do the opposite: use OutputInterface $output here, then rename the other variable, like $styleOutput = new SymfonyStyle(...). That's mostly because we tend to always call the argument $output.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weaverryan do you have some ideas for #16000? Thanks!

{
$output = new SymfonyStyle($input, $output);
$output = new SymfonyStyle($input, $cliOutput);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know would such thing be allowed:
75. protected function execute(InputInterface $input, OutputInterface $output) - to leave as is
77. $output = new SymfonyStyle($input, $cliOutput = $output); - replace with this
88. return $command->run($input, $cliOutput); - replace with this


if (!extension_loaded('pcntl')) {
$output->error(array(
Expand All @@ -85,7 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($output->ask('Do you want to execute <info>server:run</info> immediately? [Yn] ', true)) {
$command = $this->getApplication()->find('server:run');

return $command->run($input, $output);
return $command->run($input, $cliOutput);
}

return 1;
Expand Down
0