fix xdebug option

This commit is contained in:
Tomas Votruba 2019-10-31 00:16:41 +01:00
parent 099fdcc05b
commit 46948a4fe7
2 changed files with 9 additions and 8 deletions

View File

@ -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;

View File

@ -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);
}
}
}