diff --git a/apps/dav/lib/Listener/CalendarDelegateActionListener.php b/apps/dav/lib/Listener/CalendarDelegateActionListener.php index 475f2fcd3ee35..eaa4d2861633e 100644 --- a/apps/dav/lib/Listener/CalendarDelegateActionListener.php +++ b/apps/dav/lib/Listener/CalendarDelegateActionListener.php @@ -18,6 +18,7 @@ use OCP\Calendar\Events\CalendarObjectUpdatedEvent; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; +use OCP\IL10N; use OCP\IUser; use OCP\IUserManager; use OCP\IUserSession; @@ -210,7 +211,7 @@ private function sendNotification( /** * @return array{0: string, 1: string} [subject, heading] */ - private function subjectAndHeading(\OCP\IL10N $l, string $action, string $actorName, string $summary, string $calendarName): array { + private function subjectAndHeading(IL10N $l, string $action, string $actorName, string $summary, string $calendarName): array { return match ($action) { self::ACTION_CREATE => [ $l->t('%1$s created "%2$s" on your behalf', [$actorName, $summary]), diff --git a/apps/settings/tests/Controller/AuthSettingsControllerTest.php b/apps/settings/tests/Controller/AuthSettingsControllerTest.php index c2e20fdf8ad98..f3503e3c2d7f3 100644 --- a/apps/settings/tests/Controller/AuthSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AuthSettingsControllerTest.php @@ -21,6 +21,7 @@ use OCP\Activity\IManager; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Services\IAppConfig; +use OCP\Authentication\Exceptions\WipeTokenException; use OCP\IConfig; use OCP\IL10N; use OCP\IRequest; @@ -243,7 +244,7 @@ public function testDestroyWipePendingEmitsCancelledSubject(): void { $this->tokenProvider->expects($this->once()) ->method('getTokenById') ->with($tokenId) - ->willThrowException(new \OCP\Authentication\Exceptions\WipeTokenException($token)); + ->willThrowException(new WipeTokenException($token)); // The token is still invalidated (the user opted into cancelling the wipe). $this->tokenProvider->expects($this->once()) diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 325f109ee6c50..b87b5fde55dec 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -21,6 +21,7 @@ use OCA\User_LDAP\User\User; use OCA\User_LDAP\User_LDAP; use OCA\User_LDAP\UserPluginManager; +use OCP\Accounts\IAccountManager; use OCP\HintException; use OCP\IConfig; use OCP\IGroupManager; @@ -1464,24 +1465,24 @@ public function testImplementsAction(string $configurable, string|int $value, in public static function canEditPropertyProvider(): array { return [ // Display name is always managed by LDAP - [\OCP\Accounts\IAccountManager::PROPERTY_DISPLAYNAME, '', false], - [\OCP\Accounts\IAccountManager::PROPERTY_DISPLAYNAME, 'cn', false], + [IAccountManager::PROPERTY_DISPLAYNAME, '', false], + [IAccountManager::PROPERTY_DISPLAYNAME, 'cn', false], // Fields with no LDAP attribute configured are user-editable - [\OCP\Accounts\IAccountManager::PROPERTY_EMAIL, '', true], - [\OCP\Accounts\IAccountManager::PROPERTY_PHONE, '', true], - [\OCP\Accounts\IAccountManager::PROPERTY_WEBSITE, '', true], - [\OCP\Accounts\IAccountManager::PROPERTY_ADDRESS, '', true], - [\OCP\Accounts\IAccountManager::PROPERTY_FEDIVERSE, '', true], - [\OCP\Accounts\IAccountManager::PROPERTY_ORGANISATION, '', true], - [\OCP\Accounts\IAccountManager::PROPERTY_ROLE, '', true], - [\OCP\Accounts\IAccountManager::PROPERTY_HEADLINE, '', true], - [\OCP\Accounts\IAccountManager::PROPERTY_BIOGRAPHY, '', true], - [\OCP\Accounts\IAccountManager::PROPERTY_BIRTHDATE, '', true], - [\OCP\Accounts\IAccountManager::PROPERTY_PRONOUNS, '', true], + [IAccountManager::PROPERTY_EMAIL, '', true], + [IAccountManager::PROPERTY_PHONE, '', true], + [IAccountManager::PROPERTY_WEBSITE, '', true], + [IAccountManager::PROPERTY_ADDRESS, '', true], + [IAccountManager::PROPERTY_FEDIVERSE, '', true], + [IAccountManager::PROPERTY_ORGANISATION, '', true], + [IAccountManager::PROPERTY_ROLE, '', true], + [IAccountManager::PROPERTY_HEADLINE, '', true], + [IAccountManager::PROPERTY_BIOGRAPHY, '', true], + [IAccountManager::PROPERTY_BIRTHDATE, '', true], + [IAccountManager::PROPERTY_PRONOUNS, '', true], // Fields with an LDAP attribute configured are managed by LDAP, not user-editable - [\OCP\Accounts\IAccountManager::PROPERTY_EMAIL, 'mail', false], - [\OCP\Accounts\IAccountManager::PROPERTY_PHONE, 'telephoneNumber', false], - [\OCP\Accounts\IAccountManager::PROPERTY_WEBSITE, 'labeledURI', false], + [IAccountManager::PROPERTY_EMAIL, 'mail', false], + [IAccountManager::PROPERTY_PHONE, 'telephoneNumber', false], + [IAccountManager::PROPERTY_WEBSITE, 'labeledURI', false], ]; } diff --git a/index.php b/index.php index d4bdd263f79f3..cb59b75b3f7ec 100644 --- a/index.php +++ b/index.php @@ -36,7 +36,7 @@ function resetStaticProperties(): void { Filesystem::reset(); } -$handler = static function () { +$handler = static function (): void { try { resetStaticProperties(); OC::init(); diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php index b67b0a90a4f6a..6a78eaa648174 100644 --- a/lib/private/Memcache/Memcached.php +++ b/lib/private/Memcache/Memcached.php @@ -9,6 +9,7 @@ namespace OC\Memcache; use OCP\IMemcache; +use OCP\Server; class Memcached extends Cache implements IMemcache { use CASTrait; @@ -19,7 +20,7 @@ class Memcached extends Cache implements IMemcache { public function __construct($prefix = '') { parent::__construct($prefix); - $this->cache = \OCP\Server::get(MemcachedFactory::class)->getInstance(); + $this->cache = Server::get(MemcachedFactory::class)->getInstance(); } /** diff --git a/lib/private/Memcache/Redis.php b/lib/private/Memcache/Redis.php index 3558264b52524..5bca6a225381f 100644 --- a/lib/private/Memcache/Redis.php +++ b/lib/private/Memcache/Redis.php @@ -50,7 +50,7 @@ public function __construct($prefix = '', string $logFile = '') { */ public function getCache(): \Redis|\RedisCluster { if ($this->cache === null) { - $this->cache = \OCP\Server::get(RedisFactory::class)->getInstance(); + $this->cache = Server::get(RedisFactory::class)->getInstance(); } return $this->cache; } diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index c3e1b78d2be69..945522cc7fdf0 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -16,6 +16,7 @@ use OC\TaskProcessing\Db\TaskMapper; use OCA\AppAPI\PublicFunctions; use OCA\Guests\UserBackend; +use OCA\NotifyPush\Queue\IQueue; use OCP\App\IAppManager; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\MultipleObjectsReturnedException; @@ -1193,7 +1194,7 @@ private function notifyTaskStatus(Task $task, int $status): void { ) { try { /** @psalm-suppress UndefinedClass */ - $queue = Server::get(\OCA\NotifyPush\Queue\IQueue::class); + $queue = Server::get(IQueue::class); /** @psalm-suppress UndefinedClass */ $queue->push('notify_custom', [ 'user' => $userId, @@ -1285,7 +1286,7 @@ public function setTaskIntermediateOutput(int $id, array $output): bool { ) { try { /** @psalm-suppress UndefinedClass */ - $queue = Server::get(\OCA\NotifyPush\Queue\IQueue::class); + $queue = Server::get(IQueue::class); /** @psalm-suppress UndefinedClass */ $queue->push('notify_custom', [ 'user' => $userId, diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 3e4b7a7fe9d8b..7af1d24d669bd 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -261,7 +261,7 @@ public static function addHeader($tag, $attributes, $text = null, $prepend = fal * @return array arrays with error messages and hints */ public static function checkServer(SystemConfig $config) { - $l = \OCP\Server::get(IFactory::class)->get('lib'); + $l = Server::get(IFactory::class)->get('lib'); $errors = []; $CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT . '/data'); diff --git a/tests/Core/Command/User/LastSeenTest.php b/tests/Core/Command/User/LastSeenTest.php index 8aa9147096478..e1deeb0d43efd 100644 --- a/tests/Core/Command/User/LastSeenTest.php +++ b/tests/Core/Command/User/LastSeenTest.php @@ -129,7 +129,7 @@ public function testAllUsersWithoutExcludeDisabled(): void { $this->userManager->expects($this->once()) ->method('callForAllUsers') - ->willReturnCallback(function ($callback) use ($enabledUser, $disabledUser) { + ->willReturnCallback(function ($callback) use ($enabledUser, $disabledUser): void { $callback($enabledUser); $callback($disabledUser); }); @@ -176,7 +176,7 @@ public function testAllUsersWithExcludeDisabled(): void { $this->userManager->expects($this->once()) ->method('callForAllUsers') - ->willReturnCallback(function ($callback) use ($enabledUser, $disabledUser) { + ->willReturnCallback(function ($callback) use ($enabledUser, $disabledUser): void { $callback($enabledUser); $callback($disabledUser); }); diff --git a/tests/lib/BackgroundJob/DummyJob.php b/tests/lib/BackgroundJob/DummyJob.php index cf8ab72d71ca9..332fc327fd911 100644 --- a/tests/lib/BackgroundJob/DummyJob.php +++ b/tests/lib/BackgroundJob/DummyJob.php @@ -1,5 +1,7 @@ clientService->method('newClient')->willReturn($this->client); $cacheFactory = $this->createMock(ICacheFactory::class); - $cacheFactory->method('createDistributed')->willReturn(new \OC\Memcache\ArrayCache('')); + $cacheFactory->method('createDistributed')->willReturn(new ArrayCache('')); $this->signatoryManager = new OCMSignatoryManager( $this->appConfig, diff --git a/tests/lib/OCM/OCMSignatoryManagerRotationTest.php b/tests/lib/OCM/OCMSignatoryManagerRotationTest.php index 24d25f4476a49..3c1d7038ee78c 100644 --- a/tests/lib/OCM/OCMSignatoryManagerRotationTest.php +++ b/tests/lib/OCM/OCMSignatoryManagerRotationTest.php @@ -9,6 +9,7 @@ namespace Test\OCM; +use OC\Memcache\ArrayCache; use OC\OCM\OCMSignatoryManager; use OC\Security\IdentityProof\Key; use OC\Security\IdentityProof\Manager as IdentityProofManager; @@ -50,7 +51,7 @@ protected function setUp(): void { ->willReturnCallback(static fn (string $suffix): string => 'https://alice.example/' . ltrim($suffix, '/')); $cacheFactory = $this->createMock(ICacheFactory::class); - $cacheFactory->method('createDistributed')->willReturn(new \OC\Memcache\ArrayCache('')); + $cacheFactory->method('createDistributed')->willReturn(new ArrayCache('')); $this->signatoryManager = new OCMSignatoryManager( $this->appConfig, @@ -194,7 +195,7 @@ public function testSignerReturnsNullWhenIdentityCannotBeDerived(): void { ->willThrowException(new IdentityNotFoundException('no url either')); $cacheFactory = $this->createMock(ICacheFactory::class); - $cacheFactory->method('createDistributed')->willReturn(new \OC\Memcache\ArrayCache('')); + $cacheFactory->method('createDistributed')->willReturn(new ArrayCache('')); $manager = new OCMSignatoryManager( $this->appConfig,