aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorCôme Chilliet <91878298+come-nc@users.noreply.github.com>2023-06-26 10:38:06 +0200
committerGitHub <noreply@github.com>2023-06-26 10:38:06 +0200
commit783f1b9a2a0cf868fcbe440f3d8fb19e7f175172 (patch)
treedb78d6e569fecd7b8c1dc4d7404db5326f80d3a1 /core
parentf7183c9dcf25ae03b925a90e85f36f21e9159953 (diff)
parentfd0e2f711aef29c22f59566f151581424b79e514 (diff)
downloadnextcloud-server-783f1b9a2a0cf868fcbe440f3d8fb19e7f175172.tar.gz
nextcloud-server-783f1b9a2a0cf868fcbe440f3d8fb19e7f175172.zip
Merge pull request #38775 from fsamapoor/constructor_property_promotion_in_core_command_part9
Uses PHP8's constructor property promotion in core/Command and /
Diffstat (limited to 'core')
-rw-r--r--core/Command/Check.php7
-rw-r--r--core/Command/Status.php11
-rw-r--r--core/Command/TwoFactorAuth/Base.php7
-rw-r--r--core/Command/TwoFactorAuth/Cleanup.php15
-rw-r--r--core/Command/TwoFactorAuth/Disable.php14
-rw-r--r--core/Command/TwoFactorAuth/Enable.php14
-rw-r--r--core/Command/TwoFactorAuth/Enforce.php8
-rw-r--r--core/Command/TwoFactorAuth/State.php15
-rw-r--r--core/Command/Upgrade.php13
9 files changed, 54 insertions, 50 deletions
diff --git a/core/Command/Check.php b/core/Command/Check.php
index 18c45323f37..478486b7dee 100644
--- a/core/Command/Check.php
+++ b/core/Command/Check.php
@@ -29,11 +29,10 @@ 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/Base.php b/core/Command/TwoFactorAuth/Base.php
index 27bd381d951..a36cb2af374 100644
--- a/core/Command/TwoFactorAuth/Base.php
+++ b/core/Command/TwoFactorAuth/Base.php
@@ -30,7 +30,12 @@ use OCP\IUserManager;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
class Base extends \OC\Core\Command\Base {
- protected IUserManager $userManager;
+ public function __construct(
+ ?string $name,
+ protected IUserManager $userManager,
+ ) {
+ parent::__construct($name);
+ }
/**
* Return possible values for the named option
diff --git a/core/Command/TwoFactorAuth/Cleanup.php b/core/Command/TwoFactorAuth/Cleanup.php
index 7d3fc3c33f7..1b2c6e22632 100644
--- a/core/Command/TwoFactorAuth/Cleanup.php
+++ b/core/Command/TwoFactorAuth/Cleanup.php
@@ -27,17 +27,20 @@ declare(strict_types=1);
namespace OC\Core\Command\TwoFactorAuth;
use OCP\Authentication\TwoFactorAuth\IRegistry;
+use OCP\IUserManager;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Cleanup extends Base {
- private IRegistry $registry;
-
- public function __construct(IRegistry $registry) {
- parent::__construct();
-
- $this->registry = $registry;
+ public function __construct(
+ private IRegistry $registry,
+ IUserManager $userManager,
+ ) {
+ parent::__construct(
+ null,
+ $userManager,
+ );
}
protected function configure() {
diff --git a/core/Command/TwoFactorAuth/Disable.php b/core/Command/TwoFactorAuth/Disable.php
index 54e4b138a0a..a593993128f 100644
--- a/core/Command/TwoFactorAuth/Disable.php
+++ b/core/Command/TwoFactorAuth/Disable.php
@@ -29,12 +29,14 @@ 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) {
- parent::__construct('twofactorauth:disable');
- $this->manager = $manager;
- $this->userManager = $userManager;
+ public function __construct(
+ private ProviderManager $manager,
+ IUserManager $userManager,
+ ) {
+ parent::__construct(
+ 'twofactorauth:disable',
+ $userManager,
+ );
}
protected function configure() {
diff --git a/core/Command/TwoFactorAuth/Enable.php b/core/Command/TwoFactorAuth/Enable.php
index 67c1778399d..b0d80c43a61 100644
--- a/core/Command/TwoFactorAuth/Enable.php
+++ b/core/Command/TwoFactorAuth/Enable.php
@@ -29,12 +29,14 @@ 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) {
- parent::__construct('twofactorauth:enable');
- $this->manager = $manager;
- $this->userManager = $userManager;
+ public function __construct(
+ private ProviderManager $manager,
+ IUserManager $userManager,
+ ) {
+ parent::__construct(
+ 'twofactorauth:enable',
+ $userManager,
+ );
}
protected function configure() {
diff --git a/core/Command/TwoFactorAuth/Enforce.php b/core/Command/TwoFactorAuth/Enforce.php
index d8fa41e2e95..e747ff99d59 100644
--- a/core/Command/TwoFactorAuth/Enforce.php
+++ b/core/Command/TwoFactorAuth/Enforce.php
@@ -35,12 +35,10 @@ 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..ddae1fe963a 100644
--- a/core/Command/TwoFactorAuth/State.php
+++ b/core/Command/TwoFactorAuth/State.php
@@ -33,13 +33,14 @@ 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) {
- parent::__construct('twofactorauth:state');
-
- $this->registry = $registry;
- $this->userManager = $userManager;
+ public function __construct(
+ private IRegistry $registry,
+ IUserManager $userManager,
+ ) {
+ parent::__construct(
+ 'twofactorauth:state',
+ $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() {