Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DebugBundle][VarDumper] Fix server dumper placeholder command #26955

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

Merged
merged 1 commit into from
May 1, 2018
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bundle\DebugBundle\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
Expand All @@ -24,15 +25,22 @@
*
* @internal
*/
class ServerDumpPlaceholderCommand extends ServerDumpCommand
class ServerDumpPlaceholderCommand extends Command
{
private $replacedCommand;

public function __construct(DumpServer $server = null, array $descriptors = array())
Copy link
Contributor

Choose a reason for hiding this comment

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

"server" never used. Here for BC? Maybe add a comment about that fact?

Copy link
Contributor Author

@ogizanagi ogizanagi Apr 18, 2018

Choose a reason for hiding this comment

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

That's only an internal command, no BC implications here.
No, actually as described in the PR description, this is a placeholder command that matches the replaced command's constructor signature (ServerDumpCommand) so we can just swap the class when the ServerDumper service cannot be wired.

{
parent::__construct(new class() extends DumpServer {
public function __construct()
{
}
}, $descriptors);
$this->replacedCommand = new ServerDumpCommand((new \ReflectionClass(DumpServer::class))->newInstanceWithoutConstructor(), $descriptors);

parent::__construct();
}

protected function configure()
{
$this->setDefinition($this->replacedCommand->getDefinition());
$this->setHelp($this->replacedCommand->getHelp());
$this->setDescription($this->replacedCommand->getDescription());
}

protected function execute(InputInterface $input, OutputInterface $output)
Expand Down