Skip to content

Commit

Permalink
fix(psalm): Adjust types to match private classes
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <kate@provokateurin.de>
  • Loading branch information
provokateurin committed Sep 16, 2024
1 parent 9bf58dd commit e765022
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/ACL/ACLCacheWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ public function getFolderContentsById($fileId) {
public function search($pattern) {
$results = $this->getCache()->search($pattern);
$this->preloadEntries($results);
return array_map([$this, 'formatCacheEntry'], $results);
return array_filter(array_map([$this, 'formatCacheEntry'], $results));
}

public function searchByMime($mimetype) {
$results = $this->getCache()->searchByMime($mimetype);
$this->preloadEntries($results);
return array_map([$this, 'formatCacheEntry'], $results);
return array_filter(array_map([$this, 'formatCacheEntry'], $results));
}

public function searchQuery(ISearchQuery $query) {
$results = $this->getCache()->searchQuery($query);
$this->preloadEntries($results);
return array_map([$this, 'formatCacheEntry'], $results);
return array_filter(array_map([$this, 'formatCacheEntry'], $results));
}

/**
Expand Down
3 changes: 2 additions & 1 deletion lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace OCA\GroupFolders\AppInfo;

use OC\Files\Node\LazyFolder;
use OC\Group;
use OCA\Circles\Events\CircleDestroyedEvent;
use OCA\DAV\Connector\Sabre\Principal;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
Expand Down Expand Up @@ -228,7 +229,7 @@ public function register(IRegistrationContext $context): void {
}

public function boot(IBootContext $context): void {
$context->injectFn(function (IMountProviderCollection $mountProviderCollection, CacheListener $cacheListener, IGroupManager $groupManager): void {
$context->injectFn(function (IMountProviderCollection $mountProviderCollection, CacheListener $cacheListener, Group\Manager $groupManager): void {
$mountProviderCollection->registerProvider($this->getMountProvider());

$groupManager->listen('\OC\Group', 'postDelete', function (IGroup $group) {
Expand Down
1 change: 0 additions & 1 deletion lib/Command/Scan.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ protected function configure() {
parent::configure();
}

/** @psalm-suppress UndefinedInterfaceMethod setUseTransactions is defined in private class */
protected function execute(InputInterface $input, OutputInterface $output) {
$folderId = $input->getArgument('folder_id');
$all = $input->getOption('all');
Expand Down
2 changes: 1 addition & 1 deletion lib/DAV/GroupFoldersHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private function getFolder(string $name): ?array {
private function getDirectoryForFolder(array $folder): GroupFolderNode {
$userHome = '/' . $this->user->getUID() . '/files';
$node = $this->rootFolder->get($userHome . '/' . $folder['mount_point']);
return new GroupFolderNode(Filesystem::getView($userHome), $node, $folder['folder_id']);
return new GroupFolderNode(Filesystem::getView(), $node, $folder['folder_id']);
}

public function getChild($name) {
Expand Down
10 changes: 5 additions & 5 deletions lib/Folder/FolderManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace OCA\GroupFolders\Folder;

use OC\Files\Cache\Cache;
use OC\Files\Cache\CacheEntry;
use OC\Files\Node\Node;
use OCA\Circles\CirclesManager;
use OCA\Circles\CirclesQueryHelper;
Expand All @@ -18,7 +19,6 @@
use OCP\DB\Exception;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\IMimeTypeLoader;
use OCP\Files\IRootFolder;
use OCP\IConfig;
Expand Down Expand Up @@ -482,7 +482,7 @@ public function searchUsers(int $id, string $search = '', int $limit = 10, int $
/**
* @param string $groupId
* @param int $rootStorageId
* @return list<array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?ICacheEntry}>
* @return list<array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?CacheEntry}>
* @throws Exception
*/
public function getFoldersForGroup(string $groupId, int $rootStorageId = 0): array {
Expand Down Expand Up @@ -534,7 +534,7 @@ public function getFoldersForGroup(string $groupId, int $rootStorageId = 0): arr
/**
* @param string[] $groupIds
* @param int $rootStorageId
* @return array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?ICacheEntry}[]
* @return array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?CacheEntry}[]
* @throws Exception
*/
public function getFoldersForGroups(array $groupIds, int $rootStorageId = 0): array {
Expand Down Expand Up @@ -592,7 +592,7 @@ public function getFoldersForGroups(array $groupIds, int $rootStorageId = 0): ar
/**
* @param string[] $groupIds
* @param int $rootStorageId
* @return array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?ICacheEntry}[]
* @return array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?CacheEntry}[]
* @throws Exception
*/
public function getFoldersFromCircleMemberships(IUser $user, int $rootStorageId = 0): array {
Expand Down Expand Up @@ -877,7 +877,7 @@ public function setFolderACL(int $folderId, bool $acl): void {
/**
* @param IUser $user
* @param int $rootStorageId
* @return list<array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?ICacheEntry}>
* @return list<array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?CacheEntry}>
* @throws Exception
*/
public function getFoldersForUser(IUser $user, int $rootStorageId = 0): array {
Expand Down
5 changes: 5 additions & 0 deletions lib/Mount/GroupFolderNoEncryptionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@

use OCP\Files\Storage\IDisableEncryptionStorage;

/**
* @psalm-suppress UnimplementedInterfaceMethod
* Psalm gets confused about missing methods, but those are implemented in OC\Files\Storage\Wrapper\Wrapper,
* so this suppression is fine and necessary as there is nothing wrong.
*/
class GroupFolderNoEncryptionStorage extends GroupFolderStorage implements IDisableEncryptionStorage {
}
3 changes: 2 additions & 1 deletion lib/Mount/MountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace OCA\GroupFolders\Mount;

use OC\Files\Cache\CacheEntry;
use OC\Files\Storage\Wrapper\Jail;
use OC\Files\Storage\Wrapper\PermissionsMask;
use OCA\GroupFolders\ACL\ACLManager;
Expand Down Expand Up @@ -102,7 +103,7 @@ private function getRootStorageId(): int {
}

/**
* @return list<array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?ICacheEntry}>
* @return list<array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?CacheEntry}>
*/
public function getFoldersForUser(IUser $user): array {
return $this->folderManager->getFoldersForUser($user, $this->getRootStorageId());
Expand Down

0 comments on commit e765022

Please sign in to comment.