Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use OCP\Constants;
use OCP\Files\IRootFolder;
use OCP\Files\IUserFolder;
use OCP\Files\Node;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserSession;
Expand Down Expand Up @@ -386,11 +387,11 @@ private function mockObjectIdsUpdate(int $permissions): void {

$this->tagMapper->method('getObjectIdsForTags')->willReturn(['1', '2']);

$fileNode = $this->createMock(\OCP\Files\Node::class);
$fileNode = $this->createMock(Node::class);
$fileNode->method('getPermissions')->willReturn($permissions);
$userFolder = $this->createMock(IUserFolder::class);
$userFolder->method('getFirstNodeById')
->willReturnCallback(fn (int $id): ?\OCP\Files\Node => in_array($id, [2, 3], true) ? $fileNode : null);
->willReturnCallback(fn (int $id): ?Node => in_array($id, [2, 3], true) ? $fileNode : null);
$userFolder->method('getById')
->willReturnCallback(fn (int $id): array => in_array($id, [2, 3], true) ? [$fileNode] : []);
$this->rootFolder->method('getUserFolder')->willReturn($userFolder);
Expand Down
1 change: 0 additions & 1 deletion apps/user_ldap/lib/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IAppConfig;
use OCP\IDBConnection;
use OCP\Server;

class Helper {
/** @var CappedMemoryCache<string> */
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,12 @@ public function __construct(
$c->get(IEventDispatcher::class),
);
$dispatcher = $this->get(IEventDispatcher::class);
$dispatcher->addListener(UserLoggedInEvent::class, function (UserLoggedInEvent $event) {
$dispatcher->addListener(UserLoggedInEvent::class, function (UserLoggedInEvent $event): void {
/** @var User $user */
\OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $event->getUser()->getUID(), 'loginName' => $event->getLoginName(), 'password' => $event->getPassword(), 'isTokenLogin' => $event->isTokenLogin()]);
});

$dispatcher->addListener(UserLoggedInWithCookieEvent::class, function (UserLoggedInWithCookieEvent $event) {
$dispatcher->addListener(UserLoggedInWithCookieEvent::class, function (UserLoggedInWithCookieEvent $event): void {
/** @var User $user */
\OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $event->getUser()->getUID(), 'password' => $event->getPassword()]);
});
Expand Down
11 changes: 6 additions & 5 deletions lib/private/legacy/OC_Hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
*/

use OC\Files\Cache\Scanner;
use OC\Files\Filesystem;
use OC\ServerNotAvailableException;
use OCA\Files_Trashbin\Trashbin;
use OCP\HintException;
use OCP\Server;
use OCP\Share;
Expand Down Expand Up @@ -54,8 +55,8 @@ class OC_Hook {
['OC\Files\Storage\Shared','fopen'],
['OC\Files\Storage\Shared','file_get_contents'],
['OC\Files\Storage\Shared','file_put_contents'],
[\OCA\Files_Trashbin\Trashbin::class,'post_moveToTrash'],
[\OCA\Files_Trashbin\Trashbin::class,'post_restore'],
[Trashbin::class,'post_moveToTrash'],
[Trashbin::class,'post_restore'],
['OCP\Trashbin','delete'],
['OCP\Trashbin','preDelete'],
['OCP\Trashbin','preDeleteAll'],
Expand All @@ -69,8 +70,8 @@ class OC_Hook {
['OC\User','assignedUserId'],
['OC\User','preUnassignedUserId'],
['OC\User','postUnassignedUserId'],
[\OC\Files\Cache\Scanner::class,'scan_file'],
[\OC\Files\Cache\Scanner::class,'post_scan_file'],
[Scanner::class,'scan_file'],
[Scanner::class,'post_scan_file'],
['Scanner','removeFromCache'],
['Scanner','addToCache'],
['Scanner','correctFolderSize'],
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/Files/Storage/Wrapper/QuotaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use OC\Files\Storage\Local;
use OC\Files\Storage\Wrapper\Quota;
use OCP\Files;
use OCP\Files\FileInfo;
use OCP\Files\NotEnoughSpaceException;
use OCP\ITempManager;
use OCP\Server;
Expand Down Expand Up @@ -258,7 +259,7 @@ public function testWriteStreamAllowsUploadPathWithUnlimitedFreeSpace(): void {
->getMock();
$storage->expects($this->any())
->method('free_space')
->willReturn(Files\FileInfo::SPACE_UNLIMITED);
->willReturn(FileInfo::SPACE_UNLIMITED);
$storage->mkdir('uploads');

$instance = new Quota(['storage' => $storage, 'quota' => 5.0]);
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/Preview/AVIFTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Test\Preview;

use OC\Preview\AVIF;
use OCP\Image;

/**
* Class AVIFTest
Expand All @@ -29,7 +30,7 @@ protected function setUp(): void {
// format never reaches imagecreatefromavif() however capable libgd
// is. Ask for the whole path rather than for one part of it, and
// say which part was missing when it is not there.
$probe = new \OCP\Image();
$probe = new Image();
$probe->loadFromFile($sourcePath);
if (!$probe->valid()) {
$this->markTestSkipped(sprintf(
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/SystemReport/SystemReportManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected function setUp(): void {
}

/**
* @param \OC\AppFramework\Bootstrap\ServiceRegistration[] $registrations
* @param ServiceRegistration[] $registrations
*/
private function withRegisteredSections(array $registrations): void {
$context = $this->createMock(RegistrationContext::class);
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/User/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public function testLogClientInNoTokenPasswordWith2fa(): void {
->expects($this->exactly(2))
->method('dispatchTyped')
->willReturnCallback(
function (Event $event) {
function (Event $event): void {
if ($event instanceof LoginFailed) {
$this->assertEquals($event, new LoginFailed('john', 'doe'));
} elseif ($event instanceof BeforeUserLoggedInEvent) {
Expand Down Expand Up @@ -579,7 +579,7 @@ public function testLogClientInNoTokenPasswordNo2fa(): void {
->expects($this->exactly(2))
->method('dispatchTyped')
->willReturnCallback(
function (Event $event) {
function (Event $event): void {
if ($event instanceof LoginFailed) {
$this->assertEquals($event, new LoginFailed('john', 'doe'));
} elseif ($event instanceof BeforeUserLoggedInEvent) {
Expand Down Expand Up @@ -1363,7 +1363,7 @@ public function testLogClientInThrottlerUsername(): void {
->expects($this->exactly(2))
->method('dispatchTyped')
->willReturnCallback(
function (Event $event) {
function (Event $event): void {
if ($event instanceof LoginFailed) {
$this->assertEquals($event, new LoginFailed('john', 'I-AM-A-PASSWORD'));
} elseif ($event instanceof BeforeUserLoggedInEvent) {
Expand Down Expand Up @@ -1426,7 +1426,7 @@ public function testLogClientInThrottlerEmail(): void {
->expects($this->exactly(2))
->method('dispatchTyped')
->willReturnCallback(
function (Event $event) {
function (Event $event): void {
if ($event instanceof LoginFailed) {
$this->assertEquals($event, new LoginFailed('john@foo.bar', 'I-AM-A-PASSWORD'));
} elseif ($event instanceof BeforeUserLoggedInEvent) {
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/User/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public function testSetPasswordHooks(): void {
$this->dispatcher->expects(self::atLeastOnce())
->method('dispatchTyped')
->willReturnCallback(
function (Event $event) use (&$hooksCalled) {
function (Event $event) use (&$hooksCalled): void {
if ($event instanceof BeforePasswordUpdatedEvent) {
$hooksCalled++;
$this->assertEquals('foo', $event->getUser()->getUID());
Expand Down Expand Up @@ -438,7 +438,7 @@ public function testDeleteEvent(bool $result, int $expectedHooks): void {
$this->dispatcher->expects(self::atLeastOnce())
->method('dispatchTyped')
->willReturnCallback(
function (Event $event) use (&$hooksCalled) {
function (Event $event) use (&$hooksCalled): void {
if ($event instanceof BeforeUserDeletedEvent) {
$hooksCalled++;
$this->assertEquals('foo', $event->getUser()->getUID());
Expand Down
Loading