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 <[email protected]>
  • Loading branch information
provokateurin committed Sep 15, 2024
1 parent 969642a commit f38dc16
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
8 changes: 4 additions & 4 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);
$results = $this->getCache()->searchQuery($searchQuery);
$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
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
1 change: 1 addition & 0 deletions lib/Mount/GroupFolderNoEncryptionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@

use OCP\Files\Storage\IDisableEncryptionStorage;

/** @psalm-suppress UnimplementedInterfaceMethod */
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 f38dc16

Please sign in to comment.