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
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 = 'user@example.com';
$user = $this->createMock(\OCP\IUser::class);
$user = $this->createMock(IUser::class);

$this->userManager->expects(self::once())
->method('getByEmail')
Expand Down
16 changes: 10 additions & 6 deletions apps/dav/tests/unit/Connector/Sabre/NodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function davPermissionsProvider(): array {
public function testDavPermissions(int $permissions, string $type, bool $shared, int $shareRootPermissions, bool $mounted, string $internalPath, string $expected): void {
$info = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()
->onlyMethods(['getPermissions', 'isShared', 'isMounted', 'getType', 'getInternalPath', 'getStorage', 'getMountPoint'])
->onlyMethods(['getPermissions', 'isShared', 'isMounted', 'getType', 'getInternalPath', 'getStorage', 'getMountPoint', 'getPath'])
->getMock();
$info->method('getPermissions')
->willReturn($permissions);
Expand All @@ -65,6 +65,8 @@ public function testDavPermissions(int $permissions, string $type, bool $shared,
->willReturn($mounted);
$info->method('getType')
->willReturn($type);
$info->method('getPath')
->willReturn('');
$info->method('getInternalPath')
->willReturn($internalPath);
$info->method('getMountPoint')
Expand Down Expand Up @@ -160,18 +162,18 @@ public function testSharePermissions(string $type, ?string $user, int $permissio

$info = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()
->onlyMethods(['getStorage', 'getType', 'getMountPoint', 'getPermissions'])
->onlyMethods(['getStorage', 'getType', 'getMountPoint', 'getPermissions', 'getPath'])
->getMock();

$info->method('getStorage')->willReturn($storage);
$info->method('getPath')->willReturn('notMyPath');
$info->method('getType')->willReturn($type);
$info->method('getMountPoint')->willReturn($mountpoint);
$info->method('getPermissions')->willReturn($permissions);

$view = $this->createMock(View::class);

$node = new File($view, $info);
$this->invokePrivate($node, 'shareManager', [$shareManager]);
$node = new File($view, $info, $shareManager);
$this->assertEquals($expected, $node->getSharePermissions($user));
}

Expand All @@ -196,9 +198,10 @@ public function testShareAttributes(): void {
/** @var Folder&MockObject $info */
$info = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->onlyMethods(['getStorage', 'getType'])
->onlyMethods(['getStorage', 'getType', 'getPath'])
->getMock();

$info->method('getPath')->willReturn('myPath');
$info->method('getStorage')->willReturn($storage);
$info->method('getType')->willReturn(FileInfo::TYPE_FOLDER);

Expand All @@ -217,9 +220,10 @@ public function testShareAttributesNonShare(): void {
/** @var Folder&MockObject */
$info = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->onlyMethods(['getStorage', 'getType'])
->onlyMethods(['getStorage', 'getType', 'getPath'])
->getMock();

$info->method('getPath')->willReturn('myPath');
$info->method('getStorage')->willReturn($storage);
$info->method('getType')->willReturn(FileInfo::TYPE_FOLDER);

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
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ public function __construct(
]);
}

/**
* @return void
*/
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null): void {
try {
$credentials = $this->credentialsStore->getLoginCredentials();
} catch (CredentialsUnavailableException $e) {
Expand Down
4 changes: 3 additions & 1 deletion apps/files_external/lib/Lib/SessionStorageWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@

use OC\Files\Storage\Wrapper\PermissionsMask;
use OCP\Constants;
use OCP\Files\Storage;
use OCP\Files\Storage\IStorage;

/**
* Wrap Storage in PermissionsMask for session ephemeral use
*/
class SessionStorageWrapper extends PermissionsMask {
/**
* @param array $parameters ['storage' => $storage]
* @param array{storage: IStorage} $parameters
*/
public function __construct(array $parameters) {
// disable sharing permission
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);
}
}
11 changes: 3 additions & 8 deletions apps/files_sharing/lib/SharedStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage

private LoggerInterface $logger;

/** @var IStorage */
/** @var Storage */
private $nonMaskedStorage;

private array $mountOptions = [];
Expand All @@ -85,12 +85,6 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage

private static int $initDepth = 0;

/**
* @psalm-suppress NonInvariantDocblockPropertyType
* @var ?Storage $storage
*/
protected $storage;

public function __construct(array $parameters) {
$this->ownerView = $parameters['ownerView'];
$this->logger = Server::get(LoggerInterface::class);
Expand All @@ -105,6 +99,7 @@ public function __construct(array $parameters) {
$this->sharingDisabledForUser = false;
}

/** @psalm-suppress InvalidArgument This is fine as we also overwrite getWrappedStorage */
parent::__construct([
'storage' => null,
'root' => null,
Expand All @@ -129,7 +124,7 @@ private function getSourceRootInfo() {
/**
* @psalm-assert Storage $this->storage
*/
private function init() {
private function init(): void {
if ($this->initialized) {
if (!$this->storage) {
// marked as initialized but no storage set
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 @@ -3641,22 +3641,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
Loading
Loading