Skip to content

Commit

Permalink
Merge pull request #39183 from shdehnavi/refactor_core_command_app
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Feb 23, 2024
2 parents 816ddaf + 3658894 commit f40c2a0
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions core/Command/App/Disable.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private function disableApp(string $appId, OutputInterface $output): void {
* @param CompletionContext $context
* @return string[]
*/
public function completeOptionValues($optionName, CompletionContext $context) {
public function completeOptionValues($optionName, CompletionContext $context): array {
return [];
}

Expand All @@ -92,7 +92,7 @@ public function completeOptionValues($optionName, CompletionContext $context) {
* @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());
}
Expand Down
4 changes: 2 additions & 2 deletions core/Command/App/Enable.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private function resolveGroupIds(array $groupIds): array {
* @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();
Expand All @@ -160,7 +160,7 @@ public function completeOptionValues($optionName, CompletionContext $context) {
* @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));
Expand Down
4 changes: 2 additions & 2 deletions core/Command/App/GetPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
use Symfony\Component\Console\Output\OutputInterface;

class GetPath extends Base {
protected function configure() {
protected function configure(): void {
parent::configure();

$this
Expand Down Expand Up @@ -67,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
* @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();
}
Expand Down
2 changes: 1 addition & 1 deletion core/Command/App/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
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')
Expand Down
8 changes: 4 additions & 4 deletions core/Command/App/ListApps.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(
parent::__construct();
}

protected function configure() {
protected function configure(): void {
parent::configure();

$this
Expand Down Expand Up @@ -98,7 +98,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
* @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:');
Expand All @@ -119,7 +119,7 @@ protected function writeAppList(InputInterface $input, OutputInterface $output,
* @param CompletionContext $context
* @return array
*/
public function completeOptionValues($optionName, CompletionContext $context) {
public function completeOptionValues($optionName, CompletionContext $context): array {
if ($optionName === 'shipped') {
return ['true', 'false'];
}
Expand All @@ -131,7 +131,7 @@ public function completeOptionValues($optionName, CompletionContext $context) {
* @param CompletionContext $context
* @return string[]
*/
public function completeArgumentValues($argumentName, CompletionContext $context) {
public function completeArgumentValues($argumentName, CompletionContext $context): array {
return [];
}
}
6 changes: 3 additions & 3 deletions core/Command/App/Remove.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(
parent::__construct();
}

protected function configure() {
protected function configure(): void {
$this
->setName('app:remove')
->setDescription('remove an app')
Expand Down Expand Up @@ -124,7 +124,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
* @param CompletionContext $context
* @return string[]
*/
public function completeOptionValues($optionName, CompletionContext $context) {
public function completeOptionValues($optionName, CompletionContext $context): array {
return [];
}

Expand All @@ -133,7 +133,7 @@ public function completeOptionValues($optionName, CompletionContext $context) {
* @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();
}
Expand Down
2 changes: 1 addition & 1 deletion core/Command/App/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(
parent::__construct();
}

protected function configure() {
protected function configure(): void {
$this
->setName('app:update')
->setDescription('update an app or all apps')
Expand Down

0 comments on commit f40c2a0

Please sign in to comment.