Skip to content

Commit 732ca2a

Browse files
authored
[dx] help - omit explicit command name as no longer needed; remove verbosity option, use debug instead (#7620)
* help, omit explicit command name as no longer needed * remove version option, as not used; --debug is the way
1 parent dfa1141 commit 732ca2a

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

.github/workflows/compat_test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
pull_request: null
99

1010
jobs:
11-
compate_test:
11+
compat_test:
1212
runs-on: ubuntu-latest
1313

1414
steps:

src/Console/Command/ProcessCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,19 @@ protected function configure(): void
5757
<<<'EOF'
5858
The <info>%command.name%</info> command will run Rector main feature:
5959
60-
<info>%command.full_name%</info>
60+
<info>vendor/bin/rector</info>
6161
6262
To specify a folder or a file, you can run:
6363
64-
<info>%command.full_name% src/Controller</info>
64+
<info>vendor/bin/rector src/Controller</info>
6565
6666
You can also dry run to see the changes that Rector will make with the <comment>--dry-run</comment> option:
6767
68-
<info>%command.full_name% src/Controller --dry-run</info>
68+
<info>vendor/bin/rector src/Controller --dry-run</info>
6969
7070
It's also possible to get debug via the <comment>--debug</comment> option:
7171
72-
<info>%command.full_name% src/Controller --dry-run --debug</info>
72+
<info>vendor/bin/rector src/Controller --dry-run --debug</info>
7373
EOF
7474
);
7575

src/Console/ConsoleApplication.php

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,7 @@ public function __construct(array $commands)
4242

4343
public function doRun(InputInterface $input, OutputInterface $output): int
4444
{
45-
$isXdebugAllowed = $input->hasParameterOption('--xdebug');
46-
if (! $isXdebugAllowed) {
47-
$xdebugHandler = new XdebugHandler('rector');
48-
$xdebugHandler->setPersistent();
49-
$xdebugHandler->check();
50-
unset($xdebugHandler);
51-
}
45+
$this->enableXdebug($input);
5246

5347
$shouldFollowByNewline = false;
5448

@@ -68,14 +62,12 @@ public function doRun(InputInterface $input, OutputInterface $output): int
6862
// bin/rector src
6963
// bin/rector --only "RemovePhpVersionIdCheckRector"
7064
// file_exists() can check directory and file
71-
if (is_string($commandName)
72-
&& (
73-
file_exists($commandName)
74-
|| isset($_SERVER['argv'][1])
75-
&& $commandName !== $_SERVER['argv'][1]
76-
// ensure verify has parameter option, eg: --only
77-
&& $input->hasParameterOption($_SERVER['argv'][1])
78-
)
65+
if (is_string($commandName) && (
66+
file_exists($commandName) || isset($_SERVER['argv'][1])
67+
&& $commandName !== $_SERVER['argv'][1]
68+
// ensure verify has parameter option, eg: --only
69+
&& $input->hasParameterOption($_SERVER['argv'][1])
70+
)
7971
) {
8072
// prepend command name if implicit
8173
$privatesAccessor = new PrivatesAccessor();
@@ -117,7 +109,7 @@ private function removeUnusedOptions(InputDefinition $inputDefinition): void
117109
{
118110
$options = $inputDefinition->getOptions();
119111

120-
unset($options['quiet'], $options['no-interaction']);
112+
unset($options['quiet'], $options['verbose'], $options['no-interaction']);
121113

122114
$inputDefinition->setOptions($options);
123115
}
@@ -136,7 +128,7 @@ private function addCustomOptions(InputDefinition $inputDefinition): void
136128
Option::DEBUG,
137129
null,
138130
InputOption::VALUE_NONE,
139-
'Enable debug verbosity (-vvv)'
131+
'Enable debug verbosity'
140132
));
141133

142134
$inputDefinition->addOption(new InputOption(
@@ -158,4 +150,15 @@ private function getDefaultConfigPath(): string
158150
{
159151
return getcwd() . '/rector.php';
160152
}
153+
154+
private function enableXdebug(InputInterface $input): void
155+
{
156+
$isXdebugAllowed = $input->hasParameterOption('--xdebug');
157+
if (! $isXdebugAllowed) {
158+
$xdebugHandler = new XdebugHandler('rector');
159+
$xdebugHandler->setPersistent();
160+
$xdebugHandler->check();
161+
unset($xdebugHandler);
162+
}
163+
}
161164
}

src/DependencyInjection/RectorContainerFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace Rector\DependencyInjection;
66

7-
use Rector\Config\RectorConfig;
87
use Rector\Autoloading\BootstrapFilesIncluder;
98
use Rector\Caching\Detector\ChangedFilesDetector;
9+
use Rector\Config\RectorConfig;
1010
use Rector\ValueObject\Bootstrap\BootstrapConfigs;
1111

1212
final class RectorContainerFactory

0 commit comments

Comments
 (0)