diff --git a/apps/dav/lib/Migration/RemoveObjectProperties.php b/apps/dav/lib/Migration/RemoveObjectProperties.php index f09293ae0bb..8304accb51c 100644 --- a/apps/dav/lib/Migration/RemoveObjectProperties.php +++ b/apps/dav/lib/Migration/RemoveObjectProperties.php @@ -16,27 +16,16 @@ class RemoveObjectProperties implements IRepairStep { private const ME_CARD_PROPERTY = '{http://calendarserver.org/ns/}me-card'; private const CALENDAR_TRANSP_PROPERTY = '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp'; - /** - * RemoveObjectProperties constructor. - * - * @param IDBConnection $connection - */ public function __construct( - private IDBConnection $connection, + private readonly IDBConnection $connection, ) { } - /** - * @inheritdoc - */ - public function getName() { + public function getName(): string { return 'Remove invalid object properties'; } - /** - * @inheritdoc - */ - public function run(IOutput $output) { + public function run(IOutput $output): void { $query = $this->connection->getQueryBuilder(); $updated = $query->delete('properties') ->where($query->expr()->in('propertyname', $query->createNamedParameter([self::RESOURCE_TYPE_PROPERTY, self::ME_CARD_PROPERTY, self::CALENDAR_TRANSP_PROPERTY], IQueryBuilder::PARAM_STR_ARRAY))) diff --git a/core/Command/Maintenance/Repair.php b/core/Command/Maintenance/Repair.php index f0c88f6811b..84bfe0b4cb3 100644 --- a/core/Command/Maintenance/Repair.php +++ b/core/Command/Maintenance/Repair.php @@ -39,7 +39,7 @@ class Repair extends Command { parent::__construct(); } - protected function configure() { + protected function configure(): void { $this ->setName('maintenance:repair') ->setDescription('repair this installation') @@ -81,20 +81,18 @@ class Repair extends Command { } } - - $maintenanceMode = $this->config->getSystemValueBool('maintenance'); $this->config->setSystemValue('maintenance', true); $this->progress = new ProgressBar($output); $this->output = $output; - $this->dispatcher->addListener(RepairStartEvent::class, [$this, 'handleRepairFeedBack']); - $this->dispatcher->addListener(RepairAdvanceEvent::class, [$this, 'handleRepairFeedBack']); - $this->dispatcher->addListener(RepairFinishEvent::class, [$this, 'handleRepairFeedBack']); - $this->dispatcher->addListener(RepairStepEvent::class, [$this, 'handleRepairFeedBack']); - $this->dispatcher->addListener(RepairInfoEvent::class, [$this, 'handleRepairFeedBack']); - $this->dispatcher->addListener(RepairWarningEvent::class, [$this, 'handleRepairFeedBack']); - $this->dispatcher->addListener(RepairErrorEvent::class, [$this, 'handleRepairFeedBack']); + $this->dispatcher->addListener(RepairStartEvent::class, $this->handleRepairFeedBack(...)); + $this->dispatcher->addListener(RepairAdvanceEvent::class, $this->handleRepairFeedBack(...)); + $this->dispatcher->addListener(RepairFinishEvent::class, $this->handleRepairFeedBack(...)); + $this->dispatcher->addListener(RepairStepEvent::class, $this->handleRepairFeedBack(...)); + $this->dispatcher->addListener(RepairInfoEvent::class, $this->handleRepairFeedBack(...)); + $this->dispatcher->addListener(RepairWarningEvent::class, $this->handleRepairFeedBack(...)); + $this->dispatcher->addListener(RepairErrorEvent::class, $this->handleRepairFeedBack(...)); $this->repair->run(); diff --git a/lib/private/Files/Search/SearchQuery.php b/lib/private/Files/Search/SearchQuery.php index 16639359f88..9c1d7c5df78 100644 --- a/lib/private/Files/Search/SearchQuery.php +++ b/lib/private/Files/Search/SearchQuery.php @@ -12,6 +12,9 @@ use OCP\Files\Search\ISearchQuery; use OCP\IUser; class SearchQuery implements ISearchQuery { + /** + * @param ISearchOrder[] $order + */ public function __construct( private ISearchOperator $searchOperation, private int $limit, @@ -22,38 +25,26 @@ class SearchQuery implements ISearchQuery { ) { } - /** - * @return ISearchOperator - */ - public function getSearchOperation() { + public function getSearchOperation(): ISearchOperator { return $this->searchOperation; } - /** - * @return int - */ - public function getLimit() { + public function getLimit(): int { return $this->limit; } - /** - * @return int - */ - public function getOffset() { + public function getOffset(): int { return $this->offset; } /** * @return ISearchOrder[] */ - public function getOrder() { + public function getOrder(): array { return $this->order; } - /** - * @return ?IUser - */ - public function getUser() { + public function getUser(): ?IUser { return $this->user; } diff --git a/lib/private/Profiler/FileProfilerStorage.php b/lib/private/Profiler/FileProfilerStorage.php index 67da2731cf3..1636b9d6065 100644 --- a/lib/private/Profiler/FileProfilerStorage.php +++ b/lib/private/Profiler/FileProfilerStorage.php @@ -30,10 +30,10 @@ class FileProfilerStorage { * * Example : "file:/path/to/the/storage/folder" * + * @param string $folder Folder where profiler data are stored. * @throws \RuntimeException */ public function __construct( - /** @var string $folder Folder where profiler data are stored. */ private string $folder, ) { if (!is_dir($this->folder) && @mkdir($this->folder, 0777, true) === false && !is_dir($this->folder)) { diff --git a/lib/private/Remote/Credentials.php b/lib/private/Remote/Credentials.php index ce7c7f88590..763e420c8c9 100644 --- a/lib/private/Remote/Credentials.php +++ b/lib/private/Remote/Credentials.php @@ -9,27 +9,17 @@ namespace OC\Remote; use OCP\Remote\ICredentials; class Credentials implements ICredentials { - /** - * @param string $user - * @param string $password - */ public function __construct( - private $user, - private $password, + private string $user, + private string $password, ) { } - /** - * @return string - */ - public function getUsername() { + public function getUsername(): string { return $this->user; } - /** - * @return string - */ - public function getPassword() { + public function getPassword(): string { return $this->password; } } diff --git a/lib/private/Repair.php b/lib/private/Repair.php index 45524145ed4..765bd730096 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -7,7 +7,6 @@ */ namespace OC; -use OC\DB\ConnectionAdapter; use OC\Repair\AddBruteForceCleanupJob; use OC\Repair\AddCleanupDeletedUsersBackgroundJob; use OC\Repair\AddCleanupUpdaterBackupsJob; @@ -57,42 +56,32 @@ use OC\Repair\RepairDavShares; use OC\Repair\RepairInvalidShares; use OC\Repair\RepairLogoDimension; use OC\Repair\RepairMimeTypes; -use OC\Template\JSCombiner; use OCA\DAV\Migration\DeleteSchedulingObjects; use OCA\DAV\Migration\RemoveObjectProperties; use OCA\Files_Sharing\Repair\CleanupShareTarget; -use OCP\AppFramework\QueryException; -use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJobList; -use OCP\Collaboration\Resources\IManager; use OCP\EventDispatcher\IEventDispatcher; -use OCP\Files\AppData\IAppDataFactory; -use OCP\IAppConfig; -use OCP\ICacheFactory; use OCP\IConfig; use OCP\IDBConnection; -use OCP\IGroupManager; -use OCP\IUserManager; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; -use OCP\Notification\IManager as INotificationManager; use OCP\Server; +use Psr\Container\ContainerExceptionInterface; use Psr\Log\LoggerInterface; use Throwable; class Repair implements IOutput { - /** @var IRepairStep[] */ + /** @var list */ private array $repairSteps = []; private string $currentStep; public function __construct( - private IEventDispatcher $dispatcher, - private LoggerInterface $logger, + private readonly IEventDispatcher $dispatcher, + private readonly LoggerInterface $logger, ) { } - /** @param IRepairStep[] $repairSteps */ + /** @param list $repairSteps */ public function setRepairSteps(array $repairSteps): void { $this->repairSteps = $repairSteps; } @@ -100,7 +89,7 @@ class Repair implements IOutput { /** * Run a series of repair steps for common problems */ - public function run() { + public function run(): void { if (count($this->repairSteps) === 0) { $this->dispatcher->dispatchTyped(new RepairInfoEvent('No repair steps available')); @@ -124,19 +113,19 @@ class Repair implements IOutput { /** * Add repair step * - * @param IRepairStep|string $repairStep repair step + * @param IRepairStep|class-string $repairStep repair step * @throws \Exception */ - public function addStep($repairStep) { + public function addStep(IRepairStep|string $repairStep): void { if (is_string($repairStep)) { try { $s = Server::get($repairStep); - } catch (QueryException $e) { + } catch (ContainerExceptionInterface $e) { if (class_exists($repairStep)) { try { // Last resort: hope there are no constructor arguments $s = new $repairStep(); - } catch (Throwable $inner) { + } catch (Throwable) { // Well, it was worth a try throw new \Exception("Repair step '$repairStep' can't be instantiated: " . $e->getMessage(), 0, $e); } @@ -159,35 +148,28 @@ class Repair implements IOutput { * Returns the default repair steps to be run on the * command line or after an upgrade. * - * @return IRepairStep[] + * @return list */ public static function getRepairSteps(): array { return [ new Collation(Server::get(IConfig::class), Server::get(LoggerInterface::class), Server::get(IDBConnection::class), false), - new CleanTags(Server::get(IDBConnection::class), Server::get(IUserManager::class)), - new RepairInvalidShares(Server::get(IConfig::class), Server::get(IDBConnection::class)), - new MoveUpdaterStepFile(Server::get(IConfig::class)), - new MoveAvatars( - Server::get(IJobList::class), - Server::get(IConfig::class) - ), - new CleanPreviews( - Server::get(IJobList::class), - Server::get(IUserManager::class), - Server::get(IConfig::class) - ), + Server::get(CleanTags::class), + Server::get(RepairInvalidShares::class), + Server::get(MoveUpdaterStepFile::class), + Server::get(MoveAvatars::class), + Server::get(CleanPreviews::class), Server::get(MigratePropertiesTable::class), Server::get(MigrateOauthTables::class), - new UpdateLanguageCodes(Server::get(IDBConnection::class), Server::get(IConfig::class)), - new AddLogRotateJob(Server::get(IJobList::class)), - new ClearFrontendCaches(Server::get(ICacheFactory::class), Server::get(JSCombiner::class)), + Server::get(UpdateLanguageCodes::class), + Server::get(AddLogRotateJob::class), + Server::get(ClearFrontendCaches::class), Server::get(ClearGeneratedAvatarCache::class), - new AddPreviewBackgroundCleanupJob(Server::get(IJobList::class)), - new AddCleanupUpdaterBackupsJob(Server::get(IJobList::class)), - new CleanupCardDAVPhotoCache(Server::get(IConfig::class), Server::get(IAppDataFactory::class), Server::get(LoggerInterface::class)), - new AddClenupLoginFlowV2BackgroundJob(Server::get(IJobList::class)), - new RemoveLinkShares(Server::get(IDBConnection::class), Server::get(IConfig::class), Server::get(IGroupManager::class), Server::get(INotificationManager::class), Server::get(ITimeFactory::class)), - new ClearCollectionsAccessCache(Server::get(IConfig::class), Server::get(IManager::class)), + Server::get(AddPreviewBackgroundCleanupJob::class), + Server::get(AddCleanupUpdaterBackupsJob::class), + Server::get(CleanupCardDAVPhotoCache::class), + Server::get(AddClenupLoginFlowV2BackgroundJob::class), + Server::get(RemoveLinkShares::class), + Server::get(ClearCollectionsAccessCache::class), Server::get(ResetGeneratedAvatarFlag::class), Server::get(EncryptionLegacyCipher::class), Server::get(EncryptionMigration::class), @@ -214,17 +196,13 @@ class Repair implements IOutput { * Returns expensive repair steps to be run on the * command line with a special option. * - * @return IRepairStep[] + * @return list */ - public static function getExpensiveRepairSteps() { + public static function getExpensiveRepairSteps(): array { return [ - new OldGroupMembershipShares(Server::get(IDBConnection::class), Server::get(IGroupManager::class)), - new RemoveBrokenProperties(Server::get(IDBConnection::class)), - new RepairMimeTypes( - Server::get(IConfig::class), - Server::get(IAppConfig::class), - Server::get(IDBConnection::class) - ), + Server::get(OldGroupMembershipShares::class), + Server::get(RemoveBrokenProperties::class), + Server::get(RepairMimeTypes::class), Server::get(DeleteSchedulingObjects::class), Server::get(RemoveObjectProperties::class), Server::get(CleanupShareTarget::class), @@ -235,19 +213,14 @@ class Repair implements IOutput { * Returns the repair steps to be run before an * upgrade. * - * @return IRepairStep[] + * @return list */ - public static function getBeforeUpgradeRepairSteps() { - /** @var ConnectionAdapter $connectionAdapter */ - $connectionAdapter = Server::get(ConnectionAdapter::class); - $config = Server::get(IConfig::class); - $steps = [ - new Collation(Server::get(IConfig::class), Server::get(LoggerInterface::class), $connectionAdapter, true), - new SaveAccountsTableData($connectionAdapter, $config), - new DropAccountTermsTable($connectionAdapter), + public static function getBeforeUpgradeRepairSteps(): array { + return [ + new Collation(Server::get(IConfig::class), Server::get(LoggerInterface::class), Server::get(IDBConnection::class), true), + Server::get(SaveAccountsTableData::class), + Server::get(DropAccountTermsTable::class), ]; - - return $steps; } public function debug(string $message): void { @@ -256,7 +229,7 @@ class Repair implements IOutput { /** * @param string $message */ - public function info($message) { + public function info($message): void { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairInfoEvent($message)); } @@ -264,7 +237,7 @@ class Repair implements IOutput { /** * @param string $message */ - public function warning($message) { + public function warning($message): void { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairWarningEvent($message)); } @@ -272,7 +245,7 @@ class Repair implements IOutput { /** * @param int $max */ - public function startProgress($max = 0) { + public function startProgress($max = 0): void { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairStartEvent($max, $this->currentStep)); } @@ -281,15 +254,12 @@ class Repair implements IOutput { * @param int $step number of step to advance * @param string $description */ - public function advance($step = 1, $description = '') { + public function advance($step = 1, $description = ''): void { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairAdvanceEvent($step, $description)); } - /** - * @param int $max - */ - public function finishProgress() { + public function finishProgress(): void { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairFinishEvent()); } diff --git a/lib/private/Repair/AddBruteForceCleanupJob.php b/lib/private/Repair/AddBruteForceCleanupJob.php index b580005d86d..9473d9031a4 100644 --- a/lib/private/Repair/AddBruteForceCleanupJob.php +++ b/lib/private/Repair/AddBruteForceCleanupJob.php @@ -19,11 +19,11 @@ class AddBruteForceCleanupJob implements IRepairStep { ) { } - public function getName() { + public function getName(): string { return 'Add job to cleanup the bruteforce entries'; } - public function run(IOutput $output) { + public function run(IOutput $output): void { $this->jobList->add(CleanupJob::class); } } diff --git a/lib/private/Repair/AddCleanupDeletedUsersBackgroundJob.php b/lib/private/Repair/AddCleanupDeletedUsersBackgroundJob.php index 398518b33d9..6d983b8456c 100644 --- a/lib/private/Repair/AddCleanupDeletedUsersBackgroundJob.php +++ b/lib/private/Repair/AddCleanupDeletedUsersBackgroundJob.php @@ -23,7 +23,7 @@ class AddCleanupDeletedUsersBackgroundJob implements IRepairStep { return 'Add cleanup-deleted-users background job'; } - public function run(IOutput $output) { + public function run(IOutput $output): void { $this->jobList->add(CleanupDeletedUsers::class); } } diff --git a/lib/private/Repair/AddCleanupUpdaterBackupsJob.php b/lib/private/Repair/AddCleanupUpdaterBackupsJob.php index be6afebc447..55d703422ff 100644 --- a/lib/private/Repair/AddCleanupUpdaterBackupsJob.php +++ b/lib/private/Repair/AddCleanupUpdaterBackupsJob.php @@ -13,15 +13,15 @@ use OCP\Migration\IRepairStep; class AddCleanupUpdaterBackupsJob implements IRepairStep { public function __construct( - protected IJobList $jobList, + protected readonly IJobList $jobList, ) { } - public function getName() { + public function getName(): string { return 'Queue a one-time job to cleanup old backups of the updater'; } - public function run(IOutput $output) { + public function run(IOutput $output): void { $this->jobList->add(BackgroundCleanupUpdaterBackupsJob::class); } } diff --git a/lib/private/Repair/AddMetadataGenerationJob.php b/lib/private/Repair/AddMetadataGenerationJob.php index 76c60f303a7..ad5fb129ab1 100644 --- a/lib/private/Repair/AddMetadataGenerationJob.php +++ b/lib/private/Repair/AddMetadataGenerationJob.php @@ -17,11 +17,11 @@ class AddMetadataGenerationJob implements IRepairStep { ) { } - public function getName() { + public function getName(): string { return 'Queue a job to generate metadata'; } - public function run(IOutput $output) { + public function run(IOutput $output): void { $this->jobList->add(GenerateMetadataJob::class); } } diff --git a/lib/private/Repair/AddMovePreviewJob.php b/lib/private/Repair/AddMovePreviewJob.php index 44a266f3787..1fe265fa1b6 100644 --- a/lib/private/Repair/AddMovePreviewJob.php +++ b/lib/private/Repair/AddMovePreviewJob.php @@ -10,18 +10,20 @@ use OC\Core\BackgroundJobs\PreviewMigrationJob; use OCP\BackgroundJob\IJobList; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; +use Override; class AddMovePreviewJob implements IRepairStep { public function __construct( - private IJobList $jobList, + private readonly IJobList $jobList, ) { } - public function getName() { + public function getName(): string { return 'Queue a job to move the preview'; } - public function run(IOutput $output) { + #[Override] + public function run(IOutput $output): void { $this->jobList->add(PreviewMigrationJob::class); } } diff --git a/lib/private/Repair/AddRemoveOldTasksBackgroundJob.php b/lib/private/Repair/AddRemoveOldTasksBackgroundJob.php index 40146a314f7..eac9d5c3dc1 100644 --- a/lib/private/Repair/AddRemoveOldTasksBackgroundJob.php +++ b/lib/private/Repair/AddRemoveOldTasksBackgroundJob.php @@ -17,7 +17,7 @@ use OCP\Migration\IRepairStep; class AddRemoveOldTasksBackgroundJob implements IRepairStep { public function __construct( - private IJobList $jobList, + private readonly IJobList $jobList, ) { } diff --git a/lib/private/Repair/CleanTags.php b/lib/private/Repair/CleanTags.php index ad8fa6235e6..4397f2cf09e 100644 --- a/lib/private/Repair/CleanTags.php +++ b/lib/private/Repair/CleanTags.php @@ -20,29 +20,22 @@ use OCP\Migration\IRepairStep; */ class CleanTags implements IRepairStep { - protected $deletedTags = 0; + protected int $deletedTags = 0; - /** - * @param IDBConnection $connection - * @param IUserManager $userManager - */ public function __construct( - protected IDBConnection $connection, - protected IUserManager $userManager, + protected readonly IDBConnection $connection, + protected readonly IUserManager $userManager, ) { } - /** - * @return string - */ - public function getName() { + public function getName(): string { return 'Clean tags and favorites'; } /** * Updates the configuration after running an update */ - public function run(IOutput $output) { + public function run(IOutput $output): void { $this->deleteOrphanTags($output); $this->deleteOrphanFileEntries($output); $this->deleteOrphanTagEntries($output); @@ -52,7 +45,7 @@ class CleanTags implements IRepairStep { /** * Delete tags for deleted users */ - protected function deleteOrphanTags(IOutput $output) { + protected function deleteOrphanTags(IOutput $output): void { $offset = 0; while ($this->checkTags($offset)) { $offset += 50; @@ -61,7 +54,7 @@ class CleanTags implements IRepairStep { $output->info(sprintf('%d tags of deleted users have been removed.', $this->deletedTags)); } - protected function checkTags($offset) { + protected function checkTags(int $offset): bool { $query = $this->connection->getQueryBuilder(); $query->select('uid') ->from('vcategory') @@ -98,7 +91,7 @@ class CleanTags implements IRepairStep { /** * Delete tag entries for deleted files */ - protected function deleteOrphanFileEntries(IOutput $output) { + protected function deleteOrphanFileEntries(IOutput $output): void { $this->deleteOrphanEntries( $output, '%d tags for delete files have been removed.', @@ -110,7 +103,7 @@ class CleanTags implements IRepairStep { /** * Delete tag entries for deleted tags */ - protected function deleteOrphanTagEntries(IOutput $output) { + protected function deleteOrphanTagEntries(IOutput $output): void { $this->deleteOrphanEntries( $output, '%d tag entries for deleted tags have been removed.', @@ -122,7 +115,7 @@ class CleanTags implements IRepairStep { /** * Delete tags that have no entries */ - protected function deleteOrphanCategoryEntries(IOutput $output) { + protected function deleteOrphanCategoryEntries(IOutput $output): void { $this->deleteOrphanEntries( $output, '%d tags with no entries have been removed.', @@ -138,15 +131,10 @@ class CleanTags implements IRepairStep { * whether $sourceNullColumn is null. If it is null, the entry in $deleteTable * is being deleted. * - * @param string $repairInfo - * @param string $deleteTable - * @param string $deleteId - * @param string $sourceTable - * @param string $sourceId * @param string $sourceNullColumn If this column is null in the source table, * the entry is deleted in the $deleteTable */ - protected function deleteOrphanEntries(IOutput $output, $repairInfo, $deleteTable, $deleteId, $sourceTable, $sourceId, $sourceNullColumn) { + protected function deleteOrphanEntries(IOutput $output, string $repairInfo, string $deleteTable, string $deleteId, string $sourceTable, string $sourceId, string $sourceNullColumn): void { $qb = $this->connection->getQueryBuilder(); $qb->select('d.' . $deleteId) diff --git a/lib/private/Repair/CleanUpAbandonedApps.php b/lib/private/Repair/CleanUpAbandonedApps.php index cbc9349c72a..ce166ebd2b3 100644 --- a/lib/private/Repair/CleanUpAbandonedApps.php +++ b/lib/private/Repair/CleanUpAbandonedApps.php @@ -15,7 +15,7 @@ class CleanUpAbandonedApps implements IRepairStep { protected const ABANDONED_APPS = ['accessibility', 'files_videoplayer']; public function __construct( - private IConfig $config, + private readonly IConfig $config, ) { } diff --git a/lib/private/Repair/ClearFrontendCaches.php b/lib/private/Repair/ClearFrontendCaches.php index ff10c7ae109..60be83efe63 100644 --- a/lib/private/Repair/ClearFrontendCaches.php +++ b/lib/private/Repair/ClearFrontendCaches.php @@ -18,11 +18,11 @@ class ClearFrontendCaches implements IRepairStep { ) { } - public function getName() { + public function getName(): string { return 'Clear frontend caches'; } - public function run(IOutput $output) { + public function run(IOutput $output): void { try { $c = $this->cacheFactory->createDistributed('imagePath'); $c->clear(); diff --git a/lib/private/Repair/ClearGeneratedAvatarCache.php b/lib/private/Repair/ClearGeneratedAvatarCache.php index 0e4c8a67fda..d48683dfb1e 100644 --- a/lib/private/Repair/ClearGeneratedAvatarCache.php +++ b/lib/private/Repair/ClearGeneratedAvatarCache.php @@ -14,9 +14,9 @@ use OCP\Migration\IRepairStep; class ClearGeneratedAvatarCache implements IRepairStep { public function __construct( - private IConfig $config, - protected AvatarManager $avatarManager, - private IJobList $jobList, + private readonly IConfig $config, + protected readonly AvatarManager $avatarManager, + private readonly IJobList $jobList, ) { } diff --git a/lib/private/Repair/Collation.php b/lib/private/Repair/Collation.php index 2ffa2086d9f..346a5abc815 100644 --- a/lib/private/Repair/Collation.php +++ b/lib/private/Repair/Collation.php @@ -15,25 +15,22 @@ use OCP\Migration\IRepairStep; use Psr\Log\LoggerInterface; class Collation implements IRepairStep { - /** - * @param bool $ignoreFailures - */ public function __construct( protected IConfig $config, protected LoggerInterface $logger, protected IDBConnection $connection, - protected $ignoreFailures, + protected bool $ignoreFailures, ) { } - public function getName() { + public function getName(): string { return 'Repair MySQL collation'; } /** * Fix mime types */ - public function run(IOutput $output) { + public function run(IOutput $output): void { if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_MYSQL) { $output->info('Not a mysql database -> nothing to do'); return; @@ -73,10 +70,9 @@ class Collation implements IRepairStep { } /** - * @param IDBConnection $connection * @return string[] */ - protected function getAllNonUTF8BinTables(IDBConnection $connection) { + protected function getAllNonUTF8BinTables(IDBConnection $connection): array { $dbName = $this->config->getSystemValueString('dbname'); $characterSet = $this->config->getSystemValueBool('mysql.utf8mb4', false) ? 'utf8mb4' : 'utf8'; diff --git a/lib/private/Repair/ConfigKeyMigration.php b/lib/private/Repair/ConfigKeyMigration.php index dcca43d65df..acdda68dc0a 100644 --- a/lib/private/Repair/ConfigKeyMigration.php +++ b/lib/private/Repair/ConfigKeyMigration.php @@ -23,7 +23,7 @@ class ConfigKeyMigration implements IRepairStep { return 'Migrate config keys'; } - public function run(IOutput $output) { + public function run(IOutput $output): void { $this->configManager->migrateConfigLexiconKeys(); $this->configManager->updateLexiconEntries('core'); } diff --git a/lib/private/Repair/MoveUpdaterStepFile.php b/lib/private/Repair/MoveUpdaterStepFile.php index e7cdfa8036c..7155eed5689 100644 --- a/lib/private/Repair/MoveUpdaterStepFile.php +++ b/lib/private/Repair/MoveUpdaterStepFile.php @@ -12,19 +12,16 @@ use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; class MoveUpdaterStepFile implements IRepairStep { - /** - * @param IConfig $config - */ public function __construct( - protected $config, + protected IConfig $config, ) { } - public function getName() { + public function getName(): string { return 'Move .step file of updater to backup location'; } - public function run(IOutput $output) { + public function run(IOutput $output): void { $updateDir = $this->config->getSystemValue('updatedirectory', null) ?? $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data'); $instanceId = $this->config->getSystemValueString('instanceid'); diff --git a/lib/private/Repair/NC13/AddLogRotateJob.php b/lib/private/Repair/NC13/AddLogRotateJob.php index 6c41b602587..7ad9b3445b3 100644 --- a/lib/private/Repair/NC13/AddLogRotateJob.php +++ b/lib/private/Repair/NC13/AddLogRotateJob.php @@ -13,15 +13,15 @@ use OCP\Migration\IRepairStep; class AddLogRotateJob implements IRepairStep { public function __construct( - private IJobList $jobList, + private readonly IJobList $jobList, ) { } - public function getName() { + public function getName(): string { return 'Add log rotate job'; } - public function run(IOutput $output) { + public function run(IOutput $output): void { $this->jobList->add(Rotate::class); } } diff --git a/lib/private/Repair/NC14/AddPreviewBackgroundCleanupJob.php b/lib/private/Repair/NC14/AddPreviewBackgroundCleanupJob.php index 3419716ada4..c7a95775083 100644 --- a/lib/private/Repair/NC14/AddPreviewBackgroundCleanupJob.php +++ b/lib/private/Repair/NC14/AddPreviewBackgroundCleanupJob.php @@ -15,7 +15,7 @@ use OCP\Migration\IRepairStep; class AddPreviewBackgroundCleanupJob implements IRepairStep { public function __construct( - private IJobList $jobList, + private readonly IJobList $jobList, ) { } diff --git a/lib/private/Repair/NC16/ClearCollectionsAccessCache.php b/lib/private/Repair/NC16/ClearCollectionsAccessCache.php index d6d51eb96a0..e1eef24eedd 100644 --- a/lib/private/Repair/NC16/ClearCollectionsAccessCache.php +++ b/lib/private/Repair/NC16/ClearCollectionsAccessCache.php @@ -9,15 +9,14 @@ declare(strict_types=1); namespace OC\Repair\NC16; use OC\Collaboration\Resources\Manager; -use OCP\Collaboration\Resources\IManager; use OCP\IConfig; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; class ClearCollectionsAccessCache implements IRepairStep { public function __construct( - private IConfig $config, - private IManager $manager, + private readonly IConfig $config, + private readonly Manager $manager, ) { } @@ -32,9 +31,7 @@ class ClearCollectionsAccessCache implements IRepairStep { public function run(IOutput $output): void { if ($this->shouldRun()) { - /** @var Manager $man */ - $man = $this->manager; - $man->invalidateAccessCacheForAllCollections(); + $this->manager->invalidateAccessCacheForAllCollections(); } } } diff --git a/lib/private/Repair/NC18/ResetGeneratedAvatarFlag.php b/lib/private/Repair/NC18/ResetGeneratedAvatarFlag.php index 23bd05a69a7..d07bc2d7193 100644 --- a/lib/private/Repair/NC18/ResetGeneratedAvatarFlag.php +++ b/lib/private/Repair/NC18/ResetGeneratedAvatarFlag.php @@ -15,8 +15,8 @@ use OCP\Migration\IRepairStep; class ResetGeneratedAvatarFlag implements IRepairStep { public function __construct( - private IConfig $config, - private IDBConnection $connection, + private readonly IConfig $config, + private readonly IDBConnection $connection, ) { } diff --git a/lib/private/Repair/NC20/ShippedDashboardEnable.php b/lib/private/Repair/NC20/ShippedDashboardEnable.php index 0050cab67f6..5d505d0c3ef 100644 --- a/lib/private/Repair/NC20/ShippedDashboardEnable.php +++ b/lib/private/Repair/NC20/ShippedDashboardEnable.php @@ -14,15 +14,15 @@ use OCP\Migration\IRepairStep; class ShippedDashboardEnable implements IRepairStep { public function __construct( - private IConfig $config, + private readonly IConfig $config, ) { } - public function getName() { + public function getName(): string { return 'Remove old dashboard app config data'; } - public function run(IOutput $output) { + public function run(IOutput $output): void { $version = $this->config->getAppValue('dashboard', 'version', '7.0.0'); if (version_compare($version, '7.0.0', '<')) { $this->config->deleteAppValues('dashboard'); diff --git a/lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php b/lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php index e20db9d644b..e55dce7814d 100644 --- a/lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php +++ b/lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php @@ -19,18 +19,18 @@ class AddCheckForUserCertificatesJob implements IRepairStep { ) { } - public function getName() { + public function getName(): string { return 'Queue a one-time job to check for user uploaded certificates'; } - private function shouldRun() { + private function shouldRun(): bool { $versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0.0'); // was added to 21.0.0.2 return version_compare($versionFromBeforeUpdate, '21.0.0.2', '<'); } - public function run(IOutput $output) { + public function run(IOutput $output): void { if ($this->shouldRun()) { $this->config->setAppValue('files_external', 'user_certificate_scan', 'not-run-yet'); $this->jobList->add(CheckForUserCertificates::class); diff --git a/lib/private/Repair/NC22/LookupServerSendCheck.php b/lib/private/Repair/NC22/LookupServerSendCheck.php index a7e33557347..453e06fd606 100644 --- a/lib/private/Repair/NC22/LookupServerSendCheck.php +++ b/lib/private/Repair/NC22/LookupServerSendCheck.php @@ -10,14 +10,12 @@ namespace OC\Repair\NC22; use OC\Core\BackgroundJobs\LookupServerSendCheckBackgroundJob; use OCP\BackgroundJob\IJobList; -use OCP\IConfig; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; class LookupServerSendCheck implements IRepairStep { public function __construct( - private IJobList $jobList, - private IConfig $config, + private readonly IJobList $jobList, ) { } diff --git a/lib/private/Repair/NC24/AddTokenCleanupJob.php b/lib/private/Repair/NC24/AddTokenCleanupJob.php index 44ba97e6482..be6b24b0c1c 100644 --- a/lib/private/Repair/NC24/AddTokenCleanupJob.php +++ b/lib/private/Repair/NC24/AddTokenCleanupJob.php @@ -15,7 +15,7 @@ use OCP\Migration\IRepairStep; class AddTokenCleanupJob implements IRepairStep { public function __construct( - private IJobList $jobList, + private readonly IJobList $jobList, ) { } diff --git a/lib/private/Repair/NC25/AddMissingSecretJob.php b/lib/private/Repair/NC25/AddMissingSecretJob.php index c8cd30ae23a..2b8f5934ee8 100644 --- a/lib/private/Repair/NC25/AddMissingSecretJob.php +++ b/lib/private/Repair/NC25/AddMissingSecretJob.php @@ -16,8 +16,8 @@ use OCP\Security\ISecureRandom; class AddMissingSecretJob implements IRepairStep { public function __construct( - private IConfig $config, - private ISecureRandom $random, + private readonly IConfig $config, + private readonly ISecureRandom $random, ) { } diff --git a/lib/private/Repair/OldGroupMembershipShares.php b/lib/private/Repair/OldGroupMembershipShares.php index 003c15cfb88..a0ae19957e5 100644 --- a/lib/private/Repair/OldGroupMembershipShares.php +++ b/lib/private/Repair/OldGroupMembershipShares.php @@ -15,26 +15,17 @@ use OCP\Share\IShare; class OldGroupMembershipShares implements IRepairStep { /** - * @var array [gid => [uid => (bool)]] + * @var array> [gid => [uid => (bool)]] */ - protected $memberships; + protected array $memberships = []; - /** - * @param IDBConnection $connection - * @param IGroupManager $groupManager - */ public function __construct( - protected IDBConnection $connection, - protected IGroupManager $groupManager, + protected readonly IDBConnection $connection, + protected readonly IGroupManager $groupManager, ) { } - /** - * Returns the step's name - * - * @return string - */ - public function getName() { + public function getName(): string { return 'Remove shares of old group memberships'; } @@ -44,7 +35,7 @@ class OldGroupMembershipShares implements IRepairStep { * * @throws \Exception in case of failure */ - public function run(IOutput $output) { + public function run(IOutput $output): void { $deletedEntries = 0; $query = $this->connection->getQueryBuilder(); @@ -75,12 +66,7 @@ class OldGroupMembershipShares implements IRepairStep { } } - /** - * @param string $gid - * @param string $uid - * @return bool - */ - protected function isMember($gid, $uid) { + protected function isMember(string $gid, string $uid): bool { if (isset($this->memberships[$gid][$uid])) { return $this->memberships[$gid][$uid]; } diff --git a/lib/private/Repair/Owncloud/CleanPreviews.php b/lib/private/Repair/Owncloud/CleanPreviews.php index 52ef3a850c8..8764929669a 100644 --- a/lib/private/Repair/Owncloud/CleanPreviews.php +++ b/lib/private/Repair/Owncloud/CleanPreviews.php @@ -14,28 +14,18 @@ use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; class CleanPreviews implements IRepairStep { - /** - * MoveAvatars constructor. - * - * @param IJobList $jobList - * @param IUserManager $userManager - * @param IConfig $config - */ public function __construct( - private IJobList $jobList, - private IUserManager $userManager, - private IConfig $config, + private readonly IJobList $jobList, + private readonly IUserManager $userManager, + private readonly IConfig $config, ) { } - /** - * @return string - */ - public function getName() { + public function getName(): string { return 'Add preview cleanup background jobs'; } - public function run(IOutput $output) { + public function run(IOutput $output): void { if (!$this->config->getAppValue('core', 'previewsCleanedUp', false)) { $this->userManager->callForSeenUsers(function (IUser $user): void { $this->jobList->add(CleanPreviewsBackgroundJob::class, ['uid' => $user->getUID()]); diff --git a/lib/private/Repair/Owncloud/DropAccountTermsTable.php b/lib/private/Repair/Owncloud/DropAccountTermsTable.php index a7e43f8790d..2420327a037 100644 --- a/lib/private/Repair/Owncloud/DropAccountTermsTable.php +++ b/lib/private/Repair/Owncloud/DropAccountTermsTable.php @@ -11,25 +11,16 @@ use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; class DropAccountTermsTable implements IRepairStep { - /** - * @param IDBConnection $db - */ public function __construct( protected IDBConnection $db, ) { } - /** - * @return string - */ - public function getName() { + public function getName(): string { return 'Drop account terms table when migrating from ownCloud'; } - /** - * @param IOutput $output - */ - public function run(IOutput $output) { + public function run(IOutput $output): void { if (!$this->db->tableExists('account_terms')) { return; } diff --git a/lib/private/Repair/Owncloud/MigrateOauthTables.php b/lib/private/Repair/Owncloud/MigrateOauthTables.php index de26a907e02..1d7b630b4e5 100644 --- a/lib/private/Repair/Owncloud/MigrateOauthTables.php +++ b/lib/private/Repair/Owncloud/MigrateOauthTables.php @@ -34,14 +34,11 @@ class MigrateOauthTables implements IRepairStep { ) { } - /** - * @return string - */ - public function getName() { + public function getName(): string { return 'Migrate oauth2_clients table to nextcloud schema'; } - public function run(IOutput $output) { + public function run(IOutput $output): void { $schema = new SchemaWrapper($this->db); if (!$schema->hasTable('oauth2_clients')) { $output->info('oauth2_clients table does not exist.'); diff --git a/lib/private/Repair/Owncloud/MigratePropertiesTable.php b/lib/private/Repair/Owncloud/MigratePropertiesTable.php index f7462ebbe53..60122bbf3d1 100644 --- a/lib/private/Repair/Owncloud/MigratePropertiesTable.php +++ b/lib/private/Repair/Owncloud/MigratePropertiesTable.php @@ -19,7 +19,7 @@ use OCP\Migration\IRepairStep; class MigratePropertiesTable implements IRepairStep { public function __construct( - private Connection $db, + private readonly Connection $db, ) { } diff --git a/lib/private/Repair/Owncloud/MoveAvatars.php b/lib/private/Repair/Owncloud/MoveAvatars.php index 987767eabbf..f4ee9d751f2 100644 --- a/lib/private/Repair/Owncloud/MoveAvatars.php +++ b/lib/private/Repair/Owncloud/MoveAvatars.php @@ -12,26 +12,17 @@ use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; class MoveAvatars implements IRepairStep { - /** - * MoveAvatars constructor. - * - * @param IJobList $jobList - * @param IConfig $config - */ public function __construct( - private IJobList $jobList, - private IConfig $config, + private readonly IJobList $jobList, + private readonly IConfig $config, ) { } - /** - * @return string - */ - public function getName() { + public function getName(): string { return 'Add move avatar background job'; } - public function run(IOutput $output) { + public function run(IOutput $output): void { // only run once if ($this->config->getAppValue('core', 'moveavatarsdone') === 'yes') { $output->info('Repair step already executed'); diff --git a/lib/private/Repair/Owncloud/SaveAccountsTableData.php b/lib/private/Repair/Owncloud/SaveAccountsTableData.php index 0f8a9b07964..61284a09e5d 100644 --- a/lib/private/Repair/Owncloud/SaveAccountsTableData.php +++ b/lib/private/Repair/Owncloud/SaveAccountsTableData.php @@ -20,29 +20,19 @@ use OCP\PreConditionNotMetException; class SaveAccountsTableData implements IRepairStep { public const BATCH_SIZE = 75; - protected $hasForeignKeyOnPersistentLocks = false; + protected bool $hasForeignKeyOnPersistentLocks = false; - /** - * @param IDBConnection $db - * @param IConfig $config - */ public function __construct( protected IDBConnection $db, protected IConfig $config, ) { } - /** - * @return string - */ - public function getName() { + public function getName(): string { return 'Copy data from accounts table when migrating from ownCloud'; } - /** - * @param IOutput $output - */ - public function run(IOutput $output) { + public function run(IOutput $output): void { if (!$this->shouldRun()) { return; } @@ -71,10 +61,7 @@ class SaveAccountsTableData implements IRepairStep { $this->db->dropTable('accounts'); } - /** - * @return bool - */ - protected function shouldRun() { + protected function shouldRun(): bool { $schema = $this->db->createSchema(); $prefix = $this->config->getSystemValueString('dbtableprefix', 'oc_'); @@ -102,10 +89,9 @@ class SaveAccountsTableData implements IRepairStep { } /** - * @param int $offset * @return int Number of copied users */ - protected function runStep($offset) { + protected function runStep(int $offset): int { $query = $this->db->getQueryBuilder(); $query->select('*') ->from('accounts') @@ -127,9 +113,7 @@ class SaveAccountsTableData implements IRepairStep { while ($row = $result->fetch()) { try { $this->migrateUserInfo($update, $row); - } catch (PreConditionNotMetException $e) { - // Ignore and continue - } catch (\UnexpectedValueException $e) { + } catch (PreConditionNotMetException|\UnexpectedValueException) { // Ignore and continue } $updatedUsers++; @@ -140,12 +124,10 @@ class SaveAccountsTableData implements IRepairStep { } /** - * @param IQueryBuilder $update - * @param array $userdata * @throws PreConditionNotMetException * @throws \UnexpectedValueException */ - protected function migrateUserInfo(IQueryBuilder $update, $userdata) { + protected function migrateUserInfo(IQueryBuilder $update, array $userdata): void { $state = (int)$userdata['state']; if ($state === 3) { // Deleted user, ignore diff --git a/lib/private/Repair/Owncloud/UpdateLanguageCodes.php b/lib/private/Repair/Owncloud/UpdateLanguageCodes.php index fe47e19406d..1088ea6e623 100644 --- a/lib/private/Repair/Owncloud/UpdateLanguageCodes.php +++ b/lib/private/Repair/Owncloud/UpdateLanguageCodes.php @@ -13,27 +13,17 @@ use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; class UpdateLanguageCodes implements IRepairStep { - /** - * @param IDBConnection $connection - * @param IConfig $config - */ public function __construct( - private IDBConnection $connection, - private IConfig $config, + private readonly IDBConnection $connection, + private readonly IConfig $config, ) { } - /** - * {@inheritdoc} - */ - public function getName() { + public function getName(): string { return 'Repair language codes'; } - /** - * {@inheritdoc} - */ - public function run(IOutput $output) { + public function run(IOutput $output): void { $versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0'); if (version_compare($versionFromBeforeUpdate, '12.0.0.13', '>')) { diff --git a/lib/private/Repair/RemoveBrokenProperties.php b/lib/private/Repair/RemoveBrokenProperties.php index 85939b39e5e..b993ffaa5e8 100644 --- a/lib/private/Repair/RemoveBrokenProperties.php +++ b/lib/private/Repair/RemoveBrokenProperties.php @@ -12,29 +12,21 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; +use Override; class RemoveBrokenProperties implements IRepairStep { - /** - * RemoveBrokenProperties constructor. - * - * @param IDBConnection $db - */ public function __construct( - private IDBConnection $db, + private readonly IDBConnection $db, ) { } - /** - * @inheritdoc - */ - public function getName() { + #[Override] + public function getName(): string { return 'Remove broken DAV object properties'; } - /** - * @inheritdoc - */ - public function run(IOutput $output) { + #[Override] + public function run(IOutput $output): void { // retrieve all object properties $qb = $this->db->getQueryBuilder(); $qb->select('id', 'propertyvalue') diff --git a/lib/private/Repair/RemoveLinkShares.php b/lib/private/Repair/RemoveLinkShares.php index a07ebdb72c3..c2f0516af08 100644 --- a/lib/private/Repair/RemoveLinkShares.php +++ b/lib/private/Repair/RemoveLinkShares.php @@ -20,14 +20,14 @@ use OCP\Notification\IManager; class RemoveLinkShares implements IRepairStep { /** @var string[] */ - private $userToNotify = []; + private array $userToNotify = []; public function __construct( - private IDBConnection $connection, - private IConfig $config, - private IGroupManager $groupManager, - private IManager $notificationManager, - private ITimeFactory $timeFactory, + private readonly IDBConnection $connection, + private readonly IConfig $config, + private readonly IGroupManager $groupManager, + private readonly IManager $notificationManager, + private readonly ITimeFactory $timeFactory, ) { } @@ -53,8 +53,6 @@ class RemoveLinkShares implements IRepairStep { /** * Delete the share - * - * @param int $id */ private function deleteShare(int $id): void { $qb = $this->connection->getQueryBuilder(); @@ -65,8 +63,6 @@ class RemoveLinkShares implements IRepairStep { /** * Get the total of affected shares - * - * @return int */ private function getTotal(): int { $subSubQuery = $this->connection->getQueryBuilder(); @@ -130,7 +126,7 @@ class RemoveLinkShares implements IRepairStep { /** * Process a single share * - * @param array $data + * @param array{id: int|string, uid_owner: string, uid_initiator: string} $data */ private function processShare(array $data): void { $id = $data['id']; @@ -143,8 +139,6 @@ class RemoveLinkShares implements IRepairStep { /** * Update list of users to notify - * - * @param string $uid */ private function addToNotify(string $uid): void { if (!isset($this->userToNotify[$uid])) { diff --git a/lib/private/Repair/RepairDavShares.php b/lib/private/Repair/RepairDavShares.php index 8199d3dff27..c21c0274461 100644 --- a/lib/private/Repair/RepairDavShares.php +++ b/lib/private/Repair/RepairDavShares.php @@ -23,25 +23,21 @@ use function urlencode; class RepairDavShares implements IRepairStep { protected const GROUP_PRINCIPAL_PREFIX = 'principals/groups/'; - /** @var bool */ - private $hintInvalidShares = false; + private bool $hintInvalidShares = false; public function __construct( - private IConfig $config, - private IDBConnection $dbc, - private IGroupManager $groupManager, - private LoggerInterface $logger, + private readonly IConfig $config, + private readonly IDBConnection $dbc, + private readonly IGroupManager $groupManager, + private readonly LoggerInterface $logger, ) { } - /** - * @inheritDoc - */ - public function getName() { + public function getName(): string { return 'Repair DAV shares'; } - protected function repairUnencodedGroupShares() { + protected function repairUnencodedGroupShares(): bool { $qb = $this->dbc->getQueryBuilder(); $qb->select(['id', 'principaluri']) ->from('dav_shares') @@ -92,10 +88,7 @@ class RepairDavShares implements IRepairStep { return true; } - /** - * @inheritDoc - */ - public function run(IOutput $output) { + public function run(IOutput $output): void { $versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0'); if (version_compare($versionFromBeforeUpdate, '20.0.8', '<') && $this->repairUnencodedGroupShares() diff --git a/lib/private/Repair/RepairInvalidShares.php b/lib/private/Repair/RepairInvalidShares.php index 4c85432969a..5939d0d6430 100644 --- a/lib/private/Repair/RepairInvalidShares.php +++ b/lib/private/Repair/RepairInvalidShares.php @@ -25,7 +25,7 @@ class RepairInvalidShares implements IRepairStep { ) { } - public function getName() { + public function getName(): string { return 'Repair invalid shares'; } diff --git a/lib/private/Repair/RepairMimeTypes.php b/lib/private/Repair/RepairMimeTypes.php index 28594778636..a9ef95b50c2 100644 --- a/lib/private/Repair/RepairMimeTypes.php +++ b/lib/private/Repair/RepairMimeTypes.php @@ -19,14 +19,12 @@ use OCP\Migration\IRepairStep; class RepairMimeTypes implements IRepairStep { private bool $dryRun = false; private int $changeCount = 0; - - /** @var int */ protected int $folderMimeTypeId; public function __construct( - protected IConfig $config, - protected IAppConfig $appConfig, - protected IDBConnection $connection, + protected readonly IConfig $config, + protected readonly IAppConfig $appConfig, + protected readonly IDBConnection $connection, ) { } diff --git a/tests/lib/Repair/RepairCollationTest.php b/tests/lib/Repair/RepairCollationTest.php index 11fbecb0171..969c5b57b7f 100644 --- a/tests/lib/Repair/RepairCollationTest.php +++ b/tests/lib/Repair/RepairCollationTest.php @@ -20,10 +20,9 @@ use Test\TestCase; class TestCollationRepair extends Collation { /** - * @param IDBConnection $connection * @return string[] */ - public function getAllNonUTF8BinTables(IDBConnection $connection) { + public function getAllNonUTF8BinTables(IDBConnection $connection): array { return parent::getAllNonUTF8BinTables($connection); } } @@ -49,7 +48,6 @@ class RepairCollationTest extends TestCase { $this->connection = Server::get(ConnectionAdapter::class); if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_MYSQL) { $this->markTestSkipped('Test only relevant on MySql'); - return; } $this->logger = $this->createMock(LoggerInterface::class);