Skip to content

Commit a7e7dee

Browse files
committed
[DX] Define list of allowed implicit commands on ConsoleApplication
1 parent a68a80e commit a7e7dee

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Console/ConsoleApplication.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ final class ConsoleApplication extends Application
2222
{
2323
private const string NAME = 'Rector';
2424

25+
private const ALLOWED_COMMANDS = [
26+
'custom-rule',
27+
'process',
28+
'list',
29+
'setup-ci',
30+
'worker',
31+
'help',
32+
'completion',
33+
];
34+
2535
/**
2636
* @param Command[] $commands
2737
*/
@@ -73,6 +83,8 @@ public function doRun(InputInterface $input, OutputInterface $output): int
7383
$tokens = $privatesAccessor->getPrivateProperty($input, 'tokens');
7484
$tokens = array_merge(['process'], $tokens);
7585
$privatesAccessor->setPrivateProperty($input, 'tokens', $tokens);
86+
} elseif (! in_array($commandName, self::ALLOWED_COMMANDS, true)) {
87+
Assert::fileExists($commandName);
7688
}
7789

7890
return parent::doRun($input, $output);

0 commit comments

Comments
 (0)