diff options
author | Louis <6653109+artonge@users.noreply.github.com> | 2023-06-22 14:09:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-22 14:09:06 +0200 |
commit | cbebc50987965b0f8f97f4827fce1da3ff624c68 (patch) | |
tree | ce51ccb12f1a1a8819244639cf589aaf240f258f | |
parent | 199b9788e696696f32ded025df0b8c1bb2a8ce02 (diff) | |
parent | b590059c26bdf80626814212c7db7ae0d758d222 (diff) | |
download | nextcloud-server-cbebc50987965b0f8f97f4827fce1da3ff624c68.tar.gz nextcloud-server-cbebc50987965b0f8f97f4827fce1da3ff624c68.zip |
Merge pull request #38771 from fsamapoor/constructor_property_promotion_in_core_command_part7
Uses PHP8's constructor property promotion core/Command/Info, /Integrity, and /Preview
-rw-r--r-- | core/Command/Info/File.php | 7 | ||||
-rw-r--r-- | core/Command/Info/FileUtils.php | 17 | ||||
-rw-r--r-- | core/Command/Info/Space.php | 7 | ||||
-rw-r--r-- | core/Command/Integrity/CheckApp.php | 7 | ||||
-rw-r--r-- | core/Command/Integrity/CheckCore.php | 7 | ||||
-rw-r--r-- | core/Command/Integrity/SignApp.php | 15 | ||||
-rw-r--r-- | core/Command/Integrity/SignCore.php | 11 | ||||
-rw-r--r-- | core/Command/Preview/Generate.php | 14 | ||||
-rw-r--r-- | core/Command/Preview/Repair.php | 17 | ||||
-rw-r--r-- | core/Command/Preview/ResetRenderedTexts.php | 24 |
10 files changed, 43 insertions, 83 deletions
diff --git a/core/Command/Info/File.php b/core/Command/Info/File.php index 238c1e28140..d62feeb5a17 100644 --- a/core/Command/Info/File.php +++ b/core/Command/Info/File.php @@ -23,11 +23,12 @@ use Symfony\Component\Console\Output\OutputInterface; class File extends Command { private IL10N $l10n; - private FileUtils $fileUtils; - public function __construct(IFactory $l10nFactory, FileUtils $fileUtils) { + public function __construct( + IFactory $l10nFactory, + private FileUtils $fileUtils, + ) { $this->l10n = $l10nFactory->get("core"); - $this->fileUtils = $fileUtils; parent::__construct(); } diff --git a/core/Command/Info/FileUtils.php b/core/Command/Info/FileUtils.php index 1264dee5de2..000cb0eb3d6 100644 --- a/core/Command/Info/FileUtils.php +++ b/core/Command/Info/FileUtils.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace OC\Core\Command\Info; -use OC\Files\SetupManager; use OCA\Circles\MountManager\CircleMount; use OCA\Files_External\Config\ExternalMountPoint; use OCA\Files_Sharing\SharedMount; @@ -33,7 +32,6 @@ use OCP\Files\Config\IUserMountCache; use OCP\Files\FileInfo; use OCP\Files\IHomeStorage; use OCP\Files\IRootFolder; -use OCP\Files\Mount\IMountManager; use OCP\Files\Mount\IMountPoint; use OCP\Files\Node; use OCP\Files\NotFoundException; @@ -43,21 +41,10 @@ use Symfony\Component\Console\Output\OutputInterface; use OCP\Files\Folder; class FileUtils { - private IRootFolder $rootFolder; - private IUserMountCache $userMountCache; - private IMountManager $mountManager; - private SetupManager $setupManager; - public function __construct( - IRootFolder $rootFolder, - IUserMountCache $userMountCache, - IMountManager $mountManager, - SetupManager $setupManager + private IRootFolder $rootFolder, + private IUserMountCache $userMountCache, ) { - $this->rootFolder = $rootFolder; - $this->userMountCache = $userMountCache; - $this->mountManager = $mountManager; - $this->setupManager = $setupManager; } /** diff --git a/core/Command/Info/Space.php b/core/Command/Info/Space.php index 7f901ee729b..dfbfcf848c1 100644 --- a/core/Command/Info/Space.php +++ b/core/Command/Info/Space.php @@ -32,10 +32,9 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Space extends Command { - private FileUtils $fileUtils; - - public function __construct(FileUtils $fileUtils) { - $this->fileUtils = $fileUtils; + public function __construct( + private FileUtils $fileUtils, + ) { parent::__construct(); } diff --git a/core/Command/Integrity/CheckApp.php b/core/Command/Integrity/CheckApp.php index ebd502c3d29..fe999fed9fd 100644 --- a/core/Command/Integrity/CheckApp.php +++ b/core/Command/Integrity/CheckApp.php @@ -40,11 +40,10 @@ use Symfony\Component\Console\Output\OutputInterface; * @package OC\Core\Command\Integrity */ class CheckApp extends Base { - private Checker $checker; - - public function __construct(Checker $checker) { + public function __construct( + private Checker $checker, + ) { parent::__construct(); - $this->checker = $checker; } /** diff --git a/core/Command/Integrity/CheckCore.php b/core/Command/Integrity/CheckCore.php index 9436786cad9..0bcb75fa6be 100644 --- a/core/Command/Integrity/CheckCore.php +++ b/core/Command/Integrity/CheckCore.php @@ -36,11 +36,10 @@ use Symfony\Component\Console\Output\OutputInterface; * @package OC\Core\Command\Integrity */ class CheckCore extends Base { - private Checker $checker; - - public function __construct(Checker $checker) { + public function __construct( + private Checker $checker, + ) { parent::__construct(); - $this->checker = $checker; } /** diff --git a/core/Command/Integrity/SignApp.php b/core/Command/Integrity/SignApp.php index 8492511d597..ebdc714c8c2 100644 --- a/core/Command/Integrity/SignApp.php +++ b/core/Command/Integrity/SignApp.php @@ -40,17 +40,12 @@ use Symfony\Component\Console\Output\OutputInterface; * @package OC\Core\Command\Integrity */ class SignApp extends Command { - private Checker $checker; - private FileAccessHelper $fileAccessHelper; - private IURLGenerator $urlGenerator; - - public function __construct(Checker $checker, - FileAccessHelper $fileAccessHelper, - IURLGenerator $urlGenerator) { + public function __construct( + private Checker $checker, + private FileAccessHelper $fileAccessHelper, + private IURLGenerator $urlGenerator, + ) { parent::__construct(null); - $this->checker = $checker; - $this->fileAccessHelper = $fileAccessHelper; - $this->urlGenerator = $urlGenerator; } protected function configure() { diff --git a/core/Command/Integrity/SignCore.php b/core/Command/Integrity/SignCore.php index 55d356fcd6b..48cfcadd10d 100644 --- a/core/Command/Integrity/SignCore.php +++ b/core/Command/Integrity/SignCore.php @@ -39,14 +39,11 @@ use Symfony\Component\Console\Output\OutputInterface; * @package OC\Core\Command\Integrity */ class SignCore extends Command { - private Checker $checker; - private FileAccessHelper $fileAccessHelper; - - public function __construct(Checker $checker, - FileAccessHelper $fileAccessHelper) { + public function __construct( + private Checker $checker, + private FileAccessHelper $fileAccessHelper, + ) { parent::__construct(null); - $this->checker = $checker; - $this->fileAccessHelper = $fileAccessHelper; } protected function configure() { diff --git a/core/Command/Preview/Generate.php b/core/Command/Preview/Generate.php index 24e34c1bd76..6697afa537c 100644 --- a/core/Command/Preview/Generate.php +++ b/core/Command/Preview/Generate.php @@ -36,15 +36,11 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Generate extends Command { - private IRootFolder $rootFolder; - private IUserMountCache $userMountCache; - private IPreview $previewManager; - - public function __construct(IRootFolder $rootFolder, IUserMountCache $userMountCache, IPreview $previewManager) { - $this->rootFolder = $rootFolder; - $this->userMountCache = $userMountCache; - $this->previewManager = $previewManager; - + public function __construct( + private IRootFolder $rootFolder, + private IUserMountCache $userMountCache, + private IPreview $previewManager, + ) { parent::__construct(); } diff --git a/core/Command/Preview/Repair.php b/core/Command/Preview/Repair.php index 4d08024483b..fcdea9c20c8 100644 --- a/core/Command/Preview/Repair.php +++ b/core/Command/Preview/Repair.php @@ -45,20 +45,17 @@ use Symfony\Component\Console\Question\ConfirmationQuestion; use function pcntl_signal; class Repair extends Command { - protected IConfig $config; - private IRootFolder $rootFolder; - private LoggerInterface $logger; private bool $stopSignalReceived = false; private int $memoryLimit; private int $memoryTreshold; - private ILockingProvider $lockingProvider; - - public function __construct(IConfig $config, IRootFolder $rootFolder, LoggerInterface $logger, IniGetWrapper $phpIni, ILockingProvider $lockingProvider) { - $this->config = $config; - $this->rootFolder = $rootFolder; - $this->logger = $logger; - $this->lockingProvider = $lockingProvider; + public function __construct( + protected IConfig $config, + private IRootFolder $rootFolder, + private LoggerInterface $logger, + IniGetWrapper $phpIni, + private ILockingProvider $lockingProvider, + ) { $this->memoryLimit = (int)$phpIni->getBytes('memory_limit'); $this->memoryTreshold = $this->memoryLimit - 25 * 1024 * 1024; diff --git a/core/Command/Preview/ResetRenderedTexts.php b/core/Command/Preview/ResetRenderedTexts.php index df623651f83..ec57f632ac9 100644 --- a/core/Command/Preview/ResetRenderedTexts.php +++ b/core/Command/Preview/ResetRenderedTexts.php @@ -39,24 +39,14 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class ResetRenderedTexts extends Command { - protected IDBConnection $connection; - protected IUserManager $userManager; - protected IAvatarManager $avatarManager; - private Root $previewFolder; - private IMimeTypeLoader $mimeTypeLoader; - - public function __construct(IDBConnection $connection, - IUserManager $userManager, - IAvatarManager $avatarManager, - Root $previewFolder, - IMimeTypeLoader $mimeTypeLoader) { + public function __construct( + protected IDBConnection $connection, + protected IUserManager $userManager, + protected IAvatarManager $avatarManager, + private Root $previewFolder, + private IMimeTypeLoader $mimeTypeLoader, + ) { parent::__construct(); - - $this->connection = $connection; - $this->userManager = $userManager; - $this->avatarManager = $avatarManager; - $this->previewFolder = $previewFolder; - $this->mimeTypeLoader = $mimeTypeLoader; } protected function configure() { |