Merge pull request #59917 from nextcloud/automated/noid/rector-changes

This commit is contained in:
Kate 2026-04-30 00:37:13 +02:00 committed by GitHub
commit c9ece351ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 18 additions and 16 deletions

View file

@ -2519,7 +2519,7 @@ class IMipServiceTest extends TestCase {
$actualHtmlValues = [];
$template
->method('addBodyListItem')
->willReturnCallback(function (string $html) use (&$actualHtmlValues) {
->willReturnCallback(function (string $html) use (&$actualHtmlValues): void {
$actualHtmlValues[] = $html;
});
@ -2558,7 +2558,7 @@ class IMipServiceTest extends TestCase {
$actualHtmlValues = [];
$template
->method('addBodyListItem')
->willReturnCallback(function (string $html) use (&$actualHtmlValues) {
->willReturnCallback(function (string $html) use (&$actualHtmlValues): void {
$actualHtmlValues[] = $html;
});

View file

@ -303,12 +303,12 @@ END:VCARD';
->method('createCard');
$this->backend->expects($this->exactly(1))
->method('updateCard')
->willReturnCallback(function ($id, $uri) use (&$pendingCards) {
->willReturnCallback(function ($id, $uri) use (&$pendingCards): void {
unset($pendingCards[$uri]);
});
$this->backend->expects($this->exactly(1))
->method('markCardsAsPending')
->willReturnCallback(function ($id) use (&$pendingCards) {
->willReturnCallback(function ($id) use (&$pendingCards): void {
$cards = array_values($this->backend->getCards($id));
$uris = array_map(fn ($card) => $card['uri'], $cards);
$pendingCards = array_combine($uris, $cards);

View file

@ -26,6 +26,7 @@ class UserFirstTimeLoggedInListener implements IEventListener {
) {
}
#[\Override()]
public function handle(Event $event): void {
if (!$event instanceof UserFirstTimeLoggedInEvent) {
return;

View file

@ -92,7 +92,7 @@ class SharesUpdatedListener implements IEventListener {
}
if ($share->getSharedBy() !== $user->getUID()) {
$this->markOrRun($user, function () use ($user, $share) {
$this->markOrRun($user, function () use ($user, $share): void {
$this->shareUpdater->updateForAddedShare($user, $share);
});
// Share target validation might have changed the target, restore it for the next user
@ -106,7 +106,7 @@ class SharesUpdatedListener implements IEventListener {
// don't trigger if the share is moved as part of the conflict resolution
if (!$this->shareUpdater->isInUpdate($user)) {
$this->markOrRun($user, function () use ($user, $share) {
$this->markOrRun($user, function () use ($user, $share): void {
$this->shareUpdater->updateForMovedShare($user, $share);
});
}
@ -118,7 +118,7 @@ class SharesUpdatedListener implements IEventListener {
continue;
}
$this->markOrRun($user, function () use ($user, $share) {
$this->markOrRun($user, function () use ($user, $share): void {
$this->shareUpdater->updateForDeletedShare($user, $share);
});
}
@ -139,7 +139,7 @@ class SharesUpdatedListener implements IEventListener {
}
private function updateOrMarkUser(IUser $user): void {
$this->markOrRun($user, function () use ($user) {
$this->markOrRun($user, function () use ($user): void {
$this->shareUpdater->updateForUser($user);
});
}

View file

@ -84,7 +84,7 @@ class SharesUpdatedListenerTest extends \Test\TestCase {
$this->shareRecipientUpdater
->expects($this->exactly(2))
->method('updateForAddedShare')
->willReturnCallback(function (IUser $user, IShare $eventShare) use ($user1, $user2, $share) {
->willReturnCallback(function (IUser $user, IShare $eventShare) use ($user1, $user2, $share): void {
$this->assertContains($user, [$user1, $user2]);
$this->assertEquals($share, $eventShare);
});
@ -107,7 +107,7 @@ class SharesUpdatedListenerTest extends \Test\TestCase {
$this->shareRecipientUpdater
->expects($this->exactly(1))
->method('updateForAddedShare')
->willReturnCallback(function (IUser $user, IShare $eventShare) use ($user2, $share) {
->willReturnCallback(function (IUser $user, IShare $eventShare) use ($user2, $share): void {
$this->assertEquals($user, $user2);
$this->assertEquals($share, $eventShare);
});
@ -124,7 +124,7 @@ class SharesUpdatedListenerTest extends \Test\TestCase {
$this->shareRecipientUpdater
->expects($this->exactly(2))
->method('updateForUser')
->willReturnCallback(function (IUser $user) use ($user1, $user2) {
->willReturnCallback(function (IUser $user) use ($user1, $user2): void {
$this->assertContains($user, [$user1, $user2]);
});
@ -144,7 +144,7 @@ class SharesUpdatedListenerTest extends \Test\TestCase {
$this->shareRecipientUpdater
->expects($this->exactly(2))
->method('updateForDeletedShare')
->willReturnCallback(function (IUser $user) use ($user1, $user2, $share) {
->willReturnCallback(function (IUser $user) use ($user1, $user2, $share): void {
$this->assertContains($user, [$user1, $user2]);
});

View file

@ -5,9 +5,9 @@
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
use Behat\Gherkin\Node\TableNode;
use GuzzleHttp\Client;
use OCA\Files_Sharing\MountProvider;
use PHPUnit\Framework\Assert;
use Psr\Http\Message\ResponseInterface;
@ -805,7 +805,7 @@ trait Sharing {
}
$this->runOcc(['files:mount:list', '--output', 'json', '--cached-only', $user]);
$mounts = json_decode($this->lastStdOut, true)['cached'];
$shareMounts = array_filter($mounts, fn (array $data) => $data['provider'] === \OCA\Files_Sharing\MountProvider::class);
$shareMounts = array_filter($mounts, fn (array $data) => $data['provider'] === MountProvider::class);
$actual = array_values(array_map(fn (array $data) => $data['mountpoint'], $shareMounts));
Assert::assertEquals($expected, $actual);
}
@ -817,7 +817,7 @@ trait Sharing {
public function checkShareMountsEmpty(string $user) {
$this->runOcc(['files:mount:list', '--output', 'json', '--cached-only', $user]);
$mounts = json_decode($this->lastStdOut, true)['cached'];
$shareMounts = array_filter($mounts, fn (array $data) => $data['provider'] === \OCA\Files_Sharing\MountProvider::class);
$shareMounts = array_filter($mounts, fn (array $data) => $data['provider'] === MountProvider::class);
$actual = array_values(array_map(fn (array $data) => $data['mountpoint'], $shareMounts));
Assert::assertEquals([], $actual);
}

View file

@ -1,11 +1,12 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Test;
use OC\Files\Mount\MountPoint;