Skip to content

Commit a06bbac

Browse files
authored
Merge pull request #44 from shoppingflux/source-optional
Allow execution without source
2 parents 3659f5b + ea2aded commit a06bbac

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Console/PHPCSCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ protected function configure()
2121
);
2222
$this->addArgument(
2323
'source',
24-
InputArgument::REQUIRED | InputArgument::IS_ARRAY,
24+
InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
2525
'The source(s) folder(s) to analyse, multiples values allowed'
2626
);
2727
$this->addOption(
@@ -86,7 +86,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8686
'--ignore=' . $input->getOption('ignore'),
8787
];
8888

89-
array_push($options, ...$input->getArgument('source'));
89+
if ($source = $input->getArgument('source')) {
90+
array_push($options, ...$source);
91+
}
9092

9193
if ($input->getOption('exclude')) {
9294
$options[] = '--exclude=' . $input->getOption('exclude');

0 commit comments

Comments
 (0)