@@ -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}
0 commit comments