From 922034c614a02dfe53b922d40a0bec6c1f59628d Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Fri, 9 Aug 2024 15:35:19 +0200 Subject: [PATCH] Replaced `Command::(SUCCESS|FAILURE)` with `self::(SUCCESS|FAILURE)` --- src/bundle/Core/Command/CheckURLsCommand.php | 2 +- src/bundle/Core/Command/CleanupVersionsCommand.php | 4 ++-- src/bundle/Core/Command/CopySubtreeCommand.php | 4 ++-- .../Core/Command/DebugConfigResolverCommand.php | 4 ++-- .../Core/Command/DeleteContentTranslationCommand.php | 4 ++-- .../Core/Command/ExpireUserPasswordsCommand.php | 4 ++-- .../Core/Command/NormalizeImagesPathsCommand.php | 6 +++--- .../Core/Command/RegenerateUrlAliasesCommand.php | 8 ++++---- src/bundle/Core/Command/ReindexCommand.php | 4 ++-- .../Core/Command/ResizeOriginalImagesCommand.php | 10 +++++----- .../Core/Command/UpdateTimestampsToUTCCommand.php | 12 ++++++------ src/bundle/IO/Command/MigrateFilesCommand.php | 12 ++++++------ .../Command/InstallPlatformCommand.php | 4 ++-- .../Command/ValidatePasswordHashesCommand.php | 2 +- 14 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/bundle/Core/Command/CheckURLsCommand.php b/src/bundle/Core/Command/CheckURLsCommand.php index ab573e074f..c1a4fc357d 100644 --- a/src/bundle/Core/Command/CheckURLsCommand.php +++ b/src/bundle/Core/Command/CheckURLsCommand.php @@ -106,7 +106,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $progress->finish(); - return Command::SUCCESS; + return self::SUCCESS; } private function getTotalCount(): int diff --git a/src/bundle/Core/Command/CleanupVersionsCommand.php b/src/bundle/Core/Command/CleanupVersionsCommand.php index b5f7a1314e..67efa6bbbe 100644 --- a/src/bundle/Core/Command/CleanupVersionsCommand.php +++ b/src/bundle/Core/Command/CleanupVersionsCommand.php @@ -148,7 +148,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($contentIdsCount === 0) { $output->writeln('There is no content matching the given Criteria.'); - return Command::SUCCESS; + return self::SUCCESS; } $output->writeln(sprintf( @@ -229,7 +229,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $contentIdsCount )); - return Command::SUCCESS; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/Command/CopySubtreeCommand.php b/src/bundle/Core/Command/CopySubtreeCommand.php index edab530ab6..a8270b1d55 100644 --- a/src/bundle/Core/Command/CopySubtreeCommand.php +++ b/src/bundle/Core/Command/CopySubtreeCommand.php @@ -152,7 +152,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ); if (!$input->getOption('no-interaction') && !$questionHelper->ask($input, $output, $question)) { - return Command::SUCCESS; + return self::SUCCESS; } $this->locationService->copySubtree( @@ -164,7 +164,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int 'Finished' ); - return Command::SUCCESS; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/Command/DebugConfigResolverCommand.php b/src/bundle/Core/Command/DebugConfigResolverCommand.php index 6bdc9603ce..a796f9b4c6 100644 --- a/src/bundle/Core/Command/DebugConfigResolverCommand.php +++ b/src/bundle/Core/Command/DebugConfigResolverCommand.php @@ -97,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($input->getOption('json')) { $output->write(json_encode($parameterData)); - return Command::SUCCESS; + return self::SUCCESS; } $output->writeln('SiteAccess name: ' . $this->siteAccess->name); @@ -112,6 +112,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int ) ); - return Command::SUCCESS; + return self::SUCCESS; } } diff --git a/src/bundle/Core/Command/DeleteContentTranslationCommand.php b/src/bundle/Core/Command/DeleteContentTranslationCommand.php index cb0737d6aa..9514113014 100644 --- a/src/bundle/Core/Command/DeleteContentTranslationCommand.php +++ b/src/bundle/Core/Command/DeleteContentTranslationCommand.php @@ -127,7 +127,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->repository->rollback(); $this->output->writeln('Reverting and aborting.'); - return Command::SUCCESS; + return self::SUCCESS; } // Delete Translation @@ -144,7 +144,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int throw $e; } - return Command::SUCCESS; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/Command/ExpireUserPasswordsCommand.php b/src/bundle/Core/Command/ExpireUserPasswordsCommand.php index c7dc06e1ad..ca29407ea1 100644 --- a/src/bundle/Core/Command/ExpireUserPasswordsCommand.php +++ b/src/bundle/Core/Command/ExpireUserPasswordsCommand.php @@ -148,7 +148,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($totalCount === 0) { $output->writeln('There are no users matching given criteria'); - return Command::SUCCESS; + return self::SUCCESS; } $output->writeln(sprintf( @@ -213,7 +213,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ); } - return Command::SUCCESS; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/Command/NormalizeImagesPathsCommand.php b/src/bundle/Core/Command/NormalizeImagesPathsCommand.php index 4c5b07608f..e5eeceed8c 100644 --- a/src/bundle/Core/Command/NormalizeImagesPathsCommand.php +++ b/src/bundle/Core/Command/NormalizeImagesPathsCommand.php @@ -113,11 +113,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($imagePathsToNormalizeCount === 0) { $io->success('No paths to normalize.'); - return Command::SUCCESS; + return self::SUCCESS; } if (!$io->confirm('Do you want to continue?')) { - return Command::SUCCESS; + return self::SUCCESS; } $io->writeln('Normalizing image paths. Please wait...'); @@ -136,7 +136,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $io->progressFinish(); $io->success('Done!'); - return Command::SUCCESS; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php b/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php index 8743daf90a..4a59fde16b 100644 --- a/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php +++ b/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php @@ -126,7 +126,7 @@ static function (Repository $repository): int { if ($locationsCount === 0) { $output->writeln('No location was found. Exiting.'); - return Command::SUCCESS; + return self::SUCCESS; } if (!$input->getOption('no-interaction')) { @@ -140,10 +140,10 @@ static function (Repository $repository): int { false ); if (!$helper->ask($input, $output, $question)) { - return Command::SUCCESS; + return self::SUCCESS; } } elseif (!$input->getOption('force')) { - return Command::FAILURE; + return self::FAILURE; } $this->regenerateSystemUrlAliases($output, $locationsCount, $locationIds, $iterationCount); @@ -157,7 +157,7 @@ static function (Repository $repository): int { $output->writeln("Done. Deleted {$corruptedAliasesCount} entries."); $output->writeln('Make sure to clear HTTP cache.'); - return Command::SUCCESS; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/Command/ReindexCommand.php b/src/bundle/Core/Command/ReindexCommand.php index 4b61b8f731..6481e83fe9 100644 --- a/src/bundle/Core/Command/ReindexCommand.php +++ b/src/bundle/Core/Command/ReindexCommand.php @@ -222,7 +222,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int EOT); if (!$io->confirm('Continue?', true)) { - return Command::SUCCESS; + return self::SUCCESS; } } @@ -232,7 +232,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return $this->indexIncrementally($input, $output, $iterationCount, $commit); } - return Command::SUCCESS; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/Command/ResizeOriginalImagesCommand.php b/src/bundle/Core/Command/ResizeOriginalImagesCommand.php index 9ccbaee686..649beac29c 100644 --- a/src/bundle/Core/Command/ResizeOriginalImagesCommand.php +++ b/src/bundle/Core/Command/ResizeOriginalImagesCommand.php @@ -157,7 +157,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ) ); - return Command::SUCCESS; + return self::SUCCESS; } try { @@ -170,7 +170,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ) ); - return Command::SUCCESS; + return self::SUCCESS; } $query = new Query(); @@ -195,13 +195,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int ) ); - return Command::SUCCESS; + return self::SUCCESS; } $helper = $this->getHelper('question'); $question = new ConfirmationQuestion('The changes you are going to perform cannot be undone. Remember to do a proper backup before. Would you like to continue? ', false); if (!$helper->ask($input, $output, $question)) { - return Command::SUCCESS; + return self::SUCCESS; } $progressBar = new ProgressBar($output, $totalCount); @@ -228,7 +228,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ) ); - return Command::SUCCESS; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php b/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php index 36f133a893..d317f520f0 100644 --- a/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php +++ b/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php @@ -153,17 +153,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int sprintf('The selected mode is not supported. Use one of the following modes: %s', implode(', ', array_keys(self::MODES))) ); - return Command::SUCCESS; + return self::SUCCESS; } $from = $input->getOption('from'); $to = $input->getOption('to'); if ($from && !$this->validateDateTimeString($from, $output)) { - return Command::SUCCESS; + return self::SUCCESS; } if ($to && !$this->validateDateTimeString($to, $output)) { - return Command::SUCCESS; + return self::SUCCESS; } if ($from) { $this->from = $this->dateStringToTimestamp($from); @@ -195,7 +195,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($count == 0) { $output->writeln('Nothing to process, exiting.'); - return Command::SUCCESS; + return self::SUCCESS; } $helper = $this->getHelper('question'); @@ -207,7 +207,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (!$helper->ask($input, $output, $question)) { $output->writeln(''); - return Command::SUCCESS; + return self::SUCCESS; } $progressBar = $this->getProgressBar($count, $output); @@ -256,7 +256,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ]); } - return Command::SUCCESS; + return self::SUCCESS; } /** diff --git a/src/bundle/IO/Command/MigrateFilesCommand.php b/src/bundle/IO/Command/MigrateFilesCommand.php index a8fe28e01c..438520952a 100644 --- a/src/bundle/IO/Command/MigrateFilesCommand.php +++ b/src/bundle/IO/Command/MigrateFilesCommand.php @@ -98,14 +98,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($input->getOption('list-io-handlers')) { $this->outputConfiguredHandlers($output); - return Command::SUCCESS; + return self::SUCCESS; } $bulkCount = (int)$input->getOption('bulk-count'); if ($bulkCount < 1) { $output->writeln('The value for --bulk-count must be a positive integer.'); - return Command::SUCCESS; + return self::SUCCESS; } $output->writeln($this->getProcessedHelp()); @@ -124,7 +124,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if (!$this->validateHandlerOptions($fromHandlers, $toHandlers, $output)) { - return Command::SUCCESS; + return self::SUCCESS; } $output->writeln([ @@ -159,7 +159,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($totalCount === 0) { $output->writeln('Nothing to process.'); - return Command::SUCCESS; + return self::SUCCESS; } if (!$input->getOption('no-interaction')) { @@ -172,7 +172,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (!$helper->ask($input, $output, $question)) { $output->writeln('Aborting.'); - return Command::SUCCESS; + return self::SUCCESS; } } @@ -183,7 +183,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output ); - return Command::SUCCESS; + return self::SUCCESS; } /** diff --git a/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php b/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php index 8b9b0a4a7e..2d6d606176 100644 --- a/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php +++ b/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php @@ -88,7 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (!empty($schemaManager->listTables())) { $io = new SymfonyStyle($input, $output); if (!$io->confirm('Running this command will delete data in all Ibexa generated tables. Continue?')) { - return Command::SUCCESS; + return self::SUCCESS; } } @@ -114,7 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->indexData($output, $siteaccess); } - return Command::SUCCESS; + return self::SUCCESS; } private function checkPermissions() diff --git a/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php b/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php index d8c302d2ef..f73a9d7443 100644 --- a/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php +++ b/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php @@ -46,6 +46,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln('OK - All users have supported password hash types'); } - return Command::SUCCESS; + return self::SUCCESS; } }