Bläddra i källkod

Refactor core/Command/App

Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
tags/v29.0.0beta1
Hamid Dehnavi 11 månader sedan
förälder
incheckning
81884cf9da

+ 2
- 2
core/Command/App/Disable.php Visa fil

@@ -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());
}

+ 2
- 2
core/Command/App/Enable.php Visa fil

@@ -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));

+ 2
- 2
core/Command/App/GetPath.php Visa fil

@@ -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();
}

+ 8
- 1
core/Command/App/Install.php Visa fil

@@ -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');

+ 4
- 4
core/Command/App/ListApps.php Visa fil

@@ -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 [];
}
}

+ 3
- 3
core/Command/App/Remove.php Visa fil

@@ -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();
}

+ 1
- 1
core/Command/App/Update.php Visa fil

@@ -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')

Laddar…
Avbryt
Spara