diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 000000000..574b920e4 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,7 @@ +# .git-blame-ignore-revs + +# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later + +# Update to coding-standard 1.3.2 +a7143209bd296f1956fb26ca78fdc1b1e02464b6 diff --git a/lib/Command/CleanUp.php b/lib/Command/CleanUp.php index a68fb1f35..14f7c0535 100644 --- a/lib/Command/CleanUp.php +++ b/lib/Command/CleanUp.php @@ -47,7 +47,7 @@ class CleanUp extends Command { public function __construct( IDBConnection $db, IUserManager $userManager, - TotpSecretMapper $totpSecretMapper + TotpSecretMapper $totpSecretMapper, ) { parent::__construct(); diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 73adbff1b..8d2cbdcc3 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -72,7 +72,7 @@ public function state(): JSONResponse { * @param int $state * @param string|null $code for verification */ - public function enable(int $state, string $code = null): JSONResponse { + public function enable(int $state, ?string $code = null): JSONResponse { $user = $this->userSession->getUser(); if (is_null($user)) { throw new \Exception('user not available'); @@ -96,7 +96,7 @@ public function enable(int $state, string $code = null): JSONResponse { ]); case ITotp::STATE_ENABLED: if ($code === null) { - throw new InvalidArgumentException("code is missing"); + throw new InvalidArgumentException('code is missing'); } $success = $this->totp->enable($user, $code); return new JSONResponse([ @@ -116,7 +116,7 @@ private function getSecretName(): string { $productName = $this->defaults->getName(); $user = $this->userSession->getUser(); if ($user === null) { - throw new RuntimeException("No user in this context"); + throw new RuntimeException('No user in this context'); } $userName = $user->getCloudId(); return rawurlencode("$productName:$userName"); diff --git a/lib/Service/Totp.php b/lib/Service/Totp.php index eef5ff6d4..f5a8fb294 100644 --- a/lib/Service/Totp.php +++ b/lib/Service/Totp.php @@ -65,14 +65,14 @@ public function __construct(TotpSecretMapper $secretMapper, public function hasSecret(IUser $user): bool { try { $secret = $this->secretMapper->getSecret($user); - return ITotp::STATE_ENABLED === (int)$secret->getState(); + return (int)$secret->getState() === ITotp::STATE_ENABLED; } catch (DoesNotExistException $ex) { return false; } } private function generateSecret(): string { - return $this->random->generate(32, ISecureRandom::CHAR_UPPER.'234567'); + return $this->random->generate(32, ISecureRandom::CHAR_UPPER . '234567'); } /** diff --git a/vendor-bin/cs-fixer/composer.json b/vendor-bin/cs-fixer/composer.json index 9ba62c38e..dd60f5127 100644 --- a/vendor-bin/cs-fixer/composer.json +++ b/vendor-bin/cs-fixer/composer.json @@ -1,5 +1,5 @@ { "require-dev": { - "nextcloud/coding-standard": "1.1.1" + "nextcloud/coding-standard": "1.3.2" } } diff --git a/vendor-bin/cs-fixer/composer.lock b/vendor-bin/cs-fixer/composer.lock index 3875aef6c..0476802d0 100644 --- a/vendor-bin/cs-fixer/composer.lock +++ b/vendor-bin/cs-fixer/composer.lock @@ -4,24 +4,71 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b2af82dc91410a5903723d6aabcdd237", + "content-hash": "b46314f6faf93432bddfb6f52958b66d", "packages": [], "packages-dev": [ + { + "name": "kubawerlos/php-cs-fixer-custom-fixers", + "version": "v3.22.0", + "source": { + "type": "git", + "url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-tokenizer": "*", + "friendsofphp/php-cs-fixer": "^3.61.1", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6.4 || ^10.5.29" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpCsFixerCustomFixers\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kuba Werłos", + "email": "werlos@gmail.com" + } + ], + "description": "A set of custom fixers for PHP CS Fixer", + "support": { + "issues": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/issues", + "source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.22.0" + }, + "time": "2024-08-16T20:44:35+00:00" + }, { "name": "nextcloud/coding-standard", - "version": "v1.1.1", + "version": "v1.3.2", "source": { "type": "git", "url": "https://github.com/nextcloud/coding-standard.git", - "reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb" + "reference": "9c719c4747fa26efc12f2e8b21c14a9a75c6ba6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/55def702fb9a37a219511e1d8c6fe8e37164c1fb", - "reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/9c719c4747fa26efc12f2e8b21c14a9a75c6ba6d", + "reference": "9c719c4747fa26efc12f2e8b21c14a9a75c6ba6d", "shasum": "" }, "require": { + "kubawerlos/php-cs-fixer-custom-fixers": "^3.22", "php": "^7.3|^8.0", "php-cs-fixer/shim": "^3.17" }, @@ -44,22 +91,22 @@ "description": "Nextcloud coding standards for the php cs fixer", "support": { "issues": "https://github.com/nextcloud/coding-standard/issues", - "source": "https://github.com/nextcloud/coding-standard/tree/v1.1.1" + "source": "https://github.com/nextcloud/coding-standard/tree/v1.3.2" }, - "time": "2023-06-01T12:05:01+00:00" + "time": "2024-10-14T16:49:05+00:00" }, { "name": "php-cs-fixer/shim", - "version": "v3.28.0", + "version": "v3.64.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/shim.git", - "reference": "84584aec6278f7641d7b0b257a8103955b704657" + "reference": "81ccfd24baf3a10810dab1152c403981a790b837" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/84584aec6278f7641d7b0b257a8103955b704657", - "reference": "84584aec6278f7641d7b0b257a8103955b704657", + "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/81ccfd24baf3a10810dab1152c403981a790b837", + "reference": "81ccfd24baf3a10810dab1152c403981a790b837", "shasum": "" }, "require": { @@ -96,17 +143,17 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "https://github.com/PHP-CS-Fixer/shim/issues", - "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.28.0" + "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.64.0" }, - "time": "2023-09-22T20:44:22+00:00" + "time": "2024-08-30T23:10:11+00:00" } ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [], + "platform": {}, + "platform-dev": {}, "plugin-api-version": "2.6.0" }