diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index aedcbbce335fc..7630f2ec30a89 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -180,7 +180,7 @@ private function getGenerator(): Generator { * @throws \InvalidArgumentException if the preview would be invalid (in case the original image is invalid) * @since 11.0.0 - \InvalidArgumentException was added in 12.0.0 */ - public function getPreview(File $file, $width = -1, $height = -1, $crop = false, $mode = IPreview::MODE_FILL, $mimeType = null) { + public function getPreview(File $file, $width = -1, $height = -1, $crop = false, $mode = IPreview::MODE_FILL, $mimeType = null): ISimpleFile { $previewConcurrency = $this->getGenerator()->getNumConcurrentPreviews('preview_concurrency_all'); $sem = Generator::guardWithSemaphore(Generator::SEMAPHORE_ID_ALL, $previewConcurrency); try { @@ -203,7 +203,7 @@ public function getPreview(File $file, $width = -1, $height = -1, $crop = false, * @throws \InvalidArgumentException if the preview would be invalid (in case the original image is invalid) * @since 19.0.0 */ - public function generatePreviews(File $file, array $specifications, $mimeType = null) { + public function generatePreviews(File $file, array $specifications, $mimeType = null): ISimpleFile { return $this->getGenerator()->generatePreviews($file, $specifications, $mimeType); } @@ -213,7 +213,7 @@ public function generatePreviews(File $file, array $specifications, $mimeType = * @param string $mimeType * @return boolean */ - public function isMimeSupported($mimeType = '*') { + public function isMimeSupported($mimeType = '*'): bool { if (!$this->config->getSystemValueBool('enable_previews', true)) { return false; } @@ -299,9 +299,9 @@ public function isAvailable(\OCP\Files\FileInfo $file): bool { * - OC\Preview\SVG * - OC\Preview\TIFF * - * @return array + * @return array|null */ - protected function getEnabledDefaultProvider() { + protected function getEnabledDefaultProvider(): ?array { if ($this->defaultProviders !== null) { return $this->defaultProviders; } @@ -335,8 +335,9 @@ protected function getEnabledDefaultProvider() { * * @param string $class * @param string $mimeType + * @param array $options */ - protected function registerCoreProvider($class, $mimeType, $options = []) { + protected function registerCoreProvider(string $class, string $mimeType, array $options = []): void { if (in_array(trim($class, '\\'), $this->getEnabledDefaultProvider())) { $this->registerProvider($mimeType, function () use ($class, $options) { return new $class($options); @@ -347,7 +348,7 @@ protected function registerCoreProvider($class, $mimeType, $options = []) { /** * Register the default providers (if enabled) */ - protected function registerCoreProviders() { + protected function registerCoreProviders(): void { if ($this->registeredCoreProviders) { return; } diff --git a/lib/private/RedisFactory.php b/lib/private/RedisFactory.php index 4903a8713df2e..21aa077caa09d 100644 --- a/lib/private/RedisFactory.php +++ b/lib/private/RedisFactory.php @@ -33,23 +33,23 @@ class RedisFactory { public const REDIS_EXTRA_PARAMETERS_MINIMAL_VERSION = '5.3.0'; /** @var \Redis|\RedisCluster */ - private $instance; - - private SystemConfig $config; - - private IEventLogger $eventLogger; + private \Redis|\RedisCluster $instance; /** * RedisFactory constructor. * * @param SystemConfig $config */ - public function __construct(SystemConfig $config, IEventLogger $eventLogger) { - $this->config = $config; - $this->eventLogger = $eventLogger; + public function __construct( + private SystemConfig $config, + private IEventLogger $eventLogger, + ) { } - private function create() { + /** + * @throws \Exception + */ + private function create(): void { $isCluster = in_array('redis.cluster', $this->config->getKeys(), true); $config = $isCluster ? $this->config->getValue('redis.cluster', []) @@ -137,7 +137,7 @@ private function create() { * @return array|null * @throws \UnexpectedValueException */ - private function getSslContext($config) { + private function getSslContext(array $config): ?array { if (isset($config['ssl_context'])) { if (!$this->isConnectionParametersSupported()) { throw new \UnexpectedValueException(\sprintf( @@ -150,7 +150,10 @@ private function getSslContext($config) { return null; } - public function getInstance() { + /** + * @throws \Exception + */ + public function getInstance(): \RedisCluster|\Redis { if (!$this->isAvailable()) { throw new \Exception('Redis support is not available'); } diff --git a/lib/private/Repair.php b/lib/private/Repair.php index b1800d6087d39..bbd5e5f6a12b2 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -110,7 +110,7 @@ public function setRepairSteps(array $repairSteps): void { /** * 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')); @@ -132,10 +132,10 @@ public function run() { /** * Add repair step * - * @param IRepairStep|string $repairStep repair step + * @param string|IRepairStep $repairStep repair step * @throws \Exception */ - public function addStep($repairStep) { + public function addStep(string|IRepairStep $repairStep): void { if (is_string($repairStep)) { try { $s = \OC::$server->get($repairStep); @@ -220,7 +220,7 @@ public static function getRepairSteps(): array { * * @return IRepairStep[] */ - public static function getExpensiveRepairSteps() { + public static function getExpensiveRepairSteps(): array { return [ new OldGroupMembershipShares(\OC::$server->getDatabaseConnection(), \OC::$server->getGroupManager()), \OC::$server->get(ValidatePhoneNumber::class), @@ -233,7 +233,7 @@ public static function getExpensiveRepairSteps() { * * @return IRepairStep[] */ - public static function getBeforeUpgradeRepairSteps() { + public static function getBeforeUpgradeRepairSteps(): array { /** @var ConnectionAdapter $connectionAdapter */ $connectionAdapter = \OC::$server->get(ConnectionAdapter::class); $config = \OC::$server->getConfig(); @@ -252,7 +252,7 @@ public function debug(string $message): void { /** * @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)); } @@ -260,7 +260,7 @@ public function info($message) { /** * @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)); } @@ -268,7 +268,7 @@ public function warning($message) { /** * @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)); } @@ -277,15 +277,12 @@ public function startProgress($max = 0) { * @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/Search.php b/lib/private/Search.php index 9f1a0323aa30b..145601e832688 100644 --- a/lib/private/Search.php +++ b/lib/private/Search.php @@ -37,8 +37,8 @@ */ class Search implements ISearch { /** @var Provider[] */ - private $providers = []; - private $registeredProviders = []; + private array $providers = []; + private array $registeredProviders = []; /** * Search all providers for $query @@ -48,7 +48,7 @@ class Search implements ISearch { * @param int $size, 0 = all * @return array An array of OC\Search\Result's */ - public function searchPaged($query, array $inApps = [], $page = 1, $size = 30) { + public function searchPaged($query, array $inApps = [], $page = 1, $size = 30): array { $this->initProviders(); $results = []; foreach ($this->providers as $provider) { @@ -75,7 +75,7 @@ public function searchPaged($query, array $inApps = [], $page = 1, $size = 30) { /** * Remove all registered search providers */ - public function clearProviders() { + public function clearProviders(): void { $this->providers = []; $this->registeredProviders = []; } @@ -84,7 +84,7 @@ public function clearProviders() { * Remove one existing search provider * @param string $provider class name of a OC\Search\Provider */ - public function removeProvider($provider) { + public function removeProvider($provider): void { $this->registeredProviders = array_filter( $this->registeredProviders, function ($element) use ($provider) { @@ -100,14 +100,14 @@ function ($element) use ($provider) { * @param string $class class name of a OC\Search\Provider * @param array $options optional */ - public function registerProvider($class, array $options = []) { + public function registerProvider($class, array $options = []): void { $this->registeredProviders[] = ['class' => $class, 'options' => $options]; } /** * Create instances of all the registered search providers */ - private function initProviders() { + private function initProviders(): void { if (! empty($this->providers)) { return; } diff --git a/lib/private/Server.php b/lib/private/Server.php index 21d60d558295a..333458a7c5336 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -292,16 +292,15 @@ * TODO: hookup all manager classes */ class Server extends ServerContainer implements IServerContainer { - /** @var string */ - private $webRoot; - /** * @param string $webRoot * @param \OC\Config $config */ - public function __construct($webRoot, \OC\Config $config) { + public function __construct( + private string $webRoot, + \OC\Config $config, + ) { parent::__construct(); - $this->webRoot = $webRoot; // To find out if we are running from CLI or not $this->registerParameter('isCLI', \OC::$CLI); @@ -1436,7 +1435,7 @@ public function __construct($webRoot, \OC\Config $config) { $this->connectDispatcher(); } - public function boot() { + public function boot(): void { /** @var HookConnector $hookConnector */ $hookConnector = $this->get(HookConnector::class); $hookConnector->viewToNode(); @@ -1446,7 +1445,7 @@ public function boot() { * @return \OCP\Calendar\IManager * @deprecated 20.0.0 */ - public function getCalendarManager() { + public function getCalendarManager(): \OCP\Calendar\IManager { return $this->get(\OC\Calendar\Manager::class); } @@ -1454,7 +1453,7 @@ public function getCalendarManager() { * @return \OCP\Calendar\Resource\IManager * @deprecated 20.0.0 */ - public function getCalendarResourceBackendManager() { + public function getCalendarResourceBackendManager(): \OCP\Calendar\Resource\IManager { return $this->get(\OC\Calendar\Resource\Manager::class); } @@ -1462,7 +1461,7 @@ public function getCalendarResourceBackendManager() { * @return \OCP\Calendar\Room\IManager * @deprecated 20.0.0 */ - public function getCalendarRoomBackendManager() { + public function getCalendarRoomBackendManager(): \OCP\Calendar\Room\IManager { return $this->get(\OC\Calendar\Room\Manager::class); } @@ -1482,7 +1481,7 @@ private function connectDispatcher(): void { * @return \OCP\Contacts\IManager * @deprecated 20.0.0 */ - public function getContactsManager() { + public function getContactsManager(): \OCP\Contacts\IManager { return $this->get(\OCP\Contacts\IManager::class); } @@ -1490,7 +1489,7 @@ public function getContactsManager() { * @return \OC\Encryption\Manager * @deprecated 20.0.0 */ - public function getEncryptionManager() { + public function getEncryptionManager(): Encryption\Manager { return $this->get(\OCP\Encryption\IManager::class); } @@ -1498,7 +1497,7 @@ public function getEncryptionManager() { * @return \OC\Encryption\File * @deprecated 20.0.0 */ - public function getEncryptionFilesHelper() { + public function getEncryptionFilesHelper(): Encryption\File { return $this->get(IFile::class); } @@ -1506,7 +1505,7 @@ public function getEncryptionFilesHelper() { * @return \OCP\Encryption\Keys\IStorage * @deprecated 20.0.0 */ - public function getEncryptionKeyStorage() { + public function getEncryptionKeyStorage(): IStorage { return $this->get(IStorage::class); } @@ -1518,7 +1517,7 @@ public function getEncryptionKeyStorage() { * @return \OCP\IRequest * @deprecated 20.0.0 */ - public function getRequest() { + public function getRequest(): IRequest { return $this->get(IRequest::class); } @@ -1528,7 +1527,7 @@ public function getRequest() { * @return IPreview * @deprecated 20.0.0 */ - public function getPreviewManager() { + public function getPreviewManager(): IPreview { return $this->get(IPreview::class); } @@ -1539,7 +1538,7 @@ public function getPreviewManager() { * @return ITagManager * @deprecated 20.0.0 */ - public function getTagManager() { + public function getTagManager(): ITagManager { return $this->get(ITagManager::class); } @@ -1551,7 +1550,7 @@ public function getTagManager() { * @since 9.0.0 * @deprecated 20.0.0 */ - public function getSystemTagManager() { + public function getSystemTagManager(): ISystemTagManager { return $this->get(ISystemTagManager::class); } @@ -1563,7 +1562,7 @@ public function getSystemTagManager() { * @since 9.0.0 * @deprecated 20.0.0 */ - public function getSystemTagObjectMapper() { + public function getSystemTagObjectMapper(): ISystemTagObjectMapper { return $this->get(ISystemTagObjectMapper::class); } @@ -1573,7 +1572,7 @@ public function getSystemTagObjectMapper() { * @return IAvatarManager * @deprecated 20.0.0 */ - public function getAvatarManager() { + public function getAvatarManager(): IAvatarManager { return $this->get(IAvatarManager::class); } @@ -1583,7 +1582,7 @@ public function getAvatarManager() { * @return IRootFolder * @deprecated 20.0.0 */ - public function getRootFolder() { + public function getRootFolder(): IRootFolder { return $this->get(IRootFolder::class); } @@ -1595,7 +1594,7 @@ public function getRootFolder() { * @return IRootFolder * @deprecated 20.0.0 */ - public function getLazyRootFolder() { + public function getLazyRootFolder(): IRootFolder { return $this->get(IRootFolder::class); } @@ -1606,7 +1605,7 @@ public function getLazyRootFolder() { * @return \OCP\Files\Folder|null * @deprecated 20.0.0 */ - public function getUserFolder($userId = null) { + public function getUserFolder($userId = null): ?\OCP\Files\Folder { if ($userId === null) { $user = $this->get(IUserSession::class)->getUser(); if (!$user) { @@ -1622,7 +1621,7 @@ public function getUserFolder($userId = null) { * @return \OC\User\Manager * @deprecated 20.0.0 */ - public function getUserManager() { + public function getUserManager(): User\Manager { return $this->get(IUserManager::class); } @@ -1630,7 +1629,7 @@ public function getUserManager() { * @return \OC\Group\Manager * @deprecated 20.0.0 */ - public function getGroupManager() { + public function getGroupManager(): Group\Manager { return $this->get(IGroupManager::class); } @@ -1638,7 +1637,7 @@ public function getGroupManager() { * @return \OC\User\Session * @deprecated 20.0.0 */ - public function getUserSession() { + public function getUserSession(): Session { return $this->get(IUserSession::class); } @@ -1646,7 +1645,7 @@ public function getUserSession() { * @return \OCP\ISession * @deprecated 20.0.0 */ - public function getSession() { + public function getSession(): ISession { return $this->get(Session::class)->getSession(); } @@ -1654,7 +1653,7 @@ public function getSession() { * @param \OCP\ISession $session * @return void */ - public function setSession(\OCP\ISession $session) { + public function setSession(\OCP\ISession $session): void { $this->get(SessionStorage::class)->setSession($session); $this->get(Session::class)->setSession($session); $this->get(Store::class)->setSession($session); @@ -1664,7 +1663,7 @@ public function setSession(\OCP\ISession $session) { * @return \OC\Authentication\TwoFactorAuth\Manager * @deprecated 20.0.0 */ - public function getTwoFactorAuthManager() { + public function getTwoFactorAuthManager(): Authentication\TwoFactorAuth\Manager { return $this->get(\OC\Authentication\TwoFactorAuth\Manager::class); } @@ -1672,7 +1671,7 @@ public function getTwoFactorAuthManager() { * @return \OC\NavigationManager * @deprecated 20.0.0 */ - public function getNavigationManager() { + public function getNavigationManager(): NavigationManager { return $this->get(INavigationManager::class); } @@ -1680,7 +1679,7 @@ public function getNavigationManager() { * @return \OCP\IConfig * @deprecated 20.0.0 */ - public function getConfig() { + public function getConfig(): \OCP\IConfig { return $this->get(AllConfig::class); } @@ -1688,7 +1687,7 @@ public function getConfig() { * @return \OC\SystemConfig * @deprecated 20.0.0 */ - public function getSystemConfig() { + public function getSystemConfig(): SystemConfig { return $this->get(SystemConfig::class); } @@ -1698,7 +1697,7 @@ public function getSystemConfig() { * @return IAppConfig * @deprecated 20.0.0 */ - public function getAppConfig() { + public function getAppConfig(): IAppConfig { return $this->get(IAppConfig::class); } @@ -1706,7 +1705,7 @@ public function getAppConfig() { * @return IFactory * @deprecated 20.0.0 */ - public function getL10NFactory() { + public function getL10NFactory(): IFactory { return $this->get(IFactory::class); } @@ -1718,7 +1717,7 @@ public function getL10NFactory() { * @return IL10N * @deprecated 20.0.0 use DI of {@see IL10N} or {@see IFactory} instead, or {@see \OCP\Util::getL10N()} as a last resort */ - public function getL10N($app, $lang = null) { + public function getL10N($app, $lang = null): IL10N { return $this->get(IFactory::class)->get($app, $lang); } @@ -1726,7 +1725,7 @@ public function getL10N($app, $lang = null) { * @return IURLGenerator * @deprecated 20.0.0 */ - public function getURLGenerator() { + public function getURLGenerator(): IURLGenerator { return $this->get(IURLGenerator::class); } @@ -1734,7 +1733,7 @@ public function getURLGenerator() { * @return AppFetcher * @deprecated 20.0.0 */ - public function getAppFetcher() { + public function getAppFetcher(): AppFetcher { return $this->get(AppFetcher::class); } @@ -1745,7 +1744,7 @@ public function getAppFetcher() { * @return ICache * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache */ - public function getCache() { + public function getCache(): ICache { return $this->get(ICache::class); } @@ -1755,7 +1754,7 @@ public function getCache() { * @return \OCP\ICacheFactory * @deprecated 20.0.0 */ - public function getMemCacheFactory() { + public function getMemCacheFactory(): ICacheFactory { return $this->get(ICacheFactory::class); } @@ -1765,7 +1764,7 @@ public function getMemCacheFactory() { * @return \OC\RedisFactory * @deprecated 20.0.0 */ - public function getGetRedisFactory() { + public function getGetRedisFactory(): RedisFactory { return $this->get('RedisFactory'); } @@ -1776,7 +1775,7 @@ public function getGetRedisFactory() { * @return \OCP\IDBConnection * @deprecated 20.0.0 */ - public function getDatabaseConnection() { + public function getDatabaseConnection(): IDBConnection { return $this->get(IDBConnection::class); } @@ -1786,7 +1785,7 @@ public function getDatabaseConnection() { * @return \OCP\Activity\IManager * @deprecated 20.0.0 */ - public function getActivityManager() { + public function getActivityManager(): \OCP\Activity\IManager { return $this->get(\OCP\Activity\IManager::class); } @@ -1796,7 +1795,7 @@ public function getActivityManager() { * @return IJobList * @deprecated 20.0.0 */ - public function getJobList() { + public function getJobList(): IJobList { return $this->get(IJobList::class); } @@ -1806,7 +1805,7 @@ public function getJobList() { * @return ILogger * @deprecated 20.0.0 */ - public function getLogger() { + public function getLogger(): ILogger { return $this->get(ILogger::class); } @@ -1815,7 +1814,7 @@ public function getLogger() { * @throws \OCP\AppFramework\QueryException * @deprecated 20.0.0 */ - public function getLogFactory() { + public function getLogFactory(): ILogFactory { return $this->get(ILogFactory::class); } @@ -1825,7 +1824,7 @@ public function getLogFactory() { * @return IRouter * @deprecated 20.0.0 */ - public function getRouter() { + public function getRouter(): IRouter { return $this->get(IRouter::class); } @@ -1835,7 +1834,7 @@ public function getRouter() { * @return ISearch * @deprecated 20.0.0 */ - public function getSearch() { + public function getSearch(): ISearch { return $this->get(ISearch::class); } @@ -1845,7 +1844,7 @@ public function getSearch() { * @return \OCP\Security\ISecureRandom * @deprecated 20.0.0 */ - public function getSecureRandom() { + public function getSecureRandom(): ISecureRandom { return $this->get(ISecureRandom::class); } @@ -1855,7 +1854,7 @@ public function getSecureRandom() { * @return ICrypto * @deprecated 20.0.0 */ - public function getCrypto() { + public function getCrypto(): ICrypto { return $this->get(ICrypto::class); } @@ -1865,7 +1864,7 @@ public function getCrypto() { * @return IHasher * @deprecated 20.0.0 */ - public function getHasher() { + public function getHasher(): IHasher { return $this->get(IHasher::class); } @@ -1875,7 +1874,7 @@ public function getHasher() { * @return ICredentialsManager * @deprecated 20.0.0 */ - public function getCredentialsManager() { + public function getCredentialsManager(): ICredentialsManager { return $this->get(ICredentialsManager::class); } @@ -1884,7 +1883,7 @@ public function getCredentialsManager() { * * @return \OCP\ICertificateManager */ - public function getCertificateManager() { + public function getCertificateManager(): ICertificateManager { return $this->get(ICertificateManager::class); } @@ -1894,7 +1893,7 @@ public function getCertificateManager() { * @return IClientService * @deprecated 20.0.0 */ - public function getHTTPClientService() { + public function getHTTPClientService(): IClientService { return $this->get(IClientService::class); } @@ -1906,7 +1905,7 @@ public function getHTTPClientService() { * @return IEventLogger * @deprecated 20.0.0 */ - public function getEventLogger() { + public function getEventLogger(): IEventLogger { return $this->get(IEventLogger::class); } @@ -1918,7 +1917,7 @@ public function getEventLogger() { * @return IQueryLogger * @deprecated 20.0.0 */ - public function getQueryLogger() { + public function getQueryLogger(): IQueryLogger { return $this->get(IQueryLogger::class); } @@ -1928,7 +1927,7 @@ public function getQueryLogger() { * @return \OCP\ITempManager * @deprecated 20.0.0 */ - public function getTempManager() { + public function getTempManager(): ITempManager { return $this->get(ITempManager::class); } @@ -1938,7 +1937,7 @@ public function getTempManager() { * @return \OCP\App\IAppManager * @deprecated 20.0.0 */ - public function getAppManager() { + public function getAppManager(): IAppManager { return $this->get(IAppManager::class); } @@ -1948,7 +1947,7 @@ public function getAppManager() { * @return IMailer * @deprecated 20.0.0 */ - public function getMailer() { + public function getMailer(): IMailer { return $this->get(IMailer::class); } @@ -1958,7 +1957,7 @@ public function getMailer() { * @return string * @deprecated 20.0.0 */ - public function getWebRoot() { + public function getWebRoot(): string { return $this->webRoot; } @@ -1974,7 +1973,7 @@ public function getOcsClient() { * @return IDateTimeZone * @deprecated 20.0.0 */ - public function getDateTimeZone() { + public function getDateTimeZone(): IDateTimeZone { return $this->get(IDateTimeZone::class); } @@ -1982,7 +1981,7 @@ public function getDateTimeZone() { * @return IDateTimeFormatter * @deprecated 20.0.0 */ - public function getDateTimeFormatter() { + public function getDateTimeFormatter(): IDateTimeFormatter { return $this->get(IDateTimeFormatter::class); } @@ -1990,7 +1989,7 @@ public function getDateTimeFormatter() { * @return IMountProviderCollection * @deprecated 20.0.0 */ - public function getMountProviderCollection() { + public function getMountProviderCollection(): IMountProviderCollection { return $this->get(IMountProviderCollection::class); } @@ -2000,7 +1999,7 @@ public function getMountProviderCollection() { * @return IniGetWrapper * @deprecated 20.0.0 */ - public function getIniWrapper() { + public function getIniWrapper(): IniGetWrapper { return $this->get(IniGetWrapper::class); } @@ -2008,7 +2007,7 @@ public function getIniWrapper() { * @return \OCP\Command\IBus * @deprecated 20.0.0 */ - public function getCommandBus() { + public function getCommandBus(): IBus { return $this->get(IBus::class); } @@ -2018,7 +2017,7 @@ public function getCommandBus() { * @return TrustedDomainHelper * @deprecated 20.0.0 */ - public function getTrustedDomainHelper() { + public function getTrustedDomainHelper(): TrustedDomainHelper { return $this->get(TrustedDomainHelper::class); } @@ -2029,7 +2028,7 @@ public function getTrustedDomainHelper() { * @since 8.1.0 * @deprecated 20.0.0 */ - public function getLockingProvider() { + public function getLockingProvider(): ILockingProvider { return $this->get(ILockingProvider::class); } @@ -2037,7 +2036,7 @@ public function getLockingProvider() { * @return IMountManager * @deprecated 20.0.0 **/ - public function getMountManager() { + public function getMountManager(): IMountManager { return $this->get(IMountManager::class); } @@ -2045,7 +2044,7 @@ public function getMountManager() { * @return IUserMountCache * @deprecated 20.0.0 */ - public function getUserMountCache() { + public function getUserMountCache(): IUserMountCache { return $this->get(IUserMountCache::class); } @@ -2055,7 +2054,7 @@ public function getUserMountCache() { * @return IMimeTypeDetector * @deprecated 20.0.0 */ - public function getMimeTypeDetector() { + public function getMimeTypeDetector(): IMimeTypeDetector { return $this->get(IMimeTypeDetector::class); } @@ -2065,7 +2064,7 @@ public function getMimeTypeDetector() { * @return IMimeTypeLoader * @deprecated 20.0.0 */ - public function getMimeTypeLoader() { + public function getMimeTypeLoader(): IMimeTypeLoader { return $this->get(IMimeTypeLoader::class); } @@ -2075,7 +2074,7 @@ public function getMimeTypeLoader() { * @return CapabilitiesManager * @deprecated 20.0.0 */ - public function getCapabilitiesManager() { + public function getCapabilitiesManager(): CapabilitiesManager { return $this->get(CapabilitiesManager::class); } @@ -2086,7 +2085,7 @@ public function getCapabilitiesManager() { * @since 8.2.0 * @deprecated 20.0.0 */ - public function getNotificationManager() { + public function getNotificationManager(): \OCP\Notification\IManager { return $this->get(\OCP\Notification\IManager::class); } @@ -2094,7 +2093,7 @@ public function getNotificationManager() { * @return ICommentsManager * @deprecated 20.0.0 */ - public function getCommentsManager() { + public function getCommentsManager(): ICommentsManager { return $this->get(ICommentsManager::class); } @@ -2102,7 +2101,7 @@ public function getCommentsManager() { * @return \OCA\Theming\ThemingDefaults * @deprecated 20.0.0 */ - public function getThemingDefaults() { + public function getThemingDefaults(): ThemingDefaults { return $this->get('ThemingDefaults'); } @@ -2110,7 +2109,7 @@ public function getThemingDefaults() { * @return \OC\IntegrityCheck\Checker * @deprecated 20.0.0 */ - public function getIntegrityCodeChecker() { + public function getIntegrityCodeChecker(): Checker { return $this->get('IntegrityCodeChecker'); } @@ -2118,7 +2117,7 @@ public function getIntegrityCodeChecker() { * @return \OC\Session\CryptoWrapper * @deprecated 20.0.0 */ - public function getSessionCryptoWrapper() { + public function getSessionCryptoWrapper(): CryptoWrapper { return $this->get('CryptoWrapper'); } @@ -2126,7 +2125,7 @@ public function getSessionCryptoWrapper() { * @return CsrfTokenManager * @deprecated 20.0.0 */ - public function getCsrfTokenManager() { + public function getCsrfTokenManager(): CsrfTokenManager { return $this->get(CsrfTokenManager::class); } @@ -2134,7 +2133,7 @@ public function getCsrfTokenManager() { * @return IThrottler * @deprecated 20.0.0 */ - public function getBruteForceThrottler() { + public function getBruteForceThrottler(): Throttler { return $this->get(Throttler::class); } @@ -2142,7 +2141,7 @@ public function getBruteForceThrottler() { * @return IContentSecurityPolicyManager * @deprecated 20.0.0 */ - public function getContentSecurityPolicyManager() { + public function getContentSecurityPolicyManager(): IContentSecurityPolicyManager { return $this->get(ContentSecurityPolicyManager::class); } @@ -2150,7 +2149,7 @@ public function getContentSecurityPolicyManager() { * @return ContentSecurityPolicyNonceManager * @deprecated 20.0.0 */ - public function getContentSecurityPolicyNonceManager() { + public function getContentSecurityPolicyNonceManager(): ContentSecurityPolicyNonceManager { return $this->get(ContentSecurityPolicyNonceManager::class); } @@ -2160,7 +2159,7 @@ public function getContentSecurityPolicyNonceManager() { * @return \OCA\Files_External\Service\BackendService * @deprecated 20.0.0 */ - public function getStoragesBackendService() { + public function getStoragesBackendService(): BackendService { return $this->get(BackendService::class); } @@ -2170,7 +2169,7 @@ public function getStoragesBackendService() { * @return \OCA\Files_External\Service\GlobalStoragesService * @deprecated 20.0.0 */ - public function getGlobalStoragesService() { + public function getGlobalStoragesService(): GlobalStoragesService { return $this->get(GlobalStoragesService::class); } @@ -2180,7 +2179,7 @@ public function getGlobalStoragesService() { * @return \OCA\Files_External\Service\UserGlobalStoragesService * @deprecated 20.0.0 */ - public function getUserGlobalStoragesService() { + public function getUserGlobalStoragesService(): UserGlobalStoragesService { return $this->get(UserGlobalStoragesService::class); } @@ -2190,7 +2189,7 @@ public function getUserGlobalStoragesService() { * @return \OCA\Files_External\Service\UserStoragesService * @deprecated 20.0.0 */ - public function getUserStoragesService() { + public function getUserStoragesService(): UserStoragesService { return $this->get(UserStoragesService::class); } @@ -2198,7 +2197,7 @@ public function getUserStoragesService() { * @return \OCP\Share\IManager * @deprecated 20.0.0 */ - public function getShareManager() { + public function getShareManager(): \OCP\Share\IManager { return $this->get(\OCP\Share\IManager::class); } @@ -2206,7 +2205,7 @@ public function getShareManager() { * @return \OCP\Collaboration\Collaborators\ISearch * @deprecated 20.0.0 */ - public function getCollaboratorSearch() { + public function getCollaboratorSearch(): \OCP\Collaboration\Collaborators\ISearch { return $this->get(\OCP\Collaboration\Collaborators\ISearch::class); } @@ -2214,7 +2213,7 @@ public function getCollaboratorSearch() { * @return \OCP\Collaboration\AutoComplete\IManager * @deprecated 20.0.0 */ - public function getAutoCompleteManager() { + public function getAutoCompleteManager(): IManager { return $this->get(IManager::class); } @@ -2224,7 +2223,7 @@ public function getAutoCompleteManager() { * @return \OCP\LDAP\ILDAPProvider * @deprecated 20.0.0 */ - public function getLDAPProvider() { + public function getLDAPProvider(): ILDAPProvider { return $this->get('LDAPProvider'); } @@ -2232,7 +2231,7 @@ public function getLDAPProvider() { * @return \OCP\Settings\IManager * @deprecated 20.0.0 */ - public function getSettingsManager() { + public function getSettingsManager(): \OCP\Settings\IManager { return $this->get(\OC\Settings\Manager::class); } @@ -2240,7 +2239,7 @@ public function getSettingsManager() { * @return \OCP\Files\IAppData * @deprecated 20.0.0 Use get(\OCP\Files\AppData\IAppDataFactory::class)->get($app) instead */ - public function getAppDataDir($app) { + public function getAppDataDir($app): \OCP\Files\IAppData { /** @var \OC\Files\AppData\Factory $factory */ $factory = $this->get(\OC\Files\AppData\Factory::class); return $factory->get($app); @@ -2250,7 +2249,7 @@ public function getAppDataDir($app) { * @return \OCP\Lockdown\ILockdownManager * @deprecated 20.0.0 */ - public function getLockdownManager() { + public function getLockdownManager(): ILockdownManager { return $this->get('LockdownManager'); } @@ -2258,7 +2257,7 @@ public function getLockdownManager() { * @return \OCP\Federation\ICloudIdManager * @deprecated 20.0.0 */ - public function getCloudIdManager() { + public function getCloudIdManager(): ICloudIdManager { return $this->get(ICloudIdManager::class); } @@ -2266,7 +2265,7 @@ public function getCloudIdManager() { * @return \OCP\GlobalScale\IConfig * @deprecated 20.0.0 */ - public function getGlobalScaleConfig() { + public function getGlobalScaleConfig(): IConfig { return $this->get(IConfig::class); } @@ -2274,7 +2273,7 @@ public function getGlobalScaleConfig() { * @return \OCP\Federation\ICloudFederationProviderManager * @deprecated 20.0.0 */ - public function getCloudFederationProviderManager() { + public function getCloudFederationProviderManager(): ICloudFederationProviderManager { return $this->get(ICloudFederationProviderManager::class); } @@ -2282,7 +2281,7 @@ public function getCloudFederationProviderManager() { * @return \OCP\Remote\Api\IApiFactory * @deprecated 20.0.0 */ - public function getRemoteApiFactory() { + public function getRemoteApiFactory(): IApiFactory { return $this->get(IApiFactory::class); } @@ -2290,7 +2289,7 @@ public function getRemoteApiFactory() { * @return \OCP\Federation\ICloudFederationFactory * @deprecated 20.0.0 */ - public function getCloudFederationFactory() { + public function getCloudFederationFactory(): ICloudFederationFactory { return $this->get(ICloudFederationFactory::class); } @@ -2298,7 +2297,7 @@ public function getCloudFederationFactory() { * @return \OCP\Remote\IInstanceFactory * @deprecated 20.0.0 */ - public function getRemoteInstanceFactory() { + public function getRemoteInstanceFactory(): IInstanceFactory { return $this->get(IInstanceFactory::class); } @@ -2306,7 +2305,7 @@ public function getRemoteInstanceFactory() { * @return IStorageFactory * @deprecated 20.0.0 */ - public function getStorageFactory() { + public function getStorageFactory(): IStorageFactory { return $this->get(IStorageFactory::class); } @@ -2317,11 +2316,11 @@ public function getStorageFactory() { * @since 17.0.0 * @deprecated 20.0.0 */ - public function getGeneratorHelper() { + public function getGeneratorHelper(): GeneratorHelper { return $this->get(\OC\Preview\GeneratorHelper::class); } - private function registerDeprecatedAlias(string $alias, string $target) { + private function registerDeprecatedAlias(string $alias, string $target): void { $this->registerService($alias, function (ContainerInterface $container) use ($target, $alias) { try { /** @var LoggerInterface $logger */ diff --git a/lib/private/ServerContainer.php b/lib/private/ServerContainer.php index daa480a75d11d..67a254883bffc 100644 --- a/lib/private/ServerContainer.php +++ b/lib/private/ServerContainer.php @@ -40,13 +40,13 @@ */ class ServerContainer extends SimpleContainer { /** @var DIContainer[] */ - protected $appContainers; + protected array $appContainers; /** @var string[] */ - protected $hasNoAppContainer; + protected array $hasNoAppContainer; /** @var string[] */ - protected $namespaces; + protected array $namespaces; /** * ServerContainer constructor.