From 9d383a5a968f0943fce6f11165b01f8578c43388 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 20 Jun 2024 08:45:20 +0200 Subject: [PATCH] fix(CS): Auto-update coding style Signed-off-by: Joas Schilling --- lib/AppInfo/Application.php | 2 +- lib/BackgroundJob/RollbackBackgroundJob.php | 4 +-- lib/Capabilities.php | 4 +-- lib/Config.php | 2 +- lib/Connector/Sabre/APlugin.php | 2 +- lib/Connector/Sabre/LockPlugin.php | 12 +++---- lib/Connector/Sabre/PropFindPlugin.php | 10 +++--- lib/Controller/EncryptionController.php | 10 +++--- lib/Controller/KeyController.php | 16 ++++----- lib/Controller/LockingController.php | 4 +-- lib/Controller/MetaDataController.php | 2 +- lib/E2EEPublicShareTemplateProvider.php | 6 ++-- lib/E2EEnabledPathCache.php | 8 ++--- lib/EncryptionManager.php | 12 +++---- lib/Exceptions/FileLockedException.php | 2 +- lib/Exceptions/FileNotLockedException.php | 2 +- lib/Exceptions/KeyExistsException.php | 2 +- lib/Exceptions/MetaDataExistsException.php | 2 +- lib/Exceptions/MissingMetaDataException.php | 2 +- lib/KeyStorage.php | 2 +- lib/LockManager.php | 8 ++--- lib/MetaDataStorage.php | 2 +- lib/Middleware/CanUseAppMiddleware.php | 6 ++-- lib/Middleware/UserAgentCheckMiddleware.php | 4 +-- .../Version1005Date20200312102456.php | 2 +- .../Version1005Date20200312161123.php | 6 ++-- lib/RollbackService.php | 14 ++++---- lib/Settings/Admin.php | 2 +- lib/Settings/Personal.php | 4 +-- tests/Unit/CapabilitiesTest.php | 4 +-- tests/Unit/Connector/Sabre/LockPluginTest.php | 36 +++++++++---------- .../Connector/Sabre/PropFindPluginTest.php | 12 +++---- tests/Unit/Controller/KeyControllerTest.php | 30 ++++++++-------- .../Unit/Controller/LockingControllerTest.php | 10 +++--- .../Controller/MetaDataControllerTest.php | 32 ++++++++--------- tests/Unit/EncryptionManagerTest.php | 2 +- tests/Unit/MetaDataStorageTest.php | 12 +++---- tests/Unit/RollbackServiceTest.php | 2 +- tests/Unit/UserAgentManagerTest.php | 4 +-- 39 files changed, 149 insertions(+), 149 deletions(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 79f89d9c..2aa053b4 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -34,8 +34,8 @@ use OCA\EndToEndEncryption\KeyStorage; use OCA\EndToEndEncryption\Listener\UserDeletedListener; use OCA\EndToEndEncryption\MetaDataStorage; -use OCA\EndToEndEncryption\Middleware\UserAgentCheckMiddleware; use OCA\EndToEndEncryption\Middleware\CanUseAppMiddleware; +use OCA\EndToEndEncryption\Middleware\UserAgentCheckMiddleware; use OCA\Files_Trashbin\Events\MoveToTrashEvent; use OCA\Files_Versions\Events\CreateVersionEvent; use OCP\AppFramework\App; diff --git a/lib/BackgroundJob/RollbackBackgroundJob.php b/lib/BackgroundJob/RollbackBackgroundJob.php index 2ec71be7..0d25aa86 100644 --- a/lib/BackgroundJob/RollbackBackgroundJob.php +++ b/lib/BackgroundJob/RollbackBackgroundJob.php @@ -38,8 +38,8 @@ class RollbackBackgroundJob extends TimedJob { private RollbackService $rollbackService; public function __construct(IConfig $config, - ITimeFactory $time, - RollbackService $rollbackService) { + ITimeFactory $time, + RollbackService $rollbackService) { parent::__construct($time); $this->config = $config; $this->rollbackService = $rollbackService; diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 3b464e91..73ea702b 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -24,9 +24,9 @@ namespace OCA\EndToEndEncryption; -use OCP\IUserSession; -use OCP\IUser; use OCP\Capabilities\ICapability; +use OCP\IUser; +use OCP\IUserSession; class Capabilities implements ICapability { private Config $config; diff --git a/lib/Config.php b/lib/Config.php index cfee8b2a..3c1b92c3 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -23,8 +23,8 @@ namespace OCA\EndToEndEncryption; use OCP\IConfig; -use OCP\IUser; use OCP\IGroupManager; +use OCP\IUser; class Config { private IConfig $config; diff --git a/lib/Connector/Sabre/APlugin.php b/lib/Connector/Sabre/APlugin.php index 3762222a..1d606b0b 100644 --- a/lib/Connector/Sabre/APlugin.php +++ b/lib/Connector/Sabre/APlugin.php @@ -22,6 +22,7 @@ */ namespace OCA\EndToEndEncryption\Connector\Sabre; +use Exception; use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\File; use OCA\EndToEndEncryption\E2EEnabledPathCache; @@ -33,7 +34,6 @@ use Sabre\DAV\INode; use Sabre\DAV\Server; use Sabre\DAV\ServerPlugin; -use Exception; abstract class APlugin extends ServerPlugin { protected ?Server $server = null; diff --git a/lib/Connector/Sabre/LockPlugin.php b/lib/Connector/Sabre/LockPlugin.php index b1e1ea1a..c0481415 100644 --- a/lib/Connector/Sabre/LockPlugin.php +++ b/lib/Connector/Sabre/LockPlugin.php @@ -24,14 +24,15 @@ namespace OCA\EndToEndEncryption\Connector\Sabre; -use OCP\AppFramework\Http; use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\Exception\FileLocked; use OCA\DAV\Connector\Sabre\Exception\Forbidden; use OCA\DAV\Connector\Sabre\File; use OCA\DAV\Upload\FutureFile; +use OCA\EndToEndEncryption\E2EEnabledPathCache; use OCA\EndToEndEncryption\LockManager; use OCA\EndToEndEncryption\UserAgentManager; +use OCP\AppFramework\Http; use OCP\Files\IRootFolder; use OCP\IUserSession; use Sabre\DAV\Exception\Conflict; @@ -39,17 +40,16 @@ use Sabre\DAV\INode; use Sabre\DAV\Server; use Sabre\HTTP\RequestInterface; -use OCA\EndToEndEncryption\E2EEnabledPathCache; class LockPlugin extends APlugin { private LockManager $lockManager; private UserAgentManager $userAgentManager; public function __construct(IRootFolder $rootFolder, - IUserSession $userSession, - LockManager $lockManager, - UserAgentManager $userAgentManager, - E2EEnabledPathCache $pathCache) { + IUserSession $userSession, + LockManager $lockManager, + UserAgentManager $userAgentManager, + E2EEnabledPathCache $pathCache) { parent::__construct($rootFolder, $userSession, $pathCache); $this->lockManager = $lockManager; $this->userAgentManager = $userAgentManager; diff --git a/lib/Connector/Sabre/PropFindPlugin.php b/lib/Connector/Sabre/PropFindPlugin.php index ee1b81a0..b327aaf0 100644 --- a/lib/Connector/Sabre/PropFindPlugin.php +++ b/lib/Connector/Sabre/PropFindPlugin.php @@ -26,8 +26,8 @@ use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\Exception\Forbidden; -use OCA\EndToEndEncryption\UserAgentManager; use OCA\EndToEndEncryption\E2EEnabledPathCache; +use OCA\EndToEndEncryption\UserAgentManager; use OCP\Files\IRootFolder; use OCP\IRequest; use OCP\IUserSession; @@ -42,10 +42,10 @@ class PropFindPlugin extends APlugin { protected ?Server $server = null; public function __construct(IRootFolder $rootFolder, - IUserSession $userSession, - UserAgentManager $userAgentManager, - IRequest $request, - E2EEnabledPathCache $pathCache) { + IUserSession $userSession, + UserAgentManager $userAgentManager, + IRequest $request, + E2EEnabledPathCache $pathCache) { parent::__construct($rootFolder, $userSession, $pathCache); $this->userAgentManager = $userAgentManager; $this->request = $request; diff --git a/lib/Controller/EncryptionController.php b/lib/Controller/EncryptionController.php index 223cb71f..d8a261b7 100644 --- a/lib/Controller/EncryptionController.php +++ b/lib/Controller/EncryptionController.php @@ -50,11 +50,11 @@ class EncryptionController extends OCSController { private LoggerInterface $logger; public function __construct(string $AppName, - IRequest $request, - ?string $userId, - IMetaDataStorage $metaDataStorage, - EncryptionManager $manager, - LoggerInterface $logger) { + IRequest $request, + ?string $userId, + IMetaDataStorage $metaDataStorage, + EncryptionManager $manager, + LoggerInterface $logger) { parent::__construct($AppName, $request); $this->userId = $userId; $this->metaDataStorage = $metaDataStorage; diff --git a/lib/Controller/KeyController.php b/lib/Controller/KeyController.php index 484d4f6a..6694963f 100644 --- a/lib/Controller/KeyController.php +++ b/lib/Controller/KeyController.php @@ -29,6 +29,8 @@ namespace OCA\EndToEndEncryption\Controller; +use BadMethodCallException; +use Exception; use OCA\EndToEndEncryption\Exceptions\KeyExistsException; use OCA\EndToEndEncryption\IKeyStorage; use OCA\EndToEndEncryption\SignatureHandler; @@ -43,8 +45,6 @@ use OCP\Files\NotPermittedException; use OCP\IL10N; use OCP\IRequest; -use Exception; -use BadMethodCallException; use Psr\Log\LoggerInterface; class KeyController extends OCSController { @@ -55,12 +55,12 @@ class KeyController extends OCSController { private IL10N $l10n; public function __construct(string $AppName, - IRequest $request, - ?string $userId, - IKeyStorage $keyStorage, - SignatureHandler $signatureHandler, - LoggerInterface $logger, - IL10N $l10n + IRequest $request, + ?string $userId, + IKeyStorage $keyStorage, + SignatureHandler $signatureHandler, + LoggerInterface $logger, + IL10N $l10n ) { parent::__construct($AppName, $request); $this->userId = $userId; diff --git a/lib/Controller/LockingController.php b/lib/Controller/LockingController.php index a2f8ac49..bb069163 100644 --- a/lib/Controller/LockingController.php +++ b/lib/Controller/LockingController.php @@ -37,6 +37,7 @@ use OCA\EndToEndEncryption\IMetaDataStorage; use OCA\EndToEndEncryption\LockManager; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCS\OCSBadRequestException; use OCP\AppFramework\OCS\OCSForbiddenException; use OCP\AppFramework\OCS\OCSNotFoundException; use OCP\AppFramework\OCSController; @@ -44,9 +45,8 @@ use OCP\Files\IRootFolder; use OCP\IL10N; use OCP\IRequest; -use Psr\Log\LoggerInterface; use OCP\Share\IManager as ShareManager; -use OCP\AppFramework\OCS\OCSBadRequestException; +use Psr\Log\LoggerInterface; class LockingController extends OCSController { private ?string $userId; diff --git a/lib/Controller/MetaDataController.php b/lib/Controller/MetaDataController.php index ba7e111b..9354a15a 100644 --- a/lib/Controller/MetaDataController.php +++ b/lib/Controller/MetaDataController.php @@ -43,8 +43,8 @@ use OCP\Files\NotPermittedException; use OCP\IL10N; use OCP\IRequest; -use Psr\Log\LoggerInterface; use OCP\Share\IManager as ShareManager; +use Psr\Log\LoggerInterface; class MetaDataController extends OCSController { private ?string $userId; diff --git a/lib/E2EEPublicShareTemplateProvider.php b/lib/E2EEPublicShareTemplateProvider.php index 00be8f86..ce9edb50 100644 --- a/lib/E2EEPublicShareTemplateProvider.php +++ b/lib/E2EEPublicShareTemplateProvider.php @@ -6,15 +6,15 @@ use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\Template\PublicTemplateResponse; use OCP\AppFramework\Http\TemplateResponse; +use OCP\AppFramework\Services\IInitialState; use OCP\Defaults; +use OCP\Files\FileInfo; use OCP\Files\NotFoundException; use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUserManager; -use OCP\Share\IShare; use OCP\Share\IPublicShareTemplateProvider; -use OCP\AppFramework\Services\IInitialState; -use OCP\Files\FileInfo; +use OCP\Share\IShare; use OCP\Util; use Psr\Log\LoggerInterface; diff --git a/lib/E2EEnabledPathCache.php b/lib/E2EEnabledPathCache.php index e9a79557..11fda4cf 100644 --- a/lib/E2EEnabledPathCache.php +++ b/lib/E2EEnabledPathCache.php @@ -24,12 +24,12 @@ namespace OCA\EndToEndEncryption; -use OCP\Files\Node; -use OCP\Files\Storage\IStorage; -use OCP\Files\IHomeStorage; -use OCP\Files\Cache\ICache; use OCP\Cache\CappedMemoryCache; +use OCP\Files\Cache\ICache; +use OCP\Files\IHomeStorage; +use OCP\Files\Node; use OCP\Files\NotFoundException; +use OCP\Files\Storage\IStorage; class E2EEnabledPathCache { /** diff --git a/lib/EncryptionManager.php b/lib/EncryptionManager.php index 6ff17e9e..b48134e3 100644 --- a/lib/EncryptionManager.php +++ b/lib/EncryptionManager.php @@ -24,15 +24,15 @@ namespace OCA\EndToEndEncryption; +use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\Files\Node; use OCP\Files\NotFoundException; +use OCP\IDBConnection; use OCP\IUserSession; use OCP\Share\IManager; use OCP\Share\IShare; -use OCP\IDBConnection; -use OCP\DB\QueryBuilder\IQueryBuilder; use Psr\Log\LoggerInterface; /** @@ -50,10 +50,10 @@ class EncryptionManager { private LoggerInterface $logger; public function __construct(IRootFolder $rootFolder, - IUserSession $userSession, - IManager $shareManager, - IDBConnection $dbConnection, - LoggerInterface $logger) { + IUserSession $userSession, + IManager $shareManager, + IDBConnection $dbConnection, + LoggerInterface $logger) { $this->rootFolder = $rootFolder; $this->userSession = $userSession; $this->shareManager = $shareManager; diff --git a/lib/Exceptions/FileLockedException.php b/lib/Exceptions/FileLockedException.php index b23fcf48..0b681192 100644 --- a/lib/Exceptions/FileLockedException.php +++ b/lib/Exceptions/FileLockedException.php @@ -28,7 +28,7 @@ use Throwable; class FileLockedException extends Exception { - public function __construct(string $message = 'File is locked', int $code = 0, Throwable $previous = null) { + public function __construct(string $message = 'File is locked', int $code = 0, ?Throwable $previous = null) { parent::__construct($message, $code, $previous); } } diff --git a/lib/Exceptions/FileNotLockedException.php b/lib/Exceptions/FileNotLockedException.php index ccecd945..bce38c39 100644 --- a/lib/Exceptions/FileNotLockedException.php +++ b/lib/Exceptions/FileNotLockedException.php @@ -28,7 +28,7 @@ use Throwable; class FileNotLockedException extends Exception { - public function __construct(string $message = 'File is not locked', int $code = 0, Throwable $previous = null) { + public function __construct(string $message = 'File is not locked', int $code = 0, ?Throwable $previous = null) { parent::__construct($message, $code, $previous); } } diff --git a/lib/Exceptions/KeyExistsException.php b/lib/Exceptions/KeyExistsException.php index 0ecd7ccf..a3926788 100644 --- a/lib/Exceptions/KeyExistsException.php +++ b/lib/Exceptions/KeyExistsException.php @@ -36,7 +36,7 @@ class KeyExistsException extends Exception { * @param int $code * @param Throwable|null $previous */ - public function __construct(string $message = 'key already exists', int $code = 0, Throwable $previous = null) { + public function __construct(string $message = 'key already exists', int $code = 0, ?Throwable $previous = null) { parent::__construct($message, $code, $previous); } } diff --git a/lib/Exceptions/MetaDataExistsException.php b/lib/Exceptions/MetaDataExistsException.php index b9fd4380..bf8cbc2f 100644 --- a/lib/Exceptions/MetaDataExistsException.php +++ b/lib/Exceptions/MetaDataExistsException.php @@ -36,7 +36,7 @@ class MetaDataExistsException extends Exception { * @param int $code * @param Throwable|null $previous */ - public function __construct(string $message = 'meta data file already exists', int $code = 0, Throwable $previous = null) { + public function __construct(string $message = 'meta data file already exists', int $code = 0, ?Throwable $previous = null) { parent::__construct($message, $code, $previous); } } diff --git a/lib/Exceptions/MissingMetaDataException.php b/lib/Exceptions/MissingMetaDataException.php index cd1bf0c4..241f9453 100644 --- a/lib/Exceptions/MissingMetaDataException.php +++ b/lib/Exceptions/MissingMetaDataException.php @@ -36,7 +36,7 @@ class MissingMetaDataException extends Exception { * @param int $code * @param Throwable|null $previous */ - public function __construct(string $message = 'can\'t find meta data file', int $code = 0, Throwable $previous = null) { + public function __construct(string $message = 'can\'t find meta data file', int $code = 0, ?Throwable $previous = null) { parent::__construct($message, $code, $previous); } } diff --git a/lib/KeyStorage.php b/lib/KeyStorage.php index f935765e..664fde1f 100644 --- a/lib/KeyStorage.php +++ b/lib/KeyStorage.php @@ -46,7 +46,7 @@ class KeyStorage implements IKeyStorage { private string $publicKeysRoot = '/public-keys'; public function __construct(IAppData $appData, - IUserSession $userSession) { + IUserSession $userSession) { $this->appData = $appData; $this->userSession = $userSession; } diff --git a/lib/LockManager.php b/lib/LockManager.php index 78ef1a70..eb608272 100644 --- a/lib/LockManager.php +++ b/lib/LockManager.php @@ -50,10 +50,10 @@ class LockManager { private ITimeFactory $timeFactory; public function __construct(LockMapper $lockMapper, - ISecureRandom $secureRandom, - IRootFolder $rootFolder, - IUserSession $userSession, - ITimeFactory $timeFactory + ISecureRandom $secureRandom, + IRootFolder $rootFolder, + IUserSession $userSession, + ITimeFactory $timeFactory ) { $this->lockMapper = $lockMapper; $this->secureRandom = $secureRandom; diff --git a/lib/MetaDataStorage.php b/lib/MetaDataStorage.php index 4958f339..a27f872c 100644 --- a/lib/MetaDataStorage.php +++ b/lib/MetaDataStorage.php @@ -46,7 +46,7 @@ class MetaDataStorage implements IMetaDataStorage { private string $intermediateMetaDataFileName = 'intermediate.meta.data'; public function __construct(IAppData $appData, - IRootFolder $rootFolder) { + IRootFolder $rootFolder) { $this->appData = $appData; $this->rootFolder = $rootFolder; } diff --git a/lib/Middleware/CanUseAppMiddleware.php b/lib/Middleware/CanUseAppMiddleware.php index 98dd8d63..21f9387d 100644 --- a/lib/Middleware/CanUseAppMiddleware.php +++ b/lib/Middleware/CanUseAppMiddleware.php @@ -27,8 +27,8 @@ use OCA\EndToEndEncryption\Middleware\Exceptions\CanNotUseAppException; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; -use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\RedirectToDefaultAppResponse; +use OCP\AppFramework\Http\Response; use OCP\AppFramework\Middleware; use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCSController; @@ -42,8 +42,8 @@ class CanUseAppMiddleware extends Middleware { private Config $config; public function __construct(IUserSession $userSession, - IControllerMethodReflector $reflector, - Config $config) { + IControllerMethodReflector $reflector, + Config $config) { $this->userSession = $userSession; $this->reflector = $reflector; $this->config = $config; diff --git a/lib/Middleware/UserAgentCheckMiddleware.php b/lib/Middleware/UserAgentCheckMiddleware.php index ef9d194b..8906785d 100644 --- a/lib/Middleware/UserAgentCheckMiddleware.php +++ b/lib/Middleware/UserAgentCheckMiddleware.php @@ -44,8 +44,8 @@ class UserAgentCheckMiddleware extends Middleware { private UserAgentManager $userAgentManager; public function __construct(IControllerMethodReflector $reflector, - IRequest $request, - UserAgentManager $userAgentManager) { + IRequest $request, + UserAgentManager $userAgentManager) { $this->reflector = $reflector; $this->request = $request; $this->userAgentManager = $userAgentManager; diff --git a/lib/Migration/Version1005Date20200312102456.php b/lib/Migration/Version1005Date20200312102456.php index e2afd61e..1592f7dd 100644 --- a/lib/Migration/Version1005Date20200312102456.php +++ b/lib/Migration/Version1005Date20200312102456.php @@ -24,9 +24,9 @@ use Closure; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; -use OCP\DB\Types; /** * Class Version1005Date20200312102456 diff --git a/lib/Migration/Version1005Date20200312161123.php b/lib/Migration/Version1005Date20200312161123.php index 238f8dad..ea104832 100644 --- a/lib/Migration/Version1005Date20200312161123.php +++ b/lib/Migration/Version1005Date20200312161123.php @@ -52,9 +52,9 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt } // deactivated. a newer migration set id as primary key. oci does not allow a primary key and index for the same column. -// if (!$table->hasIndex('e2e_unique_lock')) { -// $table->addUniqueIndex(['id'], 'e2e_unique_lock'); -// } + // if (!$table->hasIndex('e2e_unique_lock')) { + // $table->addUniqueIndex(['id'], 'e2e_unique_lock'); + // } } return $schema; diff --git a/lib/RollbackService.php b/lib/RollbackService.php index 046ff2a8..c13afc6c 100644 --- a/lib/RollbackService.php +++ b/lib/RollbackService.php @@ -22,11 +22,11 @@ */ namespace OCA\EndToEndEncryption; +use OCA\EndToEndEncryption\AppInfo\Application; +use OCA\EndToEndEncryption\Db\LockMapper; use OCP\Files\Config\ICachedMountFileInfo; use OCP\Files\Config\IUserMountCache; use OCP\Files\Folder; -use OCA\EndToEndEncryption\AppInfo\Application; -use OCA\EndToEndEncryption\Db\LockMapper; use OCP\Files\IRootFolder; use Psr\Log\LoggerInterface; @@ -55,11 +55,11 @@ class RollbackService { private LoggerInterface $logger; public function __construct(LockMapper $lockMapper, - IMetaDataStorage $metaDataStorage, - FileService $fileService, - IUserMountCache $userMountCache, - IRootFolder $rootFolder, - LoggerInterface $logger) { + IMetaDataStorage $metaDataStorage, + FileService $fileService, + IUserMountCache $userMountCache, + IRootFolder $rootFolder, + LoggerInterface $logger) { $this->lockMapper = $lockMapper; $this->metaDataStorage = $metaDataStorage; $this->fileService = $fileService; diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index c4c75999..43c55d88 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -8,10 +8,10 @@ namespace OCA\EndToEndEncryption\Settings; use OCA\EndToEndEncryption\AppInfo\Application; +use OCA\EndToEndEncryption\Config; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; use OCP\Settings\ISettings; -use OCA\EndToEndEncryption\Config; class Admin implements ISettings { private Config $config; diff --git a/lib/Settings/Personal.php b/lib/Settings/Personal.php index 356bd0f6..4a800308 100644 --- a/lib/Settings/Personal.php +++ b/lib/Settings/Personal.php @@ -8,12 +8,12 @@ namespace OCA\EndToEndEncryption\Settings; use OCA\EndToEndEncryption\AppInfo\Application; -use OCA\EndToEndEncryption\IKeyStorage; use OCA\EndToEndEncryption\Config; +use OCA\EndToEndEncryption\IKeyStorage; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; -use OCP\Settings\ISettings; use OCP\IUserSession; +use OCP\Settings\ISettings; class Personal implements ISettings { private IKeyStorage $keyStorage; diff --git a/tests/Unit/CapabilitiesTest.php b/tests/Unit/CapabilitiesTest.php index 90397401..8e494bff 100644 --- a/tests/Unit/CapabilitiesTest.php +++ b/tests/Unit/CapabilitiesTest.php @@ -26,9 +26,9 @@ use OCA\EndToEndEncryption\Capabilities; use OCA\EndToEndEncryption\Config; use OCA\EndToEndEncryption\IKeyStorage; -use Test\TestCase; -use OCP\IUserSession; use OCP\IUser; +use OCP\IUserSession; +use Test\TestCase; class CapabilitiesTest extends TestCase { private Capabilities $capabilities; diff --git a/tests/Unit/Connector/Sabre/LockPluginTest.php b/tests/Unit/Connector/Sabre/LockPluginTest.php index 584f735d..1cc99903 100644 --- a/tests/Unit/Connector/Sabre/LockPluginTest.php +++ b/tests/Unit/Connector/Sabre/LockPluginTest.php @@ -23,20 +23,20 @@ namespace OCA\EndToEndEncryption\Tests\Connector\Sabre; +use OC\Files\Node\Node; use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\Exception\FileLocked; use OCA\DAV\Connector\Sabre\Exception\Forbidden; use OCA\DAV\Connector\Sabre\File; use OCA\DAV\Upload\FutureFile; use OCA\EndToEndEncryption\Connector\Sabre\LockPlugin; +use OCA\EndToEndEncryption\E2EEnabledPathCache; use OCA\EndToEndEncryption\LockManager; use OCA\EndToEndEncryption\UserAgentManager; -use OCA\EndToEndEncryption\E2EEnabledPathCache; -use OCP\Files\IRootFolder; -use OC\Files\Node\Node; -use OCP\IUserSession; use OCP\Files\Cache\ICache; +use OCP\Files\IRootFolder; use OCP\Files\Storage\IStorage; +use OCP\IUserSession; use Sabre\CalDAV\ICalendar; use Sabre\DAV\INode; use Sabre\DAV\Server; @@ -270,10 +270,10 @@ public function nonCopyMoveMethodDataProvider(): array { * @param bool $expectsFileLocked */ public function testCheckLockForWrite(string $method, - ?string $token, - bool $isLocked, - bool $expectsForbidden, - bool $expectsFileLocked): void { + ?string $token, + bool $isLocked, + bool $expectsForbidden, + bool $expectsFileLocked): void { $plugin = $this->getMockBuilder(LockPlugin::class) ->setMethods(['isFile', 'getNode', 'isE2EEnabledPath', 'isE2EEnabledUserAgent']) ->setConstructorArgs([ @@ -393,16 +393,16 @@ public function writeMethodDataProvider(): array { * @param bool $expectsFileLocked */ public function testCheckLockForWriteCopyMove(string $method, - ?string $token, - bool $isSrcE2E, - bool $isDestE2E, - bool $isSrcFutureFile, - bool $isSrcLocked, - bool $isDestLocked, - bool $expectsReturn, - bool $expectsForbidden1, - bool $expectsForbidden2, - bool $expectsFileLocked): void { + ?string $token, + bool $isSrcE2E, + bool $isDestE2E, + bool $isSrcFutureFile, + bool $isSrcLocked, + bool $isDestLocked, + bool $expectsReturn, + bool $expectsForbidden1, + bool $expectsForbidden2, + bool $expectsFileLocked): void { $plugin = $this->getMockBuilder(LockPlugin::class) ->setMethods(['isFile', 'getNode', 'isE2EEnabledPath', 'isE2EEnabledUserAgent']) ->setConstructorArgs([ diff --git a/tests/Unit/Connector/Sabre/PropFindPluginTest.php b/tests/Unit/Connector/Sabre/PropFindPluginTest.php index f0d81001..a408858b 100644 --- a/tests/Unit/Connector/Sabre/PropFindPluginTest.php +++ b/tests/Unit/Connector/Sabre/PropFindPluginTest.php @@ -26,8 +26,8 @@ use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\Exception\Forbidden; use OCA\EndToEndEncryption\Connector\Sabre\PropFindPlugin; -use OCA\EndToEndEncryption\UserAgentManager; use OCA\EndToEndEncryption\E2EEnabledPathCache; +use OCA\EndToEndEncryption\UserAgentManager; use OCP\Files\IRootFolder; use OCP\IRequest; use OCP\IUserSession; @@ -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); } diff --git a/tests/Unit/Controller/KeyControllerTest.php b/tests/Unit/Controller/KeyControllerTest.php index 1aed14ff..6c929aa0 100644 --- a/tests/Unit/Controller/KeyControllerTest.php +++ b/tests/Unit/Controller/KeyControllerTest.php @@ -36,8 +36,8 @@ use OCP\Files\NotPermittedException; use OCP\IL10N; use OCP\IRequest; -use Test\TestCase; use Psr\Log\LoggerInterface; +use Test\TestCase; class KeyControllerTest extends TestCase { @@ -119,9 +119,9 @@ protected function setUp(): void { * @dataProvider getPrivateKeyDataProvider */ public function testGetPrivateKey(?\Exception $keyStorageException, - ?string $expectedException, - ?string $expectedExceptionMessage, - bool $expectLogger): void { + ?string $expectedException, + ?string $expectedExceptionMessage, + bool $expectLogger): void { $privateKey = 'MY-SECRET-PRIVATE-KEY'; if ($keyStorageException) { $this->keyStorage->expects($this->once()) @@ -179,9 +179,9 @@ public function getPrivateKeyDataProvider(): array { * @dataProvider deletePrivateKeyDataProvider */ public function testDeletePrivateKey(?\Exception $keyStorageException, - ?string $expectedException, - ?string $expectedExceptionMessage, - bool $expectLogger): void { + ?string $expectedException, + ?string $expectedExceptionMessage, + bool $expectLogger): void { if ($keyStorageException) { $this->keyStorage->expects($this->once()) ->method('deletePrivateKey') @@ -237,11 +237,11 @@ public function deletePrivateKeyDataProvider(): array { * @dataProvider setPrivateKeyDataProvider */ public function testSetPrivateKey(?\Exception $keyStorageException, - ?string $expectedException, - ?string $expectedExceptionMessage, - bool $expectLogger, - ?array $expectedData, - ?int $expectedStatusCode): void { + ?string $expectedException, + ?string $expectedExceptionMessage, + bool $expectLogger, + ?array $expectedData, + ?int $expectedStatusCode): void { $privateKey = 'MY-SECRET-PRIVATE-KEY'; if ($keyStorageException) { $this->keyStorage->expects($this->once()) @@ -465,9 +465,9 @@ public function testCreatePublicKeyConflict(): void { * @dataProvider deletePublicKeyDataProvider */ public function testDeletePublicKey(?\Exception $keyStorageException, - ?string $expectedException, - ?string $expectedExceptionMessage, - bool $expectLogger): void { + ?string $expectedException, + ?string $expectedExceptionMessage, + bool $expectLogger): void { if ($keyStorageException) { $this->keyStorage->expects($this->once()) ->method('deletePublicKey') diff --git a/tests/Unit/Controller/LockingControllerTest.php b/tests/Unit/Controller/LockingControllerTest.php index 2319c378..d2ea7e22 100644 --- a/tests/Unit/Controller/LockingControllerTest.php +++ b/tests/Unit/Controller/LockingControllerTest.php @@ -37,9 +37,9 @@ use OCP\Files\IRootFolder; use OCP\IL10N; use OCP\IRequest; +use OCP\Share\IManager as ShareManager; use Psr\Log\LoggerInterface; use Test\TestCase; -use OCP\Share\IManager as ShareManager; class LockingControllerTest extends TestCase { @@ -189,10 +189,10 @@ public function testLockFolderException(): void { * @dataProvider unlockFolderDataProvider */ public function testUnlockFolder(bool $getUserFolderThrows, - bool $userFolderReturnsNodes, - ?\Exception $unlockException, - ?string $expectedExceptionClass, - ?string $expectedExceptionMessage): void { + bool $userFolderReturnsNodes, + ?\Exception $unlockException, + ?string $expectedExceptionClass, + ?string $expectedExceptionMessage): void { $fileId = 42; $sendE2E = 'e2e-token'; diff --git a/tests/Unit/Controller/MetaDataControllerTest.php b/tests/Unit/Controller/MetaDataControllerTest.php index 819dddc1..60566012 100644 --- a/tests/Unit/Controller/MetaDataControllerTest.php +++ b/tests/Unit/Controller/MetaDataControllerTest.php @@ -36,9 +36,9 @@ use OCP\Files\NotPermittedException; use OCP\IL10N; use OCP\IRequest; +use OCP\Share\IManager as ShareManager; use Psr\Log\LoggerInterface; use Test\TestCase; -use OCP\Share\IManager as ShareManager; class MetaDataControllerTest extends TestCase { @@ -104,9 +104,9 @@ protected function setUp(): void { * @dataProvider getMetaDataDataProvider */ public function testGetMetaData(?\Exception $metaDataStorageException, - ?string $expectedException, - ?string $expectedExceptionMessage, - bool $expectLogger): void { + ?string $expectedException, + ?string $expectedExceptionMessage, + bool $expectLogger): void { $fileId = 42; $metaData = 'JSON-ENCODED-META-DATA'; if ($metaDataStorageException) { @@ -166,11 +166,11 @@ public function getMetaDataDataProvider(): array { * @dataProvider setMetaDataDataProvider */ public function testSetMetaData(?\Exception $metaDataStorageException, - ?string $expectedException, - ?string $expectedExceptionMessage, - bool $expectLogger, - ?array $expectedResponseData, - ?int $expectedResponseCode): void { + ?string $expectedException, + ?string $expectedExceptionMessage, + bool $expectLogger, + ?array $expectedResponseData, + ?int $expectedResponseCode): void { $fileId = 42; $metaData = 'JSON-ENCODED-META-DATA'; if ($metaDataStorageException) { @@ -228,10 +228,10 @@ public function setMetaDataDataProvider(): array { * @dataProvider updateMetaDataDataProvider */ public function testUpdateMetaData(bool $isLocked, - ?\Exception $metaDataStorageException, - ?string $expectedException, - ?string $expectedExceptionMessage, - bool $expectLogger): void { + ?\Exception $metaDataStorageException, + ?string $expectedException, + ?string $expectedExceptionMessage, + bool $expectLogger): void { $fileId = 42; $sendToken = 'sendE2EToken'; $metaData = 'JSON-ENCODED-META-DATA'; @@ -303,9 +303,9 @@ public function updateMetaDataDataProvider(): array { * @dataProvider deleteMetaDataDataProvider */ public function testDeleteMetaData(?\Exception $metaDataStorageException, - ?string $expectedException, - ?string $expectedExceptionMessage, - bool $expectLogger): void { + ?string $expectedException, + ?string $expectedExceptionMessage, + bool $expectLogger): void { $fileId = 42; if ($metaDataStorageException) { $this->metaDataStorage->expects($this->once()) diff --git a/tests/Unit/EncryptionManagerTest.php b/tests/Unit/EncryptionManagerTest.php index 443521f5..f7fe24fa 100644 --- a/tests/Unit/EncryptionManagerTest.php +++ b/tests/Unit/EncryptionManagerTest.php @@ -38,8 +38,8 @@ use OCP\Share\IManager; use OCP\Share\IShare; use PHPUnit_Framework_MockObject_MockObject; -use Test\TestCase; use Psr\Log\LoggerInterface; +use Test\TestCase; class EncryptionManagerTest extends TestCase { diff --git a/tests/Unit/MetaDataStorageTest.php b/tests/Unit/MetaDataStorageTest.php index e53089de..2eb3e0fb 100644 --- a/tests/Unit/MetaDataStorageTest.php +++ b/tests/Unit/MetaDataStorageTest.php @@ -23,6 +23,7 @@ namespace OCA\EndToEndEncryption\Tests\Unit; +use Exception; use OC\User\NoUserException; use OCA\EndToEndEncryption\Exceptions\MetaDataExistsException; use OCA\EndToEndEncryption\Exceptions\MissingMetaDataException; @@ -35,7 +36,6 @@ use OCP\Files\SimpleFS\ISimpleFile; use OCP\Files\SimpleFS\ISimpleFolder; use Test\TestCase; -use Exception; class MetaDataStorageTest extends TestCase { @@ -679,9 +679,9 @@ public function verifyFolderStructureDataProvider(): array { * @dataProvider getLegacyFileDataProvider */ public function testGetLegacyFile(?Exception $legacyOwnerException, - ?Exception $getFolderException, - ?Exception $getFileException, - bool $expectsNull): void { + ?Exception $getFolderException, + ?Exception $getFileException, + bool $expectsNull): void { $metaDataStorage = $this->getMockBuilder(MetaDataStorage::class) ->setMethods([ 'getLegacyOwnerPath', @@ -755,8 +755,8 @@ public function getLegacyFileDataProvider(): array { * @dataProvider cleanupLegacyFileDataProvider */ public function testCleanupLegacyFile(?Exception $legacyOwnerException, - ?Exception $getFolderException, - bool $expectsDelete): void { + ?Exception $getFolderException, + bool $expectsDelete): void { $metaDataStorage = $this->getMockBuilder(MetaDataStorage::class) ->setMethods([ 'getLegacyOwnerPath', diff --git a/tests/Unit/RollbackServiceTest.php b/tests/Unit/RollbackServiceTest.php index 97f5cf19..3739a7c6 100644 --- a/tests/Unit/RollbackServiceTest.php +++ b/tests/Unit/RollbackServiceTest.php @@ -32,8 +32,8 @@ use OCP\Files\Config\IUserMountCache; use OCP\Files\Folder; use OCP\Files\IRootFolder; -use Psr\Log\LoggerInterface; use OCP\IUser; +use Psr\Log\LoggerInterface; use Test\TestCase; class RollbackServiceTest extends TestCase { diff --git a/tests/Unit/UserAgentManagerTest.php b/tests/Unit/UserAgentManagerTest.php index f20f6768..cf5789dd 100644 --- a/tests/Unit/UserAgentManagerTest.php +++ b/tests/Unit/UserAgentManagerTest.php @@ -25,8 +25,8 @@ namespace OCA\EndToEndEncryption\Tests\Unit; use OCA\EndToEndEncryption\UserAgentManager; -use Test\TestCase; use OCP\IConfig; +use Test\TestCase; class UserAgentManagerTest extends TestCase { @@ -37,7 +37,7 @@ class UserAgentManagerTest extends TestCase { * @dataProvider supportsEndToEndEncryptionDataProvider */ public function testSupportsEndToEndEncryption(string $client, - bool $expected): void { + bool $expected): void { $supportedUAs = $this->getSupportedUserAgents(); $userAgentManager = $this->getUserAgentManager(['getSupportedUserAgents']); $userAgentManager->expects($this->once())