From c109ae9437403c5bd17834c2ee53507c1d1f2ad2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 2 Oct 2024 23:58:31 +0200 Subject: [PATCH] ci: Fix psalm by typing the QuestionHelper Signed-off-by: Joas Schilling --- apps/files_external/lib/Command/Delete.php | 3 +++ core/Command/Background/Delete.php | 2 ++ core/Command/Config/App/SetConfig.php | 2 ++ core/Command/Db/ConvertFilecacheBigInt.php | 2 ++ core/Command/Db/Migrations/GenerateCommand.php | 2 ++ core/Command/Maintenance/RepairShareOwnership.php | 2 ++ core/Command/Preview/Repair.php | 2 ++ 7 files changed, 15 insertions(+) diff --git a/apps/files_external/lib/Command/Delete.php b/apps/files_external/lib/Command/Delete.php index 61e974ff589..3e6ccf751a8 100644 --- a/apps/files_external/lib/Command/Delete.php +++ b/apps/files_external/lib/Command/Delete.php @@ -13,6 +13,7 @@ use OCA\Files_External\Service\UserStoragesService; use OCP\AppFramework\Http; use OCP\IUserManager; use OCP\IUserSession; +use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -26,6 +27,7 @@ class Delete extends Base { protected UserStoragesService $userService, protected IUserSession $userSession, protected IUserManager $userManager, + protected QuestionHelper $questionHelper, ) { parent::__construct(); } @@ -64,6 +66,7 @@ class Delete extends Base { $listInput->setOption('output', $input->getOption('output')); $listCommand->listMounts(null, [$mount], $listInput, $output); + /** @var QuestionHelper $questionHelper */ $questionHelper = $this->getHelper('question'); $question = new ConfirmationQuestion('Delete this mount? [y/N] ', false); diff --git a/core/Command/Background/Delete.php b/core/Command/Background/Delete.php index 41efaf84665..50ae309065b 100644 --- a/core/Command/Background/Delete.php +++ b/core/Command/Background/Delete.php @@ -10,6 +10,7 @@ namespace OC\Core\Command\Background; use OC\Core\Command\Base; use OCP\BackgroundJob\IJobList; +use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -51,6 +52,7 @@ class Delete extends Base { '/^(y|Y)/i' ); + /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); if (!$helper->ask($input, $output, $question)) { $output->writeln('aborted.'); diff --git a/core/Command/Config/App/SetConfig.php b/core/Command/Config/App/SetConfig.php index 461c024d038..b1d1632ff1a 100644 --- a/core/Command/Config/App/SetConfig.php +++ b/core/Command/Config/App/SetConfig.php @@ -12,6 +12,7 @@ use OC\AppConfig; use OCP\Exceptions\AppConfigIncorrectTypeException; use OCP\Exceptions\AppConfigUnknownKeyException; use OCP\IAppConfig; +use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -229,6 +230,7 @@ class SetConfig extends Base { } private function ask(InputInterface $input, OutputInterface $output, string $request): bool { + /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); if ($input->getOption('no-interaction')) { return true; diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php index d16e6d30231..f5028aacaef 100644 --- a/core/Command/Db/ConvertFilecacheBigInt.php +++ b/core/Command/Db/ConvertFilecacheBigInt.php @@ -11,6 +11,7 @@ use OC\DB\SchemaWrapper; use OCP\DB\Types; use OCP\IDBConnection; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; @@ -89,6 +90,7 @@ class ConvertFilecacheBigInt extends Command { $output->writeln('This can take up to hours, depending on the number of files in your instance!'); if ($input->isInteractive()) { + /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); $question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false); diff --git a/core/Command/Db/Migrations/GenerateCommand.php b/core/Command/Db/Migrations/GenerateCommand.php index cd92dc5acd6..ed29412f00b 100644 --- a/core/Command/Db/Migrations/GenerateCommand.php +++ b/core/Command/Db/Migrations/GenerateCommand.php @@ -15,6 +15,7 @@ use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareI use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Exception\RuntimeException; +use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -117,6 +118,7 @@ class {{classname}} extends SimpleMigrationStep { $output->writeln(' - Actual: ' . $version . ''); if ($input->isInteractive()) { + /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); $question = new ConfirmationQuestion('Continue with your given version? (y/n) [n] ', false); diff --git a/core/Command/Maintenance/RepairShareOwnership.php b/core/Command/Maintenance/RepairShareOwnership.php index a24be53b00e..16675545afe 100644 --- a/core/Command/Maintenance/RepairShareOwnership.php +++ b/core/Command/Maintenance/RepairShareOwnership.php @@ -14,6 +14,7 @@ use OCP\IDBConnection; use OCP\IUser; use OCP\IUserManager; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -60,6 +61,7 @@ class RepairShareOwnership extends Command { $output->writeln(''); if (!$noConfirm) { + /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); $question = new ConfirmationQuestion('Repair these shares? [y/N]', false); diff --git a/core/Command/Preview/Repair.php b/core/Command/Preview/Repair.php index 641e204e050..3ccd8231300 100644 --- a/core/Command/Preview/Repair.php +++ b/core/Command/Preview/Repair.php @@ -19,6 +19,7 @@ use OCP\Lock\LockedException; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\ProgressBar; +use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -133,6 +134,7 @@ class Repair extends Command { if ($input->getOption('batch')) { $output->writeln('Batch mode active: migration is started right away.'); } else { + /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); $question = new ConfirmationQuestion('Should the migration be started? (y/[n]) ', false); -- 2.39.5