aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis <6653109+artonge@users.noreply.github.com>2023-06-19 21:09:24 +0200
committerGitHub <noreply@github.com>2023-06-19 21:09:24 +0200
commitd9bf410762e3e0e6bdb5a788ea6af5d314e7e523 (patch)
tree30e80cfad2dda11414dbd53dee371f0132d0a690
parentf8cf61addfba324b94c5c2f8bc46e207c9fa0a74 (diff)
parentcda0f74e0bf32082feca8b49836ae6316ad6c1b2 (diff)
downloadnextcloud-server-d9bf410762e3e0e6bdb5a788ea6af5d314e7e523.tar.gz
nextcloud-server-d9bf410762e3e0e6bdb5a788ea6af5d314e7e523.zip
Merge pull request #38769 from fsamapoor/constructor_property_promotion_in_core_command_part6
Uses PHP8's constructor property promotion core/Command/App,/Background, and /Broadcast
-rw-r--r--core/Command/App/Disable.php6
-rw-r--r--core/Command/App/Enable.php9
-rw-r--r--core/Command/App/ListApps.php7
-rw-r--r--core/Command/App/Remove.php13
-rw-r--r--core/Command/App/Update.php13
-rw-r--r--core/Command/Background/Base.php6
-rw-r--r--core/Command/Background/Job.php11
-rw-r--r--core/Command/Background/ListCommand.php7
-rw-r--r--core/Command/Broadcast/Test.php7
9 files changed, 33 insertions, 46 deletions
diff --git a/core/Command/App/Disable.php b/core/Command/App/Disable.php
index 0ed4d29cf41..c5abc6c95cf 100644
--- a/core/Command/App/Disable.php
+++ b/core/Command/App/Disable.php
@@ -33,12 +33,12 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Disable extends Command implements CompletionAwareInterface {
- protected IAppManager $appManager;
protected int $exitCode = 0;
- public function __construct(IAppManager $appManager) {
+ public function __construct(
+ protected IAppManager $appManager,
+ ) {
parent::__construct();
- $this->appManager = $appManager;
}
protected function configure(): void {
diff --git a/core/Command/App/Enable.php b/core/Command/App/Enable.php
index d50c8d79181..c3ab8be38ce 100644
--- a/core/Command/App/Enable.php
+++ b/core/Command/App/Enable.php
@@ -39,14 +39,13 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Enable extends Command implements CompletionAwareInterface {
- protected IAppManager $appManager;
- protected IGroupManager $groupManager;
protected int $exitCode = 0;
- public function __construct(IAppManager $appManager, IGroupManager $groupManager) {
+ public function __construct(
+ protected IAppManager $appManager,
+ protected IGroupManager $groupManager,
+ ) {
parent::__construct();
- $this->appManager = $appManager;
- $this->groupManager = $groupManager;
}
protected function configure(): void {
diff --git a/core/Command/App/ListApps.php b/core/Command/App/ListApps.php
index 365ac48e080..24856304afc 100644
--- a/core/Command/App/ListApps.php
+++ b/core/Command/App/ListApps.php
@@ -33,11 +33,10 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class ListApps extends Base {
- protected IAppManager $manager;
-
- public function __construct(IAppManager $manager) {
+ public function __construct(
+ protected IAppManager $manager,
+ ) {
parent::__construct();
- $this->manager = $manager;
}
protected function configure() {
diff --git a/core/Command/App/Remove.php b/core/Command/App/Remove.php
index ced17e3ef92..522ddc20e07 100644
--- a/core/Command/App/Remove.php
+++ b/core/Command/App/Remove.php
@@ -39,15 +39,12 @@ use Symfony\Component\Console\Output\OutputInterface;
use Throwable;
class Remove extends Command implements CompletionAwareInterface {
- protected IAppManager $manager;
- private Installer $installer;
- private LoggerInterface $logger;
-
- public function __construct(IAppManager $manager, Installer $installer, LoggerInterface $logger) {
+ public function __construct(
+ protected IAppManager $manager,
+ private Installer $installer,
+ private LoggerInterface $logger,
+ ) {
parent::__construct();
- $this->manager = $manager;
- $this->installer = $installer;
- $this->logger = $logger;
}
protected function configure() {
diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php
index 6a6d43c28e5..ca6a6758dbd 100644
--- a/core/Command/App/Update.php
+++ b/core/Command/App/Update.php
@@ -37,15 +37,12 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Update extends Command {
- protected IAppManager $manager;
- private Installer $installer;
- private LoggerInterface $logger;
-
- public function __construct(IAppManager $manager, Installer $installer, LoggerInterface $logger) {
+ public function __construct(
+ protected IAppManager $manager,
+ private Installer $installer,
+ private LoggerInterface $logger,
+ ) {
parent::__construct();
- $this->manager = $manager;
- $this->installer = $installer;
- $this->logger = $logger;
}
protected function configure() {
diff --git a/core/Command/Background/Base.php b/core/Command/Background/Base.php
index dca7b58a5fc..5b2da21af75 100644
--- a/core/Command/Background/Base.php
+++ b/core/Command/Background/Base.php
@@ -38,11 +38,11 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
abstract class Base extends Command {
abstract protected function getMode();
- protected IConfig $config;
- public function __construct(IConfig $config) {
+ public function __construct(
+ protected IConfig $config,
+ ) {
parent::__construct();
- $this->config = $config;
}
protected function configure() {
diff --git a/core/Command/Background/Job.php b/core/Command/Background/Job.php
index 823498cf8ca..aeee60bd6a5 100644
--- a/core/Command/Background/Job.php
+++ b/core/Command/Background/Job.php
@@ -35,14 +35,11 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Job extends Command {
- protected IJobList $jobList;
- protected ILogger $logger;
-
- public function __construct(IJobList $jobList,
- ILogger $logger) {
+ public function __construct(
+ protected IJobList $jobList,
+ protected ILogger $logger,
+ ) {
parent::__construct();
- $this->jobList = $jobList;
- $this->logger = $logger;
}
protected function configure(): void {
diff --git a/core/Command/Background/ListCommand.php b/core/Command/Background/ListCommand.php
index 4116bfa0ff1..a7b98a037a8 100644
--- a/core/Command/Background/ListCommand.php
+++ b/core/Command/Background/ListCommand.php
@@ -32,11 +32,10 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class ListCommand extends Base {
- protected IJobList $jobList;
-
- public function __construct(IJobList $jobList) {
+ public function __construct(
+ protected IJobList $jobList,
+ ) {
parent::__construct();
- $this->jobList = $jobList;
}
protected function configure(): void {
diff --git a/core/Command/Broadcast/Test.php b/core/Command/Broadcast/Test.php
index 7a67c983f79..da450f30ca8 100644
--- a/core/Command/Broadcast/Test.php
+++ b/core/Command/Broadcast/Test.php
@@ -34,11 +34,10 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Test extends Command {
- private IEventDispatcher $eventDispatcher;
-
- public function __construct(IEventDispatcher $eventDispatcher) {
+ public function __construct(
+ private IEventDispatcher $eventDispatcher,
+ ) {
parent::__construct();
- $this->eventDispatcher = $eventDispatcher;
}
protected function configure(): void {