]> source.dussan.org Git - nextcloud-server.git/commitdiff
Uses PHP8's constructor property promotion.
authorFaraz Samapoor <fsa@adlas.at>
Mon, 12 Jun 2023 15:02:59 +0000 (18:32 +0330)
committerLouis <6653109+artonge@users.noreply.github.com>
Mon, 19 Jun 2023 10:55:27 +0000 (12:55 +0200)
 in core/Command/App, /Background, and /Broadcast classes.

Signed-off-by: Faraz Samapoor <fsa@adlas.at>
core/Command/App/Disable.php
core/Command/App/Enable.php
core/Command/App/ListApps.php
core/Command/App/Remove.php
core/Command/App/Update.php
core/Command/Background/Base.php
core/Command/Background/Job.php
core/Command/Background/ListCommand.php
core/Command/Broadcast/Test.php

index 0ed4d29cf41af9401b4679e66e214e88806b478f..c31d65d946479f1a34b6e2179777659abbd703fe 100644 (file)
@@ -33,12 +33,10 @@ 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 {
index d50c8d79181288ca4f0be299e1d846808bd64f39..c3ab8be38cea48d0e6095ecbd7e986892ef536a4 100644 (file)
@@ -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 {
index 365ac48e0800d2536ab54d46f36fb09203915376..cb48c2007b0680c2ecf44c38648fae17af1953ae 100644 (file)
@@ -33,11 +33,8 @@ 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() {
index ced17e3ef926a4b5c3b72e46133e5f5ef0e4ee80..522ddc20e07c0c73fa0890d0c73e55cd2694d80d 100644 (file)
@@ -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() {
index 6a6d43c28e59d906aaee8649778bde36920cb0e5..ca6a6758dbd22936a1eabbbd5135bf478514f613 100644 (file)
@@ -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() {
index dca7b58a5fcac2e9903b6285f1aced15b22d937f..130db9e79d846225187848901a566d547f98f394 100644 (file)
@@ -38,11 +38,9 @@ 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() {
index 823498cf8ca6c06507f75e84285e76208d9f6f3f..aeee60bd6a5eb02b4134b8eb52a34fa23b9a72cc 100644 (file)
@@ -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 {
index 4116bfa0ff1bc5e37b48b8bee6c158c4eada9e72..6119fb76de9ae577a4a1c0cafb080371cc997f52 100644 (file)
@@ -32,11 +32,8 @@ 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 {
index 7a67c983f794dc08a1b045ae6a3ad65288a8161e..71d7e2cacdb73cf892016f4730e138df6dd04ba5 100644 (file)
@@ -34,11 +34,8 @@ 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 {