Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
refactor: Run rector
Signed-off-by: provokateurin <kate@provokateurin.de>
  • Loading branch information
provokateurin committed Sep 27, 2025
commit 6a12fbc4f31db4103e3a486aaacb84d8331ba142
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/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
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
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
4 changes: 2 additions & 2 deletions tests/lib/DB/QueryBuilder/QueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function testSelect(array $selectArguments, array $expected, string $expe

array_walk_recursive(
$selectArguments,
function (string &$arg) {
function (string &$arg): void {
if (\str_starts_with($arg, 'l::')) {
$arg = $this->queryBuilder->expr()->literal(substr($arg, 3));
}
Expand Down Expand Up @@ -357,7 +357,7 @@ public function testAddSelect(array $selectArguments, array $expected, string $e

array_walk_recursive(
$selectArguments,
function (string &$arg) {
function (string &$arg): void {
if (\str_starts_with($arg, 'l::')) {
$arg = $this->queryBuilder->expr()->literal(substr($arg, 3));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/SystemTag/SystemTagObjectMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function testGetObjectsForNonExistingTag(): void {

public function testAssignUnassignTags(): void {
$event = null;
$this->dispatcher->expects($this->any())->method('dispatchTyped')->willReturnCallback(function (Event $e) use (&$event) {
$this->dispatcher->expects($this->any())->method('dispatchTyped')->willReturnCallback(function (Event $e) use (&$event): void {
$event = $e;
});

Expand Down
Loading