Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8138: [Rector] Applied rules from Symfony 5 Rector set lists #385

Merged
merged 17 commits into from
Aug 28, 2024
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Rector] Applied Symfony 5.1 CommandConstantReturnCodeRector
alongosz committed Aug 28, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit aa2711f57fa83ccc50e13f2fb3fc6eb9ae58f23a
2 changes: 1 addition & 1 deletion src/bundle/Core/Command/CheckURLsCommand.php
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
$progress->finish();

return 0;
return Command::SUCCESS;
}

private function getTotalCount(): int
4 changes: 2 additions & 2 deletions src/bundle/Core/Command/CleanupVersionsCommand.php
Original file line number Diff line number Diff line change
@@ -144,7 +144,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($contentIdsCount === 0) {
$output->writeln('<info>There is no content matching the given Criteria.</info>');

return 0;
return Command::SUCCESS;
}

$output->writeln(sprintf(
@@ -225,7 +225,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$contentIdsCount
));

return 0;
return Command::SUCCESS;
}

/**
4 changes: 2 additions & 2 deletions src/bundle/Core/Command/CopySubtreeCommand.php
Original file line number Diff line number Diff line change
@@ -150,7 +150,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
);

if (!$input->getOption('no-interaction') && !$questionHelper->ask($input, $output, $question)) {
return 0;
return Command::SUCCESS;
}

$this->locationService->copySubtree(
@@ -162,7 +162,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
'<info>Finished</info>'
);

return 0;
return Command::SUCCESS;
}

/**
4 changes: 2 additions & 2 deletions src/bundle/Core/Command/DebugConfigResolverCommand.php
Original file line number Diff line number Diff line change
@@ -96,7 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($input->getOption('json')) {
$output->write(json_encode($parameterData));

return 0;
return Command::SUCCESS;
}

$output->writeln('<comment>SiteAccess name:</comment> ' . $this->siteAccess->name);
@@ -111,6 +111,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
)
);

return 0;
return Command::SUCCESS;
}
}
4 changes: 2 additions & 2 deletions src/bundle/Core/Command/DeleteContentTranslationCommand.php
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->repository->rollback();
$this->output->writeln('Reverting and aborting.');

return 0;
return Command::SUCCESS;
}

// Delete Translation
@@ -142,7 +142,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
throw $e;
}

return 0;
return Command::SUCCESS;
}

/**
6 changes: 3 additions & 3 deletions src/bundle/Core/Command/NormalizeImagesPathsCommand.php
Original file line number Diff line number Diff line change
@@ -112,11 +112,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($imagePathsToNormalizeCount === 0) {
$io->success('No paths to normalize.');

return 0;
return Command::SUCCESS;
}

if (!$io->confirm('Do you want to continue?')) {
return 0;
return Command::SUCCESS;
}

$io->writeln('Normalizing image paths. Please wait...');
@@ -135,7 +135,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io->progressFinish();
$io->success('Done!');

return 0;
return Command::SUCCESS;
}

/**
8 changes: 4 additions & 4 deletions src/bundle/Core/Command/RegenerateUrlAliasesCommand.php
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ static function (Repository $repository) {
if ($locationsCount === 0) {
$output->writeln('<info>No location was found. Exiting.</info>');

return 0;
return Command::SUCCESS;
}

if (!$input->getOption('no-interaction')) {
@@ -139,10 +139,10 @@ static function (Repository $repository) {
false
);
if (!$helper->ask($input, $output, $question)) {
return 0;
return Command::SUCCESS;
}
} elseif (!$input->getOption('force')) {
return 1;
return Command::FAILURE;
}

$this->regenerateSystemUrlAliases($output, $locationsCount, $locationIds, $iterationCount);
@@ -156,7 +156,7 @@ static function (Repository $repository) {
$output->writeln("<info>Done. Deleted {$corruptedAliasesCount} entries.</info>");
$output->writeln('<comment>Make sure to clear HTTP cache.</comment>');

return 0;
return Command::SUCCESS;
}

/**
4 changes: 2 additions & 2 deletions src/bundle/Core/Command/ReindexCommand.php
Original file line number Diff line number Diff line change
@@ -220,7 +220,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
EOT);

if (!$io->confirm('Continue?', true)) {
return 0;
return Command::SUCCESS;
}
}

@@ -230,7 +230,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return $this->indexIncrementally($input, $output, $iterationCount, $commit);
}

return 0;
return Command::SUCCESS;
}

/**
10 changes: 5 additions & 5 deletions src/bundle/Core/Command/ResizeOriginalImagesCommand.php
Original file line number Diff line number Diff line change
@@ -156,7 +156,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
)
);

return 0;
return Command::SUCCESS;
}

try {
@@ -169,7 +169,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
)
);

return 0;
return Command::SUCCESS;
}

$query = new Query();
@@ -194,13 +194,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
)
);

return 0;
return Command::SUCCESS;
}

$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('<question>The changes you are going to perform cannot be undone. Remember to do a proper backup before. Would you like to continue?</question> ', false);
if (!$helper->ask($input, $output, $question)) {
return 0;
return Command::SUCCESS;
}

$progressBar = new ProgressBar($output, $totalCount);
@@ -227,7 +227,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
)
);

return 0;
return Command::SUCCESS;
}

/**
16 changes: 8 additions & 8 deletions src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php
Original file line number Diff line number Diff line change
@@ -150,17 +150,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 0;
return Command::SUCCESS;
}

$from = $input->getOption('from');
$to = $input->getOption('to');

if ($from && !$this->validateDateTimeString($from, $output)) {
return 0;
return Command::SUCCESS;
}
if ($to && !$this->validateDateTimeString($to, $output)) {
return 0;
return Command::SUCCESS;
}
if ($from) {
$this->from = $this->dateStringToTimestamp($from);
@@ -192,7 +192,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($count == 0) {
$output->writeln('Nothing to process, exiting.');

return 0;
return Command::SUCCESS;
}

$helper = $this->getHelper('question');
@@ -204,7 +204,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if (!$helper->ask($input, $output, $question)) {
$output->writeln('');

return 0;
return Command::SUCCESS;
}

$progressBar = $this->getProgressBar($count, $output);
@@ -253,7 +253,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
]);
}

return 0;
return Command::SUCCESS;
}

/**
@@ -386,7 +386,7 @@ protected function convertToUtcTimestamp($timestamp)
protected function validateDateTimeString($dateTimeString, OutputInterface $output)
{
try {
new \DateTime($dateTimeString);
new DateTime($dateTimeString);
} catch (\Exception $exception) {
$output->writeln('The --from and --to options must be a valid Date string.');

@@ -498,7 +498,7 @@ private function getPhpPath()
*/
private function dateStringToTimestamp($dateString)
{
$date = new \DateTime($dateString);
$date = new DateTime($dateString);

return $date->getTimestamp();
}
12 changes: 6 additions & 6 deletions src/bundle/IO/Command/MigrateFilesCommand.php
Original file line number Diff line number Diff line change
@@ -96,14 +96,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($input->getOption('list-io-handlers')) {
$this->outputConfiguredHandlers($output);

return 0;
return Command::SUCCESS;
}

$bulkCount = (int)$input->getOption('bulk-count');
if ($bulkCount < 1) {
$output->writeln('The value for --bulk-count must be a positive integer.');

return 0;
return Command::SUCCESS;
}

$output->writeln($this->getProcessedHelp());
@@ -122,7 +122,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

if (!$this->validateHandlerOptions($fromHandlers, $toHandlers, $output)) {
return 0;
return Command::SUCCESS;
}

$output->writeln([
@@ -157,7 +157,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($totalCount === 0) {
$output->writeln('Nothing to process.');

return 0;
return Command::SUCCESS;
}

if (!$input->getOption('no-interaction')) {
@@ -170,7 +170,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if (!$helper->ask($input, $output, $question)) {
$output->writeln('Aborting.');

return 0;
return Command::SUCCESS;
}
}

@@ -181,7 +181,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output
);

return 0;
return Command::SUCCESS;
}

/**
Original file line number Diff line number Diff line change
@@ -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 0;
return Command::SUCCESS;
}
}

@@ -114,7 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->indexData($output, $siteaccess);
}

return 0;
return Command::SUCCESS;
}

private function checkPermissions()