From 46948a4fe7594fb52e1955ca9c4c6c4ae2e64d84 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 31 Oct 2019 00:16:41 +0100 Subject: [PATCH] fix xdebug option --- src/Console/Application.php | 9 +++++++++ src/Console/Command/AbstractCommand.php | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Console/Application.php b/src/Console/Application.php index cc3666e1377..d4ae3a054d5 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Rector\Console; +use Composer\XdebugHandler\XdebugHandler; use Jean85\PrettyVersions; use Rector\Configuration\Configuration; use Rector\Console\Output\JsonOutputFormatter; @@ -55,6 +56,14 @@ final class Application extends SymfonyApplication public function doRun(InputInterface $input, OutputInterface $output): int { + // @fixes https://github.com/rectorphp/rector/issues/2205 + $isXdebugAllowed = $input->hasParameterOption('--xdebug'); + if (!$isXdebugAllowed) { + $xdebug = new XdebugHandler('rector', '--ansi'); + $xdebug->check(); + unset($xdebug); + } + $this->configuration->setConfigFilePathFromInput($input); $shouldFollowByNewline = false; diff --git a/src/Console/Command/AbstractCommand.php b/src/Console/Command/AbstractCommand.php index fd9f439b5f2..bf4387f56db 100644 --- a/src/Console/Command/AbstractCommand.php +++ b/src/Console/Command/AbstractCommand.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace Rector\Console\Command; -use Composer\XdebugHandler\XdebugHandler; use Nette\Utils\Strings; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Descriptor\TextDescriptor; @@ -61,12 +60,5 @@ abstract class AbstractCommand extends Command $this->getApplication()->setCatchExceptions(false); } - - // @fixes https://github.com/rectorphp/rector/issues/2205 - if ($input->getOption('xdebug')) { - $xdebug = new XdebugHandler('rector', '--ansi'); - $xdebug->check(); - unset($xdebug); - } } }