From a1d01cbf41132c9a19b8011d9c429e6b617102af Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 11 Nov 2025 10:22:03 +0100 Subject: [PATCH 1/2] help, omit explicit command name as no longer needed --- .github/workflows/compat_test.yaml | 2 +- src/Console/Command/ProcessCommand.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/compat_test.yaml b/.github/workflows/compat_test.yaml index 90766f85ebd..c4e0aa2c08f 100644 --- a/.github/workflows/compat_test.yaml +++ b/.github/workflows/compat_test.yaml @@ -8,7 +8,7 @@ on: pull_request: null jobs: - compate_test: + compat_test: runs-on: ubuntu-latest steps: diff --git a/src/Console/Command/ProcessCommand.php b/src/Console/Command/ProcessCommand.php index c77ddac6427..050268d6652 100644 --- a/src/Console/Command/ProcessCommand.php +++ b/src/Console/Command/ProcessCommand.php @@ -57,19 +57,19 @@ protected function configure(): void <<<'EOF' The %command.name% command will run Rector main feature: - %command.full_name% + vendor/bin/rector To specify a folder or a file, you can run: - %command.full_name% src/Controller + vendor/bin/rector src/Controller You can also dry run to see the changes that Rector will make with the --dry-run option: - %command.full_name% src/Controller --dry-run + vendor/bin/rector src/Controller --dry-run It's also possible to get debug via the --debug option: - %command.full_name% src/Controller --dry-run --debug + vendor/bin/rector src/Controller --dry-run --debug EOF ); From bd04a3b3b5ce3bd8c23eecf58ab32890f60db453 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 11 Nov 2025 10:30:56 +0100 Subject: [PATCH 2/2] remove version option, as not used; --debug is the way --- src/Console/ConsoleApplication.php | 37 ++++++++++--------- .../RectorContainerFactory.php | 2 +- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/Console/ConsoleApplication.php b/src/Console/ConsoleApplication.php index 38bd61600d1..785d3b5a227 100644 --- a/src/Console/ConsoleApplication.php +++ b/src/Console/ConsoleApplication.php @@ -42,13 +42,7 @@ public function __construct(array $commands) public function doRun(InputInterface $input, OutputInterface $output): int { - $isXdebugAllowed = $input->hasParameterOption('--xdebug'); - if (! $isXdebugAllowed) { - $xdebugHandler = new XdebugHandler('rector'); - $xdebugHandler->setPersistent(); - $xdebugHandler->check(); - unset($xdebugHandler); - } + $this->enableXdebug($input); $shouldFollowByNewline = false; @@ -68,14 +62,12 @@ public function doRun(InputInterface $input, OutputInterface $output): int // bin/rector src // bin/rector --only "RemovePhpVersionIdCheckRector" // file_exists() can check directory and file - if (is_string($commandName) - && ( - file_exists($commandName) - || isset($_SERVER['argv'][1]) - && $commandName !== $_SERVER['argv'][1] - // ensure verify has parameter option, eg: --only - && $input->hasParameterOption($_SERVER['argv'][1]) - ) + if (is_string($commandName) && ( + file_exists($commandName) || isset($_SERVER['argv'][1]) + && $commandName !== $_SERVER['argv'][1] + // ensure verify has parameter option, eg: --only + && $input->hasParameterOption($_SERVER['argv'][1]) + ) ) { // prepend command name if implicit $privatesAccessor = new PrivatesAccessor(); @@ -117,7 +109,7 @@ private function removeUnusedOptions(InputDefinition $inputDefinition): void { $options = $inputDefinition->getOptions(); - unset($options['quiet'], $options['no-interaction']); + unset($options['quiet'], $options['verbose'], $options['no-interaction']); $inputDefinition->setOptions($options); } @@ -136,7 +128,7 @@ private function addCustomOptions(InputDefinition $inputDefinition): void Option::DEBUG, null, InputOption::VALUE_NONE, - 'Enable debug verbosity (-vvv)' + 'Enable debug verbosity' )); $inputDefinition->addOption(new InputOption( @@ -158,4 +150,15 @@ private function getDefaultConfigPath(): string { return getcwd() . '/rector.php'; } + + private function enableXdebug(InputInterface $input): void + { + $isXdebugAllowed = $input->hasParameterOption('--xdebug'); + if (! $isXdebugAllowed) { + $xdebugHandler = new XdebugHandler('rector'); + $xdebugHandler->setPersistent(); + $xdebugHandler->check(); + unset($xdebugHandler); + } + } } diff --git a/src/DependencyInjection/RectorContainerFactory.php b/src/DependencyInjection/RectorContainerFactory.php index 4c8492724f1..8e2f7a21296 100644 --- a/src/DependencyInjection/RectorContainerFactory.php +++ b/src/DependencyInjection/RectorContainerFactory.php @@ -4,9 +4,9 @@ namespace Rector\DependencyInjection; -use Rector\Config\RectorConfig; use Rector\Autoloading\BootstrapFilesIncluder; use Rector\Caching\Detector\ChangedFilesDetector; +use Rector\Config\RectorConfig; use Rector\ValueObject\Bootstrap\BootstrapConfigs; final class RectorContainerFactory