Skip to content

Commit

Permalink
fix: psalm issues
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed Apr 18, 2024
1 parent 7071cc4 commit 57a4352
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/Hooks/FileListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function __construct(FaceDetectionMapper $faceDetectionMapper, LoggerInte
$this->storageService = $storageService;
$this->shareManager = $shareManager;
$this->rootFolder = $rootFolder;
$this->sourceUserIds = [];
}

public function handle(Event $event): void {
Expand All @@ -70,6 +71,7 @@ public function handle(Event $event): void {
$ownerId = $share->getShareOwner();
$node = $share->getNode();

/** @var array{users:array<string,array{node_id:int, node_path: string}>, remote: array<string,array{node_id:int, node_path: string}>, mail: array<string,array{node_id:int, node_path: string}>} $accessList */
$accessList = $this->shareManager->getAccessList($node, true, true);
$userIds = array_map(fn ($id) => strval($id), array_keys($accessList['users']));

Expand Down Expand Up @@ -106,10 +108,8 @@ public function handle(Event $event): void {
$share = $event->getShare();
$node = $share->getNode();

/** @var array{users:array<string,array{node_id:int, node_path: string}>, remote: array<string,array{node_id:int, node_path: string}>, mail: array<string,array{node_id:int, node_path: string}>} $accessList */
$accessList = $this->shareManager->getAccessList($node, true, true);
/**
* @var string[] $userIds
*/
$userIds = array_keys($accessList['users']);

if ($node->getType() === FileInfo::TYPE_FOLDER) {
Expand Down Expand Up @@ -137,6 +137,7 @@ public function handle(Event $event): void {
} else {
$this->movingFromIgnoredTerritory = false;
}
/** @var array{users:array<string,array{node_id:int, node_path: string}>, remote: array<string,array{node_id:int, node_path: string}>, mail: array<string,array{node_id:int, node_path: string}>} $sourceAccessList */
$sourceAccessList = $this->shareManager->getAccessList($event->getSource(), true, true);
$this->sourceUserIds = array_map(fn ($id) => strval($id), array_keys($sourceAccessList['users']));
return;
Expand Down Expand Up @@ -333,6 +334,7 @@ public function postInsert(Node $node, bool $recurse = true): void {
}

public function postRename(Node $source, Node $target): void {
/** @var array{users:array<string,array{node_id:int, node_path: string}>, remote: array<string,array{node_id:int, node_path: string}>, mail: array<string,array{node_id:int, node_path: string}>} $targetAccessList */
$targetAccessList = $this->shareManager->getAccessList($target, true, true);
$targetUserIds = array_map(fn ($id) => strval($id), array_keys($targetAccessList['users']));

Expand All @@ -343,10 +345,11 @@ public function postRename(Node $source, Node $target): void {

if ($target->getType() === FileInfo::TYPE_FOLDER) {
$mount = $target->getMountPoint();
if ($mount->getNumericStorageId() === null) {
$numericStorageId = $mount->getNumericStorageId();
if ($numericStorageId === null) {
return;
}
$files = $this->storageService->getFilesInMount($mount->getNumericStorageId(), $target->getId(), [ClusteringFaceClassifier::MODEL_NAME], 0, 0);
$files = $this->storageService->getFilesInMount($numericStorageId, $target->getId(), [ClusteringFaceClassifier::MODEL_NAME], 0, 0);
foreach ($files as $fileInfo) {
foreach ($usersToAdd as $userId) {
if (count($this->faceDetectionMapper->findByFileIdAndUser($target->getId(), $userId)) > 0) {
Expand Down

0 comments on commit 57a4352

Please sign in to comment.