]> source.dussan.org Git - nextcloud-server.git/commitdiff
Uses PHP8's constructor property promotion in core/Command/User classes.
authorFaraz Samapoor <fsa@adlas.at>
Mon, 12 Jun 2023 14:41:17 +0000 (18:11 +0330)
committerLouis <6653109+artonge@users.noreply.github.com>
Mon, 19 Jun 2023 10:55:10 +0000 (12:55 +0200)
Signed-off-by: Faraz Samapoor <fsa@adlas.at>
core/Command/User/Add.php
core/Command/User/AddAppPassword.php
core/Command/User/Delete.php
core/Command/User/Disable.php
core/Command/User/Enable.php
core/Command/User/Info.php
core/Command/User/LastSeen.php
core/Command/User/ListCommand.php
core/Command/User/Report.php
core/Command/User/ResetPassword.php
core/Command/User/Setting.php

index 24d11fbee6eefb28f1089ce48e6bbbe6e9df06a3..5e8ab92070d77352cc1464f85df79ddbcbf0d6f4 100644 (file)
@@ -39,13 +39,11 @@ use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Console\Question\Question;
 
 class Add extends Command {
-       protected IUserManager $userManager;
-       protected IGroupManager $groupManager;
-
-       public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
+       public function __construct(
+               protected IUserManager $userManager,
+               protected IGroupManager $groupManager,
+       ) {
                parent::__construct();
-               $this->userManager = $userManager;
-               $this->groupManager = $groupManager;
        }
 
        protected function configure() {
index ec39cdc974eaa80a6ebd0629181960c0ff0b1434..8c506c8510e73322eb832ac1bdc6165f22dc16e8 100644 (file)
@@ -41,19 +41,12 @@ use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Console\Question\Question;
 
 class AddAppPassword extends Command {
-       protected IUserManager $userManager;
-       protected IProvider $tokenProvider;
-       private ISecureRandom $random;
-       private IEventDispatcher $eventDispatcher;
-
-       public function __construct(IUserManager $userManager,
-                                                               IProvider $tokenProvider,
-                                                               ISecureRandom $random,
-                                                               IEventDispatcher $eventDispatcher) {
-               $this->tokenProvider = $tokenProvider;
-               $this->userManager = $userManager;
-               $this->random = $random;
-               $this->eventDispatcher = $eventDispatcher;
+       public function __construct(
+               protected IUserManager $userManager,
+               protected IProvider $tokenProvider,
+               private ISecureRandom $random,
+               private IEventDispatcher $eventDispatcher,
+       ) {
                parent::__construct();
        }
 
index 9624f04fa18f175bb8eb7b6076557a6400a90d25..55776728d5208013e5f9471dcf46a3931becf8a4 100644 (file)
@@ -33,14 +33,7 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Delete extends Base {
-       /** @var IUserManager */
-       protected $userManager;
-
-       /**
-        * @param IUserManager $userManager
-        */
-       public function __construct(IUserManager $userManager) {
-               $this->userManager = $userManager;
+       public function __construct(protected IUserManager $userManager) {
                parent::__construct();
        }
 
index bc819f39e1dfd56e3d2ea283247df0f7d655badd..915ec7f108d43adf1c146c077fe459c09db29313 100644 (file)
@@ -32,10 +32,7 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Disable extends Base {
-       protected IUserManager $userManager;
-
-       public function __construct(IUserManager $userManager) {
-               $this->userManager = $userManager;
+       public function __construct(protected IUserManager $userManager) {
                parent::__construct();
        }
 
index f4e16eec4af0af03ce62cd27f53c8a231a8ae946..a032d36ee4b463232930ea9088061abb5cbc37d2 100644 (file)
@@ -32,10 +32,7 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Enable extends Base {
-       protected IUserManager $userManager;
-
-       public function __construct(IUserManager $userManager) {
-               $this->userManager = $userManager;
+       public function __construct(protected IUserManager $userManager) {
                parent::__construct();
        }
 
index 1e89a8d0911f56bf318a9a6686212d1fa8a55b2a..a8fb62099e2d93f110255097214520f685b11852 100644 (file)
@@ -35,12 +35,10 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Info 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 5ea6c64d249980548f30b8660dbd6fd829631947..402108364694d9af581983cf6faecf0995fa279e 100644 (file)
@@ -34,10 +34,7 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class LastSeen extends Base {
-       protected IUserManager $userManager;
-
-       public function __construct(IUserManager $userManager) {
-               $this->userManager = $userManager;
+       public function __construct(protected IUserManager $userManager) {
                parent::__construct();
        }
 
index bf4bf7f030e338bccc46430e1ce54366ac78762b..f25d6c2dae9d7d3e95247c8312838b6d391816b4 100644 (file)
@@ -33,13 +33,10 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class ListCommand 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 e080a617258502d997ca1ff03bd382e55f34eae1..74ab5c29cc1a8508c5d53d0eac7583fdd6a16775 100644 (file)
@@ -41,13 +41,10 @@ use Symfony\Component\Console\Output\OutputInterface;
 class Report extends Command {
        public const DEFAULT_COUNT_DIRS_MAX_USERS = 500;
 
-       protected IUserManager $userManager;
-       private IConfig $config;
-
-       public function __construct(IUserManager $userManager,
-                                                               IConfig $config) {
-               $this->userManager = $userManager;
-               $this->config = $config;
+       public function __construct(
+               protected IUserManager $userManager,
+               private IConfig $config,
+       ) {
                parent::__construct();
        }
 
index 294cea38b7104fd1196f01cc8f8ed22ddd5c8270..6719f893be39a3418b674a3aa961eba4091d49f4 100644 (file)
@@ -41,13 +41,11 @@ use Symfony\Component\Console\Question\ConfirmationQuestion;
 use Symfony\Component\Console\Question\Question;
 
 class ResetPassword extends Base {
-       protected IUserManager $userManager;
-       private IAppManager $appManager;
-
-       public function __construct(IUserManager $userManager, IAppManager $appManager) {
+       public function __construct(
+               protected IUserManager $userManager,
+               private IAppManager $appManager,
+       ) {
                parent::__construct();
-               $this->userManager = $userManager;
-               $this->appManager = $appManager;
        }
 
        protected function configure() {
index fac5c3c976ccd73b22345938bdaecae905b08f18..8a8736fdaa212de0464ec8fadab5a54f56cc1390 100644 (file)
@@ -36,13 +36,11 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Setting extends Base {
-       protected IUserManager $userManager;
-       protected IConfig $config;
-
-       public function __construct(IUserManager $userManager, IConfig $config) {
+       public function __construct(
+               protected IUserManager $userManager,
+               protected IConfig $config,
+       ) {
                parent::__construct();
-               $this->userManager = $userManager;
-               $this->config = $config;
        }
 
        protected function configure() {