]> source.dussan.org Git - nextcloud-server.git/commitdiff
Uses PHP8's constructor property promotion.
authorFaraz Samapoor <fsa@adlas.at>
Mon, 12 Jun 2023 15:50:14 +0000 (19:20 +0330)
committerLouis <6653109+artonge@users.noreply.github.com>
Sat, 24 Jun 2023 21:14:23 +0000 (23:14 +0200)
 in core/Command and /TwoFactorAuth classes.

Signed-off-by: Faraz Samapoor <fsa@adlas.at>
core/Command/Check.php
core/Command/Status.php
core/Command/TwoFactorAuth/Cleanup.php
core/Command/TwoFactorAuth/Disable.php
core/Command/TwoFactorAuth/Enable.php
core/Command/TwoFactorAuth/Enforce.php
core/Command/TwoFactorAuth/State.php
core/Command/Upgrade.php

index 18c45323f37d1a85bf2d482ab96ceb38397fe798..529cb541f6dd0bbf4664920672c47c289392781a 100644 (file)
@@ -29,11 +29,8 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Check extends Base {
-       private SystemConfig $config;
-
-       public function __construct(SystemConfig $config) {
+       public function __construct(private SystemConfig $config) {
                parent::__construct();
-               $this->config = $config;
        }
 
        protected function configure() {
index c59dac557a867ed1a19a18006975d0efcbe17669..57b831c7eaadf95a1931a44efeb6dcdd81f463ac 100644 (file)
@@ -33,14 +33,11 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Status extends Base {
-       private IConfig $config;
-       private Defaults $themingDefaults;
-
-       public function __construct(IConfig $config, Defaults $themingDefaults) {
+       public function __construct(
+               private IConfig $config,
+               private Defaults $themingDefaults,
+       ) {
                parent::__construct('status');
-
-               $this->config = $config;
-               $this->themingDefaults = $themingDefaults;
        }
 
        protected function configure() {
index 7d3fc3c33f74c16b8858882a9de5c9ba8df2e1a8..125a7b01f4afde1527c2db64ff7b614b9f890d94 100644 (file)
@@ -32,12 +32,8 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Cleanup extends Base {
-       private IRegistry $registry;
-
-       public function __construct(IRegistry $registry) {
+       public function __construct(private IRegistry $registry) {
                parent::__construct();
-
-               $this->registry = $registry;
        }
 
        protected function configure() {
index 54e4b138a0ae5322bd96b6b68f1cdb48b5687e0d..1de4d711e0e97eecbc1003983957cda7b0fc12a2 100644 (file)
@@ -29,12 +29,11 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Disable extends Base {
-       private ProviderManager $manager;
-
-       public function __construct(ProviderManager $manager, IUserManager $userManager) {
+       public function __construct(
+               private ProviderManager $manager,
+               protected IUserManager $userManager,
+       ) {
                parent::__construct('twofactorauth:disable');
-               $this->manager = $manager;
-               $this->userManager = $userManager;
        }
 
        protected function configure() {
index 67c1778399dee78b2419257d5df760c63bd082e8..38d6894b4624ebe2acb720d35cb0c92638b94fec 100644 (file)
@@ -29,12 +29,11 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Enable extends Base {
-       private ProviderManager $manager;
-
-       public function __construct(ProviderManager $manager, IUserManager $userManager) {
+       public function __construct(
+               private ProviderManager $manager,
+               protected IUserManager $userManager,
+       ) {
                parent::__construct('twofactorauth:enable');
-               $this->manager = $manager;
-               $this->userManager = $userManager;
        }
 
        protected function configure() {
index d8fa41e2e95ce0294aeb3093fdf5bc57c8d32339..b2a05a531fb571ebca287f9b1fe8d796897df283 100644 (file)
@@ -35,12 +35,8 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class Enforce extends Command {
-       private MandatoryTwoFactor $mandatoryTwoFactor;
-
-       public function __construct(MandatoryTwoFactor $mandatoryTwoFactor) {
+       public function __construct(private MandatoryTwoFactor $mandatoryTwoFactor) {
                parent::__construct();
-
-               $this->mandatoryTwoFactor = $mandatoryTwoFactor;
        }
 
        protected function configure() {
index 4694c76b40815ebbf67036a536fef129f6a6683e..d4e930b7c9d252c8bf7cbd5f02a25427c845545a 100644 (file)
@@ -33,13 +33,11 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class State extends Base {
-       private IRegistry $registry;
-
-       public function __construct(IRegistry $registry, IUserManager $userManager) {
+       public function __construct(
+               private IRegistry $registry,
+               protected IUserManager $userManager,
+       ) {
                parent::__construct('twofactorauth:state');
-
-               $this->registry = $registry;
-               $this->userManager = $userManager;
        }
 
        protected function configure() {
index e929dc22bc8cd4a9ca69b71994e9b4e5a081e6c2..078f994d0516f0af9fcee9ba6d7204944e59a874 100644 (file)
@@ -62,15 +62,12 @@ class Upgrade extends Command {
        public const ERROR_INVALID_ARGUMENTS = 4;
        public const ERROR_FAILURE = 5;
 
-       private IConfig $config;
-       private LoggerInterface $logger;
-       private Installer $installer;
-
-       public function __construct(IConfig $config, LoggerInterface $logger, Installer $installer) {
+       public function __construct(
+               private IConfig $config,
+               private LoggerInterface $logger,
+               private Installer $installer,
+       ) {
                parent::__construct();
-               $this->config = $config;
-               $this->logger = $logger;
-               $this->installer = $installer;
        }
 
        protected function configure() {