mirror of
https://github.com/nextcloud/server.git
synced 2026-02-27 18:37:17 +01:00
chore(rector): Apply current rector config
Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
This commit is contained in:
@@ -11,6 +11,7 @@ namespace OCA\DAV\CalDAV;
|
||||
use Generator;
|
||||
use OCA\DAV\CalDAV\Auth\CustomPrincipalPlugin;
|
||||
use OCA\DAV\CalDAV\InvitationResponse\InvitationResponseServer;
|
||||
use OCA\DAV\Connector\Sabre\Server;
|
||||
use OCP\Calendar\CalendarExportOptions;
|
||||
use OCP\Calendar\Exceptions\CalendarException;
|
||||
use OCP\Calendar\ICalendarExport;
|
||||
@@ -161,7 +162,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
||||
private function createFromStringInServer(
|
||||
string $name,
|
||||
string $calendarData,
|
||||
\OCA\DAV\Connector\Sabre\Server $server,
|
||||
Server $server,
|
||||
): void {
|
||||
/** @var CustomPrincipalPlugin $plugin */
|
||||
$plugin = $server->getPlugin('auth');
|
||||
|
||||
@@ -13,6 +13,7 @@ use OCA\DAV\AppInfo\PluginManager;
|
||||
use OCA\DAV\CalDAV\Auth\CustomPrincipalPlugin;
|
||||
use OCA\DAV\CalDAV\Auth\PublicPrincipalPlugin;
|
||||
use OCA\DAV\CalDAV\Publishing\PublishPlugin;
|
||||
use OCA\DAV\CalDAV\Schedule\IMipPlugin;
|
||||
use OCA\DAV\Connector\Sabre\AnonymousOptionsPlugin;
|
||||
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
|
||||
use OCA\DAV\Connector\Sabre\CachingTree;
|
||||
@@ -94,7 +95,7 @@ class EmbeddedCalDavServer {
|
||||
Server::get(IURLGenerator::class)
|
||||
));
|
||||
if ($appConfig->getValueString('dav', 'sendInvitations', 'yes') === 'yes') {
|
||||
$this->server->addPlugin(Server::get(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
|
||||
$this->server->addPlugin(Server::get(IMipPlugin::class));
|
||||
}
|
||||
|
||||
// collection preload plugin
|
||||
|
||||
@@ -301,7 +301,7 @@ class ViewControllerTest extends TestCase {
|
||||
$invokedCountProvideInitialState = $this->exactly(9);
|
||||
$this->initialState->expects($invokedCountProvideInitialState)
|
||||
->method('provideInitialState')
|
||||
->willReturnCallback(function ($key, $data) use ($invokedCountProvideInitialState) {
|
||||
->willReturnCallback(function ($key, $data) use ($invokedCountProvideInitialState): void {
|
||||
if ($invokedCountProvideInitialState->numberOfInvocations() === 9) {
|
||||
$this->assertEquals('isTwoFactorEnabled', $key);
|
||||
$this->assertTrue($data);
|
||||
|
||||
@@ -16,6 +16,7 @@ use OCP\AppFramework\OCS\OCSException;
|
||||
use OCP\AppFramework\OCS\OCSForbiddenException;
|
||||
use OCP\AppFramework\OCS\OCSNotFoundException;
|
||||
use OCP\Constants;
|
||||
use OCP\Files\Cache\ICache;
|
||||
use OCP\Files\File;
|
||||
use OCP\Files\Folder;
|
||||
use OCP\Files\IRootFolder;
|
||||
@@ -5244,7 +5245,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||
], $result);
|
||||
}
|
||||
|
||||
public function trustedServerProvider(): array {
|
||||
public static function trustedServerProvider(): array {
|
||||
return [
|
||||
'Trusted server' => [true, true],
|
||||
'Untrusted server' => [false, false],
|
||||
@@ -5272,21 +5273,21 @@ class ShareAPIControllerTest extends TestCase {
|
||||
$nodeId
|
||||
);
|
||||
|
||||
$node = $this->createMock(\OCP\Files\File::class);
|
||||
$node = $this->createMock(File::class);
|
||||
$node->method('getId')->willReturn($nodeId);
|
||||
$node->method('getPath')->willReturn($nodePath);
|
||||
$node->method('getInternalPath')->willReturn(ltrim($nodePath, '/'));
|
||||
$mountPoint = $this->createMock(\OCP\Files\Mount\IMountPoint::class);
|
||||
$mountPoint = $this->createMock(IMountPoint::class);
|
||||
$mountPoint->method('getMountType')->willReturn('local');
|
||||
$node->method('getMountPoint')->willReturn($mountPoint);
|
||||
$node->method('getMimetype')->willReturn('text/plain');
|
||||
$storage = $this->createMock(\OCP\Files\Storage\IStorage::class);
|
||||
$storageCache = $this->createMock(\OCP\Files\Cache\ICache::class);
|
||||
$storage = $this->createMock(IStorage::class);
|
||||
$storageCache = $this->createMock(ICache::class);
|
||||
$storageCache->method('getNumericStorageId')->willReturn(1);
|
||||
$storage->method('getCache')->willReturn($storageCache);
|
||||
$storage->method('getId')->willReturn('home::shareOwner');
|
||||
$node->method('getStorage')->willReturn($storage);
|
||||
$parent = $this->createMock(\OCP\Files\Folder::class);
|
||||
$parent = $this->createMock(Folder::class);
|
||||
$parent->method('getId')->willReturn(2);
|
||||
$node->method('getParent')->willReturn($parent);
|
||||
$node->method('getSize')->willReturn(1234);
|
||||
@@ -5334,21 +5335,21 @@ class ShareAPIControllerTest extends TestCase {
|
||||
$nodeId
|
||||
);
|
||||
|
||||
$node = $this->createMock(\OCP\Files\File::class);
|
||||
$node = $this->createMock(File::class);
|
||||
$node->method('getId')->willReturn($nodeId);
|
||||
$node->method('getPath')->willReturn($nodePath);
|
||||
$node->method('getInternalPath')->willReturn(ltrim($nodePath, '/'));
|
||||
$mountPoint = $this->createMock(\OCP\Files\Mount\IMountPoint::class);
|
||||
$mountPoint = $this->createMock(IMountPoint::class);
|
||||
$mountPoint->method('getMountType')->willReturn('local');
|
||||
$node->method('getMountPoint')->willReturn($mountPoint);
|
||||
$node->method('getMimetype')->willReturn('text/plain');
|
||||
$storage = $this->createMock(\OCP\Files\Storage\IStorage::class);
|
||||
$storageCache = $this->createMock(\OCP\Files\Cache\ICache::class);
|
||||
$storage = $this->createMock(IStorage::class);
|
||||
$storageCache = $this->createMock(ICache::class);
|
||||
$storageCache->method('getNumericStorageId')->willReturn(1);
|
||||
$storage->method('getCache')->willReturn($storageCache);
|
||||
$storage->method('getId')->willReturn('home::shareOwner');
|
||||
$node->method('getStorage')->willReturn($storage);
|
||||
$parent = $this->createMock(\OCP\Files\Folder::class);
|
||||
$parent = $this->createMock(Folder::class);
|
||||
$parent->method('getId')->willReturn(2);
|
||||
$node->method('getParent')->willReturn($parent);
|
||||
$node->method('getSize')->willReturn(1234);
|
||||
|
||||
@@ -110,7 +110,7 @@ class ExpireTrashTest extends TestCase {
|
||||
$this->assertEquals($shouldExpire ? 0 : 1, count($trashFiles));
|
||||
}
|
||||
|
||||
public function retentionObligationProvider(): array {
|
||||
public static function retentionObligationProvider(): array {
|
||||
$hour = 3600; // 60 * 60
|
||||
|
||||
$oneDay = 24 * $hour;
|
||||
|
||||
@@ -13,6 +13,7 @@ use OCP\Config\IUserConfig;
|
||||
use OCP\IDateTimeZone;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Server;
|
||||
|
||||
class Capabilities implements ICapability {
|
||||
|
||||
@@ -33,7 +34,7 @@ class Capabilities implements ICapability {
|
||||
|
||||
$user = $this->session->getUser();
|
||||
if ($user !== null) {
|
||||
$timezone = \OCP\Server::get(IDateTimeZone::class)->getTimeZone();
|
||||
$timezone = Server::get(IDateTimeZone::class)->getTimeZone();
|
||||
|
||||
$capabilities['user'] = [
|
||||
'language' => $this->userConfig->getValueString($user->getUID(), Application::APP_ID, ConfigLexicon::USER_LANGUAGE),
|
||||
|
||||
@@ -12,13 +12,15 @@ use OC\Core\Command\Base;
|
||||
use OC\TaskProcessing\Db\TaskMapper;
|
||||
use OC\TaskProcessing\Manager;
|
||||
use OCP\Files\AppData\IAppDataFactory;
|
||||
use OCP\Files\IAppData;
|
||||
use OCP\Files\NotFoundException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Cleanup extends Base {
|
||||
private \OCP\Files\IAppData $appData;
|
||||
private IAppData $appData;
|
||||
|
||||
public function __construct(
|
||||
protected Manager $taskProcessingManager,
|
||||
@@ -76,7 +78,7 @@ class Cleanup extends Base {
|
||||
foreach ($textToImageDeletedFileNames as $entry) {
|
||||
$output->writeln("<info>\t - " . 'Deleted appData/core/text2image/' . $entry . '</info>');
|
||||
}
|
||||
} catch (\OCP\Files\NotFoundException $e) {
|
||||
} catch (NotFoundException $e) {
|
||||
// noop
|
||||
}
|
||||
try {
|
||||
@@ -84,7 +86,7 @@ class Cleanup extends Base {
|
||||
foreach ($audioToTextDeletedFileNames as $entry) {
|
||||
$output->writeln("<info>\t - " . 'Deleted appData/core/audio2text/' . $entry . '</info>');
|
||||
}
|
||||
} catch (\OCP\Files\NotFoundException $e) {
|
||||
} catch (NotFoundException $e) {
|
||||
// noop
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Test\Avatar;
|
||||
|
||||
use OC\Avatar\GuestAvatar;
|
||||
use OCP\Files\SimpleFS\InMemoryFile;
|
||||
use OCP\IConfig;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
@@ -35,7 +36,7 @@ class GuestAvatarTest extends TestCase {
|
||||
public function setupGuestAvatar() {
|
||||
/* @var MockObject|LoggerInterface $logger */
|
||||
$logger = $this->createMock(LoggerInterface::class);
|
||||
$config = $this->createMock(\OCP\IConfig::class);
|
||||
$config = $this->createMock(IConfig::class);
|
||||
$this->guestAvatar = new GuestAvatar('einstein', $config, $logger);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,13 @@ namespace Test\Files\Cache;
|
||||
|
||||
use OC\Files\Cache\CacheEntry;
|
||||
use OC\Files\Cache\FileAccess;
|
||||
use OC\Files\Mount\LocalHomeMountProvider;
|
||||
use OC\FilesMetadata\FilesMetadataManager;
|
||||
use OC\SystemConfig;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\Files\IMimeTypeLoader;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\Server;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
@@ -25,15 +30,15 @@ class FileAccessTest extends TestCase {
|
||||
parent::setUp();
|
||||
|
||||
// Setup the actual database connection (assume the database is configured properly in PHPUnit setup)
|
||||
$this->dbConnection = \OCP\Server::get(IDBConnection::class);
|
||||
$this->dbConnection = Server::get(IDBConnection::class);
|
||||
|
||||
// Ensure FileAccess is instantiated with the real connection
|
||||
$this->fileAccess = new FileAccess(
|
||||
$this->dbConnection,
|
||||
\OCP\Server::get(\OC\SystemConfig::class),
|
||||
\OCP\Server::get(LoggerInterface::class),
|
||||
\OCP\Server::get(\OC\FilesMetadata\FilesMetadataManager::class),
|
||||
\OCP\Server::get(\OCP\Files\IMimeTypeLoader::class)
|
||||
Server::get(SystemConfig::class),
|
||||
Server::get(LoggerInterface::class),
|
||||
Server::get(FilesMetadataManager::class),
|
||||
Server::get(IMimeTypeLoader::class)
|
||||
);
|
||||
|
||||
// Clear and prepare `filecache` table for tests
|
||||
@@ -142,7 +147,7 @@ class FileAccessTest extends TestCase {
|
||||
->values([
|
||||
'storage_id' => $queryBuilder->createNamedParameter(4, IQueryBuilder::PARAM_INT),
|
||||
'root_id' => $queryBuilder->createNamedParameter(40, IQueryBuilder::PARAM_INT),
|
||||
'mount_provider_class' => $queryBuilder->createNamedParameter(\OC\Files\Mount\LocalHomeMountProvider::class),
|
||||
'mount_provider_class' => $queryBuilder->createNamedParameter(LocalHomeMountProvider::class),
|
||||
'mount_point' => $queryBuilder->createNamedParameter('/home/user'),
|
||||
'user_id' => $queryBuilder->createNamedParameter('test'),
|
||||
])
|
||||
|
||||
@@ -46,7 +46,7 @@ class PrimaryObjectStoreConfigTest extends TestCase {
|
||||
}
|
||||
});
|
||||
$this->config->method('setUserValue')
|
||||
->willReturnCallback(function ($userId, $appName, $key, $value) {
|
||||
->willReturnCallback(function ($userId, $appName, $key, $value): void {
|
||||
$this->userConfig[$userId][$appName][$key] = $value;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user