Skip to content

Commit 9b519b4

Browse files
committed
refactor: simplify code
replace array_reduce + array_merge with array_merge(...) replace conditional assignment with ??= Signed-off-by: Salvatore Martire <[email protected]>
1 parent f47a586 commit 9b519b4

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

lib/private/Files/Config/MountProviderCollection.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ private function getUserMountsForProviders(IUser $user, array $providers): array
6767
$mounts = array_map(function (IMountProvider $provider) use ($user, $loader) {
6868
return $this->getMountsFromProvider($provider, $user, $loader);
6969
}, $providers);
70-
$mounts = array_reduce($mounts, function (array $mounts, array $providerMounts) {
71-
return array_merge($mounts, $providerMounts);
72-
}, []);
70+
$mounts = array_merge(...array_values($mounts));
7371
return $this->filterMounts($user, $mounts);
7472
}
7573

lib/private/Files/SetupManager.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,7 @@ public function setupForUser(IUser $user): void {
199199

200200
$this->eventLogger->start('fs:setup:user:full', 'Setup full filesystem for user');
201201

202-
if (!isset($this->setupUserMountProviders[$user->getUID()])) {
203-
$this->setupUserMountProviders[$user->getUID()] = [];
204-
}
205-
202+
$this->setupUserMountProviders[$user->getUID()] ??= [];
206203
$previouslySetupProviders = $this->setupUserMountProviders[$user->getUID()];
207204

208205
$this->setupForUserWith($user, function () use ($user) {

0 commit comments

Comments
 (0)