From d83944fd101ca46f53cdb11520ae3b011f62b2b8 Mon Sep 17 00:00:00 2001 From: Faraz Samapoor Date: Mon, 12 Jun 2023 19:16:09 +0330 Subject: [PATCH] Uses PHP8's constructor property promotion. in core/Command/Log, /Security, and /SystemTag classes. Signed-off-by: Faraz Samapoor --- core/Command/Log/File.php | 5 +---- core/Command/Log/Manage.php | 5 +---- core/Command/Security/ImportCertificate.php | 5 +---- core/Command/Security/ListCertificates.php | 10 ++++------ core/Command/Security/RemoveCertificate.php | 5 +---- core/Command/Security/ResetBruteforceAttempts.php | 5 +---- core/Command/SystemTag/Add.php | 5 +---- core/Command/SystemTag/Delete.php | 5 +---- core/Command/SystemTag/Edit.php | 5 +---- core/Command/SystemTag/ListCommand.php | 5 +---- 10 files changed, 13 insertions(+), 42 deletions(-) diff --git a/core/Command/Log/File.php b/core/Command/Log/File.php index 6d6e530fe9a..4e3dc97a546 100644 --- a/core/Command/Log/File.php +++ b/core/Command/Log/File.php @@ -36,10 +36,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class File extends Command implements Completion\CompletionAwareInterface { - protected IConfig $config; - - public function __construct(IConfig $config) { - $this->config = $config; + public function __construct(protected IConfig $config) { parent::__construct(); } diff --git a/core/Command/Log/Manage.php b/core/Command/Log/Manage.php index 63a8efde370..500bc1e8a52 100644 --- a/core/Command/Log/Manage.php +++ b/core/Command/Log/Manage.php @@ -39,10 +39,7 @@ class Manage extends Command implements CompletionAwareInterface { public const DEFAULT_LOG_LEVEL = 2; public const DEFAULT_TIMEZONE = 'UTC'; - protected IConfig $config; - - public function __construct(IConfig $config) { - $this->config = $config; + public function __construct(protected IConfig $config) { parent::__construct(); } diff --git a/core/Command/Security/ImportCertificate.php b/core/Command/Security/ImportCertificate.php index 9db7889e307..f3a44face48 100644 --- a/core/Command/Security/ImportCertificate.php +++ b/core/Command/Security/ImportCertificate.php @@ -30,10 +30,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class ImportCertificate extends Base { - protected ICertificateManager $certificateManager; - - public function __construct(ICertificateManager $certificateManager) { - $this->certificateManager = $certificateManager; + public function __construct(protected ICertificateManager $certificateManager) { parent::__construct(); } diff --git a/core/Command/Security/ListCertificates.php b/core/Command/Security/ListCertificates.php index 15dd1812077..96063fb5b61 100644 --- a/core/Command/Security/ListCertificates.php +++ b/core/Command/Security/ListCertificates.php @@ -31,12 +31,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class ListCertificates extends Base { - protected ICertificateManager $certificateManager; - protected IL10N $l; - - public function __construct(ICertificateManager $certificateManager, IL10N $l) { - $this->certificateManager = $certificateManager; - $this->l = $l; + public function __construct( + protected ICertificateManager $certificateManager, + protected IL10N $l, + ) { parent::__construct(); } diff --git a/core/Command/Security/RemoveCertificate.php b/core/Command/Security/RemoveCertificate.php index 2f9c6ff978a..51ddfc98111 100644 --- a/core/Command/Security/RemoveCertificate.php +++ b/core/Command/Security/RemoveCertificate.php @@ -30,10 +30,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class RemoveCertificate extends Base { - protected ICertificateManager $certificateManager; - - public function __construct(ICertificateManager $certificateManager) { - $this->certificateManager = $certificateManager; + public function __construct(protected ICertificateManager $certificateManager) { parent::__construct(); } diff --git a/core/Command/Security/ResetBruteforceAttempts.php b/core/Command/Security/ResetBruteforceAttempts.php index 8def0873bdf..a203d1daa10 100644 --- a/core/Command/Security/ResetBruteforceAttempts.php +++ b/core/Command/Security/ResetBruteforceAttempts.php @@ -30,10 +30,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class ResetBruteforceAttempts extends Base { - protected Throttler $throttler; - - public function __construct(Throttler $throttler) { - $this->throttler = $throttler; + public function __construct(protected Throttler $throttler) { parent::__construct(); } diff --git a/core/Command/SystemTag/Add.php b/core/Command/SystemTag/Add.php index f4fb80eb70a..7df8d5e03eb 100644 --- a/core/Command/SystemTag/Add.php +++ b/core/Command/SystemTag/Add.php @@ -31,10 +31,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Add extends Base { - protected ISystemTagManager $systemTagManager; - - public function __construct(ISystemTagManager $systemTagManager) { - $this->systemTagManager = $systemTagManager; + public function __construct(protected ISystemTagManager $systemTagManager) { parent::__construct(); } diff --git a/core/Command/SystemTag/Delete.php b/core/Command/SystemTag/Delete.php index 4c1145ae1b4..a23b09d4e56 100644 --- a/core/Command/SystemTag/Delete.php +++ b/core/Command/SystemTag/Delete.php @@ -30,10 +30,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Delete extends Base { - protected ISystemTagManager $systemTagManager; - - public function __construct(ISystemTagManager $systemTagManager) { - $this->systemTagManager = $systemTagManager; + public function __construct(protected ISystemTagManager $systemTagManager) { parent::__construct(); } diff --git a/core/Command/SystemTag/Edit.php b/core/Command/SystemTag/Edit.php index 7ed933c3b35..d3c68a2b76e 100644 --- a/core/Command/SystemTag/Edit.php +++ b/core/Command/SystemTag/Edit.php @@ -31,10 +31,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Edit extends Base { - protected ISystemTagManager $systemTagManager; - - public function __construct(ISystemTagManager $systemTagManager) { - $this->systemTagManager = $systemTagManager; + public function __construct(protected ISystemTagManager $systemTagManager) { parent::__construct(); } diff --git a/core/Command/SystemTag/ListCommand.php b/core/Command/SystemTag/ListCommand.php index 7993eb87891..c968fb14ef2 100644 --- a/core/Command/SystemTag/ListCommand.php +++ b/core/Command/SystemTag/ListCommand.php @@ -30,10 +30,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class ListCommand extends Base { - protected ISystemTagManager $systemTagManager; - - public function __construct(ISystemTagManager $systemTagManager) { - $this->systemTagManager = $systemTagManager; + public function __construct(protected ISystemTagManager $systemTagManager) { parent::__construct(); } -- 2.39.5