Browse Source

refactor: Run rector

Signed-off-by: provokateurin <kate@provokateurin.de>
pull/55360/head
provokateurin 1 week ago
parent
commit
6a12fbc4f3
Failed to extract signature
  1. 10
      apps/comments/lib/Search/Result.php
  2. 3
      apps/dav/appinfo/v1/caldav.php
  3. 3
      apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php
  4. 3
      apps/dav/lib/DAV/RemoteUserPrincipalBackend.php
  5. 4
      apps/dav/tests/unit/Connector/Sabre/PropFindMonitorPluginTest.php
  6. 4
      apps/files_sharing/tests/ApiTest.php
  7. 5
      apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php
  8. 4
      apps/files_trashbin/tests/Command/ExpireTrashTest.php
  9. 3
      build/psalm-baseline.xml
  10. 3
      console.php
  11. 4
      core/Command/Base.php
  12. 4
      tests/lib/DB/QueryBuilder/QueryBuilderTest.php
  13. 2
      tests/lib/SystemTag/SystemTagObjectMapperTest.php

10
apps/comments/lib/Search/Result.php

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

3
apps/dav/appinfo/v1/caldav.php

@ -24,6 +24,7 @@ use OCA\DAV\Connector\Sabre\Principal;
use OCP\Accounts\IAccountManager;
use OCP\App\IAppManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroupManager;
@ -78,7 +79,7 @@ $calDavBackend = new CalDavBackend(
$config,
Server::get(\OCA\DAV\CalDAV\Sharing\Backend::class),
Server::get(FederatedCalendarMapper::class),
Server::get(\OCP\ICacheFactory::class),
Server::get(ICacheFactory::class),
true
);

3
apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php

@ -11,6 +11,7 @@ namespace OCA\DAV\CalDAV\Federation;
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;
@ -74,7 +75,7 @@ class CalendarFederationProvider implements ICloudFederationProvider {
case CalendarFederationProtocolV1::VERSION:
try {
$protocol = CalendarFederationProtocolV1::parse($rawProtocol);
} catch (Protocol\CalendarProtocolParseException $e) {
} catch (CalendarProtocolParseException $e) {
throw new ProviderCouldNotAddShareException(
'Invalid protocol data (v1)',
'',

3
apps/dav/lib/DAV/RemoteUserPrincipalBackend.php

@ -10,6 +10,7 @@ declare(strict_types=1);
namespace OCA\DAV\DAV;
use OCA\DAV\DAV\Sharing\SharingMapper;
use OCP\Federation\ICloudId;
use OCP\Federation\ICloudIdManager;
use Sabre\DAVACL\PrincipalBackend\BackendInterface;
@ -102,7 +103,7 @@ class RemoteUserPrincipalBackend implements BackendInterface {
}
/**
* @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);

4
apps/dav/tests/unit/Connector/Sabre/PropFindMonitorPluginTest.php

@ -105,9 +105,7 @@ class PropFindMonitorPluginTest extends TestCase {
];
}
/**
* @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')

4
apps/files_sharing/tests/ApiTest.php

@ -240,8 +240,8 @@ class ApiTest extends TestCase {
/**
* @group RoutingWeirdness
* @dataProvider dataAllowFederationOnPublicShares
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataAllowFederationOnPublicShares')]
public function testCreateShareLinkPublicUpload(array $appConfig, int $permissions): void {
$this->appConfig->method('getValueBool')
->willReturnMap([$appConfig]);
@ -1016,8 +1016,8 @@ class ApiTest extends TestCase {
/**
* @medium
* @dataProvider dataAllowFederationOnPublicShares
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataAllowFederationOnPublicShares')]
public function testUpdateShareUpload(array $appConfig, int $permissions): void {
$this->appConfig->method('getValueBool')->willReturnMap([
$appConfig,

5
apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php

@ -19,6 +19,7 @@ use OCP\IAppConfig;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
use Psr\Log\LoggerInterface;
class ExpireTrash extends TimedJob {
@ -111,7 +112,7 @@ class ExpireTrash extends TimedJob {
}
private function resetOffset() {
$this->runMutexOperation(function () {
$this->runMutexOperation(function (): void {
$this->appConfig->setValueInt(Application::APP_ID, self::OFFSET_CONFIG_KEY_NAME, 0);
});
}
@ -123,7 +124,7 @@ class ExpireTrash extends TimedJob {
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);
}

4
apps/files_trashbin/tests/Command/ExpireTrashTest.php

@ -64,9 +64,7 @@ class ExpireTrashTest extends TestCase {
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);

3
build/psalm-baseline.xml

@ -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>
@ -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>

3
console.php

@ -3,6 +3,7 @@
declare(strict_types=1);
use OCP\IConfig;
use OCP\IURLGenerator;
use OCP\Server;
/**
@ -100,7 +101,7 @@ try {
$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(),

4
core/Command/Base.php

@ -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;
@ -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(

4
tests/lib/DB/QueryBuilder/QueryBuilderTest.php

@ -189,7 +189,7 @@ class QueryBuilderTest extends \Test\TestCase {
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));
}
@ -357,7 +357,7 @@ class QueryBuilderTest extends \Test\TestCase {
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));
}

2
tests/lib/SystemTag/SystemTagObjectMapperTest.php

@ -212,7 +212,7 @@ class SystemTagObjectMapperTest extends TestCase {
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;
});

Loading…
Cancel
Save