Skip to content

Commit

Permalink
Remove property type to fix psalm error
Browse files Browse the repository at this point in the history
Signed-off-by: Danial Rahimi <48244647+danialRahimy@users.noreply.github.com>
  • Loading branch information
danialRahimy committed Jul 7, 2023
2 parents a8e75fc + ebd0fcc commit cd9b081
Show file tree
Hide file tree
Showing 38 changed files with 120 additions and 148 deletions.
7 changes: 4 additions & 3 deletions apps/admin_audit/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,16 @@
use Psr\Log\LoggerInterface;

class Application extends App implements IBootstrap {
protected LoggerInterface $logger;
/** @var LoggerInterface */
protected $logger;

public function __construct() {
parent::__construct('admin_audit');
}

public function register(IRegistrationContext $context): void {
$context->registerService(IAuditLogger::class, function (ContainerInterface $c) {
return new AuditLogger($c->get(ILogFactory::class), $c->get(Iconfig::class));
return new AuditLogger($c->get(ILogFactory::class), $c->get(IConfig::class));
});

$context->registerEventListener(CriticalActionPerformedEvent::class, CriticalActionPerformedEventListener::class);
Expand All @@ -100,7 +101,7 @@ public function boot(IBootContext $context): void {
* Register hooks in order to log them
*/
private function registerHooks(IAuditLogger $logger,
IServerContainer $serverContainer): void {
ContainerInterface $serverContainer): void {
$this->userManagementHooks($logger, $serverContainer->get(IUserSession::class));
$this->groupHooks($logger, $serverContainer->get(IGroupManager::class));
$this->authHooks($logger);
Expand Down
1 change: 0 additions & 1 deletion apps/dav/lib/HookManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
use OCP\IUserManager;
use OCP\Util;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

class HookManager {

Expand Down
6 changes: 2 additions & 4 deletions apps/files_versions/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ public function __construct(
* Return this classes capabilities
*/
public function getCapabilities() {
$groupFolderInstalled = $this->appManager->isInstalled('groupfolders');

return [
'files' => [
'versioning' => true,
'version_labeling' => !$groupFolderInstalled && $this->config->getSystemValueBool('enable_version_labeling', true),
'version_deletion' => !$groupFolderInstalled && $this->config->getSystemValueBool('enable_version_deletion', true),
'version_labeling' => $this->config->getSystemValueBool('enable_version_labeling', true),
'version_deletion' => $this->config->getSystemValueBool('enable_version_deletion', true),
]
];
}
Expand Down
14 changes: 12 additions & 2 deletions apps/files_versions/src/components/Version.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</div>
</template>
<template #actions>
<NcActionButton v-if="capabilities.files.version_labeling === true"
<NcActionButton v-if="enableLabeling"
:close-after-click="true"
@click="openVersionLabelModal">
<template #icon>
Expand All @@ -70,7 +70,7 @@
</template>
{{ t('files_versions', 'Download version') }}
</NcActionLink>
<NcActionButton v-if="!isCurrent && capabilities.files.version_deletion === true"
<NcActionButton v-if="!isCurrent && enableDeletion"
:close-after-click="true"
@click="deleteVersion">
<template #icon>
Expand Down Expand Up @@ -250,6 +250,16 @@ export default {
formattedDate() {
return moment(this.version.mtime).format('LLL')
},

/** @return {boolean} */
enableLabeling() {
return this.capabilities.files.version_labeling === true && this.fileInfo.mountType !== 'group'
},

/** @return {boolean} */
enableDeletion() {
return this.capabilities.files.version_deletion === true && this.fileInfo.mountType !== 'group'
}
},
methods: {
openVersionLabelModal() {
Expand Down
9 changes: 1 addition & 8 deletions core/src/OCA/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,9 @@
*
*/

import Search from './search.js'

/**
* Namespace for apps
*
* @namespace OCA
*/
export default {
/**
* @deprecated 20.0.0, will be removed in Nextcloud 22
*/
Search,
}
export default { }
32 changes: 0 additions & 32 deletions core/src/OCA/search.js

This file was deleted.

4 changes: 2 additions & 2 deletions dist/core-login.js

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions dist/core-login.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,28 +212,6 @@
*
*/

/**
* @copyright 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* @copyright 2020, Roeland Jago Douma <roeland@famdouma.nl>
*
Expand Down
2 changes: 1 addition & 1 deletion dist/core-login.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-main.js

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions dist/core-main.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -561,28 +561,6 @@
*
*/

/**
* @copyright 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* @copyright Bernhard Posselt 2014
*
Expand Down
2 changes: 1 addition & 1 deletion dist/core-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files_versions-files_versions.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_versions-files_versions.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
'OCP\\AppFramework\\OCS\\OCSException' => $baseDir . '/lib/public/AppFramework/OCS/OCSException.php',
'OCP\\AppFramework\\OCS\\OCSForbiddenException' => $baseDir . '/lib/public/AppFramework/OCS/OCSForbiddenException.php',
'OCP\\AppFramework\\OCS\\OCSNotFoundException' => $baseDir . '/lib/public/AppFramework/OCS/OCSNotFoundException.php',
'OCP\\AppFramework\\OCS\\OCSPreconditionFailedException' => $baseDir . '/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php',
'OCP\\AppFramework\\PublicShareController' => $baseDir . '/lib/public/AppFramework/PublicShareController.php',
'OCP\\AppFramework\\QueryException' => $baseDir . '/lib/public/AppFramework/QueryException.php',
'OCP\\AppFramework\\Services\\IAppConfig' => $baseDir . '/lib/public/AppFramework/Services/IAppConfig.php',
Expand Down
1 change: 1 addition & 0 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\AppFramework\\OCS\\OCSException' => __DIR__ . '/../../..' . '/lib/public/AppFramework/OCS/OCSException.php',
'OCP\\AppFramework\\OCS\\OCSForbiddenException' => __DIR__ . '/../../..' . '/lib/public/AppFramework/OCS/OCSForbiddenException.php',
'OCP\\AppFramework\\OCS\\OCSNotFoundException' => __DIR__ . '/../../..' . '/lib/public/AppFramework/OCS/OCSNotFoundException.php',
'OCP\\AppFramework\\OCS\\OCSPreconditionFailedException' => __DIR__ . '/../../..' . '/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php',
'OCP\\AppFramework\\PublicShareController' => __DIR__ . '/../../..' . '/lib/public/AppFramework/PublicShareController.php',
'OCP\\AppFramework\\QueryException' => __DIR__ . '/../../..' . '/lib/public/AppFramework/QueryException.php',
'OCP\\AppFramework\\Services\\IAppConfig' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Services/IAppConfig.php',
Expand Down
6 changes: 3 additions & 3 deletions lib/private/Activity/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function registerFilter(string $filter): void {
public function getFilters(): array {
foreach ($this->filterClasses as $class => $false) {
/** @var IFilter $filter */
$filter = \OC::$server->query($class);
$filter = \OCP\Server::get($class);

if (!$filter instanceof IFilter) {
throw new \InvalidArgumentException('Invalid activity filter registered');
Expand Down Expand Up @@ -242,7 +242,7 @@ public function registerProvider(string $provider): void {
public function getProviders(): array {
foreach ($this->providerClasses as $class => $false) {
/** @var IProvider $provider */
$provider = \OC::$server->query($class);
$provider = \OCP\Server::get($class);

if (!$provider instanceof IProvider) {
throw new \InvalidArgumentException('Invalid activity provider registered');
Expand Down Expand Up @@ -276,7 +276,7 @@ public function registerSetting(string $setting): void {
public function getSettings(): array {
foreach ($this->settingsClasses as $class => $false) {
/** @var ISetting $setting */
$setting = \OC::$server->query($class);
$setting = \OCP\Server::get($class);

if ($setting instanceof ISetting) {
if (!$setting instanceof ActivitySettings) {
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Authentication/TwoFactorAuth/ProviderLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getProviders(IUser $user): array {
foreach ($providerClasses as $class) {
try {
$this->loadTwoFactorApp($appId);
$provider = OC::$server->query($class);
$provider = \OCP\Server::get($class);
$providers[$provider->getId()] = $provider;
} catch (QueryException $exc) {
// Provider class can not be resolved
Expand All @@ -80,7 +80,7 @@ public function getProviders(IUser $user): array {
foreach ($registeredProviders as $provider) {
try {
$this->loadTwoFactorApp($provider->getAppId());
$provider = OC::$server->query($provider->getService());
$provider = \OCP\Server::get($provider->getService());
$providers[$provider->getId()] = $provider;
} catch (QueryException $exc) {
// Provider class can not be resolved
Expand Down
6 changes: 3 additions & 3 deletions lib/private/Collaboration/Resources/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static function register(SymfonyAdapter $symfonyDispatcher, IEventDispatc
/** @var IUser $user */
$user = $event->getArgument('user');
/** @var IManager $resourceManager */
$resourceManager = \OC::$server->query(IManager::class);
$resourceManager = \OCP\Server::get(IManager::class);

$resourceManager->invalidateAccessCacheForUser($user);
};
Expand All @@ -51,7 +51,7 @@ public static function register(SymfonyAdapter $symfonyDispatcher, IEventDispatc
/** @var IUser $user */
$user = $event->getSubject();
/** @var IManager $resourceManager */
$resourceManager = \OC::$server->query(IManager::class);
$resourceManager = \OCP\Server::get(IManager::class);

$resourceManager->invalidateAccessCacheForUser($user);
});
Expand All @@ -60,7 +60,7 @@ public static function register(SymfonyAdapter $symfonyDispatcher, IEventDispatc
/** @var IGroup $group */
$group = $event->getSubject();
/** @var IManager $resourceManager */
$resourceManager = \OC::$server->query(IManager::class);
$resourceManager = \OCP\Server::get(IManager::class);

foreach ($group->getUsers() as $user) {
$resourceManager->invalidateAccessCacheForUser($user);
Expand Down
6 changes: 3 additions & 3 deletions lib/private/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
use OC\MemoryInfo;
use OC\NeedsUpdateException;
use OC_App;
use OCP\AppFramework\QueryException;
use OCP\App\IAppManager;
use OCP\Console\ConsoleEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IRequest;
use Psr\Container\ContainerExceptionInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Application as SymfonyApplication;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -216,8 +216,8 @@ public function run(InputInterface $input = null, OutputInterface $output = null
private function loadCommandsFromInfoXml($commands) {
foreach ($commands as $command) {
try {
$c = \OC::$server->query($command);
} catch (QueryException $e) {
$c = \OCP\Server::get($command);
} catch (ContainerExceptionInterface $e) {
if (class_exists($command)) {
try {
$c = new $command();
Expand Down
2 changes: 1 addition & 1 deletion lib/private/DB/MigrationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ public function describeMigrationStep($to = 'latest') {
protected function createInstance($version) {
$class = $this->getClass($version);
try {
$s = \OC::$server->query($class);
$s = \OCP\Server::get($class);

if (!$s instanceof IMigrationStep) {
throw new \InvalidArgumentException('Not a valid migration');
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function __construct(IStorage $storage) {
$this->mimetypeLoader = \OC::$server->getMimeTypeLoader();
$this->connection = \OC::$server->getDatabaseConnection();
$this->eventDispatcher = \OC::$server->get(IEventDispatcher::class);
$this->querySearchHelper = \OC::$server->query(QuerySearchHelper::class);
$this->querySearchHelper = \OCP\Server::get(QuerySearchHelper::class);
}

protected function getQueryBuilder() {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Node/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private function queryFromOperator(ISearchOperator $operator, string $uid = null
$user = null;
} else {
/** @var IUserManager $userManager */
$userManager = \OC::$server->query(IUserManager::class);
$userManager = \OCP\Server::get(IUserManager::class);
$user = $userManager->get($uid);
}
return new SearchQuery($operator, $limit, $offset, [], $user);
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Preview/WatcherConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(IRootFolder $root,
* @return Watcher
*/
private function getWatcher(): Watcher {
return \OC::$server->query(Watcher::class);
return \OCP\Server::get(Watcher::class);
}

public function connectWatcher() {
Expand Down
6 changes: 3 additions & 3 deletions lib/private/Repair.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ public static function getRepairSteps(): array {
new FixMountStorages(\OC::$server->getDatabaseConnection()),
new UpdateLanguageCodes(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()),
new AddLogRotateJob(\OC::$server->getJobList()),
new ClearFrontendCaches(\OC::$server->getMemCacheFactory(), \OC::$server->query(JSCombiner::class)),
new ClearFrontendCaches(\OC::$server->getMemCacheFactory(), \OCP\Server::get(JSCombiner::class)),
\OCP\Server::get(ClearGeneratedAvatarCache::class),
new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()),
new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()),
new CleanupCardDAVPhotoCache(\OC::$server->getConfig(), \OC::$server->getAppDataDir('dav-photocache'), \OC::$server->get(LoggerInterface::class)),
new AddClenupLoginFlowV2BackgroundJob(\OC::$server->getJobList()),
new RemoveLinkShares(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getGroupManager(), \OC::$server->getNotificationManager(), \OC::$server->query(ITimeFactory::class)),
new ClearCollectionsAccessCache(\OC::$server->getConfig(), \OC::$server->query(IManager::class)),
new RemoveLinkShares(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getGroupManager(), \OC::$server->getNotificationManager(), \OCP\Server::get(ITimeFactory::class)),
new ClearCollectionsAccessCache(\OC::$server->getConfig(), \OCP\Server::get(IManager::class)),
\OCP\Server::get(ResetGeneratedAvatarFlag::class),
\OCP\Server::get(EncryptionLegacyCipher::class),
\OCP\Server::get(EncryptionMigration::class),
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Search/Provider/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ class File extends PagedProvider {
*/
public function search($query, int $limit = null, int $offset = null) {
/** @var IRootFolder $rootFolder */
$rootFolder = \OC::$server->query(IRootFolder::class);
$rootFolder = \OCP\Server::get(IRootFolder::class);
/** @var IUserSession $userSession */
$userSession = \OC::$server->query(IUserSession::class);
$userSession = \OCP\Server::get(IUserSession::class);
$user = $userSession->getUser();
if (!$user) {
return [];
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Session/Internal.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function regenerateId(bool $deleteOldSession = true, bool $updateToken =
$newId = $this->getId();

/** @var IProvider $tokenProvider */
$tokenProvider = \OC::$server->query(IProvider::class);
$tokenProvider = \OCP\Server::get(IProvider::class);

try {
$tokenProvider->renewSessionToken($oldId, $newId);
Expand Down
Loading

0 comments on commit cd9b081

Please sign in to comment.