]> source.dussan.org Git - nextcloud-server.git/commitdiff
Uses PHP8's constructor property promotion in core/Command/Encryption classes.
authorFaraz Samapoor <fsa@adlas.at>
Mon, 12 Jun 2023 14:22:30 +0000 (17:52 +0330)
committerLouis <6653109+artonge@users.noreply.github.com>
Tue, 20 Jun 2023 14:24:46 +0000 (16:24 +0200)
Signed-off-by: Faraz Samapoor <fsa@adlas.at>
core/Command/Encryption/ChangeKeyStorageRoot.php
core/Command/Encryption/DecryptAll.php
core/Command/Encryption/Disable.php
core/Command/Encryption/Enable.php
core/Command/Encryption/EncryptAll.php
core/Command/Encryption/ListModules.php
core/Command/Encryption/MigrateKeyStorage.php
core/Command/Encryption/SetDefaultModule.php
core/Command/Encryption/ShowKeyStorageRoot.php
core/Command/Encryption/Status.php

index 6ae59421a6918b6821e4db95e0ec1e735f66d47c..96884de25e9e2d6eab95b11826f4c648f9c95882 100644 (file)
@@ -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() {
index ce17f787abde44e29a0e37b45516ede12666b4f9..7569605e7751dc32b72f3ed66577fd011a71af4c 100644 (file)
@@ -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;
        }
 
        /**
index 446601a1b4f0dc1f44cda670526894d2adbaec44..e188e6be3442e4fec8dcf5e132337632ce5bc407 100644 (file)
@@ -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() {
index 284d96809aed9b847dac364c01204f3bc36cac6c..2cbb315283e5007d1636f16d5097650cfeee24d5 100644 (file)
@@ -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;
        }
 }
index 11e33ae9e2ee8a1d104fd3a38f620e19a5759f21..17d3a80394262f0f2261342b2477fdae50b7657c 100644 (file)
@@ -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;
        }
 
        /**
index 88ad987507341b1bf55cdca136c3e3bcf346d77c..46be88864a794ac40507519a5ab4801952bf0baa 100644 (file)
@@ -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() {
index 8d9c7910769cd18c79806c2a635b42d7e4327037..0a2a14195f25b565e9c7204e24f70afaa0b1e8ed 100644 (file)
@@ -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() {
index b50e004867fef4d57dfbb80f5fa12c6a7b212d9c..f4106926778830eb4ed444e8bd70eb99ab922188 100644 (file)
@@ -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() {
index 1c4f2b4cb4a17df83284bb8d3fc0bdbf0a999eff..33addebc1be2734fe07e14a02577ea1f3de89648 100644 (file)
@@ -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() {
index 34ebabe1b736526960fbf2b51f2402b5ad88ac6a..232e897299a7ce6a9b58f646a5902bf1b0f806ad 100644 (file)
@@ -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() {