diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 9d4ef09a30b5d..eacdc6318b6d6 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -1301,11 +1301,6 @@ $i - - - $legacyEvent - - getEditors @@ -1639,8 +1634,7 @@ $files_list - - $freeSpace + $maxUploadFilesize $maxUploadFilesize @@ -1681,11 +1675,6 @@ isSharable - - - $legacyEvent - - $exception->getMessage() @@ -1967,10 +1956,8 @@ - + $share->getId() - $shareId - $shareId (int)$data['id'] diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php index 598c66b6aba74..95693eddac220 100644 --- a/lib/private/AppFramework/Utility/SimpleContainer.php +++ b/lib/private/AppFramework/Utility/SimpleContainer.php @@ -52,6 +52,12 @@ public function __construct() { $this->container = new Container(); } + /** + * @psalm-suppress MoreSpecificImplementedParamType + * @psalm-template T + * @psalm-param class-string $id + * @psalm-return T + */ public function get(string $id) { return $this->query($id); } diff --git a/lib/private/EventDispatcher/SymfonyAdapter.php b/lib/private/EventDispatcher/SymfonyAdapter.php index 6cd636afc55dd..0e33c8455d2c4 100644 --- a/lib/private/EventDispatcher/SymfonyAdapter.php +++ b/lib/private/EventDispatcher/SymfonyAdapter.php @@ -82,8 +82,8 @@ private static function detectEventAndName($a, $b) { * @param string $eventName The name of the event to dispatch. The name of * the event is the name of the method that is * invoked on listeners. - * @param Event|null $event The event to pass to the event handlers/listeners - * If not supplied, an empty Event instance is created + * @param Event|GenericEvent|null $event The event to pass to the event handlers/listeners + * If not supplied, an empty Event instance is created * * @return object the emitted event * @deprecated 20.0.0 diff --git a/lib/private/Server.php b/lib/private/Server.php index 13bbf972abb0a..a7bb3eb562596 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -982,7 +982,10 @@ public function __construct($webRoot, \OC\Config $config) { $this->registerAlias(ITrustedDomainHelper::class, TrustedDomainHelper::class); /** @deprecated 19.0.0 */ $this->registerDeprecatedAlias('Throttler', Throttler::class); - $this->registerService('IntegrityCodeChecker', function (ContainerInterface $c) { + + /** @deprecated 24.0.0 */ + $this->registerDeprecatedAlias('IntegrityCodeChecker', Checker::class); + $this->registerService(Checker::class, function (ContainerInterface $c) { // IConfig and IAppManager requires a working database. This code // might however be called when ownCloud is not yet setup. if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { @@ -1156,8 +1159,10 @@ public function __construct($webRoot, \OC\Config $config) { /** @deprecated 19.0.0 */ $this->registerDeprecatedAlias('CommentsManager', ICommentsManager::class); - $this->registerAlias(\OC_Defaults::class, 'ThemingDefaults'); - $this->registerService('ThemingDefaults', function (Server $c) { + $this->registerAlias(\OC_Defaults::class, ThemingDefaults::class); + /** @deprecated 24.0.0 */ + $this->registerDeprecatedAlias('ThemingDefaults', ThemingDefaults::class); + $this->registerService(ThemingDefaults::class, function (Server $c) { /* * Dark magic for autoloader. * If we do a class_exists it will try to load the class which will @@ -1206,7 +1211,9 @@ public function __construct($webRoot, \OC\Config $config) { $this->registerDeprecatedAlias('EventDispatcher', \OC\EventDispatcher\SymfonyAdapter::class); $this->registerAlias(EventDispatcherInterface::class, \OC\EventDispatcher\SymfonyAdapter::class); - $this->registerService('CryptoWrapper', function (ContainerInterface $c) { + /** @deprecated 24.0.0 */ + $this->registerDeprecatedAlias('CryptoWrapper', CryptoWrapper::class); + $this->registerService(CryptoWrapper::class, function (ContainerInterface $c) { // FIXME: Instantiiated here due to cyclic dependency $request = new Request( [ @@ -1261,7 +1268,7 @@ public function __construct($webRoot, \OC\Config $config) { $c->get(SymfonyAdapter::class), $c->get(IMailer::class), $c->get(IURLGenerator::class), - $c->get('ThemingDefaults'), + $c->get(ThemingDefaults::class), $c->get(IEventDispatcher::class), $c->get(IUserSession::class), $c->get(KnownUserService::class) @@ -1302,7 +1309,9 @@ public function __construct($webRoot, \OC\Config $config) { ); }); - $this->registerService('LockdownManager', function (ContainerInterface $c) { + /** @deprecated 24.0.0 */ + $this->registerDeprecatedAlias('LockdownManager', LockdownManager::class); + $this->registerService(LockdownManager::class, function (ContainerInterface $c): LockdownManager { return new LockdownManager(function () use ($c) { return $c->get(ISession::class); }); @@ -1645,6 +1654,7 @@ public function getUserSession() { * @deprecated 20.0.0 */ public function getSession() { + /** @psalm-suppress UndefinedInterfaceMethod */ return $this->get(IUserSession::class)->getSession(); } @@ -1653,6 +1663,7 @@ public function getSession() { */ public function setSession(\OCP\ISession $session) { $this->get(SessionStorage::class)->setSession($session); + /** @psalm-suppress UndefinedInterfaceMethod */ $this->get(IUserSession::class)->setSession($session); $this->get(Store::class)->setSession($session); } @@ -1763,7 +1774,7 @@ public function getMemCacheFactory() { * @deprecated 20.0.0 */ public function getGetRedisFactory() { - return $this->get('RedisFactory'); + return $this->get(RedisFactory::class); } @@ -1974,6 +1985,7 @@ public function getWebRoot() { * @deprecated 20.0.0 */ public function getOcsClient() { + /** @psalm-suppress UndefinedClass */ return $this->get('OcsClient'); } @@ -2117,11 +2129,11 @@ public function getCommentsManager() { } /** - * @return \OCA\Theming\ThemingDefaults + * @return ThemingDefaults * @deprecated 20.0.0 */ public function getThemingDefaults() { - return $this->get('ThemingDefaults'); + return $this->get(ThemingDefaults::class); } /** @@ -2129,15 +2141,15 @@ public function getThemingDefaults() { * @deprecated 20.0.0 */ public function getIntegrityCodeChecker() { - return $this->get('IntegrityCodeChecker'); + return $this->get(Checker::class); } /** - * @return \OC\Session\CryptoWrapper + * @return CryptoWrapper * @deprecated 20.0.0 */ public function getSessionCryptoWrapper() { - return $this->get('CryptoWrapper'); + return $this->get(CryptoWrapper::class); } /** @@ -2243,7 +2255,7 @@ public function getAutoCompleteManager() { * @deprecated 20.0.0 */ public function getLDAPProvider() { - return $this->get('LDAPProvider'); + return $this->get(ILDAPProvider::class); } /** @@ -2269,7 +2281,7 @@ public function getAppDataDir($app) { * @deprecated 20.0.0 */ public function getLockdownManager() { - return $this->get('LockdownManager'); + return $this->get(LockdownManager::class); } /** diff --git a/lib/private/Template/Base.php b/lib/private/Template/Base.php index 2de8c7ad5b18c..66f51a6e9d88d 100644 --- a/lib/private/Template/Base.php +++ b/lib/private/Template/Base.php @@ -30,7 +30,6 @@ namespace OC\Template; use OCP\Defaults; -use Throwable; class Base { private $template; // The template @@ -92,7 +91,7 @@ protected function getCoreTemplateDirs($theme, $serverRoot) { /** * Assign variables * @param string $key key - * @param array|bool|integer|string|Throwable $value value + * @param mixed $value value * @return bool * * This function assigns a variable. It can be accessed via $_[$key] in