Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions bin/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

declare(strict_types=1);

use Composer\XdebugHandler\XdebugHandler;
use Nette\Utils\Json;
use Rector\Bootstrap\AutoloadFileParameterResolver;
use Rector\Bootstrap\RectorConfigsResolver;
Expand Down Expand Up @@ -123,6 +124,14 @@ public function loadIfExistsAndNotLoadedYet(string $filePath): void
$autoloadIncluder->autoloadRectorInstalledAsGlobalDependency();
$autoloadIncluder->autoloadFromCommandLine();

// restart without Xdebug before the container is built, so the restarted process does not repeat that work
if (! new ArgvInput()->hasParameterOption('--xdebug')) {
$xdebugHandler = new XdebugHandler('rector');
$xdebugHandler->setPersistent();
$xdebugHandler->check();
unset($xdebugHandler);
}

AutoloadFileParameterResolver::resolveFromArgv($_SERVER['argv']);

$rectorConfigsResolver = new RectorConfigsResolver();
Expand Down
14 changes: 0 additions & 14 deletions src/Console/ConsoleApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Rector\Console;

use Composer\XdebugHandler\XdebugHandler;
use Rector\Application\VersionResolver;
use Rector\ChangesReporting\Output\ConsoleOutputFormatter;
use Rector\Configuration\Option;
Expand Down Expand Up @@ -49,8 +48,6 @@ public function doRun(InputInterface $input, OutputInterface $output): int
return ExitCode::SUCCESS;
}

$this->enableXdebug($input);

$shouldFollowByNewline = false;

// skip in this case, since generate content must be clear from meta-info
Expand Down Expand Up @@ -165,15 +162,4 @@ private function addCustomOptions(InputDefinition $inputDefinition): void
'Clear cache before starting the execution of the command'
));
}

private function enableXdebug(InputInterface $input): void
{
$isXdebugAllowed = $input->hasParameterOption('--xdebug');
if (! $isXdebugAllowed) {
$xdebugHandler = new XdebugHandler('rector');
$xdebugHandler->setPersistent();
$xdebugHandler->check();
unset($xdebugHandler);
}
}
}
Loading