chore: re-apply current rector configuration to apps folder

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2025-01-30 16:56:48 +01:00
parent ed9b47462f
commit ed5b7ae161
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A
11 changed files with 86 additions and 78 deletions

View file

@ -19,6 +19,7 @@ use OCP\IRequest;
use OCP\ISession;
use OCP\Security\Bruteforce\IThrottler;
use OCP\Security\Bruteforce\MaxDelayReached;
use OCP\Server;
use Psr\Log\LoggerInterface;
use Sabre\DAV\Auth\Backend\AbstractBasic;
use Sabre\DAV\Exception\NotAuthenticated;
@ -108,7 +109,7 @@ class Auth extends AbstractBasic {
} catch (Exception $e) {
$class = get_class($e);
$msg = $e->getMessage();
\OCP\Server::get(LoggerInterface::class)->error($e->getMessage(), ['exception' => $e]);
Server::get(LoggerInterface::class)->error($e->getMessage(), ['exception' => $e]);
throw new ServiceUnavailable("$class: $msg");
}
}

View file

@ -10,6 +10,7 @@ namespace OCA\DAV\Connector\Sabre;
use OC\AppFramework\Http\Request;
use OC\FilesMetadata\Model\FilesMetadata;
use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
use OCA\Files_Sharing\External\Mount as SharingExternalMount;
use OCP\Constants;
use OCP\Files\ForbiddenException;
use OCP\Files\IFilenameValidator;
@ -424,7 +425,7 @@ class FilesPlugin extends ServerPlugin {
$propFind->handle(self::IS_FEDERATED_PROPERTYNAME, function () use ($node) {
return $node->getFileInfo()->getMountPoint()
instanceof \OCA\Files_Sharing\External\Mount;
instanceof SharingExternalMount;
});
}

View file

@ -10,6 +10,7 @@ namespace OCA\DAV\Tests\unit\CardDAV;
use OCA\DAV\CardDAV\AddressBook;
use OCA\DAV\CardDAV\ImageExportPlugin;
use OCA\DAV\CardDAV\PhotoCache;
use OCP\AppFramework\Http;
use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
use Sabre\CardDAV\Card;
@ -171,7 +172,7 @@ class ImageExportPluginTest extends TestCase {
->willThrowException(new NotFoundException());
$this->response->expects($this->once())
->method('setStatus')
->with(\OCP\AppFramework\Http::STATUS_NO_CONTENT);
->with(Http::STATUS_NO_CONTENT);
}
$result = $this->plugin->httpGet($this->request, $this->response);

View file

@ -327,7 +327,7 @@ class SFTP extends Common {
$context = stream_context_create(['sftp' => ['session' => $connection]]);
$fh = fopen('sftpwrite://' . trim($absPath, '/'), 'w', false, $context);
if ($fh) {
$fh = CallbackWrapper::wrap($fh, null, null, function () use ($path) {
$fh = CallbackWrapper::wrap($fh, null, null, function () use ($path): void {
$this->knownMTimes->set($path, time());
});
}

View file

@ -471,7 +471,7 @@ class ShareAPIController extends OCSController {
$share = $this->formatShare($share);
if ($include_tags) {
$share = Helper::populateTags([$share], \OCP\Server::get(ITagManager::class));
$share = Helper::populateTags([$share], Server::get(ITagManager::class));
} else {
$share = [$share];
}
@ -754,7 +754,7 @@ class ShareAPIController extends OCSController {
$share->setSharedWith($shareWith);
$share->setPermissions($permissions);
} elseif ($shareType === IShare::TYPE_CIRCLE) {
if (!\OCP\Server::get(IAppManager::class)->isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) {
if (!Server::get(IAppManager::class)->isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) {
throw new OCSNotFoundException($this->l->t('You cannot share to a Team if the app is not enabled'));
}
@ -842,7 +842,7 @@ class ShareAPIController extends OCSController {
}
if ($includeTags) {
$formatted = Helper::populateTags($formatted, \OCP\Server::get(ITagManager::class));
$formatted = Helper::populateTags($formatted, Server::get(ITagManager::class));
}
return $formatted;
@ -1096,7 +1096,7 @@ class ShareAPIController extends OCSController {
if ($includeTags) {
$formatted =
Helper::populateTags($formatted, \OCP\Server::get(ITagManager::class));
Helper::populateTags($formatted, Server::get(ITagManager::class));
}
return $formatted;
@ -1971,7 +1971,7 @@ class ShareAPIController extends OCSController {
return true;
}
if ($share->getShareType() === IShare::TYPE_CIRCLE && \OCP\Server::get(IAppManager::class)->isEnabledForUser('circles')
if ($share->getShareType() === IShare::TYPE_CIRCLE && Server::get(IAppManager::class)->isEnabledForUser('circles')
&& class_exists('\OCA\Circles\Api\v1\Circles')) {
$hasCircleId = (str_ends_with($share->getSharedWith(), ']'));
$shareWithStart = ($hasCircleId ? strrpos($share->getSharedWith(), '[') + 1 : 0);

View file

@ -34,6 +34,7 @@ use OCP\IUserManager;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
use OCP\Mail\IMailer;
use OCP\Server;
use OCP\Share\Exceptions\GenericShareException;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IAttributes as IShareAttributes;
@ -162,7 +163,7 @@ class ShareAPIControllerTest extends TestCase {
}
private function newShare() {
return \OCP\Server::get(IManager::class)->newShare();
return Server::get(IManager::class)->newShare();
}
@ -911,7 +912,7 @@ class ShareAPIControllerTest extends TestCase {
$this->expectException(OCSNotFoundException::class);
$this->expectExceptionMessage('Wrong share ID, share does not exist');
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setSharedBy('initiator')
->setSharedWith('recipient')
->setShareOwner('owner');
@ -942,7 +943,7 @@ class ShareAPIControllerTest extends TestCase {
$folder->method('getDirectoryListing')
->willReturn([$file1, $file2]);
$file1UserShareOwner = \OCP\Server::get(IManager::class)->newShare();
$file1UserShareOwner = Server::get(IManager::class)->newShare();
$file1UserShareOwner->setShareType(IShare::TYPE_USER)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -956,7 +957,7 @@ class ShareAPIControllerTest extends TestCase {
'share_type' => IShare::TYPE_USER,
];
$file1UserShareInitiator = \OCP\Server::get(IManager::class)->newShare();
$file1UserShareInitiator = Server::get(IManager::class)->newShare();
$file1UserShareInitiator->setShareType(IShare::TYPE_USER)
->setSharedWith('recipient')
->setSharedBy('currentUser')
@ -970,7 +971,7 @@ class ShareAPIControllerTest extends TestCase {
'share_type' => IShare::TYPE_USER,
];
$file1UserShareRecipient = \OCP\Server::get(IManager::class)->newShare();
$file1UserShareRecipient = Server::get(IManager::class)->newShare();
$file1UserShareRecipient->setShareType(IShare::TYPE_USER)
->setSharedWith('currentUser')
->setSharedBy('initiator')
@ -984,7 +985,7 @@ class ShareAPIControllerTest extends TestCase {
'share_type' => IShare::TYPE_USER,
];
$file1UserShareOther = \OCP\Server::get(IManager::class)->newShare();
$file1UserShareOther = Server::get(IManager::class)->newShare();
$file1UserShareOther->setShareType(IShare::TYPE_USER)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -998,7 +999,7 @@ class ShareAPIControllerTest extends TestCase {
'share_type' => IShare::TYPE_USER,
];
$file1GroupShareOwner = \OCP\Server::get(IManager::class)->newShare();
$file1GroupShareOwner = Server::get(IManager::class)->newShare();
$file1GroupShareOwner->setShareType(IShare::TYPE_GROUP)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -1012,7 +1013,7 @@ class ShareAPIControllerTest extends TestCase {
'share_type' => IShare::TYPE_GROUP,
];
$file1GroupShareRecipient = \OCP\Server::get(IManager::class)->newShare();
$file1GroupShareRecipient = Server::get(IManager::class)->newShare();
$file1GroupShareRecipient->setShareType(IShare::TYPE_GROUP)
->setSharedWith('currentUserGroup')
->setSharedBy('initiator')
@ -1026,7 +1027,7 @@ class ShareAPIControllerTest extends TestCase {
'share_type' => IShare::TYPE_GROUP,
];
$file1GroupShareOther = \OCP\Server::get(IManager::class)->newShare();
$file1GroupShareOther = Server::get(IManager::class)->newShare();
$file1GroupShareOther->setShareType(IShare::TYPE_GROUP)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -1035,7 +1036,7 @@ class ShareAPIControllerTest extends TestCase {
->setNode($file1)
->setId(108);
$file1LinkShareOwner = \OCP\Server::get(IManager::class)->newShare();
$file1LinkShareOwner = Server::get(IManager::class)->newShare();
$file1LinkShareOwner->setShareType(IShare::TYPE_LINK)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -1049,7 +1050,7 @@ class ShareAPIControllerTest extends TestCase {
'share_type' => IShare::TYPE_LINK,
];
$file1EmailShareOwner = \OCP\Server::get(IManager::class)->newShare();
$file1EmailShareOwner = Server::get(IManager::class)->newShare();
$file1EmailShareOwner->setShareType(IShare::TYPE_EMAIL)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -1063,7 +1064,7 @@ class ShareAPIControllerTest extends TestCase {
'share_type' => IShare::TYPE_EMAIL,
];
$file1CircleShareOwner = \OCP\Server::get(IManager::class)->newShare();
$file1CircleShareOwner = Server::get(IManager::class)->newShare();
$file1CircleShareOwner->setShareType(IShare::TYPE_CIRCLE)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -1077,7 +1078,7 @@ class ShareAPIControllerTest extends TestCase {
'share_type' => IShare::TYPE_CIRCLE,
];
$file1RoomShareOwner = \OCP\Server::get(IManager::class)->newShare();
$file1RoomShareOwner = Server::get(IManager::class)->newShare();
$file1RoomShareOwner->setShareType(IShare::TYPE_ROOM)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -1091,7 +1092,7 @@ class ShareAPIControllerTest extends TestCase {
'share_type' => IShare::TYPE_ROOM,
];
$file1RemoteShareOwner = \OCP\Server::get(IManager::class)->newShare();
$file1RemoteShareOwner = Server::get(IManager::class)->newShare();
$file1RemoteShareOwner->setShareType(IShare::TYPE_REMOTE)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -1106,7 +1107,7 @@ class ShareAPIControllerTest extends TestCase {
'share_type' => IShare::TYPE_REMOTE,
];
$file1RemoteGroupShareOwner = \OCP\Server::get(IManager::class)->newShare();
$file1RemoteGroupShareOwner = Server::get(IManager::class)->newShare();
$file1RemoteGroupShareOwner->setShareType(IShare::TYPE_REMOTE_GROUP)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -1121,7 +1122,7 @@ class ShareAPIControllerTest extends TestCase {
'share_type' => IShare::TYPE_REMOTE_GROUP,
];
$file2UserShareOwner = \OCP\Server::get(IManager::class)->newShare();
$file2UserShareOwner = Server::get(IManager::class)->newShare();
$file2UserShareOwner->setShareType(IShare::TYPE_USER)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -2020,7 +2021,7 @@ class ShareAPIControllerTest extends TestCase {
$this->rootFolder->method('getById')
->willReturn([]);
$this->shareManager->method('newShare')->willReturn(\OCP\Server::get(IManager::class)->newShare());
$this->shareManager->method('newShare')->willReturn(Server::get(IManager::class)->newShare());
$this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
$this->shareManager->method('shareApiAllowLinks')->willReturn(false);
@ -2046,7 +2047,7 @@ class ShareAPIControllerTest extends TestCase {
$this->rootFolder->method('getById')
->willReturn([]);
$this->shareManager->method('newShare')->willReturn(\OCP\Server::get(IManager::class)->newShare());
$this->shareManager->method('newShare')->willReturn(Server::get(IManager::class)->newShare());
$this->shareManager->method('shareApiAllowLinks')->willReturn(true);
$this->ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true');
@ -2073,7 +2074,7 @@ class ShareAPIControllerTest extends TestCase {
$this->rootFolder->method('getById')
->willReturn([]);
$this->shareManager->method('newShare')->willReturn(\OCP\Server::get(IManager::class)->newShare());
$this->shareManager->method('newShare')->willReturn(Server::get(IManager::class)->newShare());
$this->shareManager->method('shareApiAllowLinks')->willReturn(true);
$this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
@ -2097,7 +2098,7 @@ class ShareAPIControllerTest extends TestCase {
$this->rootFolder->method('getById')
->willReturn([]);
$this->shareManager->method('newShare')->willReturn(\OCP\Server::get(IManager::class)->newShare());
$this->shareManager->method('newShare')->willReturn(Server::get(IManager::class)->newShare());
$this->shareManager->method('shareApiAllowLinks')->willReturn(true);
$this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
@ -2136,7 +2137,7 @@ class ShareAPIControllerTest extends TestCase {
$this->rootFolder->method('getById')
->willReturn([]);
$this->shareManager->method('newShare')->willReturn(\OCP\Server::get(IManager::class)->newShare());
$this->shareManager->method('newShare')->willReturn(Server::get(IManager::class)->newShare());
$this->shareManager->method('shareApiAllowLinks')->willReturn(true);
$this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
@ -2175,7 +2176,7 @@ class ShareAPIControllerTest extends TestCase {
$this->rootFolder->method('getById')
->willReturn([]);
$this->shareManager->method('newShare')->willReturn(\OCP\Server::get(IManager::class)->newShare());
$this->shareManager->method('newShare')->willReturn(Server::get(IManager::class)->newShare());
$this->shareManager->method('shareApiAllowLinks')->willReturn(true);
$this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
@ -2222,7 +2223,7 @@ class ShareAPIControllerTest extends TestCase {
$this->rootFolder->method('getById')
->willReturn([]);
$this->shareManager->method('newShare')->willReturn(\OCP\Server::get(IManager::class)->newShare());
$this->shareManager->method('newShare')->willReturn(Server::get(IManager::class)->newShare());
$this->shareManager->method('shareApiAllowLinks')->willReturn(true);
$this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
@ -2260,7 +2261,7 @@ class ShareAPIControllerTest extends TestCase {
$this->rootFolder->method('getById')
->willReturn([]);
$this->shareManager->method('newShare')->willReturn(\OCP\Server::get(IManager::class)->newShare());
$this->shareManager->method('newShare')->willReturn(Server::get(IManager::class)->newShare());
$this->shareManager->method('shareApiAllowLinks')->willReturn(true);
$this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
@ -2306,7 +2307,7 @@ class ShareAPIControllerTest extends TestCase {
$this->rootFolder->method('getById')
->willReturn([]);
$this->shareManager->method('newShare')->willReturn(\OCP\Server::get(IManager::class)->newShare());
$this->shareManager->method('newShare')->willReturn(Server::get(IManager::class)->newShare());
$this->shareManager->method('shareApiAllowLinks')->willReturn(true);
$this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
@ -2615,7 +2616,7 @@ class ShareAPIControllerTest extends TestCase {
* TODO: Remove once proper solution is in place
*/
public function testCreateReshareOfFederatedMountNoDeletePermissions(): void {
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$this->shareManager->method('newShare')->willReturn($share);
/** @var ShareAPIController&MockObject $ocs */
@ -2820,7 +2821,7 @@ class ShareAPIControllerTest extends TestCase {
$folder->method('getId')
->willReturn(42);
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setPermissions(Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
->setShareType(IShare::TYPE_LINK)
@ -2877,7 +2878,7 @@ class ShareAPIControllerTest extends TestCase {
$folder->method('getId')
->willReturn(42);
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setPermissions(Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
->setShareType(IShare::TYPE_LINK)
@ -2938,7 +2939,7 @@ class ShareAPIControllerTest extends TestCase {
$folder->method('getId')
->willReturn(42);
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setPermissions(Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
->setShareType(IShare::TYPE_LINK)
@ -3026,7 +3027,7 @@ class ShareAPIControllerTest extends TestCase {
$folder->method('getId')
->willReturn(42);
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setPermissions(Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
->setShareType(IShare::TYPE_LINK)
@ -3072,7 +3073,7 @@ class ShareAPIControllerTest extends TestCase {
$folder->method('getId')->willReturn(42);
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setPermissions(Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
->setShareType(IShare::TYPE_LINK)
@ -3102,7 +3103,7 @@ class ShareAPIControllerTest extends TestCase {
->with($this->currentUser)
->willReturn($userFolder);
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setPermissions(Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
->setShareType(IShare::TYPE_LINK)
@ -3468,7 +3469,7 @@ class ShareAPIControllerTest extends TestCase {
$folder->method('getId')
->willReturn(42);
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setPermissions(Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
->setShareType(IShare::TYPE_LINK)
@ -3529,7 +3530,7 @@ class ShareAPIControllerTest extends TestCase {
$folder->method('getId')
->willReturn(42);
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setPermissions(Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
->setShareType(IShare::TYPE_LINK)
@ -3589,7 +3590,7 @@ class ShareAPIControllerTest extends TestCase {
$folder->method('getId')
->willReturn(42);
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setPermissions(Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
->setShareType(IShare::TYPE_LINK)
@ -3649,7 +3650,7 @@ class ShareAPIControllerTest extends TestCase {
$file->method('getId')
->willReturn(42);
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setPermissions(Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
->setShareType(IShare::TYPE_USER)
@ -3695,7 +3696,7 @@ class ShareAPIControllerTest extends TestCase {
$folder->method('getId')
->willReturn(42);
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share
->setId(42)
->setSharedBy($this->currentUser)
@ -3707,7 +3708,7 @@ class ShareAPIControllerTest extends TestCase {
// note: updateShare will modify the received instance but getSharedWith will reread from the database,
// so their values will be different
$incomingShare = \OCP\Server::get(IManager::class)->newShare();
$incomingShare = Server::get(IManager::class)->newShare();
$incomingShare
->setId(42)
->setSharedBy($this->currentUser)
@ -3770,7 +3771,7 @@ class ShareAPIControllerTest extends TestCase {
$folder->method('getId')
->willReturn(42);
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share
->setId(42)
->setSharedBy($this->currentUser)
@ -3782,7 +3783,7 @@ class ShareAPIControllerTest extends TestCase {
// note: updateShare will modify the received instance but getSharedWith will reread from the database,
// so their values will be different
$incomingShare = \OCP\Server::get(IManager::class)->newShare();
$incomingShare = Server::get(IManager::class)->newShare();
$incomingShare
->setId(42)
->setSharedBy($this->currentUser)
@ -3945,7 +3946,7 @@ class ShareAPIControllerTest extends TestCase {
$result = [];
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_USER)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -4047,7 +4048,7 @@ class ShareAPIControllerTest extends TestCase {
], false
];
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_USER)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -4101,7 +4102,7 @@ class ShareAPIControllerTest extends TestCase {
], $share, [], false
];
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_USER)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -4157,7 +4158,7 @@ class ShareAPIControllerTest extends TestCase {
// with existing group
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_GROUP)
->setSharedWith('recipientGroup')
->setSharedBy('initiator')
@ -4211,7 +4212,7 @@ class ShareAPIControllerTest extends TestCase {
];
// with unknown group / no group backend
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_GROUP)
->setSharedWith('recipientGroup2')
->setSharedBy('initiator')
@ -4262,7 +4263,7 @@ class ShareAPIControllerTest extends TestCase {
], $share, [], false
];
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_LINK)
->setSharedBy('initiator')
->setShareOwner('owner')
@ -4321,7 +4322,7 @@ class ShareAPIControllerTest extends TestCase {
], $share, [], false
];
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_LINK)
->setSharedBy('initiator')
->setShareOwner('owner')
@ -4380,7 +4381,7 @@ class ShareAPIControllerTest extends TestCase {
], $share, [], false
];
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_REMOTE)
->setSharedBy('initiator')
->setSharedWith('user@server.com')
@ -4433,7 +4434,7 @@ class ShareAPIControllerTest extends TestCase {
], $share, [], false
];
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_REMOTE_GROUP)
->setSharedBy('initiator')
->setSharedWith('user@server.com')
@ -4487,7 +4488,7 @@ class ShareAPIControllerTest extends TestCase {
];
// Circle with id, display name and avatar set by the Circles app
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_CIRCLE)
->setSharedBy('initiator')
->setSharedWith('Circle (Public circle, circleOwner) [4815162342]')
@ -4543,7 +4544,7 @@ class ShareAPIControllerTest extends TestCase {
];
// Circle with id set by the Circles app
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_CIRCLE)
->setSharedBy('initiator')
->setSharedWith('Circle (Public circle, circleOwner) [4815162342]')
@ -4596,7 +4597,7 @@ class ShareAPIControllerTest extends TestCase {
];
// Circle with id not set by the Circles app
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_CIRCLE)
->setSharedBy('initiator')
->setSharedWith('Circle (Public circle, circleOwner)')
@ -4648,7 +4649,7 @@ class ShareAPIControllerTest extends TestCase {
], $share, [], false
];
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_USER)
->setSharedBy('initiator')
->setSharedWith('recipient')
@ -4663,7 +4664,7 @@ class ShareAPIControllerTest extends TestCase {
[], $share, [], true
];
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_EMAIL)
->setSharedBy('initiator')
->setSharedWith('user@server.com')
@ -4718,7 +4719,7 @@ class ShareAPIControllerTest extends TestCase {
], $share, [], false
];
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_EMAIL)
->setSharedBy('initiator')
->setSharedWith('user@server.com')
@ -4775,7 +4776,7 @@ class ShareAPIControllerTest extends TestCase {
];
// Preview is available
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_USER)
->setSharedWith('recipient')
->setSharedBy('initiator')
@ -4941,7 +4942,7 @@ class ShareAPIControllerTest extends TestCase {
$result = [];
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_ROOM)
->setSharedWith('recipientRoom')
->setSharedBy('initiator')
@ -4993,7 +4994,7 @@ class ShareAPIControllerTest extends TestCase {
], $share, false, []
];
$share = \OCP\Server::get(IManager::class)->newShare();
$share = Server::get(IManager::class)->newShare();
$share->setShareType(IShare::TYPE_ROOM)
->setSharedWith('recipientRoom')
->setSharedBy('initiator')

View file

@ -28,6 +28,7 @@ use OCP\Profile\BeforeTemplateRenderedEvent;
use OCP\Profile\IProfileManager;
use OCP\Share\IManager as IShareManager;
use OCP\UserStatus\IManager as IUserStatusManager;
use OCP\Util;
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
class ProfilePageController extends Controller {
@ -103,7 +104,7 @@ class ProfilePageController extends Controller {
$this->eventDispatcher->dispatchTyped(new BeforeTemplateRenderedEvent($targetUserId));
\OCP\Util::addScript('profile', 'main');
Util::addScript('profile', 'main');
return new TemplateResponse(
'profile',

View file

@ -15,6 +15,7 @@ use OC\App\AppStore\Version\VersionParser;
use OC\App\DependencyAnalyzer;
use OC\App\Platform;
use OC\Installer;
use OCA\AppAPI\Service\ExAppsPageService;
use OCP\App\AppPathNotFoundException;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
@ -94,7 +95,7 @@ class AppSettingsController extends Controller {
if ($this->appManager->isEnabledForAnyone('app_api')) {
try {
Server::get(\OCA\AppAPI\Service\ExAppsPageService::class)->provideAppApiState($this->initialState);
Server::get(ExAppsPageService::class)->provideAppApiState($this->initialState);
} catch (\Psr\Container\NotFoundExceptionInterface|\Psr\Container\ContainerExceptionInterface $e) {
}
}

View file

@ -101,7 +101,7 @@ class SharingTest extends TestCase {
$this->initialState
->expects($this->exactly(3))
->method('provideInitialState')
->willReturnCallback(function (string $key) use (&$initialStateCalls) {
->willReturnCallback(function (string $key) use (&$initialStateCalls): void {
$initialStateCalls[$key] = func_get_args();
});
@ -198,7 +198,7 @@ class SharingTest extends TestCase {
$this->initialState
->expects($this->exactly(3))
->method('provideInitialState')
->willReturnCallback(function (string $key) use (&$initialStateCalls) {
->willReturnCallback(function (string $key) use (&$initialStateCalls): void {
$initialStateCalls[$key] = func_get_args();
});

View file

@ -14,6 +14,7 @@ use OCP\AppFramework\App;
use OCP\IAvatarManager;
use OCP\IConfig;
use OCP\IUserManager;
use OCP\Server;
use OCP\UserMigration\IExportDestination;
use OCP\UserMigration\IImportSource;
use PHPUnit\Framework\Constraint\JsonMatches;
@ -67,7 +68,7 @@ class AccountMigratorTest extends TestCase {
}
protected function tearDown(): void {
\OCP\Server::get(IConfig::class)->setSystemValue('has_internet_connection', true);
Server::get(IConfig::class)->setSystemValue('has_internet_connection', true);
parent::tearDown();
}

View file

@ -16,6 +16,7 @@ use OCP\IAppConfig;
use OCP\IDBConnection;
use OCP\IUserManager;
use OCP\Migration\IOutput;
use OCP\Server;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
@ -88,11 +89,11 @@ class Version2006Date20240905111627Test extends TestCase {
->willReturn(false);
// Create a user
$manager = \OCP\Server::get(IUserManager::class);
$manager = Server::get(IUserManager::class);
$user = $manager->createUser('theming_legacy', 'theming_legacy');
self::assertNotFalse($user);
// Set the users theming value to legacy key
$config = \OCP\Server::get(IUserConfig::class);
$config = Server::get(IUserConfig::class);
$config->setValueString('theming_legacy', 'theming', 'background_color', 'ffab00');
// expect some output
@ -109,7 +110,7 @@ class Version2006Date20240905111627Test extends TestCase {
$migration = new Version2006Date20240905111627(
$this->jobList,
$this->appConfig,
\OCP\Server::get(IDBConnection::class),
Server::get(IDBConnection::class),
);
// Run the migration
$migration->changeSchema($output, fn () => null, []);
@ -138,13 +139,13 @@ class Version2006Date20240905111627Test extends TestCase {
->willReturn(false);
// Create a user
$manager = \OCP\Server::get(IUserManager::class);
$manager = Server::get(IUserManager::class);
$legacyUser = $manager->createUser('theming_legacy', 'theming_legacy');
self::assertNotFalse($legacyUser);
$user = $manager->createUser('theming_no_legacy', 'theming_no_legacy');
self::assertNotFalse($user);
// Set the users theming value to legacy key
$config = \OCP\Server::get(IUserConfig::class);
$config = Server::get(IUserConfig::class);
$config->setValueString($user->getUID(), 'theming', 'primary_color', '999999');
$config->setValueString($user->getUID(), 'theming', 'background_color', '111111');
$config->setValueString($legacyUser->getUID(), 'theming', 'background_color', 'ffab00');
@ -163,7 +164,7 @@ class Version2006Date20240905111627Test extends TestCase {
$migration = new Version2006Date20240905111627(
$this->jobList,
$this->appConfig,
\OCP\Server::get(IDBConnection::class),
Server::get(IDBConnection::class),
);
// Run the migration
$migration->changeSchema($output, fn () => null, []);