Browse Source
refactor: Run rector
Signed-off-by: provokateurin <kate@provokateurin.de>
pull/55360/head
provokateurin
1 week ago
Failed to extract signature
13 changed files with
25 additions and
27 deletions
-
apps/comments/lib/Search/Result.php
-
apps/dav/appinfo/v1/caldav.php
-
apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php
-
apps/dav/lib/DAV/RemoteUserPrincipalBackend.php
-
apps/dav/tests/unit/Connector/Sabre/PropFindMonitorPluginTest.php
-
apps/files_sharing/tests/ApiTest.php
-
apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php
-
apps/files_trashbin/tests/Command/ExpireTrashTest.php
-
build/psalm-baseline.xml
-
console.php
-
core/Command/Base.php
-
tests/lib/DB/QueryBuilder/QueryBuilderTest.php
-
tests/lib/SystemTag/SystemTagObjectMapperTest.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; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
@ -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 |
|
|
|
); |
|
|
|
|
|
|
|
|
|
@ -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)', |
|
|
|
'', |
|
|
|
|
|
@ -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); |
|
|
|
|
|
@ -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') |
|
|
|
|
|
@ -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, |
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
|
|
@ -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); |
|
|
|
|
|
@ -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,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(), |
|
|
|
|
|
@ -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( |
|
|
|
|
|
@ -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)); |
|
|
|
} |
|
|
|
|
|
@ -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; |
|
|
|
}); |
|
|
|
|
|
|
|