diff options
author | Hamid Dehnavi <hamid.dev.pro@gmail.com> | 2023-07-06 11:30:27 +0330 |
---|---|---|
committer | Faraz Samapoor <f.samapoor@gmail.com> | 2023-09-29 11:37:23 +0330 |
commit | 81884cf9da85cfb7f8b0b36cc5675d7ea72c8c0e (patch) | |
tree | 65cf5227101e571972834a71720bfbf43406d72d /core/Command | |
parent | f8f437072ac13a4556dea18219d55f11466497e5 (diff) | |
download | nextcloud-server-81884cf9da85cfb7f8b0b36cc5675d7ea72c8c0e.tar.gz nextcloud-server-81884cf9da85cfb7f8b0b36cc5675d7ea72c8c0e.zip |
Refactor core/Command/App
Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
Diffstat (limited to 'core/Command')
-rw-r--r-- | core/Command/App/Disable.php | 4 | ||||
-rw-r--r-- | core/Command/App/Enable.php | 4 | ||||
-rw-r--r-- | core/Command/App/GetPath.php | 4 | ||||
-rw-r--r-- | core/Command/App/Install.php | 9 | ||||
-rw-r--r-- | core/Command/App/ListApps.php | 8 | ||||
-rw-r--r-- | core/Command/App/Remove.php | 6 | ||||
-rw-r--r-- | core/Command/App/Update.php | 2 |
7 files changed, 22 insertions, 15 deletions
diff --git a/core/Command/App/Disable.php b/core/Command/App/Disable.php index c5abc6c95cf..53a13765342 100644 --- a/core/Command/App/Disable.php +++ b/core/Command/App/Disable.php @@ -83,7 +83,7 @@ class Disable extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ - public function completeOptionValues($optionName, CompletionContext $context) { + public function completeOptionValues($optionName, CompletionContext $context): array { return []; } @@ -92,7 +92,7 @@ class Disable extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ - public function completeArgumentValues($argumentName, CompletionContext $context) { + public function completeArgumentValues($argumentName, CompletionContext $context): array { if ($argumentName === 'app-id') { return array_diff(\OC_App::getEnabledApps(true, true), $this->appManager->getAlwaysEnabledApps()); } diff --git a/core/Command/App/Enable.php b/core/Command/App/Enable.php index c3ab8be38ce..624b31521ad 100644 --- a/core/Command/App/Enable.php +++ b/core/Command/App/Enable.php @@ -146,7 +146,7 @@ class Enable extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ - public function completeOptionValues($optionName, CompletionContext $context) { + public function completeOptionValues($optionName, CompletionContext $context): array { if ($optionName === 'groups') { return array_map(function (IGroup $group) { return $group->getGID(); @@ -160,7 +160,7 @@ class Enable extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ - public function completeArgumentValues($argumentName, CompletionContext $context) { + public function completeArgumentValues($argumentName, CompletionContext $context): array { if ($argumentName === 'app-id') { $allApps = \OC_App::getAllApps(); return array_diff($allApps, \OC_App::getEnabledApps(true, true)); diff --git a/core/Command/App/GetPath.php b/core/Command/App/GetPath.php index 2ec72385191..ea614070e7d 100644 --- a/core/Command/App/GetPath.php +++ b/core/Command/App/GetPath.php @@ -29,7 +29,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class GetPath extends Base { - protected function configure() { + protected function configure(): void { parent::configure(); $this @@ -67,7 +67,7 @@ class GetPath extends Base { * @param CompletionContext $context * @return string[] */ - public function completeArgumentValues($argumentName, CompletionContext $context) { + public function completeArgumentValues($argumentName, CompletionContext $context): array { if ($argumentName === 'app') { return \OC_App::getAllApps(); } diff --git a/core/Command/App/Install.php b/core/Command/App/Install.php index d87439b3664..a992bdd77f6 100644 --- a/core/Command/App/Install.php +++ b/core/Command/App/Install.php @@ -29,6 +29,8 @@ namespace OC\Core\Command\App; use OC\Installer; use OCP\App\IAppManager; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -36,7 +38,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Install extends Command { - protected function configure() { + protected function configure(): void { $this ->setName('app:install') ->setDescription('install an app') @@ -66,6 +68,11 @@ class Install extends Command { ; } + /** + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + * @throws \Exception + */ protected function execute(InputInterface $input, OutputInterface $output): int { $appId = $input->getArgument('app-id'); $forceEnable = (bool) $input->getOption('force'); diff --git a/core/Command/App/ListApps.php b/core/Command/App/ListApps.php index 24856304afc..2db781418e5 100644 --- a/core/Command/App/ListApps.php +++ b/core/Command/App/ListApps.php @@ -39,7 +39,7 @@ class ListApps extends Base { parent::__construct(); } - protected function configure() { + protected function configure(): void { parent::configure(); $this @@ -98,7 +98,7 @@ class ListApps extends Base { * @param OutputInterface $output * @param array $items */ - protected function writeAppList(InputInterface $input, OutputInterface $output, $items) { + protected function writeAppList(InputInterface $input, OutputInterface $output, $items): void { switch ($input->getOption('output')) { case self::OUTPUT_FORMAT_PLAIN: $output->writeln('Enabled:'); @@ -119,7 +119,7 @@ class ListApps extends Base { * @param CompletionContext $context * @return array */ - public function completeOptionValues($optionName, CompletionContext $context) { + public function completeOptionValues($optionName, CompletionContext $context): array { if ($optionName === 'shipped') { return ['true', 'false']; } @@ -131,7 +131,7 @@ class ListApps extends Base { * @param CompletionContext $context * @return string[] */ - public function completeArgumentValues($argumentName, CompletionContext $context) { + public function completeArgumentValues($argumentName, CompletionContext $context): array { return []; } } diff --git a/core/Command/App/Remove.php b/core/Command/App/Remove.php index 522ddc20e07..5fa05079bd8 100644 --- a/core/Command/App/Remove.php +++ b/core/Command/App/Remove.php @@ -47,7 +47,7 @@ class Remove extends Command implements CompletionAwareInterface { parent::__construct(); } - protected function configure() { + protected function configure(): void { $this ->setName('app:remove') ->setDescription('remove an app') @@ -124,7 +124,7 @@ class Remove extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ - public function completeOptionValues($optionName, CompletionContext $context) { + public function completeOptionValues($optionName, CompletionContext $context): array { return []; } @@ -133,7 +133,7 @@ class Remove extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ - public function completeArgumentValues($argumentName, CompletionContext $context) { + public function completeArgumentValues($argumentName, CompletionContext $context): array { if ($argumentName === 'app-id') { return \OC_App::getAllApps(); } diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php index ca6a6758dbd..c791ca9d771 100644 --- a/core/Command/App/Update.php +++ b/core/Command/App/Update.php @@ -45,7 +45,7 @@ class Update extends Command { parent::__construct(); } - protected function configure() { + protected function configure(): void { $this ->setName('app:update') ->setDescription('update an app or all apps') |