aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFaraz Samapoor <fsa@adlas.at>2023-06-12 17:52:30 +0330
committerLouis <6653109+artonge@users.noreply.github.com>2023-06-20 16:24:46 +0200
commitf9a9ad50c3f4cc49db42d62430331f175de13a70 (patch)
treee3aa45f7bcd1a7d33a006028115ffd70e2674b6a
parent14ac281acf143606c54e59e3641c9d0d898e5f95 (diff)
downloadnextcloud-server-f9a9ad50c3f4cc49db42d62430331f175de13a70.tar.gz
nextcloud-server-f9a9ad50c3f4cc49db42d62430331f175de13a70.zip
Uses PHP8's constructor property promotion in core/Command/Encryption classes.
Signed-off-by: Faraz Samapoor <fsa@adlas.at>
-rw-r--r--core/Command/Encryption/ChangeKeyStorageRoot.php19
-rw-r--r--core/Command/Encryption/DecryptAll.php21
-rw-r--r--core/Command/Encryption/Disable.php5
-rw-r--r--core/Command/Encryption/Enable.php13
-rw-r--r--core/Command/Encryption/EncryptAll.php16
-rw-r--r--core/Command/Encryption/ListModules.php9
-rw-r--r--core/Command/Encryption/MigrateKeyStorage.php20
-rw-r--r--core/Command/Encryption/SetDefaultModule.php9
-rw-r--r--core/Command/Encryption/ShowKeyStorageRoot.php5
-rw-r--r--core/Command/Encryption/Status.php5
10 files changed, 35 insertions, 87 deletions
diff --git a/core/Command/Encryption/ChangeKeyStorageRoot.php b/core/Command/Encryption/ChangeKeyStorageRoot.php
index 6ae59421a69..96884de25e9 100644
--- a/core/Command/Encryption/ChangeKeyStorageRoot.php
+++ b/core/Command/Encryption/ChangeKeyStorageRoot.php
@@ -40,19 +40,14 @@ use Symfony\Component\Console\Output\OutputInterface;
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() {
diff --git a/core/Command/Encryption/DecryptAll.php b/core/Command/Encryption/DecryptAll.php
index ce17f787abd..7569605e775 100644
--- a/core/Command/Encryption/DecryptAll.php
+++ b/core/Command/Encryption/DecryptAll.php
@@ -41,28 +41,17 @@ use Symfony\Component\Console\Output\OutputInterface;
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;
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;
}
/**
diff --git a/core/Command/Encryption/Disable.php b/core/Command/Encryption/Disable.php
index 446601a1b4f..e188e6be344 100644
--- a/core/Command/Encryption/Disable.php
+++ b/core/Command/Encryption/Disable.php
@@ -27,11 +27,8 @@ use Symfony\Component\Console\Input\InputInterface;
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() {
diff --git a/core/Command/Encryption/Enable.php b/core/Command/Encryption/Enable.php
index 284d96809ae..2cbb315283e 100644
--- a/core/Command/Encryption/Enable.php
+++ b/core/Command/Encryption/Enable.php
@@ -29,14 +29,11 @@ use Symfony\Component\Console\Input\InputInterface;
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() {
@@ -70,7 +67,7 @@ class Enable extends Command {
return 1;
}
$output->writeln('Default module: ' . $defaultModule);
-
+
return 0;
}
}
diff --git a/core/Command/Encryption/EncryptAll.php b/core/Command/Encryption/EncryptAll.php
index 11e33ae9e2e..17d3a803942 100644
--- a/core/Command/Encryption/EncryptAll.php
+++ b/core/Command/Encryption/EncryptAll.php
@@ -36,24 +36,16 @@ use Symfony\Component\Console\Output\OutputInterface;
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;
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;
}
/**
diff --git a/core/Command/Encryption/ListModules.php b/core/Command/Encryption/ListModules.php
index 88ad9875073..46be88864a7 100644
--- a/core/Command/Encryption/ListModules.php
+++ b/core/Command/Encryption/ListModules.php
@@ -30,16 +30,11 @@ use Symfony\Component\Console\Input\InputInterface;
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() {
diff --git a/core/Command/Encryption/MigrateKeyStorage.php b/core/Command/Encryption/MigrateKeyStorage.php
index 8d9c7910769..0a2a14195f2 100644
--- a/core/Command/Encryption/MigrateKeyStorage.php
+++ b/core/Command/Encryption/MigrateKeyStorage.php
@@ -38,20 +38,14 @@ 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() {
diff --git a/core/Command/Encryption/SetDefaultModule.php b/core/Command/Encryption/SetDefaultModule.php
index b50e004867f..f4106926778 100644
--- a/core/Command/Encryption/SetDefaultModule.php
+++ b/core/Command/Encryption/SetDefaultModule.php
@@ -31,16 +31,11 @@ use Symfony\Component\Console\Input\InputInterface;
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() {
diff --git a/core/Command/Encryption/ShowKeyStorageRoot.php b/core/Command/Encryption/ShowKeyStorageRoot.php
index 1c4f2b4cb4a..33addebc1be 100644
--- a/core/Command/Encryption/ShowKeyStorageRoot.php
+++ b/core/Command/Encryption/ShowKeyStorageRoot.php
@@ -29,11 +29,8 @@ use Symfony\Component\Console\Input\InputInterface;
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() {
diff --git a/core/Command/Encryption/Status.php b/core/Command/Encryption/Status.php
index 34ebabe1b73..232e897299a 100644
--- a/core/Command/Encryption/Status.php
+++ b/core/Command/Encryption/Status.php
@@ -27,11 +27,8 @@ use Symfony\Component\Console\Input\InputInterface;
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() {