Skip to content

Commit 5f9ff96

Browse files
refactor: replace array_map with foreach to guarantee list<> type
1 parent 11ee0ce commit 5f9ff96

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/private/Teams/TeamManager.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,15 @@ public function getMemberships(string $userId): array {
152152

153153
$federatedUser = $this->circlesManager->getFederatedUser($userId, Member::TYPE_USER);
154154
$this->circlesManager->startSession($federatedUser);
155-
return array_map(function (Circle $team) {
156-
return new Team(
155+
$teams = [];
156+
foreach ($this->circlesManager->getCircles() as $team) {
157+
$teams[] = new Team(
157158
$team->getSingleId(),
158159
$team->getDisplayName(),
159160
$this->urlGenerator->linkToRouteAbsolute('contacts.contacts.directcircle', ['singleId' => $team->getSingleId()]),
160161
);
161-
}, $this->circlesManager->getCircles());
162+
}
163+
164+
return $teams;
162165
}
163166
}

0 commit comments

Comments
 (0)