bump symfony to 5.4.21

adapt to the new EventDispatcher API
  - Symfony\Component\EventDispatcher => Symfony\Contracts\EventDispatcher
  - dispatch() arguments swap
  - execute() must return int
This commit is contained in:
Joe Nahmias
2023-06-01 23:06:38 -04:00
committed by Frédéric Guillot
parent bb4b547ffe
commit bd7f3d219d
42 changed files with 513 additions and 95 deletions

View File

@@ -22,11 +22,12 @@ class CronjobCommand extends BaseCommand
->setDescription('Execute daily cronjob');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
foreach ($this->commands as $command) {
$job = $this->getApplication()->find($command);
$job->run(new ArrayInput(array('command' => $command)), new NullOutput());
}
return 0;
}
}

View File

@@ -102,7 +102,7 @@ class CssCommand extends BaseCommand
;
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->minifyFiles(self::CSS_SRC_PATH, array_merge(['themes'.DIRECTORY_SEPARATOR.'light.css'], $this->appFiles), 'light.min.css');
$this->minifyFiles(self::CSS_SRC_PATH, array_merge(['themes'.DIRECTORY_SEPARATOR.'dark.css'], $this->appFiles), 'dark.min.css');
@@ -111,6 +111,7 @@ class CssCommand extends BaseCommand
$vendorBundle = concat_files($this->vendorFiles);
file_put_contents('assets/css/vendor.min.css', $vendorBundle);
return 0;
}
private function minifyFiles($folder, array $files, $destination)

View File

@@ -15,9 +15,10 @@ class DatabaseMigrationCommand extends DatabaseVersionCommand
->setDescription('Execute SQL migrations');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
parent::execute($input, $output);
DatabaseProvider::runMigrations($this->container['db']);
return 0;
}
}

View File

@@ -15,9 +15,10 @@ class DatabaseVersionCommand extends BaseCommand
->setDescription('Show database schema version');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln('<info>Current version: '.DatabaseProvider::getSchemaVersion($this->container['db']).'</info>');
$output->writeln('<info>Last version: '.\Schema\VERSION.'</info>');
return 0;
}
}

View File

@@ -23,7 +23,7 @@ class JobCommand extends BaseCommand
;
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$payload = fgets(STDIN);
@@ -31,5 +31,6 @@ class JobCommand extends BaseCommand
$job->unserialize($payload);
JobHandler::getInstance($this->container)->executeJob($job);
return 0;
}
}

View File

@@ -77,7 +77,7 @@ class JsCommand extends BaseCommand
;
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$appBundle = concat_files($this->appFiles);
$vendorBundle = concat_files($this->vendorFiles);
@@ -86,5 +86,6 @@ class JsCommand extends BaseCommand
file_put_contents('assets/js/app.min.js', $minifier->minify());
file_put_contents('assets/js/vendor.min.js', $vendorBundle);
return 0;
}
}

View File

@@ -18,7 +18,7 @@ class LocaleComparatorCommand extends BaseCommand
->setDescription('Compare application translations with the '.self::REF_LOCALE.' locale');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$strings = array();
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(APP_DIR));
@@ -33,6 +33,7 @@ class LocaleComparatorCommand extends BaseCommand
}
$this->compare(array_unique($strings));
return 0;
}
public function show(array $strings)

View File

@@ -17,7 +17,7 @@ class LocaleSyncCommand extends BaseCommand
->setDescription('Synchronize all translations based on the '.self::REF_LOCALE.' locale');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$reference_file = APP_DIR.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.self::REF_LOCALE.DIRECTORY_SEPARATOR.'translations.php';
$reference = include $reference_file;
@@ -30,6 +30,7 @@ class LocaleSyncCommand extends BaseCommand
file_put_contents($filename, $this->updateFile($reference, $filename));
}
}
return 0;
}
public function updateFile(array $reference, $outdated_file)

View File

@@ -19,7 +19,7 @@ class PluginInstallCommand extends BaseCommand
->addArgument('url', InputArgument::REQUIRED, 'Archive URL');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
if (!Installer::isConfigured()) {
throw new LogicException('Kanboard is not configured to install plugins itself');
@@ -29,8 +29,10 @@ class PluginInstallCommand extends BaseCommand
$installer = new Installer($this->container);
$installer->install($input->getArgument('url'));
$output->writeln('<info>Plugin installed successfully</info>');
return 0;
} catch (PluginInstallerException $e) {
$output->writeln('<error>'.$e->getMessage().'</error>');
return 1;
}
}
}

View File

@@ -19,7 +19,7 @@ class PluginUninstallCommand extends BaseCommand
->addArgument('pluginId', InputArgument::REQUIRED, 'Plugin directory name');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
if (!Installer::isConfigured()) {
throw new LogicException('Kanboard is not configured to install plugins itself');
@@ -29,8 +29,10 @@ class PluginUninstallCommand extends BaseCommand
$installer = new Installer($this->container);
$installer->uninstall($input->getArgument('pluginId'));
$output->writeln('<info>Plugin removed successfully</info>');
return 0;
} catch (PluginInstallerException $e) {
$output->writeln('<error>'.$e->getMessage().'</error>');
return 1;
}
}
}

View File

@@ -19,7 +19,7 @@ class PluginUpgradeCommand extends BaseCommand
;
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
if (!Installer::isConfigured()) {
throw new LogicException('Kanboard is not configured to install plugins itself');
@@ -40,6 +40,7 @@ class PluginUpgradeCommand extends BaseCommand
$output->writeln('<info>* Plugin up to date: '.$installedPlugin->getPluginName().'</info>');
}
}
return 0;
}
protected function getPluginDetails(array $availablePlugins, BasePlugin $installedPlugin)

View File

@@ -14,8 +14,9 @@ class ProjectActivityArchiveCommand extends BaseCommand
->setDescription('Remove project activities after one year');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->projectActivityModel->cleanup(strtotime('-1 year'));
return 0;
}
}

View File

@@ -15,7 +15,7 @@ class ProjectArchiveCommand extends BaseCommand
->setDescription('Disable projects not touched during one year');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$projects = $this->db->table(ProjectModel::TABLE)
->eq('is_active', 1)
@@ -26,5 +26,6 @@ class ProjectArchiveCommand extends BaseCommand
$output->writeln('Deactivating project: #'.$project['id'].' - '.$project['name']);
$this->projectModel->disable($project['id']);
}
return 0;
}
}

View File

@@ -19,7 +19,7 @@ class ProjectDailyColumnStatsExportCommand extends BaseCommand
->addArgument('end_date', InputArgument::REQUIRED, 'End date (YYYY-MM-DD)');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$data = $this->projectDailyColumnStatsModel->getAggregatedMetrics(
$input->getArgument('project_id'),
@@ -30,5 +30,6 @@ class ProjectDailyColumnStatsExportCommand extends BaseCommand
if (is_array($data)) {
Csv::output($data);
}
return 0;
}
}

View File

@@ -15,7 +15,7 @@ class ProjectDailyStatsCalculationCommand extends BaseCommand
->setDescription('Calculate daily statistics for all projects');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$projects = $this->projectModel->getAllByStatus(ProjectModel::ACTIVE);
@@ -24,5 +24,6 @@ class ProjectDailyStatsCalculationCommand extends BaseCommand
$this->projectDailyColumnStatsModel->updateTotals($project['id'], date('Y-m-d'));
$this->projectDailyStatsModel->updateTotals($project['id'], date('Y-m-d'));
}
return 0;
}
}

View File

@@ -18,7 +18,7 @@ class ResetPasswordCommand extends BaseCommand
;
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$helper = $this->getHelper('question');
$username = $input->getArgument('username');
@@ -38,6 +38,7 @@ class ResetPasswordCommand extends BaseCommand
if ($this->validatePassword($output, $password, $confirmation)) {
$this->resetPassword($output, $username, $password);
}
return 0;
}
private function validatePassword(OutputInterface $output, $password, $confirmation)

View File

@@ -16,7 +16,7 @@ class ResetTwoFactorCommand extends BaseCommand
->addArgument('username', InputArgument::REQUIRED, 'Username');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$username = $input->getArgument('username');
$userId = $this->userModel->getIdByUsername($username);
@@ -32,5 +32,6 @@ class ResetTwoFactorCommand extends BaseCommand
}
$output->writeln('<info>Two-factor authentication disabled</info>');
return 0;
}
}

View File

@@ -19,7 +19,7 @@ class SubtaskExportCommand extends BaseCommand
->addArgument('end_date', InputArgument::REQUIRED, 'End date (YYYY-MM-DD)');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$data = $this->subtaskExport->export(
$input->getArgument('project_id'),
@@ -30,5 +30,6 @@ class SubtaskExportCommand extends BaseCommand
if (is_array($data)) {
Csv::output($data);
}
return 0;
}
}

View File

@@ -19,7 +19,7 @@ class TaskExportCommand extends BaseCommand
->addArgument('end_date', InputArgument::REQUIRED, 'End date (YYYY-MM-DD)');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$data = $this->taskExport->export(
$input->getArgument('project_id'),
@@ -30,5 +30,6 @@ class TaskExportCommand extends BaseCommand
if (is_array($data)) {
Csv::output($data);
}
return 0;
}
}

View File

@@ -24,7 +24,7 @@ class TaskOverdueNotificationCommand extends BaseCommand
;
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
if ($input->getOption('project')) {
$tasks = $this->taskFinderModel->getOverdueTasksQuery()
@@ -48,6 +48,7 @@ class TaskOverdueNotificationCommand extends BaseCommand
if ($input->getOption('show')) {
$this->showTable($output, $tasks);
}
return 0;
}
public function showTable(OutputInterface $output, array $tasks)

View File

@@ -16,7 +16,7 @@ class TaskTriggerCommand extends BaseCommand
->setDescription('Trigger scheduler event for all tasks');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
foreach ($this->getProjectIds() as $project_id) {
$tasks = $this->taskFinderModel->getAll($project_id);
@@ -27,6 +27,7 @@ class TaskTriggerCommand extends BaseCommand
$this->sendEvent($tasks, $project_id);
}
}
return 0;
}
private function getProjectIds()

View File

@@ -19,7 +19,7 @@ class TransitionExportCommand extends BaseCommand
->addArgument('end_date', InputArgument::REQUIRED, 'End date (YYYY-MM-DD)');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$data = $this->transitionExport->export(
$input->getArgument('project_id'),
@@ -30,5 +30,6 @@ class TransitionExportCommand extends BaseCommand
if (is_array($data)) {
Csv::output($data);
}
return 0;
}
}

View File

@@ -21,8 +21,9 @@ class VersionCommand extends BaseCommand
;
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln(APP_VERSION);
return 0;
}
}

View File

@@ -21,8 +21,9 @@ class WorkerCommand extends BaseCommand
;
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->queueManager->listen();
return 0;
}
}