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

Skip to content

Commit e6f99da

Browse files
bug #26955 [DebugBundle][VarDumper] Fix server dumper placeholder command (ogizanagi)
This PR was merged into the 4.1-dev branch. Discussion ---------- [DebugBundle][VarDumper] Fix server dumper placeholder command | Q | A | ------------- | --- | Branch? | master <!-- see below --> | Bug fix? | no, fixes a deprecation warning | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no, fixes ones <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #26944 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | N/A This placeholder command was addressed in quite an unorthodox fashion and the following fix isn't really better, but I guess that's fine for an internal class. _As a reminder: this command aims to favor discoverability of the `ServerDumpCommand` when listing available commands and by exposing its definition so you can read about it by using `--help`. Execution hints about the `debug.dump_destination` config option required to wire the actual command._ That's the only command for which we're doing this, though. So better keep this placeholder or drop it? Commits ------- 60af39b [DebugBundle][VarDumper] Fix server dumper placeholder command
2 parents 7183c59 + 60af39b commit e6f99da

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/Symfony/Bundle/DebugBundle/Command/ServerDumpPlaceholderCommand.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\DebugBundle\Command;
1313

14+
use Symfony\Component\Console\Command\Command;
1415
use Symfony\Component\Console\Input\InputInterface;
1516
use Symfony\Component\Console\Output\OutputInterface;
1617
use Symfony\Component\Console\Style\SymfonyStyle;
@@ -24,15 +25,22 @@
2425
*
2526
* @internal
2627
*/
27-
class ServerDumpPlaceholderCommand extends ServerDumpCommand
28+
class ServerDumpPlaceholderCommand extends Command
2829
{
30+
private $replacedCommand;
31+
2932
public function __construct(DumpServer $server = null, array $descriptors = array())
3033
{
31-
parent::__construct(new class() extends DumpServer {
32-
public function __construct()
33-
{
34-
}
35-
}, $descriptors);
34+
$this->replacedCommand = new ServerDumpCommand((new \ReflectionClass(DumpServer::class))->newInstanceWithoutConstructor(), $descriptors);
35+
36+
parent::__construct();
37+
}
38+
39+
protected function configure()
40+
{
41+
$this->setDefinition($this->replacedCommand->getDefinition());
42+
$this->setHelp($this->replacedCommand->getHelp());
43+
$this->setDescription($this->replacedCommand->getDescription());
3644
}
3745

3846
protected function execute(InputInterface $input, OutputInterface $output)

0 commit comments

Comments
 (0)