Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/dav/appinfo/v1/carddav.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
/** @var string $baseuri defined in remote.php */
$server->setBaseUri($baseuri);
// Add plugins
$server->addPlugin(new MaintenancePlugin(Server::get(IConfig::class), \OCP\Server::get(IL10nFactory::class)->get('dav')));
$server->addPlugin(new MaintenancePlugin(Server::get(IConfig::class), Server::get(IL10nFactory::class)->get('dav')));
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
$server->addPlugin(new Plugin());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use OCA\DAV\DAV\RemoteUserPrincipalBackend;
use OCP\AppFramework\Db\Entity;
use OCP\Constants;
use OCP\DB\Types;
use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;

Expand Down Expand Up @@ -94,7 +95,7 @@ public function toCalendarInfo(): array {
'{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}getctag' => $this->getSyncTokenForSabre(),
'{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => $this->getSupportedCalendarComponentSet(),
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->getSharedByPrincipal(),
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => ($this->getPermissions() & \OCP\Constants::PERMISSION_UPDATE) === 0 ? 1 : 0,
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => ($this->getPermissions() & Constants::PERMISSION_UPDATE) === 0 ? 1 : 0,
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}permissions' => $this->getPermissions(),
];
}
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ public function getNodeForPath($path): INode {
}

if ($info->getMimeType() === FileInfo::MIMETYPE_FOLDER) {
$node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info, $this->tree, $this->shareManager);
$node = new Directory($this->fileView, $info, $this->tree, $this->shareManager);
} else {
// In case reading a directory was allowed but it turns out the node was a not a directory, reject it now.
if (!$this->info->isReadable()) {
Expand Down
3 changes: 2 additions & 1 deletion apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use OCP\IAppConfig;
use OCP\IDBConnection;
use OCP\IL10N;
use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
use OCP\Security\ISecureRandom;
Expand Down Expand Up @@ -163,7 +164,7 @@ public function testGetFrom(): void {

public function testIsSystemUserWhenUserExists(): void {
$email = '[email protected]';
$user = $this->createMock(\OCP\IUser::class);
$user = $this->createMock(IUser::class);

$this->userManager->expects(self::once())
->method('getByEmail')
Expand Down
3 changes: 2 additions & 1 deletion apps/federatedfilesharing/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Federation\ICloudFederationProviderManager;
use OCP\Server;

class Application extends App implements IBootstrap {

Expand All @@ -41,7 +42,7 @@ private function registerCloudFederationProvider(ICloudFederationProviderManager
$manager->addCloudFederationProvider($type,
'Federated Files Sharing',
function (): CloudFederationProviderFiles {
return \OCP\Server::get(CloudFederationProviderFiles::class);
return Server::get(CloudFederationProviderFiles::class);
});
}
}
Expand Down
5 changes: 3 additions & 2 deletions apps/federatedfilesharing/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\IDelegatedSettings;
use OCP\Util;

class Admin implements IDelegatedSettings {
/**
Expand Down Expand Up @@ -44,8 +45,8 @@ public function getForm() {
$this->initialState->provideInitialState('lookupServerUploadEnabled', $this->fedShareProvider->isLookupServerUploadEnabled());
$this->initialState->provideInitialState('federatedTrustedShareAutoAccept', $this->fedShareProvider->isFederatedTrustedShareAutoAccept());

\OCP\Util::addStyle(Application::APP_ID, 'settings-admin');
\OCP\Util::addScript(Application::APP_ID, 'settings-admin');
Util::addStyle(Application::APP_ID, 'settings-admin');
Util::addScript(Application::APP_ID, 'settings-admin');
return new TemplateResponse(Application::APP_ID, 'settings-admin', renderAs: '');
}

Expand Down
5 changes: 3 additions & 2 deletions apps/federatedfilesharing/lib/Settings/Personal.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use OCP\IURLGenerator;
use OCP\IUserSession;
use OCP\Settings\ISettings;
use OCP\Util;

class Personal implements ISettings {
public function __construct(
Expand All @@ -42,8 +43,8 @@ public function getForm(): TemplateResponse {
$this->initialState->provideInitialState('cloudId', $cloudID);
$this->initialState->provideInitialState('docUrlFederated', $this->urlGenerator->linkToDocs('user-sharing-federated'));

\OCP\Util::addStyle(Application::APP_ID, 'settings-personal');
\OCP\Util::addScript(Application::APP_ID, 'settings-personal');
Util::addStyle(Application::APP_ID, 'settings-personal');
Util::addScript(Application::APP_ID, 'settings-personal');
return new TemplateResponse(Application::APP_ID, 'settings-personal', renderAs: TemplateResponse::RENDER_AS_BLANK);
}

Expand Down
4 changes: 2 additions & 2 deletions apps/files/tests/Command/ScanAppDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function setUp(): void {
$this->scanner->method('getScanner')->willReturn($this->internalScanner);

$this->scanner->method('initTools')
->willReturnCallback(function () {});
->willReturnCallback(function (): void {});
try {
$this->rootFolder->get($this->rootFolder->getAppDataDirectoryName() . '/preview')->delete();
} catch (NotFoundException) {
Expand Down Expand Up @@ -103,7 +103,7 @@ public function testScanAppDataRoot(): void {
}

$this->input->method('getArgument')->with('folder')->willReturn('');
$this->internalScanner->method('scan')->willReturnCallback(function () {
$this->internalScanner->method('scan')->willReturnCallback(function (): void {
$this->internalScanner->emit('\OC\Files\Utils\Scanner', 'scanFile', ['path42']);
$this->internalScanner->emit('\OC\Files\Utils\Scanner', 'scanFolder', ['path42']);
$this->internalScanner->emit('\OC\Files\Utils\Scanner', 'scanFolder', ['path42']);
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/tests/Settings/AdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function testGetForm(): void {
$this->initialState
->expects($this->atLeastOnce())
->method('provideInitialState')
->willReturnCallback(function () use (&$initialState) {
->willReturnCallback(function () use (&$initialState): void {
$args = func_get_args();
$initialState[$args[0]] = $args[1];
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
namespace OCA\Files_Sharing\Controller;

use OCA\Deck\Sharing\ShareAPIHelper;
use OCA\Files_Sharing\ResponseDefinitions;
use OCP\App\IAppManager;
use OCP\AppFramework\Http;
Expand Down Expand Up @@ -204,12 +205,12 @@ private function getRoomShareHelper(): \OCA\Talk\Share\Helper\DeletedShareAPICon
* @psalm-suppress UndefinedClass
* @throws ContainerExceptionInterface
*/
private function getDeckShareHelper(): \OCA\Deck\Sharing\ShareAPIHelper {
private function getDeckShareHelper(): ShareAPIHelper {
if (!$this->appManager->isEnabledForUser('deck')) {
throw new QueryException();
}

/** @psalm-suppress UndefinedClass */
return Server::get(\OCA\Deck\Sharing\ShareAPIHelper::class);
return Server::get(ShareAPIHelper::class);
}
}
2 changes: 1 addition & 1 deletion apps/files_sharing/tests/ShareTargetValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function testShareMountCreateParentFolder(): void {
$share = $this->shareManager->getShareById($share->getFullId());
$this->assertSame('/foo/bar' . $this->folder, $share->getTarget());

$this->eventDispatcher->addListener(VerifyMountPointEvent::class, function (VerifyMountPointEvent $event) {
$this->eventDispatcher->addListener(VerifyMountPointEvent::class, function (VerifyMountPointEvent $event): void {
$event->setCreateParent(true);
});
$this->targetValidator->verifyMountPoint($this->user2, $share, [], [$share]);
Expand Down
3 changes: 2 additions & 1 deletion apps/files_trashbin/lib/Trashbin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use OC\Files\View;
use OC\User\NoUserException;
use OC_User;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\Files_Trashbin\Command\Expire;
use OCA\Files_Trashbin\Events\BeforeNodeRestoredEvent;
use OCA\Files_Trashbin\Events\NodeRestoredEvent;
Expand Down Expand Up @@ -1194,7 +1195,7 @@ private static function overwriteDeletedBy(string $user) {
return $user;
}

$federatedShareProvider = Server::get(\OCA\FederatedFileSharing\FederatedShareProvider::class);
$federatedShareProvider = Server::get(FederatedShareProvider::class);
$share = $federatedShareProvider->getShareByToken($token);

return $share->getSharedWith();
Expand Down
5 changes: 3 additions & 2 deletions apps/oauth2/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use OCP\AppFramework\Services\IInitialState;
use OCP\IURLGenerator;
use OCP\Settings\ISettings;
use OCP\Util;
use Psr\Log\LoggerInterface;

class Admin implements ISettings {
Expand Down Expand Up @@ -45,8 +46,8 @@ public function getForm(): TemplateResponse {
$this->initialState->provideInitialState('clients', $result);
$this->initialState->provideInitialState('oauth2-doc-link', $this->urlGenerator->linkToDocs('admin-oauth2'));

\OCP\Util::addStyle('oauth2', 'settings-admin');
\OCP\Util::addScript('oauth2', 'settings-admin', 'core');
Util::addStyle('oauth2', 'settings-admin');
Util::addScript('oauth2', 'settings-admin', 'core');
return new TemplateResponse(
'oauth2',
'admin',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function testIndex(): void {
$initialState = [];
$this->initialState->expects(self::atLeastOnce())
->method('provideInitialState')
->willReturnCallback(function () use (&$initialState) {
->willReturnCallback(function () use (&$initialState): void {
$initialState[] = func_get_args();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
use OC\Settings\AuthorizedGroupMapper;
use OCA\Settings\Service\AuthorizedGroupService;
use OCA\Settings\Service\ConflictException;
use OCA\Settings\Service\NotFoundException;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\Server;
use Test\TestCase;

/**
Expand All @@ -27,7 +29,7 @@ protected function setUp(): void {
parent::setUp();

// Use real mapper for integration testing
$this->mapper = \OCP\Server::get(AuthorizedGroupMapper::class);
$this->mapper = Server::get(AuthorizedGroupMapper::class);
$this->service = new AuthorizedGroupService($this->mapper);
}

Expand Down Expand Up @@ -109,10 +111,10 @@ public function testCreateAfterDelete(): void {
$this->service->delete($initialId);

// Verify it's deleted by trying to find it
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
$this->expectException(DoesNotExistException::class);
try {
$this->service->find($initialId);
} catch (\OCA\Settings\Service\NotFoundException $e) {
} catch (NotFoundException $e) {
// Expected - now create the same assignment again, which should succeed
$result2 = $this->service->create($groupId, $class);

Expand Down
4 changes: 2 additions & 2 deletions apps/settings/tests/Service/AuthorizedGroupServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function testCreateAllowsDifferentGroupsSameClass(): void {
// Mock that no duplicate exists for group1
$this->mapper->expects($this->exactly(2))
->method('findByGroupIdAndClass')
->willReturnCallback(function ($groupId, $classArg) use ($groupId1, $groupId2, $class) {
->willReturnCallback(function ($groupId, $classArg) use ($groupId1, $groupId2, $class): void {
$this->assertContains($groupId, [$groupId1, $groupId2]);
$this->assertEquals($class, $classArg);
throw new DoesNotExistException('Not found');
Expand Down Expand Up @@ -126,7 +126,7 @@ public function testCreateAllowsSameGroupDifferentClasses(): void {
// Mock that no duplicate exists for either class
$this->mapper->expects($this->exactly(2))
->method('findByGroupIdAndClass')
->willReturnCallback(function ($groupIdArg, $class) use ($groupId, $class1, $class2) {
->willReturnCallback(function ($groupIdArg, $class) use ($groupId, $class1, $class2): void {
$this->assertEquals($groupId, $groupIdArg);
$this->assertContains($class, [$class1, $class2]);
throw new DoesNotExistException('Not found');
Expand Down
5 changes: 3 additions & 2 deletions apps/user_ldap/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use OCP\Server;
use OCP\Settings\IDelegatedSettings;
use OCP\Template\ITemplateManager;
use OCP\Util;

class Admin implements IDelegatedSettings {
public function __construct(
Expand Down Expand Up @@ -60,8 +61,8 @@ public function getForm(): TemplateResponse {
$this->initialState->provideInitialState('ldapConfigs', $ldapConfigs);
$this->initialState->provideInitialState('ldapModuleInstalled', function_exists('ldap_connect'));

\OCP\Util::addStyle(Application::APP_ID, 'settings-admin');
\OCP\Util::addScript(Application::APP_ID, 'settings-admin');
Util::addStyle(Application::APP_ID, 'settings-admin');
Util::addScript(Application::APP_ID, 'settings-admin');
return new TemplateResponse(Application::APP_ID, 'settings', $parameters);
}

Expand Down
16 changes: 0 additions & 16 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3613,22 +3613,6 @@
<code><![CDATA[$this->fileInfo]]></code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/private/Files/Node/Root.php">
<LessSpecificReturnStatement>
<code><![CDATA[$folders]]></code>
<code><![CDATA[$this->mountManager->findByNumericId($numericId)]]></code>
<code><![CDATA[$this->mountManager->findByStorageId($storageId)]]></code>
<code><![CDATA[$this->mountManager->findIn($mountPoint)]]></code>
</LessSpecificReturnStatement>
<MoreSpecificReturnType>
<code><![CDATA[MountPoint[]]]></code>
<code><![CDATA[\OC\Files\Mount\MountPoint[]]]></code>
<code><![CDATA[\OC\Files\Mount\MountPoint[]]]></code>
</MoreSpecificReturnType>
<UndefinedMethod>
<code><![CDATA[remove]]></code>
</UndefinedMethod>
</file>
<file src="lib/private/Files/ObjectStore/S3ConnectionTrait.php">
<InternalClass>
<code><![CDATA[ClientResolver::_default_signature_provider()]]></code>
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion core/Controller/ContactsMenuController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

use Exception;
use OC\Contacts\ContactsMenu\Manager;
use OC\Teams\TeamManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
Expand Down Expand Up @@ -37,7 +38,7 @@ public function __construct(
public function index(?string $filter = null, ?string $teamId = null): array {
$entries = $this->manager->getEntries($this->userSession->getUser(), $filter);
if ($teamId !== null) {
/** @var \OC\Teams\TeamManager */
/** @var TeamManager */
$teamManager = $this->teamManager;
$memberIds = $teamManager->getMembersOfTeam($teamId, $this->userSession->getUser()->getUID());
$entries['contacts'] = array_filter(
Expand Down
8 changes: 5 additions & 3 deletions core/Controller/OpenMetricsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\Attribute\PublicPage;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\StreamTraversableResponse;
use OCP\IConfig;
use OCP\IRequest;
use OCP\OpenMetrics\IMetricFamily;
Expand Down Expand Up @@ -44,12 +46,12 @@ public function __construct(
#[NoCSRFRequired]
#[PublicPage]
#[FrontpageRoute(verb: 'GET', url: '/metrics')]
public function export(): Http\Response {
public function export(): Response {
if (!$this->isRemoteAddressAllowed()) {
return new Http\Response(Http::STATUS_FORBIDDEN);
return new Response(Http::STATUS_FORBIDDEN);
}

return new Http\StreamTraversableResponse(
return new StreamTraversableResponse(
$this->generate(),
Http::STATUS_OK,
[
Expand Down
4 changes: 2 additions & 2 deletions lib/composer/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '8c12590cf6f93ce7aa41f17817b3791e524da39e',
'reference' => '671cec33f134e670bb21c5e3c49c685bd78fc339',
'type' => 'library',
'install_path' => __DIR__ . '/../../../',
'aliases' => array(),
Expand All @@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '8c12590cf6f93ce7aa41f17817b3791e524da39e',
'reference' => '671cec33f134e670bb21c5e3c49c685bd78fc339',
'type' => 'library',
'install_path' => __DIR__ . '/../../../',
'aliases' => array(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use OC\AppFramework\Services\InitialState;
use OC\AppFramework\Utility\ControllerMethodReflector;
use OC\AppFramework\Utility\SimpleContainer;
use OC\CapabilitiesManager;
use OC\Core\Middleware\TwoFactorMiddleware;
use OC\Diagnostics\EventLogger;
use OC\Log\PsrLoggerAdapter;
Expand Down Expand Up @@ -305,7 +306,7 @@ private function getUserId(): string {
* @param string $serviceName e.g. 'OCA\Files\Capabilities'
*/
public function registerCapability($serviceName) {
$this->query(\OC\CapabilitiesManager::class)->registerCapability(function () use ($serviceName) {
$this->query(CapabilitiesManager::class)->registerCapability(function () use ($serviceName) {
return $this->query($serviceName);
});
}
Expand Down
Loading
Loading