Skip to content

Commit

Permalink
Merge pull request #731 from nextcloud/dependabot/composer/nextcloud/…
Browse files Browse the repository at this point in the history
…coding-standard-1.2.3

Chore(deps-dev): Bump nextcloud/coding-standard from 1.2.1 to 1.2.3
  • Loading branch information
artonge authored Aug 26, 2024
2 parents 1cf3210 + f55d2d5 commit 9b6e377
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 62 deletions.
24 changes: 12 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/Connector/Sabre/LockPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function checkLock(RequestInterface $request): void {
if (!$this->isFile($url, $node)) {
return;
}
/** @var File|Directory|FutureFile $node*/
/** @var File|Directory|FutureFile $node */

// We don't care if we are not inside an end to end encrypted folder
if ($method === 'COPY' || $method === 'MOVE') {
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/KeyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public function setPublicKey(string $publicKey): DataResponse {
} catch (KeyExistsException $e) {
return new DataResponse([], Http::STATUS_CONFLICT);
} catch (Exception $e) {
$this->logger->error("Fail to set user public key", ['exception' => $e, 'app' => $this->appName]);
$this->logger->error('Fail to set user public key', ['exception' => $e, 'app' => $this->appName]);
throw new OCSBadRequestException($this->l10n->t('Internal error'));
}

Expand Down
12 changes: 6 additions & 6 deletions lib/E2EEPublicShareTemplateProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ function (array $acc, string $userId): array {
$this->initialState->provideInitialState('encryptionVersion', $metadata['version']);

// OpenGraph Support: http://ogp.me/
Util::addHeader('meta', ['property' => "og:title", 'content' => $this->l10n->t("Encrypted share")]);
Util::addHeader('meta', ['property' => "og:description", 'content' => $this->defaults->getName() . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')]);
Util::addHeader('meta', ['property' => "og:site_name", 'content' => $this->defaults->getName()]);
Util::addHeader('meta', ['property' => "og:url", 'content' => $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.showShare', ['token' => $token])]);
Util::addHeader('meta', ['property' => "og:type", 'content' => "object"]);
Util::addHeader('meta', ['property' => 'og:title', 'content' => $this->l10n->t('Encrypted share')]);
Util::addHeader('meta', ['property' => 'og:description', 'content' => $this->defaults->getName() . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')]);
Util::addHeader('meta', ['property' => 'og:site_name', 'content' => $this->defaults->getName()]);
Util::addHeader('meta', ['property' => 'og:url', 'content' => $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.showShare', ['token' => $token])]);
Util::addHeader('meta', ['property' => 'og:type', 'content' => 'object']);

$csp = new ContentSecurityPolicy();
$csp->addAllowedFrameDomain('\'self\'');

$response = new PublicTemplateResponse(Application::APP_ID, 'filesdrop', []);
$response->setHeaderTitle($this->l10n->t("Encrypted share"));
$response->setHeaderTitle($this->l10n->t('Encrypted share'));

$response->setContentSecurityPolicy($csp);
return $response;
Expand Down
2 changes: 1 addition & 1 deletion lib/E2EEnabledPathCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function isE2EEnabledPath(Node $node): bool {
}

// walk path backwards while caching each node's state
return $this->getEncryptedStates((string) $storage->getCache()->getNumericStorageId(), $node);
return $this->getEncryptedStates((string)$storage->getCache()->getNumericStorageId(), $node);
}

/**
Expand Down
12 changes: 6 additions & 6 deletions lib/MetaDataStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,16 @@ public function readSignature(int $id): string {
$metadata = $dir->getFile($this->metaDataFileName)->getContent();
$decodedMetadata = json_decode($metadata, true);

if ($decodedMetadata['metadata']['version'] === "1.2") {
return "";
if ($decodedMetadata['metadata']['version'] === '1.2') {
return '';
}

if ($decodedMetadata['metadata']['version'] === 1.2) {
return "";
return '';
}

if ($decodedMetadata['metadata']['version'] === 1) {
return "";
return '';
}

throw $ex;
Expand Down Expand Up @@ -294,7 +294,7 @@ private function getFolderNameForFileId(int $id): string {
protected function verifyOwner(string $userId, int $id): void {
try {
$userFolder = $this->rootFolder->getUserFolder($userId);
} catch (NoUserException | NotPermittedException $ex) {
} catch (NoUserException|NotPermittedException $ex) {
throw new NotFoundException('No user-root for '. $userId);
}

Expand Down Expand Up @@ -349,7 +349,7 @@ protected function cleanupLegacyFile(string $userId, int $id): void {
try {
$legacyFolder = $this->appData->getFolder($this->metaDataRoot . '/' . $legacyOwnerPath);
$legacyFolder->delete();
} catch (NotFoundException | NotPermittedException $e) {
} catch (NotFoundException|NotPermittedException $e) {
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/MetaDataStorageV1.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private function getFolderNameForFileId(int $id): string {
protected function verifyOwner(string $userId, int $id): void {
try {
$userFolder = $this->rootFolder->getUserFolder($userId);
} catch (NoUserException | NotPermittedException $ex) {
} catch (NoUserException|NotPermittedException $ex) {
throw new NotFoundException('No user-root for '. $userId);
}

Expand Down Expand Up @@ -282,7 +282,7 @@ protected function cleanupLegacyFile(string $userId, int $id): void {
try {
$legacyFolder = $this->appData->getFolder($this->metaDataRoot . '/' . $legacyOwnerPath);
$legacyFolder->delete();
} catch (NotFoundException | NotPermittedException $e) {
} catch (NotFoundException|NotPermittedException $e) {
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Middleware/ClientHasCapabilityMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function beforeController($controller, $methodName): void {
return;
}

if ($decodedMetadata['metadata']['version'] === "1.2") {
if ($decodedMetadata['metadata']['version'] === '1.2') {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Middleware/UserAgentCheckMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function beforeController($controller, $methodName): void {
return;
}

if ($this->request->getHeader('x-e2ee-supported') === "true") {
if ($this->request->getHeader('x-e2ee-supported') === 'true') {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Settings/Personal.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(IKeyStorage $keyStorage, IInitialState $initialState
}

public function getForm(): TemplateResponse {
assert($this->userId !== null, "We are always logged in inside the setting app");
assert($this->userId !== null, 'We are always logged in inside the setting app');

$hasKey = $this->keyStorage->publicKeyExists($this->userId)
&& $this->keyStorage->privateKeyExists($this->userId);
Expand All @@ -40,7 +40,7 @@ public function getForm(): TemplateResponse {
return new TemplateResponse(
Application::APP_ID,
'settings',
["canUseApp" => !$this->config->isDisabledForUser($this->userSession->getUser())]
['canUseApp' => !$this->config->isDisabledForUser($this->userSession->getUser())]
);
}

Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/CapabilitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ public function testGetCapabilities(): void {
->willReturn($user);
$user
->method('getUID')
->willReturn("test");
->willReturn('test');
$this->config->expects($this->once())
->method('isDisabledForUser')
->with($user)
->willReturn(false);
$this->keyStorage->expects($this->once())
->method('publicKeyExists')
->with("test")
->with('test')
->willReturn(true);
$this->keyStorage->expects($this->once())
->method('privateKeyExists')
->with("test")
->with('test')
->willReturn(true);
$this->assertEquals([
'end-to-end-encryption' => [
Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/Connector/Sabre/PropFindPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class PropFindPluginTest extends TestCase {
/** @var UserAgentManager|\PHPUnit\Framework\MockObject\MockObject */
private $userAgentManager;

/** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
/** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
private $request;

/** @var Server|\PHPUnit\Framework\MockObject\MockObject */
Expand Down Expand Up @@ -83,11 +83,11 @@ public function testInitialize(): void {
$server = $this->createMock(Server::class);

$server->expects($this->atLeast(2))
->method('on')
->withConsecutive(
['afterMethod:PROPFIND', [$this->plugin, 'checkAccess'], 50],
['propFind', [$this->plugin, 'updateProperty'], 105],
);
->method('on')
->withConsecutive(
['afterMethod:PROPFIND', [$this->plugin, 'checkAccess'], 50],
['propFind', [$this->plugin, 'updateProperty'], 105],
);

$this->plugin->initialize($server);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Controller/KeyControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class KeyControllerTest extends TestCase {
private $controller;

/** @var string valid CSR (CN set to "admin") */
private $validCSR = "-----BEGIN CERTIFICATE REQUEST-----
private $validCSR = '-----BEGIN CERTIFICATE REQUEST-----
MIIC7jCCAdYCAQAwgagxCzAJBgNVBAYTAlVLMREwDwYDVQQIDAhTb21lcnNldDEU
MBIGA1UEBwwLR2xhc3RvbmJ1cnkxHzAdBgNVBAoMFlRoZSBCcmFpbiBSb29tIExp
bWl0ZWQxHzAdBgNVBAsMFlBIUCBEb2N1bWVudGF0aW9uIFRlYW0xDjAMBgNVBAMM
Expand All @@ -84,7 +84,7 @@ class KeyControllerTest extends TestCase {
w7829dr37SuA2kQb86aVpqdL50v3HjCclXd7PfWiYqajuHaIsokBV5ly2IdQo4Cz
AYzYQFPtjsDZ4Tju4VZKM4YpF2GwQgT7zhzDBvywGPqvfw==
-----END CERTIFICATE REQUEST-----
";
';

/** @var string */
private $invalidCSR = "-----BEGIN CERTIFICATE REQUEST-----\nMIIC7jCCAdYCAQAwgagxCzAJBgNVBAYTAlVLMREwDwYDVQQIDAhTb21lcnNldDEU\nMBIGA1UEBwwLR2xhc3RvbmJ1cnkxHzAdBgNVBAoMFlRoZSBCcmFpbiBSb29tIExp\nbWl0ZWQxHzAdBgNVBAsMFlBIUCBEb2N1bWVudGF0aW9uIFRlYW0xDjAMBgNVBAMM\nBWFkbWluMR4wHAYJKoZIhvcNAQkBFg93ZXpAZXhhbXBsZS5jb20wggEiMA0GCSqG\nSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDHWU8rWlK3lud%2Fr5OQoilxypgIzbBf5pqM\nH0rpYwFv3uctnK5Lt3M%2BWY45XdJt98Pq8eQ0AbyAf3IuhnpF%2BX2Ej3QnCenZ0H%2BB\nJ6%2FmZXdo9f7IXa2wH5LtA2cmm1XWQWubN%2FJzr9psq%2BkxbocyGTQhNGeeB2OPcgyl\n73eddJNIbFVlNEzbdcBNNsSwKcB%2BLP%2FJyJ9e1HZ4af6CHdX2SG1HvO%2BdICdEuO2E\nmC9lM896MJFWwNns5mx453Y1FmxFmAi1zQAAP%2BAZ5Taqy6yCzqJ9Y4%2FFDRi1NC5V\nstnu9REuPYSS8YgsJwQE%2FDUd%2BI%2BUonkcDfac8PIH5p5YHpMq0ChvAgMBAAGgADAN\nBgkqhkiG9w0BAQUFAAOCAQEAh8YVAsAcPR5v7kv96UtkVI4xK6R9BdmVsnisxTpm\ng9JVbfji7kpxbSgXfRSozTG3bl9ynrck39%2F2SoFQGSGrW2iV%2BdrclftSk%2BuBFb1F\niXYEWJxYSz2CcUeijoBrBsarfmODgOHzmgXmCoOToz2DkdtM7g9INWkC06Do4pTQ\nfqA3PS2td1gWqQCQthF9IWOCIxNI16lokVTgNCZKewXsn9Bjm3hsLLeJU9jBXyVN\nw7829dr37SuA2kQb86aVpqdL50v3HjCclXd7PfWiYqajuHaIsokBV5ly2IdQo4Cz\nAYzYQFPtjsDZ4Tju4VZKM4YpF2GwQgT7zhzDBvywGPqvfw%3D%3D\n-----END+CERTIFICATE+REQUEST-----\n";
Expand Down
36 changes: 18 additions & 18 deletions tests/Unit/EncryptionManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@

class EncryptionManagerTest extends TestCase {

/** @var IRootFolder|PHPUnit_Framework_MockObject_MockObject */
/** @var IRootFolder|PHPUnit_Framework_MockObject_MockObject */
private $rootFolderInterface;

/** @var Folder|PHPUnit_Framework_MockObject_MockObject */
/** @var Folder|PHPUnit_Framework_MockObject_MockObject */
private $rootFolder;

/** @var IStorage|PHPUnit_Framework_MockObject_MockObject */
/** @var IStorage|PHPUnit_Framework_MockObject_MockObject */
private $storage;

/** @var ICache|PHPUnit_Framework_MockObject_MockObject */
/** @var ICache|PHPUnit_Framework_MockObject_MockObject */
private $fileCache;

/** @var IUserSession|PHPUnit_Framework_MockObject_MockObject */
/** @var IUserSession|PHPUnit_Framework_MockObject_MockObject */
private $userSession;

/** @var IManager|PHPUnit_Framework_MockObject_MockObject */
/** @var IManager|PHPUnit_Framework_MockObject_MockObject */
private $shareManager;

/** @var IDBConnection|PHPUnit_Framework_MockObject_MockObject */
Expand Down Expand Up @@ -213,18 +213,18 @@ public function testIsValidFolderSuccess():void {
->willReturn($user);

$this->shareManager->method('getSharesBy')
->willReturnMap([
['userId123', IShare::TYPE_USER, $node1, false, 1, []],
['userId123', IShare::TYPE_GROUP, $node1, false, 1, []],
['userId123', IShare::TYPE_USERGROUP, $node1, false, 1, []],
['userId123', IShare::TYPE_LINK, $node1, false, 1, []],
['userId123', IShare::TYPE_EMAIL, $node1, false, 1, []],
['userId123', IShare::TYPE_REMOTE, $node1, false, 1, []],
['userId123', IShare::TYPE_CIRCLE, $node1, false, 1, []],
['userId123', IShare::TYPE_GUEST, $node1, false, 1, []],
['userId123', IShare::TYPE_REMOTE_GROUP, $node1, false, 1, []],
['userId123', IShare::TYPE_ROOM, $node1, false, 1, []],
]);
->willReturnMap([
['userId123', IShare::TYPE_USER, $node1, false, 1, []],
['userId123', IShare::TYPE_GROUP, $node1, false, 1, []],
['userId123', IShare::TYPE_USERGROUP, $node1, false, 1, []],
['userId123', IShare::TYPE_LINK, $node1, false, 1, []],
['userId123', IShare::TYPE_EMAIL, $node1, false, 1, []],
['userId123', IShare::TYPE_REMOTE, $node1, false, 1, []],
['userId123', IShare::TYPE_CIRCLE, $node1, false, 1, []],
['userId123', IShare::TYPE_GUEST, $node1, false, 1, []],
['userId123', IShare::TYPE_REMOTE_GROUP, $node1, false, 1, []],
['userId123', IShare::TYPE_ROOM, $node1, false, 1, []],
]);

self::invokePrivate($instance, 'isValidFolder', [42]);
}
Expand Down

0 comments on commit 9b6e377

Please sign in to comment.