refactor: Apply rector changes

Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
nextcloud-command 2026-06-07 15:08:26 +00:00 committed by GitHub
parent d108e818fa
commit d3207be4f6
8 changed files with 31 additions and 23 deletions

View file

@ -18,6 +18,7 @@ use OCP\Calendar\Events\CalendarObjectRestoredEvent;
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 @@ class CalendarDelegateActionListener implements IEventListener {
/**
* @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]),

View file

@ -21,6 +21,7 @@ use OCP\Activity\IEvent;
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 @@ class AuthSettingsControllerTest extends TestCase {
$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())

View file

@ -21,6 +21,7 @@ use OCA\User_LDAP\User\OfflineUser;
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 @@ class User_LDAPTest extends TestCase {
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],
];
}

View file

@ -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();
}
/**

View file

@ -50,7 +50,7 @@ class Redis extends Cache implements IMemcacheTTL {
*/
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;
}

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace Test\OCM;
use OC\Memcache\ArrayCache;
use OC\OCM\OCMSignatoryManager;
use OC\Security\IdentityProof\Manager as IdentityProofManager;
use OCP\Http\Client\IClient;
@ -54,7 +55,7 @@ class OCMSignatoryManagerJwksTest extends TestCase {
$this->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,

View file

@ -9,6 +9,7 @@ declare(strict_types=1);
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 @@ class OCMSignatoryManagerRotationTest extends TestCase {
->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 @@ class OCMSignatoryManagerRotationTest extends TestCase {
->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,