mirror of
https://github.com/nextcloud/server.git
synced 2026-02-18 18:28:50 -05:00
chore(rector): Run rector on apps, core and tests directory
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
This commit is contained in:
parent
9def7a8ba7
commit
5d0d0c17e5
56 changed files with 99 additions and 165 deletions
|
|
@ -24,17 +24,14 @@ use function explode;
|
|||
|
||||
class RateLimitingPlugin extends ServerPlugin {
|
||||
|
||||
private Limiter $limiter;
|
||||
|
||||
public function __construct(
|
||||
Limiter $limiter,
|
||||
private Limiter $limiter,
|
||||
private IUserManager $userManager,
|
||||
private CalDavBackend $calDavBackend,
|
||||
private LoggerInterface $logger,
|
||||
private IAppConfig $config,
|
||||
private ?string $userId,
|
||||
) {
|
||||
$this->limiter = $limiter;
|
||||
}
|
||||
|
||||
public function initialize(DAV\Server $server): void {
|
||||
|
|
|
|||
|
|
@ -42,9 +42,6 @@ class Principal implements BackendInterface {
|
|||
/** @var bool */
|
||||
private $hasCircles;
|
||||
|
||||
/** @var KnownUserService */
|
||||
private $knownUserService;
|
||||
|
||||
public function __construct(
|
||||
private IUserManager $userManager,
|
||||
private IGroupManager $groupManager,
|
||||
|
|
@ -53,14 +50,13 @@ class Principal implements BackendInterface {
|
|||
private IUserSession $userSession,
|
||||
private IAppManager $appManager,
|
||||
private ProxyMapper $proxyMapper,
|
||||
KnownUserService $knownUserService,
|
||||
private KnownUserService $knownUserService,
|
||||
private IConfig $config,
|
||||
private IFactory $languageFactory,
|
||||
string $principalPrefix = 'principals/users/',
|
||||
) {
|
||||
$this->principalPrefix = trim($principalPrefix, '/');
|
||||
$this->hasGroups = $this->hasCircles = ($principalPrefix === 'principals/users/');
|
||||
$this->knownUserService = $knownUserService;
|
||||
}
|
||||
|
||||
use PrincipalProxyTrait {
|
||||
|
|
|
|||
|
|
@ -22,23 +22,17 @@ class AppleProvisioningPlugin extends ServerPlugin {
|
|||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* @var \OC_Defaults
|
||||
*/
|
||||
protected $themingDefaults;
|
||||
|
||||
/**
|
||||
* AppleProvisioningPlugin constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
protected IUserSession $userSession,
|
||||
protected IURLGenerator $urlGenerator,
|
||||
\OC_Defaults $themingDefaults,
|
||||
protected \OC_Defaults $themingDefaults,
|
||||
protected IRequest $request,
|
||||
protected IL10N $l10n,
|
||||
protected \Closure $uuidClosure,
|
||||
) {
|
||||
$this->themingDefaults = $themingDefaults;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -22,18 +22,15 @@ use Sabre\DAV\Exception\NotFound;
|
|||
use Sabre\DAV\SimpleCollection;
|
||||
|
||||
class SystemTagsInUseCollection extends SimpleCollection {
|
||||
protected SystemTagsInFilesDetector $systemTagsInFilesDetector;
|
||||
|
||||
/** @noinspection PhpMissingParentConstructorInspection */
|
||||
public function __construct(
|
||||
protected IUserSession $userSession,
|
||||
protected IRootFolder $rootFolder,
|
||||
protected ISystemTagManager $systemTagManager,
|
||||
protected ISystemTagObjectMapper $tagMapper,
|
||||
SystemTagsInFilesDetector $systemTagsInFilesDetector,
|
||||
protected SystemTagsInFilesDetector $systemTagsInFilesDetector,
|
||||
protected string $mediaType = '',
|
||||
) {
|
||||
$this->systemTagsInFilesDetector = $systemTagsInFilesDetector;
|
||||
$this->name = 'systemtags-assigned';
|
||||
if ($this->mediaType != '') {
|
||||
$this->name .= '/' . $this->mediaType;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
namespace OCA\FederatedFileSharing;
|
||||
|
||||
use OC\ServerNotAvailableException;
|
||||
use OCA\FederatedFileSharing\Events\FederatedShareAddedEvent;
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\BackgroundJob\IJobList;
|
||||
|
|
@ -47,7 +48,7 @@ class Notifications {
|
|||
* @param int $shareType (can be a remote user or group share)
|
||||
* @return bool
|
||||
* @throws HintException
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*/
|
||||
public function sendRemoteShare($token, $shareWith, $name, $remoteId, $owner, $ownerFederatedId, $sharedBy, $sharedByFederatedId, $shareType) {
|
||||
[$user, $remote] = $this->addressHandler->splitUserRemote($shareWith);
|
||||
|
|
@ -106,7 +107,7 @@ class Notifications {
|
|||
* @param string $filename
|
||||
* @return array|false
|
||||
* @throws HintException
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*/
|
||||
public function requestReShare($token, $id, $shareId, $remote, $shareWith, $permission, $filename, $shareType) {
|
||||
$fields = [
|
||||
|
|
|
|||
|
|
@ -10,19 +10,15 @@ namespace OCA\Federation;
|
|||
use OC\OCS\DiscoveryService;
|
||||
use OCA\DAV\CardDAV\SyncService;
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\OCS\IDiscoveryService;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class SyncFederationAddressBooks {
|
||||
private DiscoveryService $ocsDiscoveryService;
|
||||
|
||||
public function __construct(
|
||||
protected DbHandler $dbHandler,
|
||||
private SyncService $syncService,
|
||||
IDiscoveryService $ocsDiscoveryService,
|
||||
private DiscoveryService $ocsDiscoveryService,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
$this->ocsDiscoveryService = $ocsDiscoveryService;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
namespace OCA\Files_Sharing\Controller;
|
||||
|
||||
use OC\Security\CSP\ContentSecurityPolicy;
|
||||
use OC\ServerNotAvailableException;
|
||||
use OCA\DAV\Connector\Sabre\PublicAuth;
|
||||
use OCA\FederatedFileSharing\FederatedShareProvider;
|
||||
use OCA\Files_Sharing\Event\BeforeTemplateRenderedEvent;
|
||||
|
|
@ -219,7 +220,7 @@ class ShareController extends AuthPublicShareController {
|
|||
* @param string $errorMessage
|
||||
*
|
||||
* @throws HintException
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*
|
||||
* @deprecated use OCP\Files_Sharing\Event\ShareLinkAccessedEvent
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ use OCP\IUserManager;
|
|||
|
||||
class RetryJob extends Job {
|
||||
private string $lookupServer;
|
||||
private Signer $signer;
|
||||
protected int $retries = 0;
|
||||
protected bool $retainJob = false;
|
||||
|
||||
|
|
@ -38,10 +37,9 @@ class RetryJob extends Job {
|
|||
private IConfig $config,
|
||||
private IUserManager $userManager,
|
||||
private IAccountManager $accountManager,
|
||||
Signer $signer,
|
||||
private Signer $signer,
|
||||
) {
|
||||
parent::__construct($time);
|
||||
$this->signer = $signer;
|
||||
|
||||
$this->lookupServer = $this->config->getSystemValue('lookup_server', 'https://lookup.nextcloud.com');
|
||||
if (!empty($this->lookupServer)) {
|
||||
|
|
|
|||
|
|
@ -28,9 +28,6 @@ use OCP\Security\VerificationToken\IVerificationToken;
|
|||
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
|
||||
class VerificationController extends Controller {
|
||||
|
||||
/** @var Crypto */
|
||||
private $crypto;
|
||||
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
|
|
@ -39,10 +36,9 @@ class VerificationController extends Controller {
|
|||
private IL10N $l10n,
|
||||
private IUserSession $userSession,
|
||||
private IAccountManager $accountManager,
|
||||
Crypto $crypto,
|
||||
private Crypto $crypto,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->crypto = $crypto;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,11 +16,9 @@ use OCP\User\Events\UserDeletedEvent;
|
|||
/** @template-implements IEventListener<UserDeletedEvent> */
|
||||
class UserDeletedListener implements IEventListener {
|
||||
|
||||
/** @var KnownUserService */
|
||||
private $service;
|
||||
|
||||
public function __construct(KnownUserService $service) {
|
||||
$this->service = $service;
|
||||
public function __construct(
|
||||
private KnownUserService $service,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ use OCP\Session\Exceptions\SessionNotAvailableException;
|
|||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class AuthSettingsController extends Controller {
|
||||
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
|
|
|
|||
|
|
@ -25,24 +25,20 @@ use OCP\IL10N;
|
|||
use OCP\IRequest;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Server;
|
||||
|
||||
class ChangePasswordController extends Controller {
|
||||
private Session $userSession;
|
||||
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
private ?string $userId,
|
||||
private IUserManager $userManager,
|
||||
IUserSession $userSession,
|
||||
private Session $userSession,
|
||||
private GroupManager $groupManager,
|
||||
private IAppManager $appManager,
|
||||
private IL10N $l,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->userSession = $userSession;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -27,21 +27,17 @@ use Psr\Log\LoggerInterface;
|
|||
|
||||
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
|
||||
class CheckSetupController extends Controller {
|
||||
/** @var Checker */
|
||||
private $checker;
|
||||
|
||||
public function __construct(
|
||||
$appName,
|
||||
IRequest $request,
|
||||
private IConfig $config,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private IL10N $l10n,
|
||||
Checker $checker,
|
||||
private Checker $checker,
|
||||
private LoggerInterface $logger,
|
||||
private ISetupCheckManager $setupCheckManager,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->checker = $checker;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ use OCP\IRequest;
|
|||
|
||||
class LogSettingsController extends Controller {
|
||||
|
||||
/** @var Log */
|
||||
private $log;
|
||||
|
||||
public function __construct(string $appName, IRequest $request, Log $logger) {
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
private Log $log,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->log = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,15 +16,12 @@ use OCP\IRequest;
|
|||
|
||||
class TwoFactorSettingsController extends Controller {
|
||||
|
||||
/** @var MandatoryTwoFactor */
|
||||
private $mandatoryTwoFactor;
|
||||
|
||||
public function __construct(string $appName,
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
MandatoryTwoFactor $mandatoryTwoFactor) {
|
||||
private MandatoryTwoFactor $mandatoryTwoFactor,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
$this->mandatoryTwoFactor = $mandatoryTwoFactor;
|
||||
}
|
||||
|
||||
public function index(): JSONResponse {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use OCP\IUserSession;
|
|||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* @template-implements IEventListener<\OC\Authentication\Events\AppPasswordCreatedEvent>
|
||||
* @template-implements IEventListener<AppPasswordCreatedEvent>
|
||||
*/
|
||||
class AppPasswordCreatedActivityListener implements IEventListener {
|
||||
public function __construct(
|
||||
|
|
|
|||
|
|
@ -15,16 +15,13 @@ use OCP\IUserManager;
|
|||
use OCP\Settings\ISettings;
|
||||
|
||||
class Security implements ISettings {
|
||||
private MandatoryTwoFactor $mandatoryTwoFactor;
|
||||
|
||||
public function __construct(
|
||||
private IManager $manager,
|
||||
private IUserManager $userManager,
|
||||
MandatoryTwoFactor $mandatoryTwoFactor,
|
||||
private MandatoryTwoFactor $mandatoryTwoFactor,
|
||||
private IInitialState $initialState,
|
||||
private IURLGenerator $urlGenerator,
|
||||
) {
|
||||
$this->mandatoryTwoFactor = $mandatoryTwoFactor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -35,23 +35,19 @@ use OCP\Util;
|
|||
|
||||
class PersonalInfo implements ISettings {
|
||||
|
||||
/** @var ProfileManager */
|
||||
private $profileManager;
|
||||
|
||||
public function __construct(
|
||||
private IConfig $config,
|
||||
private IUserManager $userManager,
|
||||
private IGroupManager $groupManager,
|
||||
private ITeamManager $teamManager,
|
||||
private IAccountManager $accountManager,
|
||||
ProfileManager $profileManager,
|
||||
private ProfileManager $profileManager,
|
||||
private IAppManager $appManager,
|
||||
private IFactory $l10nFactory,
|
||||
private IL10N $l,
|
||||
private IInitialState $initialStateService,
|
||||
private IManager $manager,
|
||||
) {
|
||||
$this->profileManager = $profileManager;
|
||||
}
|
||||
|
||||
public function getForm(): TemplateResponse {
|
||||
|
|
|
|||
|
|
@ -24,21 +24,13 @@ use function is_null;
|
|||
|
||||
class TwoFactor implements ISettings {
|
||||
|
||||
/** @var ProviderLoader */
|
||||
private $providerLoader;
|
||||
|
||||
/** @var MandatoryTwoFactor */
|
||||
private $mandatoryTwoFactor;
|
||||
|
||||
public function __construct(
|
||||
ProviderLoader $providerLoader,
|
||||
MandatoryTwoFactor $mandatoryTwoFactor,
|
||||
private ProviderLoader $providerLoader,
|
||||
private MandatoryTwoFactor $mandatoryTwoFactor,
|
||||
private IUserSession $userSession,
|
||||
private IConfig $config,
|
||||
private ?string $userId,
|
||||
) {
|
||||
$this->providerLoader = $providerLoader;
|
||||
$this->mandatoryTwoFactor = $mandatoryTwoFactor;
|
||||
}
|
||||
|
||||
public function getForm(): TemplateResponse {
|
||||
|
|
|
|||
|
|
@ -17,20 +17,12 @@ use OCP\Settings\ISettings;
|
|||
|
||||
class WebAuthn implements ISettings {
|
||||
|
||||
/** @var PublicKeyCredentialMapper */
|
||||
private $mapper;
|
||||
|
||||
/** @var Manager */
|
||||
private $manager;
|
||||
|
||||
public function __construct(
|
||||
PublicKeyCredentialMapper $mapper,
|
||||
private PublicKeyCredentialMapper $mapper,
|
||||
private string $userId,
|
||||
private IInitialStateService $initialStateService,
|
||||
Manager $manager,
|
||||
private Manager $manager,
|
||||
) {
|
||||
$this->mapper = $mapper;
|
||||
$this->manager = $manager;
|
||||
}
|
||||
|
||||
public function getForm() {
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator {
|
|||
|
||||
use TAccountsHelper;
|
||||
|
||||
private ProfileManager $profileManager;
|
||||
|
||||
private const PATH_ROOT = Application::APP_ID . '/';
|
||||
|
||||
private const PATH_ACCOUNT_FILE = AccountMigrator::PATH_ROOT . 'account.json';
|
||||
|
|
@ -46,11 +44,10 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator {
|
|||
public function __construct(
|
||||
private IAccountManager $accountManager,
|
||||
private IAvatarManager $avatarManager,
|
||||
ProfileManager $profileManager,
|
||||
private ProfileManager $profileManager,
|
||||
private ProfileConfigMapper $configMapper,
|
||||
private IL10N $l10n,
|
||||
) {
|
||||
$this->profileManager = $profileManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@ use OCP\IConfig;
|
|||
use OCP\IRequest;
|
||||
|
||||
class IconController extends Controller {
|
||||
/** @var FileAccessHelper */
|
||||
private $fileAccessHelper;
|
||||
|
||||
public function __construct(
|
||||
$appName,
|
||||
IRequest $request,
|
||||
|
|
@ -35,11 +32,10 @@ class IconController extends Controller {
|
|||
private ThemingDefaults $themingDefaults,
|
||||
private IconBuilder $iconBuilder,
|
||||
private ImageManager $imageManager,
|
||||
FileAccessHelper $fileAccessHelper,
|
||||
private FileAccessHelper $fileAccessHelper,
|
||||
private IAppManager $appManager,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->fileAccessHelper = $fileAccessHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,18 +18,14 @@ use OCP\IUserManager;
|
|||
|
||||
class CheckBackupCodes extends QueuedJob {
|
||||
|
||||
/** @var Manager */
|
||||
private $twofactorManager;
|
||||
|
||||
public function __construct(
|
||||
ITimeFactory $timeFactory,
|
||||
private IUserManager $userManager,
|
||||
private IJobList $jobList,
|
||||
Manager $twofactorManager,
|
||||
private Manager $twofactorManager,
|
||||
private IRegistry $registry,
|
||||
) {
|
||||
parent::__construct($timeFactory);
|
||||
$this->twofactorManager = $twofactorManager;
|
||||
}
|
||||
|
||||
protected function run($argument) {
|
||||
|
|
|
|||
|
|
@ -1050,11 +1050,10 @@ class Access extends LDAPUtility {
|
|||
*
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param mixed[] $arguments
|
||||
* @return mixed
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*/
|
||||
private function invokeLDAPMethod(string $command, ...$arguments) {
|
||||
if ($command == 'controlPagedResultResponse') {
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ class Connection extends LDAPUtility {
|
|||
/**
|
||||
* @param string $host
|
||||
* @param string $port
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*/
|
||||
private function doConnect($host, $port): bool {
|
||||
if ($host === '') {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ namespace OCA\User_LDAP\User;
|
|||
|
||||
use InvalidArgumentException;
|
||||
use OC\Accounts\AccountManager;
|
||||
use OC\ServerNotAvailableException;
|
||||
use OCA\User_LDAP\Access;
|
||||
use OCA\User_LDAP\Connection;
|
||||
use OCA\User_LDAP\Exceptions\AttributeNotSet;
|
||||
|
|
@ -693,7 +694,7 @@ class User {
|
|||
|
||||
/**
|
||||
* @throws AttributeNotSet
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
* @throws PreConditionNotMetException
|
||||
*/
|
||||
public function getExtStorageHome():string {
|
||||
|
|
@ -714,7 +715,7 @@ class User {
|
|||
|
||||
/**
|
||||
* @throws PreConditionNotMetException
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*/
|
||||
public function updateExtStorageHome(?string $valueFromLDAP = null):string {
|
||||
if ($valueFromLDAP === null) {
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I
|
|||
* @param string|User $user either the Nextcloud user
|
||||
* name or an instance of that user
|
||||
* @throws \Exception
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*/
|
||||
public function userExistsOnLDAP($user, bool $ignoreCache = false): bool {
|
||||
if (is_string($user)) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
namespace OCA\User_LDAP\Tests\Integration\Lib\User;
|
||||
|
||||
use OC\ServerNotAvailableException;
|
||||
use OCA\User_LDAP\Mapping\UserMapping;
|
||||
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
|
||||
use OCA\User_LDAP\User\DeletedUsersIndex;
|
||||
|
|
@ -108,7 +109,7 @@ class IntegrationTestUserAvatar extends AbstractIntegrationTest {
|
|||
*
|
||||
* @param string $dn
|
||||
* @param string $image An image read via file_get_contents
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*/
|
||||
private function setJpegPhotoAttribute($dn, $image) {
|
||||
$changeSet = ['jpegphoto' => $image];
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@ use OCP\Util;
|
|||
/** @template-implements IEventListener<BeforeTemplateRenderedEvent> */
|
||||
class BeforeTemplateRenderedListener implements IEventListener {
|
||||
|
||||
/** @var ProfileManager */
|
||||
private $profileManager;
|
||||
|
||||
/**
|
||||
* BeforeTemplateRenderedListener constructor.
|
||||
*
|
||||
|
|
@ -35,12 +32,11 @@ class BeforeTemplateRenderedListener implements IEventListener {
|
|||
* @param JSDataService $jsDataService
|
||||
*/
|
||||
public function __construct(
|
||||
ProfileManager $profileManager,
|
||||
private ProfileManager $profileManager,
|
||||
private IUserSession $userSession,
|
||||
private IInitialStateService $initialState,
|
||||
private JSDataService $jsDataService,
|
||||
) {
|
||||
$this->profileManager = $profileManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,13 +2,14 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use OC\Route\Router;
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2012-2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
/** @var OC\Route\Router $this */
|
||||
/** @var Router $this */
|
||||
// Core ajax actions
|
||||
// Routing
|
||||
$this->create('core_ajax_update', '/core/ajax/update.php')
|
||||
|
|
|
|||
|
|
@ -8,24 +8,25 @@
|
|||
|
||||
namespace Test\Archive;
|
||||
|
||||
use OC\Archive\Archive;
|
||||
use OCP\Files;
|
||||
use OCP\ITempManager;
|
||||
use OCP\Server;
|
||||
|
||||
abstract class TestBase extends \Test\TestCase {
|
||||
/**
|
||||
* @var \OC\Archive\Archive
|
||||
* @var Archive
|
||||
*/
|
||||
protected $instance;
|
||||
|
||||
/**
|
||||
* get the existing test archive
|
||||
* @return \OC\Archive\Archive
|
||||
* @return Archive
|
||||
*/
|
||||
abstract protected function getExisting();
|
||||
/**
|
||||
* get a new archive for write testing
|
||||
* @return \OC\Archive\Archive
|
||||
* @return Archive
|
||||
*/
|
||||
abstract protected function getNew();
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use OCP\Constants;
|
|||
use OCP\IAddressBook;
|
||||
|
||||
class ContactsManagerTest extends \Test\TestCase {
|
||||
/** @var \OC\ContactsManager */
|
||||
/** @var ContactsManager */
|
||||
private $cm;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace Test\DB\QueryBuilder;
|
|||
|
||||
use Doctrine\DBAL\Query\Expression\ExpressionBuilder as DoctrineExpressionBuilder;
|
||||
use OC\DB\QueryBuilder\ExpressionBuilder\ExpressionBuilder;
|
||||
use OC\DB\QueryBuilder\Literal;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\Server;
|
||||
|
|
@ -338,7 +339,7 @@ class ExpressionBuilderTest extends TestCase {
|
|||
*/
|
||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataLiteral')]
|
||||
public function testLiteral($input, $type): void {
|
||||
/** @var \OC\DB\QueryBuilder\Literal $actual */
|
||||
/** @var Literal $actual */
|
||||
$actual = $this->expressionBuilder->literal($input, $type);
|
||||
|
||||
$this->assertInstanceOf('\OC\DB\QueryBuilder\Literal', $actual);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use OC\DateTimeFormatter;
|
|||
use OCP\Util;
|
||||
|
||||
class DateTimeFormatterTest extends TestCase {
|
||||
/** @var \OC\DateTimeFormatter */
|
||||
/** @var DateTimeFormatter */
|
||||
protected $formatter;
|
||||
protected static $oneMinute = 60;
|
||||
protected static $oneHour = 3600;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use Psr\Log\LoggerInterface;
|
|||
use Test\TestCase;
|
||||
|
||||
class EventLoggerTest extends TestCase {
|
||||
/** @var \OC\Diagnostics\EventLogger */
|
||||
/** @var EventLogger */
|
||||
private $logger;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use OC\Diagnostics\QueryLogger;
|
|||
use Test\TestCase;
|
||||
|
||||
class QueryLoggerTest extends TestCase {
|
||||
/** @var \OC\Diagnostics\QueryLogger */
|
||||
/** @var QueryLogger */
|
||||
private $logger;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class StorageTest extends TestCase {
|
|||
/** @var Storage */
|
||||
protected $storage;
|
||||
|
||||
/** @var MockObject|\OC\Encryption\Util */
|
||||
/** @var MockObject|Util */
|
||||
protected $util;
|
||||
|
||||
/** @var MockObject|View */
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
namespace Test\Files\Cache;
|
||||
|
||||
use OC\Files\Cache\HomeCache;
|
||||
use OC\Files\Storage\Home;
|
||||
use OC\User\User;
|
||||
use OCP\ITempManager;
|
||||
|
|
@ -48,12 +49,12 @@ class DummyUser extends User {
|
|||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
||||
class HomeCacheTest extends \Test\TestCase {
|
||||
/**
|
||||
* @var \OC\Files\Storage\Home $storage
|
||||
* @var Home $storage
|
||||
*/
|
||||
private $storage;
|
||||
|
||||
/**
|
||||
* @var \OC\Files\Cache\HomeCache $cache
|
||||
* @var HomeCache $cache
|
||||
*/
|
||||
private $cache;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
namespace Test\Files\Cache;
|
||||
|
||||
use OC\Files\Cache\Cache;
|
||||
use OC\Files\Cache\Updater;
|
||||
use OC\Files\Filesystem;
|
||||
use OC\Files\ObjectStore\ObjectStoreStorage;
|
||||
use OC\Files\ObjectStore\StorageObjectStore;
|
||||
|
|
@ -41,7 +42,7 @@ class UpdaterTest extends \Test\TestCase {
|
|||
protected $view;
|
||||
|
||||
/**
|
||||
* @var \OC\Files\Cache\Updater
|
||||
* @var Updater
|
||||
*/
|
||||
protected $updater;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class FileTest extends NodeTestCase {
|
|||
}
|
||||
|
||||
public function testGetContent(): void {
|
||||
/** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
|
||||
/** @var Root|\PHPUnit\Framework\MockObject\MockObject $root */
|
||||
$root = $this->getMockBuilder(Root::class)
|
||||
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory, $this->appConfig])
|
||||
->getMock();
|
||||
|
|
@ -77,7 +77,7 @@ class FileTest extends NodeTestCase {
|
|||
public function testGetContentNotPermitted(): void {
|
||||
$this->expectException(NotPermittedException::class);
|
||||
|
||||
/** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
|
||||
/** @var Root|\PHPUnit\Framework\MockObject\MockObject $root */
|
||||
$root = $this->getMockBuilder(Root::class)
|
||||
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory, $this->appConfig])
|
||||
->getMock();
|
||||
|
|
@ -96,7 +96,7 @@ class FileTest extends NodeTestCase {
|
|||
}
|
||||
|
||||
public function testPutContent(): void {
|
||||
/** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
|
||||
/** @var Root|\PHPUnit\Framework\MockObject\MockObject $root */
|
||||
$root = $this->getMockBuilder(Root::class)
|
||||
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory, $this->appConfig])
|
||||
->getMock();
|
||||
|
|
@ -123,7 +123,7 @@ class FileTest extends NodeTestCase {
|
|||
public function testPutContentNotPermitted(): void {
|
||||
$this->expectException(NotPermittedException::class);
|
||||
|
||||
/** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
|
||||
/** @var Root|\PHPUnit\Framework\MockObject\MockObject $root */
|
||||
$root = $this->getMockBuilder(Root::class)
|
||||
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory, $this->appConfig])
|
||||
->getMock();
|
||||
|
|
@ -138,7 +138,7 @@ class FileTest extends NodeTestCase {
|
|||
}
|
||||
|
||||
public function testGetMimeType(): void {
|
||||
/** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
|
||||
/** @var Root|\PHPUnit\Framework\MockObject\MockObject $root */
|
||||
$root = $this->getMockBuilder(Root::class)
|
||||
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory, $this->appConfig])
|
||||
->getMock();
|
||||
|
|
|
|||
|
|
@ -748,7 +748,7 @@ class FolderTest extends NodeTestCase {
|
|||
$manager = $this->createMock(Manager::class);
|
||||
$folderPath = '/bar/foo';
|
||||
$view = $this->getRootViewMock();
|
||||
/** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Files\Node\Root $root */
|
||||
/** @var \PHPUnit\Framework\MockObject\MockObject|Root $root */
|
||||
$root = $this->getMockBuilder(Root::class)
|
||||
->onlyMethods(['getUser', 'getMountsIn', 'getMount'])
|
||||
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory, $this->appConfig])
|
||||
|
|
@ -817,7 +817,7 @@ class FolderTest extends NodeTestCase {
|
|||
$manager = $this->createMock(Manager::class);
|
||||
$folderPath = '/bar/foo';
|
||||
$view = $this->getRootViewMock();
|
||||
/** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Files\Node\Root $root */
|
||||
/** @var \PHPUnit\Framework\MockObject\MockObject|Root $root */
|
||||
$root = $this->getMockBuilder(Root::class)
|
||||
->onlyMethods(['getUser', 'getMountsIn', 'getMount'])
|
||||
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory, $this->appConfig])
|
||||
|
|
@ -884,7 +884,7 @@ class FolderTest extends NodeTestCase {
|
|||
$manager = $this->createMock(Manager::class);
|
||||
$folderPath = '/bar/foo';
|
||||
$view = $this->getRootViewMock();
|
||||
/** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Files\Node\Root $root */
|
||||
/** @var \PHPUnit\Framework\MockObject\MockObject|Root $root */
|
||||
$root = $this->getMockBuilder(Root::class)
|
||||
->onlyMethods(['getUser', 'getMountsIn', 'getMount'])
|
||||
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory, $this->appConfig])
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
namespace Test\Files\Node;
|
||||
|
||||
use OC\Files\Node\File;
|
||||
use OC\Files\Node\Root;
|
||||
use OC\Files\Storage\Storage;
|
||||
use OC\Files\Storage\Temporary;
|
||||
|
|
@ -34,7 +35,7 @@ class IntegrationTest extends \Test\TestCase {
|
|||
use UserTrait;
|
||||
|
||||
/**
|
||||
* @var \OC\Files\Node\Root $root
|
||||
* @var Root $root
|
||||
*/
|
||||
private $root;
|
||||
|
||||
|
|
@ -134,7 +135,7 @@ class IntegrationTest extends \Test\TestCase {
|
|||
|
||||
$folder->move('/asd');
|
||||
/**
|
||||
* @var \OC\Files\Node\File $file
|
||||
* @var File $file
|
||||
*/
|
||||
$file = $folder->get('/bar');
|
||||
$this->assertInstanceOf('\OC\Files\Node\File', $file);
|
||||
|
|
@ -143,7 +144,7 @@ class IntegrationTest extends \Test\TestCase {
|
|||
$this->assertEquals('qwerty', $file->getContent());
|
||||
$folder->move('/substorage/foo');
|
||||
/**
|
||||
* @var \OC\Files\Node\File $file
|
||||
* @var File $file
|
||||
*/
|
||||
$file = $folder->get('/bar');
|
||||
$this->assertInstanceOf('\OC\Files\Node\File', $file);
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ abstract class NodeTestCase extends \Test\TestCase {
|
|||
$test = $this;
|
||||
$hooksRun = 0;
|
||||
/**
|
||||
* @param \OC\Files\Node\File $node
|
||||
* @param File $node
|
||||
*/
|
||||
$preListener = function ($node) use (&$test, &$hooksRun): void {
|
||||
$test->assertInstanceOf($this->getNodeClass(), $node);
|
||||
|
|
@ -163,7 +163,7 @@ abstract class NodeTestCase extends \Test\TestCase {
|
|||
};
|
||||
|
||||
/**
|
||||
* @param \OC\Files\Node\File $node
|
||||
* @param File $node
|
||||
*/
|
||||
$postListener = function ($node) use (&$test, &$hooksRun): void {
|
||||
$test->assertInstanceOf($this->getNonExistingNodeClass(), $node);
|
||||
|
|
@ -407,7 +407,7 @@ abstract class NodeTestCase extends \Test\TestCase {
|
|||
$test = $this;
|
||||
$hooksRun = 0;
|
||||
/**
|
||||
* @param \OC\Files\Node\File $node
|
||||
* @param File $node
|
||||
*/
|
||||
$preListener = function ($node) use (&$test, &$hooksRun): void {
|
||||
$test->assertEquals('foo', $node->getInternalPath());
|
||||
|
|
@ -416,7 +416,7 @@ abstract class NodeTestCase extends \Test\TestCase {
|
|||
};
|
||||
|
||||
/**
|
||||
* @param \OC\Files\Node\File $node
|
||||
* @param File $node
|
||||
*/
|
||||
$postListener = function ($node) use (&$test, &$hooksRun): void {
|
||||
$test->assertEquals('foo', $node->getInternalPath());
|
||||
|
|
@ -624,7 +624,7 @@ abstract class NodeTestCase extends \Test\TestCase {
|
|||
->willReturn($this->getFileInfo(['permissions' => Constants::PERMISSION_ALL, 'fileid' => 1]));
|
||||
|
||||
/**
|
||||
* @var \OC\Files\Node\File|\PHPUnit\Framework\MockObject\MockObject $node
|
||||
* @var File|\PHPUnit\Framework\MockObject\MockObject $node
|
||||
*/
|
||||
$node = $this->createTestNode($root, $this->view, '/bar/foo');
|
||||
$parentNode = new Folder($root, $this->view, '/bar');
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class S3Test extends ObjectStoreTestCase {
|
|||
}
|
||||
|
||||
public function assertNoUpload($objectUrn) {
|
||||
/** @var \OC\Files\ObjectStore\S3 */
|
||||
/** @var S3 */
|
||||
$s3 = $this->getInstance();
|
||||
$s3client = $s3->getConnection();
|
||||
$uploads = $s3client->listMultipartUploads([
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class CheckerTest extends TestCase {
|
|||
private $cacheFactory;
|
||||
/** @var IAppManager|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $appManager;
|
||||
/** @var \OC\Files\Type\Detection|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var Detection|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $mimeTypeDetector;
|
||||
|
||||
private Checker $checker;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class LargeFileHelperGetFileSizeTest extends TestCase {
|
|||
protected $filename;
|
||||
/** @var int */
|
||||
protected $fileSize;
|
||||
/** @var \OC\LargeFileHelper */
|
||||
/** @var LargeFileHelper */
|
||||
protected $helper;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use OCP\Server;
|
|||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
||||
class DBLockingProviderTest extends LockingProvider {
|
||||
/**
|
||||
* @var \OC\Lock\DBLockingProvider
|
||||
* @var DBLockingProvider
|
||||
*/
|
||||
protected $instance;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,12 +9,13 @@
|
|||
namespace Test\Memcache;
|
||||
|
||||
use OC\Memcache\ArrayCache;
|
||||
use OC\Memcache\CasTrait;
|
||||
use Test\TestCase;
|
||||
|
||||
#[\PHPUnit\Framework\Attributes\Group('Memcache')]
|
||||
class CasTraitTest extends TestCase {
|
||||
/**
|
||||
* @return \OC\Memcache\CasTrait
|
||||
* @return CasTrait
|
||||
*/
|
||||
private function getCache() {
|
||||
$sourceCache = new ArrayCache();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use OCP\Security\ISecureRandom;
|
|||
class CsrfTokenGeneratorTest extends \Test\TestCase {
|
||||
/** @var ISecureRandom */
|
||||
private $random;
|
||||
/** @var \OC\Security\CSRF\CsrfTokenGenerator */
|
||||
/** @var CsrfTokenGenerator */
|
||||
private $csrfTokenGenerator;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
|
|
|||
|
|
@ -11,14 +11,16 @@ declare(strict_types=1);
|
|||
namespace Test\Security\CSRF;
|
||||
|
||||
use OC\Security\CSRF\CsrfToken;
|
||||
use OC\Security\CSRF\CsrfTokenGenerator;
|
||||
use OC\Security\CSRF\CsrfTokenManager;
|
||||
use OC\Security\CSRF\TokenStorage\SessionStorage;
|
||||
|
||||
class CsrfTokenManagerTest extends \Test\TestCase {
|
||||
/** @var \OC\Security\CSRF\CsrfTokenManager */
|
||||
/** @var CsrfTokenManager */
|
||||
private $csrfTokenManager;
|
||||
/** @var \OC\Security\CSRF\CsrfTokenGenerator */
|
||||
/** @var CsrfTokenGenerator */
|
||||
private $tokenGenerator;
|
||||
/** @var \OC\Security\CSRF\TokenStorage\SessionStorage */
|
||||
/** @var SessionStorage */
|
||||
private $storageInterface;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use OCP\ISession;
|
|||
class SessionStorageTest extends \Test\TestCase {
|
||||
/** @var ISession */
|
||||
private $session;
|
||||
/** @var \OC\Security\CSRF\TokenStorage\SessionStorage */
|
||||
/** @var SessionStorage */
|
||||
private $sessionStorage;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class CryptoWrappingTest extends TestCase {
|
|||
/** @var \PHPUnit\Framework\MockObject\MockObject|ISession */
|
||||
protected $wrappedSession;
|
||||
|
||||
/** @var \OC\Session\CryptoSessionData */
|
||||
/** @var CryptoSessionData */
|
||||
protected $instance;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class TagsTest extends \Test\TestCase {
|
|||
/** @var IUserSession */
|
||||
protected $userSession;
|
||||
protected $backupGlobals = false;
|
||||
/** @var \OC\Tagging\TagMapper */
|
||||
/** @var TagMapper */
|
||||
protected $tagMapper;
|
||||
/** @var ITagManager */
|
||||
protected $tagMgr;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class TempManagerTest extends \Test\TestCase {
|
|||
/**
|
||||
* @param ?LoggerInterface $logger
|
||||
* @param ?IConfig $config
|
||||
* @return \OC\TempManager
|
||||
* @return TempManager
|
||||
*/
|
||||
protected function getManager($logger = null, $config = null) {
|
||||
if (!$logger) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ trait MountProviderTrait {
|
|||
protected $mountProvider;
|
||||
|
||||
/**
|
||||
* @var \OC\Files\Storage\StorageFactory
|
||||
* @var StorageFactory
|
||||
*/
|
||||
protected $storageFactory;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class DatabaseTest extends Backend {
|
|||
/** @var IEventDispatcher|MockObject */
|
||||
private $eventDispatcher;
|
||||
|
||||
/** @var \OC\User\Database */
|
||||
/** @var Database */
|
||||
protected $backend;
|
||||
|
||||
public function getUser() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue