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

Uses PHP8's constructor property promotion in core/Command/Encryption #38762

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 7 additions & 12 deletions core/Command/Encryption/ChangeKeyStorageRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,14 @@
use Symfony\Component\Console\Question\ConfirmationQuestion;

class ChangeKeyStorageRoot extends Command {
protected View $rootView;
protected IUserManager $userManager;
protected IConfig $config;
protected Util $util;
protected QuestionHelper $questionHelper;

public function __construct(View $view, IUserManager $userManager, IConfig $config, Util $util, QuestionHelper $questionHelper) {
public function __construct(
protected View $rootView,
protected IUserManager $userManager,
protected IConfig $config,
protected Util $util,
protected QuestionHelper $questionHelper,
) {
parent::__construct();
$this->rootView = $view;
$this->userManager = $userManager;
$this->config = $config;
$this->util = $util;
$this->questionHelper = $questionHelper;
}

protected function configure() {
Expand Down
25 changes: 7 additions & 18 deletions core/Command/Encryption/DecryptAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,17 @@
use Symfony\Component\Console\Question\ConfirmationQuestion;

class DecryptAll extends Command {
protected IManager $encryptionManager;
protected IAppManager $appManager;
protected IConfig $config;
protected QuestionHelper $questionHelper;
protected bool $wasTrashbinEnabled;
protected bool $wasMaintenanceModeEnabled;
protected \OC\Encryption\DecryptAll $decryptAll;
protected bool $wasTrashbinEnabled = false;
protected bool $wasMaintenanceModeEnabled = false;

public function __construct(
IManager $encryptionManager,
IAppManager $appManager,
IConfig $config,
\OC\Encryption\DecryptAll $decryptAll,
QuestionHelper $questionHelper
protected IManager $encryptionManager,
protected IAppManager $appManager,
protected IConfig $config,
protected \OC\Encryption\DecryptAll $decryptAll,
protected QuestionHelper $questionHelper,
) {
parent::__construct();

$this->appManager = $appManager;
$this->encryptionManager = $encryptionManager;
$this->config = $config;
$this->decryptAll = $decryptAll;
$this->questionHelper = $questionHelper;
}

/**
Expand Down
7 changes: 3 additions & 4 deletions core/Command/Encryption/Disable.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@
use Symfony\Component\Console\Output\OutputInterface;

class Disable extends Command {
protected IConfig $config;

public function __construct(IConfig $config) {
public function __construct(
protected IConfig $config,
) {
parent::__construct();
$this->config = $config;
}

protected function configure() {
Expand Down
13 changes: 5 additions & 8 deletions core/Command/Encryption/Enable.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@
use Symfony\Component\Console\Output\OutputInterface;

class Enable extends Command {
protected IConfig $config;
protected IManager $encryptionManager;

public function __construct(IConfig $config, IManager $encryptionManager) {
public function __construct(
protected IConfig $config,
protected IManager $encryptionManager,
) {
parent::__construct();

$this->encryptionManager = $encryptionManager;
$this->config = $config;
}

protected function configure() {
Expand Down Expand Up @@ -70,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 1;
}
$output->writeln('Default module: ' . $defaultModule);

return 0;
}
}
18 changes: 5 additions & 13 deletions core/Command/Encryption/EncryptAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,16 @@
use Symfony\Component\Console\Question\ConfirmationQuestion;

class EncryptAll extends Command {
protected IManager $encryptionManager;
protected IAppManager $appManager;
protected IConfig $config;
protected QuestionHelper $questionHelper;
protected bool $wasTrashbinEnabled = false;
protected bool $wasMaintenanceModeEnabled;
protected bool $wasMaintenanceModeEnabled = false;

public function __construct(
IManager $encryptionManager,
IAppManager $appManager,
IConfig $config,
QuestionHelper $questionHelper
protected IManager $encryptionManager,
protected IAppManager $appManager,
protected IConfig $config,
protected QuestionHelper $questionHelper,
) {
parent::__construct();
$this->appManager = $appManager;
$this->encryptionManager = $encryptionManager;
$this->config = $config;
$this->questionHelper = $questionHelper;
}

/**
Expand Down
9 changes: 2 additions & 7 deletions core/Command/Encryption/ListModules.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,11 @@
use Symfony\Component\Console\Output\OutputInterface;

class ListModules extends Base {
protected IManager $encryptionManager;
protected IConfig $config;

public function __construct(
IManager $encryptionManager,
IConfig $config
protected IManager $encryptionManager,
protected IConfig $config,
) {
parent::__construct();
$this->encryptionManager = $encryptionManager;
$this->config = $config;
}

protected function configure() {
Expand Down
21 changes: 7 additions & 14 deletions core/Command/Encryption/MigrateKeyStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,18 @@
use OCP\Security\ICrypto;
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\Output\OutputInterface;

class MigrateKeyStorage extends Command {
protected View $rootView;
protected IUserManager $userManager;
protected IConfig $config;
protected Util $util;
protected QuestionHelper $questionHelper;
private ICrypto $crypto;

public function __construct(View $view, IUserManager $userManager, IConfig $config, Util $util, ICrypto $crypto) {
public function __construct(
protected View $rootView,
protected IUserManager $userManager,
protected IConfig $config,
protected Util $util,
private ICrypto $crypto,
) {
parent::__construct();
$this->rootView = $view;
$this->userManager = $userManager;
$this->config = $config;
$this->util = $util;
$this->crypto = $crypto;
}

protected function configure() {
Expand Down
9 changes: 2 additions & 7 deletions core/Command/Encryption/SetDefaultModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,11 @@
use Symfony\Component\Console\Output\OutputInterface;

class SetDefaultModule extends Command {
protected IManager $encryptionManager;
protected IConfig $config;

public function __construct(
IManager $encryptionManager,
IConfig $config
protected IManager $encryptionManager,
protected IConfig $config,
) {
parent::__construct();
$this->encryptionManager = $encryptionManager;
$this->config = $config;
}

protected function configure() {
Expand Down
7 changes: 3 additions & 4 deletions core/Command/Encryption/ShowKeyStorageRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
use Symfony\Component\Console\Output\OutputInterface;

class ShowKeyStorageRoot extends Command {
protected Util $util;

public function __construct(Util $util) {
public function __construct(
protected Util $util,
) {
parent::__construct();
$this->util = $util;
}

protected function configure() {
Expand Down
7 changes: 3 additions & 4 deletions core/Command/Encryption/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@
use Symfony\Component\Console\Output\OutputInterface;

class Status extends Base {
protected IManager $encryptionManager;

public function __construct(IManager $encryptionManager) {
public function __construct(
protected IManager $encryptionManager,
) {
parent::__construct();
$this->encryptionManager = $encryptionManager;
}

protected function configure() {
Expand Down