Skip to content

Commit 608f4d6

Browse files
authored
Merge pull request #31 from totten/master-symfony-7
Update `Command` classes for Symfony 7 compatibility (#28)
2 parents 904f101 + a30a1d9 commit 608f4d6

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/Command/CompileCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Civi\CompilePlugin\TaskRunner;
77
use Civi\CompilePlugin\Util\EnvHelper;
88
use Composer\Script\ScriptEvents;
9+
use Symfony\Component\Console\Command\Command;
910
use Symfony\Component\Console\Input\InputArgument;
1011
use Symfony\Component\Console\Input\InputInterface;
1112
use Symfony\Component\Console\Input\InputOption;
@@ -37,7 +38,7 @@ protected function configure()
3738
protected function initialize(
3839
InputInterface $input,
3940
OutputInterface $output
40-
) {
41+
): void {
4142
$so = $input->getOption('soft-options');
4243
if ($so) {
4344
$json = json_decode(base64_decode($so), 1);
@@ -51,7 +52,7 @@ protected function initialize(
5152
parent::initialize($input, $output);
5253
}
5354

54-
protected function execute(InputInterface $input, OutputInterface $output)
55+
protected function execute(InputInterface $input, OutputInterface $output): int
5556
{
5657
if ($output->isVerbose()) {
5758
EnvHelper::set('COMPOSER_COMPILE_PASSTHRU', 'always');
@@ -75,6 +76,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
7576
} else {
7677
$taskRunner->runDefault($taskList, $input->getOption('dry-run'));
7778
}
78-
return 0;
79+
return Command::SUCCESS;
7980
}
8081
}

src/Command/CompileListCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Civi\CompilePlugin\TaskList;
66
use Civi\CompilePlugin\TaskRunner;
77
use Civi\CompilePlugin\Util\TaskUIHelper;
8+
use Symfony\Component\Console\Command\Command;
89
use Symfony\Component\Console\Input\InputInterface;
910
use Symfony\Component\Console\Input\InputOption;
1011
use Symfony\Component\Console\Output\OutputInterface;
@@ -23,7 +24,7 @@ protected function configure()
2324
;
2425
}
2526

26-
protected function execute(InputInterface $input, OutputInterface $output)
27+
protected function execute(InputInterface $input, OutputInterface $output): int
2728
{
2829
$taskList = new TaskList($this->getComposer(), $this->getIO());
2930
$taskList->load();
@@ -42,6 +43,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
4243
} else {
4344
$output->write(TaskUIHelper::formatTaskTable($tasks, ['active', 'id', 'title', 'action']));
4445
}
45-
return 0;
46+
return Command::SUCCESS;
4647
}
4748
}

src/Command/CompileWatchCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Civi\CompilePlugin\Util\ShellRunner;
99
use Composer\EventDispatcher\ScriptExecutionException;
1010
use Lurker\ResourceWatcher;
11+
use Symfony\Component\Console\Command\Command;
1112
use Symfony\Component\Console\Input\InputInterface;
1213
use Symfony\Component\Console\Input\InputOption;
1314
use Symfony\Component\Console\Output\OutputInterface;
@@ -27,7 +28,7 @@ protected function configure()
2728
;
2829
}
2930

30-
protected function execute(InputInterface $input, OutputInterface $output)
31+
protected function execute(InputInterface $input, OutputInterface $output): int
3132
{
3233
if ($output->isVerbose()) {
3334
EnvHelper::set('COMPOSER_COMPILE_PASSTHRU', 'always');
@@ -110,7 +111,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
110111
$output->writeln("Polling", OutputInterface::VERBOSITY_VERY_VERBOSE);
111112
$watcher->start($intervalMicroseconds, $intervalMicroseconds);
112113
}
113-
return 0;
114+
return Command::SUCCESS;
114115
}
115116

116117
/**

0 commit comments

Comments
 (0)