aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFaraz Samapoor <fsa@adlas.at>2023-06-12 19:20:14 +0330
committerLouis <6653109+artonge@users.noreply.github.com>2023-06-24 23:14:23 +0200
commitc01129947e9fecd26f10ef588cc0940ff187dc83 (patch)
tree966f843798a3b4a594ef60ba82e227331e54b518
parent10d563a873b4c2d6d423f79140985335e2eb57a7 (diff)
downloadnextcloud-server-c01129947e9fecd26f10ef588cc0940ff187dc83.tar.gz
nextcloud-server-c01129947e9fecd26f10ef588cc0940ff187dc83.zip
Uses PHP8's constructor property promotion.
in core/Command and /TwoFactorAuth classes. Signed-off-by: Faraz Samapoor <fsa@adlas.at>
-rw-r--r--core/Command/Check.php5
-rw-r--r--core/Command/Status.php11
-rw-r--r--core/Command/TwoFactorAuth/Cleanup.php6
-rw-r--r--core/Command/TwoFactorAuth/Disable.php9
-rw-r--r--core/Command/TwoFactorAuth/Enable.php9
-rw-r--r--core/Command/TwoFactorAuth/Enforce.php6
-rw-r--r--core/Command/TwoFactorAuth/State.php10
-rw-r--r--core/Command/Upgrade.php13
8 files changed, 24 insertions, 45 deletions
diff --git a/core/Command/Check.php b/core/Command/Check.php
index 18c45323f37..529cb541f6d 100644
--- a/core/Command/Check.php
+++ b/core/Command/Check.php
@@ -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() {
diff --git a/core/Command/Status.php b/core/Command/Status.php
index c59dac557a8..57b831c7eaa 100644
--- a/core/Command/Status.php
+++ b/core/Command/Status.php
@@ -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() {
diff --git a/core/Command/TwoFactorAuth/Cleanup.php b/core/Command/TwoFactorAuth/Cleanup.php
index 7d3fc3c33f7..125a7b01f4a 100644
--- a/core/Command/TwoFactorAuth/Cleanup.php
+++ b/core/Command/TwoFactorAuth/Cleanup.php
@@ -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() {
diff --git a/core/Command/TwoFactorAuth/Disable.php b/core/Command/TwoFactorAuth/Disable.php
index 54e4b138a0a..1de4d711e0e 100644
--- a/core/Command/TwoFactorAuth/Disable.php
+++ b/core/Command/TwoFactorAuth/Disable.php
@@ -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() {
diff --git a/core/Command/TwoFactorAuth/Enable.php b/core/Command/TwoFactorAuth/Enable.php
index 67c1778399d..38d6894b462 100644
--- a/core/Command/TwoFactorAuth/Enable.php
+++ b/core/Command/TwoFactorAuth/Enable.php
@@ -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() {
diff --git a/core/Command/TwoFactorAuth/Enforce.php b/core/Command/TwoFactorAuth/Enforce.php
index d8fa41e2e95..b2a05a531fb 100644
--- a/core/Command/TwoFactorAuth/Enforce.php
+++ b/core/Command/TwoFactorAuth/Enforce.php
@@ -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() {
diff --git a/core/Command/TwoFactorAuth/State.php b/core/Command/TwoFactorAuth/State.php
index 4694c76b408..d4e930b7c9d 100644
--- a/core/Command/TwoFactorAuth/State.php
+++ b/core/Command/TwoFactorAuth/State.php
@@ -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() {
diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php
index e929dc22bc8..078f994d051 100644
--- a/core/Command/Upgrade.php
+++ b/core/Command/Upgrade.php
@@ -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() {