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
2 changes: 1 addition & 1 deletion REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ SPDX-FileCopyrightText = "2023 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"

[[annotations]]
path = ["apps/dav/lib/ExampleContentFiles/exampleContact.vcf", "tests/data/testvideo-remote-file.mp4"]
path = ["apps/dav/lib/ExampleContentFiles/exampleContact.vcf", "tests/data/testvideo-remote-file.mp4", "tests/lib/AppFramework/Middleware/Mock/UseSessionController.php", "tests/lib/AppFramework/Middleware/Security/Mock/BruteForceMiddlewareController.php", "tests/lib/AppFramework/Middleware/Security/Mock/RateLimitingMiddlewareController.php"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2025 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"
Expand Down
10 changes: 4 additions & 6 deletions apps/comments/lib/Search/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ class Result extends BaseResult {
* @deprecated 20.0.0
*/
public $fileName;
/**
* @deprecated 20.0.0
*/
public int $fileId;

/**
* @throws NotFoundException
Expand All @@ -51,7 +47,10 @@ public function __construct(
*/
public string $authorName,
string $path,
int $fileId,
/**
* @deprecated 20.0.0
*/
public int $fileId,
) {
parent::__construct(
$comment->getId(),
Expand All @@ -63,7 +62,6 @@ public function __construct(
$this->authorId = $comment->getActorId();
$this->fileName = basename($path);
$this->path = $this->getVisiblePath($path);
$this->fileId = $fileId;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion apps/dav/appinfo/v1/caldav.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use OCP\Accounts\IAccountManager;
use OCP\App\IAppManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroupManager;
Expand Down Expand Up @@ -78,7 +79,7 @@
$config,
Server::get(\OCA\DAV\CalDAV\Sharing\Backend::class),
Server::get(FederatedCalendarMapper::class),
Server::get(\OCP\ICacheFactory::class),
Server::get(ICacheFactory::class),
true
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use OCA\DAV\BackgroundJob\FederatedCalendarSyncJob;
use OCA\DAV\CalDAV\Federation\Protocol\CalendarFederationProtocolV1;
use OCA\DAV\CalDAV\Federation\Protocol\CalendarProtocolParseException;
use OCA\DAV\CalDAV\Federation\Protocol\ICalendarFederationProtocol;
use OCA\DAV\DAV\Sharing\Backend as DavSharingBackend;
use OCP\AppFramework\Http;
Expand Down Expand Up @@ -74,7 +75,7 @@ public function shareReceived(ICloudFederationShare $share): string {
case CalendarFederationProtocolV1::VERSION:
try {
$protocol = CalendarFederationProtocolV1::parse($rawProtocol);
} catch (Protocol\CalendarProtocolParseException $e) {
} catch (CalendarProtocolParseException $e) {
throw new ProviderCouldNotAddShareException(
'Invalid protocol data (v1)',
'',
Expand Down
3 changes: 2 additions & 1 deletion apps/dav/lib/DAV/RemoteUserPrincipalBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace OCA\DAV\DAV;

use OCA\DAV\DAV\Sharing\SharingMapper;
use OCP\Federation\ICloudId;
use OCP\Federation\ICloudIdManager;
use Sabre\DAVACL\PrincipalBackend\BackendInterface;

Expand Down Expand Up @@ -102,7 +103,7 @@ public function setGroupMemberSet($principal, array $members) {
}

/**
* @return array{'{DAV:}displayname': string, '{http://nextcloud.com/ns}cloud-id': \OCP\Federation\ICloudId, uri: string}
* @return array{'{DAV:}displayname': string, '{http://nextcloud.com/ns}cloud-id': ICloudId, uri: string}
*/
private function principalUriToPrincipal(string $principalUri): array {
[, $name] = \Sabre\Uri\split($principalUri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ public static function dataTest(): array {
];
}

/**
* @dataProvider dataTest
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTest')]
public function test(array $queries, $expectedLogCalls): void {
$this->plugin->initialize($this->server);
$this->server->expects($this->once())->method('getPluginQueries')
Expand Down
4 changes: 2 additions & 2 deletions apps/encryption/lib/Controller/RecoveryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class RecoveryController extends Controller {
* @param Recovery $recovery
*/
public function __construct(
$AppName,
$appName,
IRequest $request,
private IConfig $config,
private IL10N $l,
private Recovery $recovery,
) {
parent::__construct($AppName, $request);
parent::__construct($appName, $request);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions apps/encryption/lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SettingsController extends Controller {
* @param Util $util
*/
public function __construct(
$AppName,
$appName,
IRequest $request,
private IL10N $l,
private IUserManager $userManager,
Expand All @@ -48,7 +48,7 @@ public function __construct(
private ISession $ocSession,
private Util $util,
) {
parent::__construct($AppName, $request);
parent::__construct($appName, $request);
}


Expand Down
4 changes: 2 additions & 2 deletions apps/encryption/lib/Controller/StatusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class StatusController extends Controller {
* @param IManager $encryptionManager
*/
public function __construct(
$AppName,
$appName,
IRequest $request,
private IL10N $l,
private Session $session,
private IManager $encryptionManager,
) {
parent::__construct($AppName, $request);
parent::__construct($appName, $request);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions apps/federation/lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@

class SettingsController extends OCSController {
public function __construct(
string $AppName,
string $appName,
IRequest $request,
private IL10N $l,
private TrustedServers $trustedServers,
private LoggerInterface $logger,
) {
parent::__construct($AppName, $request);
parent::__construct($appName, $request);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class GlobalStoragesController extends StoragesController {
* @param IConfig $config
*/
public function __construct(
$AppName,
$appName,
IRequest $request,
IL10N $l10n,
GlobalStoragesService $globalStoragesService,
Expand All @@ -46,7 +46,7 @@ public function __construct(
IConfig $config,
) {
parent::__construct(
$AppName,
$appName,
$request,
$l10n,
$globalStoragesService,
Expand Down
4 changes: 2 additions & 2 deletions apps/files_external/lib/Controller/StoragesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ abstract class StoragesController extends Controller {
* @param LoggerInterface $logger
*/
public function __construct(
$AppName,
$appName,
IRequest $request,
protected IL10N $l10n,
protected StoragesService $service,
Expand All @@ -49,7 +49,7 @@ public function __construct(
protected IGroupManager $groupManager,
protected IConfig $config,
) {
parent::__construct($AppName, $request);
parent::__construct($appName, $request);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class UserGlobalStoragesController extends StoragesController {
* @param IGroupManager $groupManager
*/
public function __construct(
$AppName,
$appName,
IRequest $request,
IL10N $l10n,
UserGlobalStoragesService $userGlobalStoragesService,
Expand All @@ -52,7 +52,7 @@ public function __construct(
IConfig $config,
) {
parent::__construct(
$AppName,
$appName,
$request,
$l10n,
$userGlobalStoragesService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class UserStoragesController extends StoragesController {
* @param IGroupManager $groupManager
*/
public function __construct(
$AppName,
$appName,
IRequest $request,
IL10N $l10n,
UserStoragesService $userStoragesService,
Expand All @@ -49,7 +49,7 @@ public function __construct(
IConfig $config,
) {
parent::__construct(
$AppName,
$appName,
$request,
$l10n,
$userStoragesService,
Expand Down
4 changes: 2 additions & 2 deletions apps/files_sharing/tests/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ public function testCreateShareLink(): void {

/**
* @group RoutingWeirdness
* @dataProvider dataAllowFederationOnPublicShares
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataAllowFederationOnPublicShares')]
public function testCreateShareLinkPublicUpload(array $appConfig, int $permissions): void {
$this->appConfig->method('getValueBool')
->willReturnMap([$appConfig]);
Expand Down Expand Up @@ -1016,8 +1016,8 @@ public function testUpdateShare(): void {

/**
* @medium
* @dataProvider dataAllowFederationOnPublicShares
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataAllowFederationOnPublicShares')]
public function testUpdateShareUpload(array $appConfig, int $permissions): void {
$this->appConfig->method('getValueBool')->willReturnMap([
$appConfig,
Expand Down
5 changes: 3 additions & 2 deletions apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use OCP\IUser;
use OCP\IUserManager;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
use Psr\Log\LoggerInterface;

class ExpireTrash extends TimedJob {
Expand Down Expand Up @@ -111,7 +112,7 @@ private function getNextOffset(): int {
}

private function resetOffset() {
$this->runMutexOperation(function () {
$this->runMutexOperation(function (): void {
$this->appConfig->setValueInt(Application::APP_ID, self::OFFSET_CONFIG_KEY_NAME, 0);
});
}
Expand All @@ -123,7 +124,7 @@ private function runMutexOperation($operation): mixed {
try {
$this->lockingProvider->acquireLock(self::OFFSET_CONFIG_KEY_NAME, ILockingProvider::LOCK_EXCLUSIVE, 'Expire trashbin background job offset');
$acquired = true;
} catch (\OCP\Lock\LockedException $e) {
} catch (LockedException $e) {
// wait a bit and try again
usleep(100000);
}
Expand Down
4 changes: 1 addition & 3 deletions apps/files_trashbin/tests/Command/ExpireTrashTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ protected function tearDown(): void {
parent::tearDown();
}

/**
* @dataProvider retentionObligationProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('retentionObligationProvider')]
public function testRetentionObligation(string $obligation, string $quota, int $elapsed, int $fileSize, bool $shouldExpire): void {
$this->config->setSystemValues(['trashbin_retention_obligation' => $obligation]);
$this->expiration->setRetentionObligation($obligation);
Expand Down
4 changes: 2 additions & 2 deletions apps/settings/lib/Controller/AuthorizedGroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

class AuthorizedGroupController extends Controller {
public function __construct(
string $AppName,
string $appName,
IRequest $request,
private AuthorizedGroupService $authorizedGroupService,
) {
parent::__construct($AppName, $request);
parent::__construct($appName, $request);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions apps/settings/lib/Controller/CheckSetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CheckSetupController extends Controller {
private $checker;

public function __construct(
$AppName,
$appName,
IRequest $request,
private IConfig $config,
private IURLGenerator $urlGenerator,
Expand All @@ -40,7 +40,7 @@ public function __construct(
private LoggerInterface $logger,
private ISetupCheckManager $setupCheckManager,
) {
parent::__construct($AppName, $request);
parent::__construct($appName, $request);
$this->checker = $checker;
}

Expand Down
3 changes: 0 additions & 3 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@
<code><![CDATA[$result->authorId]]></code>
<code><![CDATA[$result->authorId]]></code>
<code><![CDATA[$result->authorId]]></code>
<code><![CDATA[$result->fileId]]></code>
<code><![CDATA[$result->fileId]]></code>
<code><![CDATA[$result->name]]></code>
<code><![CDATA[$result->path]]></code>
</DeprecatedProperty>
Expand Down Expand Up @@ -111,7 +109,6 @@
<DeprecatedProperty>
<code><![CDATA[$this->authorId]]></code>
<code><![CDATA[$this->comment]]></code>
<code><![CDATA[$this->fileId]]></code>
<code><![CDATA[$this->fileName]]></code>
<code><![CDATA[$this->path]]></code>
</DeprecatedProperty>
Expand Down
5 changes: 4 additions & 1 deletion build/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public function shouldSkip(File $file, FullyQualifiedObjectType $fullyQualifiedO
$nextcloudDir . '/apps/*/build/stubs/*',
$nextcloudDir . '/apps/*/composer/*',
$nextcloudDir . '/apps/*/config/*',
// The mock classes are excluded, as the tests explicitly test the annotations which should not be migrated to attributes
$nextcloudDir . '/tests/lib/AppFramework/Middleware/Mock/*',
$nextcloudDir . '/tests/lib/AppFramework/Middleware/Security/Mock/*',
])
// uncomment to reach your current PHP version
// ->withPhpSets()
Expand All @@ -92,7 +95,7 @@ public function shouldSkip(File $file, FullyQualifiedObjectType $fullyQualifiedO
'rename_property' => true,
])
->withSets([
NextcloudSets::NEXTCLOUD_25,
NextcloudSets::NEXTCLOUD_27,
]);

$config->registerService(NextcloudNamespaceSkipVoter::class, tag:ClassNameImportSkipVoterInterface::class);
Expand Down
3 changes: 2 additions & 1 deletion console.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

use OCP\IConfig;
use OCP\IURLGenerator;
use OCP\Server;

/**
Expand Down Expand Up @@ -100,7 +101,7 @@ function exceptionHandler($exception) {
$profile->setUrl(implode(' ', $argv));
$profiler->saveProfile($profile);

$urlGenerator = Server::get(\OCP\IURLGenerator::class);
$urlGenerator = Server::get(IURLGenerator::class);
$url = $urlGenerator->linkToRouteAbsolute('profiler.main.profiler', [
'profiler' => 'db',
'token' => $profile->getToken(),
Expand Down
4 changes: 3 additions & 1 deletion core/Command/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
namespace OC\Core\Command;

use OC\Core\Command\User\ListCommand;
use OCP\Defaults;
use OCP\Server;
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Command\Command;
Expand All @@ -27,7 +29,7 @@ class Base extends Command implements CompletionAwareInterface {

protected function configure() {
// Some of our commands do not extend this class; and some of those that do do not call parent::configure()
$defaultHelp = 'More extensive and thorough documentation may be found at ' . \OCP\Server::get(\OCP\Defaults::class)->getDocBaseUrl() . PHP_EOL;
$defaultHelp = 'More extensive and thorough documentation may be found at ' . Server::get(Defaults::class)->getDocBaseUrl() . PHP_EOL;
$this
->setHelp($defaultHelp)
->addOption(
Expand Down
Loading
Loading