]> source.dussan.org Git - nextcloud-server.git/commitdiff
Uses PHP8's constructor property promotion in core/Command/Db classes.
authorFaraz Samapoor <fsa@adlas.at>
Mon, 12 Jun 2023 14:37:03 +0000 (18:07 +0330)
committerLouis <6653109+artonge@users.noreply.github.com>
Mon, 19 Jun 2023 10:55:15 +0000 (12:55 +0200)
Signed-off-by: Faraz Samapoor <fsa@adlas.at>
core/Command/Db/AddMissingColumns.php
core/Command/Db/AddMissingIndices.php
core/Command/Db/AddMissingPrimaryKeys.php
core/Command/Db/ConvertFilecacheBigInt.php
core/Command/Db/ConvertMysqlToMB4.php
core/Command/Db/ConvertType.php
core/Command/Db/Migrations/ExecuteCommand.php
core/Command/Db/Migrations/MigrateCommand.php
core/Command/Db/Migrations/StatusCommand.php

index acc05c3b7ff8d56eee540922f7f401ac308a262f..8e6f439e0c4c367d0c05542163b3badd645fdee6 100644 (file)
@@ -45,14 +45,11 @@ use Symfony\Component\EventDispatcher\GenericEvent;
  * @package OC\Core\Command\Db
  */
 class AddMissingColumns extends Command {
-       private Connection $connection;
-       private EventDispatcherInterface $dispatcher;
-
-       public function __construct(Connection $connection, EventDispatcherInterface $dispatcher) {
+       public function __construct(
+               private Connection $connection,
+               private EventDispatcherInterface $dispatcher,
+       ) {
                parent::__construct();
-
-               $this->connection = $connection;
-               $this->dispatcher = $dispatcher;
        }
 
        protected function configure() {
index b317f44b499303e1133ab2226cfd2f91d039672e..4f8e0c45a35ab0311e34d6d4413dfed579989410 100644 (file)
@@ -53,14 +53,11 @@ use Symfony\Component\EventDispatcher\GenericEvent;
  * @package OC\Core\Command\Db
  */
 class AddMissingIndices extends Command {
-       private Connection $connection;
-       private EventDispatcherInterface $dispatcher;
-
-       public function __construct(Connection $connection, EventDispatcherInterface $dispatcher) {
+       public function __construct(
+               private Connection $connection,
+               private EventDispatcherInterface $dispatcher,
+       ) {
                parent::__construct();
-
-               $this->connection = $connection;
-               $this->dispatcher = $dispatcher;
        }
 
        protected function configure() {
index 8262cf37e77868cd210b9bd6a6be40e8567dcc82..a11be78ccfc71bb8fbac200b821186ba92f77319 100644 (file)
@@ -45,14 +45,11 @@ use Symfony\Component\EventDispatcher\GenericEvent;
  * @package OC\Core\Command\Db
  */
 class AddMissingPrimaryKeys extends Command {
-       private Connection $connection;
-       private EventDispatcherInterface $dispatcher;
-
-       public function __construct(Connection $connection, EventDispatcherInterface $dispatcher) {
+       public function __construct(
+               private Connection $connection,
+               private EventDispatcherInterface $dispatcher,
+       ) {
                parent::__construct();
-
-               $this->connection = $connection;
-               $this->dispatcher = $dispatcher;
        }
 
        protected function configure() {
index 9d77ac9a5a046fd7d6c260bd1101077cbc5fa1d7..afa533261243986945eb9eaaadcde7d23ffbf7f0 100644 (file)
@@ -42,10 +42,7 @@ use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Console\Question\ConfirmationQuestion;
 
 class ConvertFilecacheBigInt extends Command {
-       private Connection $connection;
-
-       public function __construct(Connection $connection) {
-               $this->connection = $connection;
+       public function __construct(private Connection $connection) {
                parent::__construct();
        }
 
index 19a9532d910a5b9bdcc4bf18f13c35e61476893b..a66fb46fc5153ec7acb82730ea7ddf20915b57e0 100644 (file)
@@ -37,21 +37,12 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class ConvertMysqlToMB4 extends Command {
-       private IConfig $config;
-       private IDBConnection $connection;
-       private IURLGenerator $urlGenerator;
-       private LoggerInterface $logger;
-
        public function __construct(
-               IConfig $config,
-               IDBConnection $connection,
-               IURLGenerator $urlGenerator,
-               LoggerInterface $logger
+               private IConfig $config,
+               private IDBConnection $connection,
+               private IURLGenerator $urlGenerator,
+               private LoggerInterface $logger,
        ) {
-               $this->config = $config;
-               $this->connection = $connection;
-               $this->urlGenerator = $urlGenerator;
-               $this->logger = $logger;
                parent::__construct();
        }
 
index f7638e3024f6b0a6d07318260580907f70a5c2d8..9098f7cdd80dc70f62e009d4cf86e8f74b1b4569 100644 (file)
@@ -56,13 +56,12 @@ use function preg_match;
 use function preg_quote;
 
 class ConvertType extends Command implements CompletionAwareInterface {
-       protected IConfig $config;
-       protected ConnectionFactory $connectionFactory;
        protected array $columnTypes;
 
-       public function __construct(IConfig $config, ConnectionFactory $connectionFactory) {
-               $this->config = $config;
-               $this->connectionFactory = $connectionFactory;
+       public function __construct(
+               protected IConfig $config,
+               protected ConnectionFactory $connectionFactory,
+       ) {
                parent::__construct();
        }
 
index e87e133fa31d5d3497cb4a7747650334ee1fecd0..c75b575ab6c1acd231bd72d149238884c70c0d52 100644 (file)
@@ -35,13 +35,10 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class ExecuteCommand extends Command implements CompletionAwareInterface {
-       private Connection $connection;
-       private IConfig $config;
-
-       public function __construct(Connection $connection, IConfig $config) {
-               $this->connection = $connection;
-               $this->config = $config;
-
+       public function __construct(
+               private Connection $connection,
+               private IConfig $config,
+       ) {
                parent::__construct();
        }
 
index f0f357169979bc906ae5b438a0ffcb8d0725a005..b438da00541c4539b8ed1b36e3eb3e1b7698e9f6 100644 (file)
@@ -33,10 +33,7 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class MigrateCommand extends Command implements CompletionAwareInterface {
-       private Connection $connection;
-
-       public function __construct(Connection $connection) {
-               $this->connection = $connection;
+       public function __construct(private Connection $connection) {
                parent::__construct();
        }
 
index 725ee07521584079c9b4e9e36743a0159dc0a99d..c360299270f770fca60fa00bd91a605e03658820 100644 (file)
@@ -34,10 +34,7 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class StatusCommand extends Command implements CompletionAwareInterface {
-       private Connection $connection;
-
-       public function __construct(Connection $connection) {
-               $this->connection = $connection;
+       public function __construct(private Connection $connection) {
                parent::__construct();
        }