]> source.dussan.org Git - nextcloud-server.git/commitdiff
Uses PHP8's constructor property promotion in core/Command/Config and core/Command...
authorFaraz Samapoor <fsa@adlas.at>
Mon, 12 Jun 2023 14:52:05 +0000 (18:22 +0330)
committerLouis <6653109+artonge@users.noreply.github.com>
Tue, 20 Jun 2023 07:29:50 +0000 (09:29 +0200)
Signed-off-by: Faraz Samapoor <fsa@adlas.at>
12 files changed:
core/Command/Config/App/DeleteConfig.php
core/Command/Config/App/GetConfig.php
core/Command/Config/App/SetConfig.php
core/Command/Config/Import.php
core/Command/Config/ListConfigs.php
core/Command/Config/System/Base.php
core/Command/Group/Add.php
core/Command/Group/AddUser.php
core/Command/Group/Delete.php
core/Command/Group/Info.php
core/Command/Group/ListCommand.php
core/Command/Group/RemoveUser.php

index 0da1e965bd00c490787f0723efe623441d18d895..577378559b363393f60ab9643c8613e1471b66e2 100644 (file)
@@ -28,14 +28,8 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class DeleteConfig extends Base {
-       protected IConfig $config;
-
-       /**
-        * @param IConfig $config
-        */
-       public function __construct(IConfig $config) {
+       public function __construct(protected IConfig $config) {
                parent::__construct();
-               $this->config = $config;
        }
 
        protected function configure() {
index 7fdff2be732f38af697f74ea6cb40167439a3da0..3ed327fac79e57edefad72fd755cbbfbff3c9c38 100644 (file)
@@ -28,11 +28,8 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class GetConfig extends Base {
-       protected IConfig $config;
-
-       public function __construct(IConfig $config) {
+       public function __construct(protected IConfig $config) {
                parent::__construct();
-               $this->config = $config;
        }
 
        protected function configure() {
index 89a5f6ba5d11e84e142ce846f67178175a499153..dcc3fd58bf78376036b749d58125323c7123e6d8 100644 (file)
@@ -28,11 +28,8 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class SetConfig extends Base {
-       protected IConfig $config;
-
-       public function __construct(IConfig $config) {
+       public function __construct(protected IConfig $config) {
                parent::__construct();
-               $this->config = $config;
        }
 
        protected function configure() {
index 227c909038c7e00639ab5fb08514b2ecfd6a40e3..90c92bff489cce49d00c341d14f8ade836e96b48 100644 (file)
@@ -35,11 +35,9 @@ use Symfony\Component\Console\Output\OutputInterface;
 
 class Import extends Command implements CompletionAwareInterface {
        protected array $validRootKeys = ['system', 'apps'];
-       protected IConfig $config;
 
-       public function __construct(IConfig $config) {
+       public function __construct(protected IConfig $config) {
                parent::__construct();
-               $this->config = $config;
        }
 
        protected function configure() {
index dd8fad72d7c90cf6423977e70dedf8752174dfd3..4adb0a9df5b7945b4c97e6f6e1c261fb0a29bd6a 100644 (file)
@@ -33,13 +33,12 @@ use Symfony\Component\Console\Output\OutputInterface;
 
 class ListConfigs extends Base {
        protected string $defaultOutputFormat = self::OUTPUT_FORMAT_JSON_PRETTY;
-       protected SystemConfig $systemConfig;
-       protected IAppConfig $appConfig;
 
-       public function __construct(SystemConfig $systemConfig, IAppConfig $appConfig) {
+       public function __construct(
+               protected SystemConfig $systemConfig,
+               protected IAppConfig $appConfig,
+       ) {
                parent::__construct();
-               $this->systemConfig = $systemConfig;
-               $this->appConfig = $appConfig;
        }
 
        protected function configure() {
index 18bc9cb7ca0e485e2f99f782cac4381452ecae89..0824af8d18c14173f70d6c44b7351c4f26e756ab 100644 (file)
@@ -26,11 +26,8 @@ use OC\SystemConfig;
 use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
 
 abstract class Base extends \OC\Core\Command\Base {
-       protected SystemConfig $systemConfig;
-
-       public function __construct(SystemConfig $systemConfig) {
+       public function __construct(protected SystemConfig $systemConfig) {
                parent::__construct();
-               $this->systemConfig = $systemConfig;
        }
 
        /**
index d205cef0696a23b209c455dcce0ca294dab94e73..d148e86a1b435cb3b10bb61b8018a08411464989 100644 (file)
@@ -36,10 +36,7 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Add extends Base {
-       protected IGroupManager $groupManager;
-
-       public function __construct(IGroupManager $groupManager) {
-               $this->groupManager = $groupManager;
+       public function __construct(protected IGroupManager $groupManager) {
                parent::__construct();
        }
 
index 6638bcd4c6d6771286252e9385d9de6f0b56d2ed..a66d2898ef9aad47cbdccb4213f380db73ac3dd4 100644 (file)
@@ -34,12 +34,10 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class AddUser extends Base {
-       protected IUserManager $userManager;
-       protected IGroupManager $groupManager;
-
-       public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
-               $this->userManager = $userManager;
-               $this->groupManager = $groupManager;
+       public function __construct(
+               protected IUserManager $userManager,
+               protected IGroupManager $groupManager,
+       ) {
                parent::__construct();
        }
 
index fd1074d6f610ac5a81ddc013e8fc9f2d3b6dba26..ad6c7ce7f2b53a7d7a3755a83e1bf1674d5af1fa 100644 (file)
@@ -35,10 +35,7 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Delete extends Base {
-       protected IGroupManager $groupManager;
-
-       public function __construct(IGroupManager $groupManager) {
-               $this->groupManager = $groupManager;
+       public function __construct(protected IGroupManager $groupManager) {
                parent::__construct();
        }
 
index dc475581ac580efd7e5b2fa38d91d508c2aff57a..6d09c2826b85c91ac7f6ce09d3a73b8a6ef8a9f0 100644 (file)
@@ -35,10 +35,7 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Info extends Base {
-       protected IGroupManager $groupManager;
-
-       public function __construct(IGroupManager $groupManager) {
-               $this->groupManager = $groupManager;
+       public function __construct(protected IGroupManager $groupManager) {
                parent::__construct();
        }
 
index 0285cc05dcda3594e14d6fa0a125725d0d8e2cd6..a2a63d46a18c4ebb934c5ff6da488559ab6fabea 100644 (file)
@@ -32,10 +32,7 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class ListCommand extends Base {
-       protected IGroupManager $groupManager;
-
-       public function __construct(IGroupManager $groupManager) {
-               $this->groupManager = $groupManager;
+       public function __construct(protected IGroupManager $groupManager) {
                parent::__construct();
        }
 
index c7b3a2d84e7e382ed4cbd01ea5b5ee7a89b08b15..6c7d4ce4d84d80d4d7a9ecee62420cd32a2a3ad6 100644 (file)
@@ -34,12 +34,10 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class RemoveUser extends Base {
-       protected IUserManager $userManager;
-       protected IGroupManager $groupManager;
-
-       public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
-               $this->userManager = $userManager;
-               $this->groupManager = $groupManager;
+       public function __construct(
+               protected IUserManager $userManager,
+               protected IGroupManager $groupManager,
+       ) {
                parent::__construct();
        }