diff --git a/lib/Activity/Filter.php b/lib/Activity/Filter.php index 00d8a96b5..8af4dbd25 100644 --- a/lib/Activity/Filter.php +++ b/lib/Activity/Filter.php @@ -28,26 +28,32 @@ class Filter implements IFilter { $this->url = $url; } + #[\Override] public function getIdentifier() { return Application::APP_ID; } + #[\Override] public function getName() { return 'LibreSign'; } + #[\Override] public function getPriority() { return 31; } + #[\Override] public function getIcon() { return $this->url->getAbsoluteURL($this->url->imagePath('libresign', 'app-dark.svg')); } + #[\Override] public function filterTypes(array $types) { return array_intersect(self::ALLOWED_TYPES, $types); } + #[\Override] public function allowedApps() { return [ Application::APP_ID, diff --git a/lib/Activity/Listener.php b/lib/Activity/Listener.php index 5006088ed..43cae9488 100644 --- a/lib/Activity/Listener.php +++ b/lib/Activity/Listener.php @@ -41,6 +41,7 @@ class Listener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { /** @var SendSignNotificationEvent|SignedEvent $event */ match ($event::class) { diff --git a/lib/Activity/Provider/SignRequest.php b/lib/Activity/Provider/SignRequest.php index 79ae25850..46221df43 100644 --- a/lib/Activity/Provider/SignRequest.php +++ b/lib/Activity/Provider/SignRequest.php @@ -28,6 +28,7 @@ class SignRequest implements IProvider { ) { } + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== Application::APP_ID) { throw new UnknownActivityException('app'); diff --git a/lib/Activity/Provider/Signed.php b/lib/Activity/Provider/Signed.php index 9bbc4812e..69bb921a3 100644 --- a/lib/Activity/Provider/Signed.php +++ b/lib/Activity/Provider/Signed.php @@ -28,6 +28,7 @@ class Signed implements IProvider { ) { } + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== Application::APP_ID) { throw new UnknownActivityException('app'); diff --git a/lib/Activity/Settings/FileSigned.php b/lib/Activity/Settings/FileSigned.php index 0f07e6ce9..7a709663b 100644 --- a/lib/Activity/Settings/FileSigned.php +++ b/lib/Activity/Settings/FileSigned.php @@ -26,6 +26,7 @@ class FileSigned extends LibresignActivitySettings { /** * {@inheritdoc} */ + #[\Override] public function getIdentifier(): string { return SignedEvent::FILE_SIGNED; } @@ -33,6 +34,7 @@ class FileSigned extends LibresignActivitySettings { /** * {@inheritdoc} */ + #[\Override] public function getName(): string { return $this->l->t('A document has been signed'); } @@ -40,6 +42,7 @@ class FileSigned extends LibresignActivitySettings { /** * {@inheritdoc} */ + #[\Override] public function getPriority(): int { return 52; } @@ -47,6 +50,7 @@ class FileSigned extends LibresignActivitySettings { /** * {@inheritdoc} */ + #[\Override] public function canChangeNotification(): bool { if (!$this->userSession->getUser() instanceof IUser) { return true; @@ -62,6 +66,7 @@ class FileSigned extends LibresignActivitySettings { /** * {@inheritdoc} */ + #[\Override] public function canChangeMail() { if (!$this->userSession->getUser() instanceof IUser) { return true; diff --git a/lib/Activity/Settings/FileToSign.php b/lib/Activity/Settings/FileToSign.php index b1eda9de9..526803b71 100644 --- a/lib/Activity/Settings/FileToSign.php +++ b/lib/Activity/Settings/FileToSign.php @@ -21,6 +21,7 @@ class FileToSign extends LibresignActivitySettings { * @return string Lowercase a-z and underscore only identifier. The type of table activity * @since 20.0.0 */ + #[\Override] public function getIdentifier(): string { return SendSignNotificationEvent::FILE_TO_SIGN; } @@ -29,6 +30,7 @@ class FileToSign extends LibresignActivitySettings { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('You have a file to sign'); } diff --git a/lib/Activity/Settings/LibresignActivitySettings.php b/lib/Activity/Settings/LibresignActivitySettings.php index 7a24e9355..799b86bb3 100644 --- a/lib/Activity/Settings/LibresignActivitySettings.php +++ b/lib/Activity/Settings/LibresignActivitySettings.php @@ -15,6 +15,7 @@ abstract class LibresignActivitySettings extends ActivitySettings { /** * {@inheritdoc} */ + #[\Override] public function getGroupIdentifier() { return 'libresign'; } @@ -22,6 +23,7 @@ abstract class LibresignActivitySettings extends ActivitySettings { /** * {@inheritdoc} */ + #[\Override] public function getGroupName() { return 'LibreSign'; } @@ -29,30 +31,35 @@ abstract class LibresignActivitySettings extends ActivitySettings { /** * {@inheritdoc} */ + #[\Override] public function getPriority(): int { return 51; } /** * {@inheritdoc} */ + #[\Override] public function canChangeNotification(): bool { return true; } /** * {@inheritdoc} */ + #[\Override] public function canChangeMail() { return true; } /** * {@inheritdoc} */ + #[\Override] public function isDefaultEnabledMail() { return true; } /** * {@inheritdoc} */ + #[\Override] public function isDefaultEnabledNotification(): bool { return true; } diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 8757513f5..09b309f3f 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -45,6 +45,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID); } + #[\Override] public function boot(IBootContext $context): void { $server = $context->getServerContainer(); @@ -54,6 +55,7 @@ class Application extends App implements IBootstrap { FilesTemplateLoader::register($dispatcher); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerMiddleWare(GlobalInjectionMiddleware::class, true); $context->registerMiddleWare(InjectionMiddleware::class); diff --git a/lib/BackgroundJob/Reminder.php b/lib/BackgroundJob/Reminder.php index 69f7d65cd..18c4a3ecd 100644 --- a/lib/BackgroundJob/Reminder.php +++ b/lib/BackgroundJob/Reminder.php @@ -28,6 +28,7 @@ class Reminder extends TimedJob { /** * @inheritDoc */ + #[\Override] public function run($argument): void { $this->reminderService->sendReminders(); } diff --git a/lib/BackgroundJob/UserDeleted.php b/lib/BackgroundJob/UserDeleted.php index b1b99298f..60f67092c 100644 --- a/lib/BackgroundJob/UserDeleted.php +++ b/lib/BackgroundJob/UserDeleted.php @@ -30,6 +30,7 @@ class UserDeleted extends QueuedJob { /** * @param array $argument */ + #[\Override] public function run($argument): void { if (!isset($argument['user_id'])) { return; diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 492b38e70..a844f05c6 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -33,6 +33,7 @@ class Capabilities implements IPublicCapability { * libresign?: LibresignCapabilities, * } */ + #[\Override] public function getCapabilities(): array { $capabilities = [ 'features' => self::FEATURES, diff --git a/lib/Collaboration/Collaborators/SignerPlugin.php b/lib/Collaboration/Collaborators/SignerPlugin.php index 0acc0c951..9a7ffb698 100644 --- a/lib/Collaboration/Collaborators/SignerPlugin.php +++ b/lib/Collaboration/Collaborators/SignerPlugin.php @@ -31,6 +31,7 @@ class SignerPlugin implements ISearchPlugin { /** * {@inheritdoc} */ + #[\Override] public function search($search, $limit, $offset, ISearchResult $searchResult): bool { $user = $this->userSession->getUser()->getUID(); diff --git a/lib/Db/AccountFileMapper.php b/lib/Db/AccountFileMapper.php index 7a588665a..378d72a82 100644 --- a/lib/Db/AccountFileMapper.php +++ b/lib/Db/AccountFileMapper.php @@ -243,6 +243,7 @@ class AccountFileMapper extends QBMapper { return $files; } + #[\Override] public function delete(Entity $entity): Entity { $qb = $this->db->getQueryBuilder(); diff --git a/lib/Db/PagerFantaQueryAdapter.php b/lib/Db/PagerFantaQueryAdapter.php index 274b30752..e8dd24d68 100644 --- a/lib/Db/PagerFantaQueryAdapter.php +++ b/lib/Db/PagerFantaQueryAdapter.php @@ -31,6 +31,7 @@ class PagerFantaQueryAdapter implements AdapterInterface { } } + #[\Override] public function getNbResults(): int { $total = $this->countQueryBuilder->executeQuery()->fetchOne(); @@ -42,6 +43,7 @@ class PagerFantaQueryAdapter implements AdapterInterface { * * @return array */ + #[\Override] public function getSlice(int $offset, int $length): iterable { $qb = clone $this->queryBuilder; diff --git a/lib/Db/SignRequestMapper.php b/lib/Db/SignRequestMapper.php index 305c9b919..ba15a6b47 100644 --- a/lib/Db/SignRequestMapper.php +++ b/lib/Db/SignRequestMapper.php @@ -74,6 +74,7 @@ class SignRequestMapper extends QBMapper { /** * @inheritDoc */ + #[\Override] public function update(Entity $entity): SignRequest { /** @var SignRequest */ $signRequest = parent::update($entity); diff --git a/lib/Exception/LibresignException.php b/lib/Exception/LibresignException.php index a7978dfb5..576243735 100644 --- a/lib/Exception/LibresignException.php +++ b/lib/Exception/LibresignException.php @@ -14,6 +14,7 @@ use JsonSerializable; * @codeCoverageIgnore */ class LibresignException extends \Exception implements JsonSerializable { + #[\Override] public function jsonSerialize(): mixed { return ['message' => $this->getMessage()]; } diff --git a/lib/Files/TemplateLoader.php b/lib/Files/TemplateLoader.php index c1af02928..761ba954f 100644 --- a/lib/Files/TemplateLoader.php +++ b/lib/Files/TemplateLoader.php @@ -40,6 +40,7 @@ class TemplateLoader implements IEventListener { $dispatcher->addServiceListener(LoadSidebar::class, self::class); } + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoadSidebar)) { return; diff --git a/lib/Handler/CertificateEngine/AEngineHandler.php b/lib/Handler/CertificateEngine/AEngineHandler.php index 7201e34f3..f8cbaef3f 100644 --- a/lib/Handler/CertificateEngine/AEngineHandler.php +++ b/lib/Handler/CertificateEngine/AEngineHandler.php @@ -104,6 +104,7 @@ abstract class AEngineHandler implements IEngineHandler { return $certContent; } + #[\Override] public function updatePassword(string $certificate, string $currentPrivateKey, string $newPrivateKey): string { if (empty($certificate) || empty($currentPrivateKey) || empty($newPrivateKey)) { throw new EmptyCertificateException(); @@ -114,6 +115,7 @@ abstract class AEngineHandler implements IEngineHandler { return $certContent; } + #[\Override] public function readCertificate(string $certificate, string $privateKey): array { if (empty($certificate) || empty($privateKey)) { throw new EmptyCertificateException(); @@ -208,6 +210,7 @@ abstract class AEngineHandler implements IEngineHandler { $this->engine = $engine; } + #[\Override] public function getEngine(): string { if ($this->engine) { return $this->engine; @@ -216,6 +219,7 @@ abstract class AEngineHandler implements IEngineHandler { return $this->engine; } + #[\Override] public function populateInstance(array $rootCert): IEngineHandler { if (empty($rootCert)) { $rootCert = $this->appConfig->getValueArray(Application::APP_ID, 'rootCert'); @@ -280,6 +284,7 @@ abstract class AEngineHandler implements IEngineHandler { return $path; } + #[\Override] public function setConfigPath(string $configPath): IEngineHandler { if (!$configPath) { $this->appConfig->deleteKey(Application::APP_ID, 'config_path'); @@ -322,6 +327,7 @@ abstract class AEngineHandler implements IEngineHandler { return str_replace(' ', '+', $this->UID); } + #[\Override] public function expirity(): int { $expirity = $this->appConfig->getValueInt(Application::APP_ID, 'expiry_in_days', 365); if ($expirity < 0) { @@ -330,10 +336,12 @@ abstract class AEngineHandler implements IEngineHandler { return $expirity; } + #[\Override] public function isSetupOk(): bool { return strlen($this->appConfig->getValueString(Application::APP_ID, 'authkey', '')) > 0; } + #[\Override] public function configureCheck(): array { throw new \Exception('Necessary to implement configureCheck method'); } @@ -351,6 +359,7 @@ abstract class AEngineHandler implements IEngineHandler { return $return; } + #[\Override] public function toArray(): array { $return = [ 'configPath' => $this->getConfigPath(), diff --git a/lib/Handler/CertificateEngine/CfsslHandler.php b/lib/Handler/CertificateEngine/CfsslHandler.php index b05f50708..53da0dd2e 100644 --- a/lib/Handler/CertificateEngine/CfsslHandler.php +++ b/lib/Handler/CertificateEngine/CfsslHandler.php @@ -54,6 +54,7 @@ class CfsslHandler extends AEngineHandler implements IEngineHandler { $this->cfsslServerHandler->configCallback(fn () => $this->getConfigPath()); } + #[\Override] public function generateRootCert( string $commonName, array $names = [], @@ -81,6 +82,7 @@ class CfsslHandler extends AEngineHandler implements IEngineHandler { return $key; } + #[\Override] public function generateCertificate(): string { $certKeys = $this->newCert(); return parent::exportToPkcs12( @@ -96,6 +98,7 @@ class CfsslHandler extends AEngineHandler implements IEngineHandler { ); } + #[\Override] public function isSetupOk(): bool { if (!parent::isSetupOk()) { return false; @@ -114,6 +117,7 @@ class CfsslHandler extends AEngineHandler implements IEngineHandler { return false; } + #[\Override] public function configureCheck(): array { $return = $this->checkBinaries(); $configPath = $this->getConfigPath(); @@ -134,6 +138,7 @@ class CfsslHandler extends AEngineHandler implements IEngineHandler { ); } + #[\Override] public function toArray(): array { $return = parent::toArray(); if (!empty($return['configPath'])) { diff --git a/lib/Handler/CertificateEngine/NoneHandler.php b/lib/Handler/CertificateEngine/NoneHandler.php index ddf2ccb9c..bde9bc0a7 100644 --- a/lib/Handler/CertificateEngine/NoneHandler.php +++ b/lib/Handler/CertificateEngine/NoneHandler.php @@ -9,6 +9,7 @@ declare(strict_types=1); namespace OCA\Libresign\Handler\CertificateEngine; class NoneHandler extends AEngineHandler implements IEngineHandler { + #[\Override] public function generateRootCert( string $commonName, array $names = [], @@ -16,14 +17,17 @@ class NoneHandler extends AEngineHandler implements IEngineHandler { return ''; } + #[\Override] public function generateCertificate(string $certificate = '', string $privateKey = ''): string { return ''; } + #[\Override] public function isSetupOk(): bool { return true; } + #[\Override] public function configureCheck(): array { return []; } diff --git a/lib/Handler/CertificateEngine/OpenSslHandler.php b/lib/Handler/CertificateEngine/OpenSslHandler.php index 1b29db822..91abd08ee 100644 --- a/lib/Handler/CertificateEngine/OpenSslHandler.php +++ b/lib/Handler/CertificateEngine/OpenSslHandler.php @@ -36,6 +36,7 @@ class OpenSslHandler extends AEngineHandler implements IEngineHandler { parent::__construct($config, $appConfig, $appDataFactory, $dateTimeFormatter, $tempManager, $certificatePolicyService); } + #[\Override] public function generateRootCert( string $commonName, array $names = [], @@ -73,6 +74,7 @@ class OpenSslHandler extends AEngineHandler implements IEngineHandler { return $options; } + #[\Override] public function generateCertificate(): string { $configPath = $this->getConfigPath(); $rootCertificate = file_get_contents($configPath . DIRECTORY_SEPARATOR . 'ca.pem'); @@ -207,6 +209,7 @@ class OpenSslHandler extends AEngineHandler implements IEngineHandler { return $distinguishedNames; } + #[\Override] public function isSetupOk(): bool { $ok = parent::isSetupOk(); if (!$ok) { @@ -218,6 +221,7 @@ class OpenSslHandler extends AEngineHandler implements IEngineHandler { return $certificate && $privateKey; } + #[\Override] public function configureCheck(): array { if ($this->isSetupOk()) { return [(new ConfigureCheckHelper()) diff --git a/lib/Handler/SignEngine/JSignPdfHandler.php b/lib/Handler/SignEngine/JSignPdfHandler.php index 5cdf7fc82..8cfbe0689 100644 --- a/lib/Handler/SignEngine/JSignPdfHandler.php +++ b/lib/Handler/SignEngine/JSignPdfHandler.php @@ -147,12 +147,14 @@ class JSignPdfHandler extends Pkcs12Handler { return 'SHA256'; } + #[\Override] public function sign(): File { $signedContent = $this->getSignedContent(); $this->getInputFile()->putContent($signedContent); return $this->getInputFile(); } + #[\Override] public function getSignedContent(): string { $param = $this->getJSignParam() ->setCertificate($this->getCertificate()) @@ -278,6 +280,7 @@ class JSignPdfHandler extends Pkcs12Handler { } + #[\Override] public function readCertificate(): array { return $this->certificateEngineFactory ->getEngine() diff --git a/lib/Handler/SignEngine/Pkcs12Handler.php b/lib/Handler/SignEngine/Pkcs12Handler.php index a07913a90..0e26d91b5 100644 --- a/lib/Handler/SignEngine/Pkcs12Handler.php +++ b/lib/Handler/SignEngine/Pkcs12Handler.php @@ -83,6 +83,7 @@ class Pkcs12Handler extends SignEngineHandler { * @throws LibresignException When is not a signed file * @return array */ + #[\Override] public function getCertificateChain($resource): array { $signerCounter = 0; $certificates = []; @@ -317,6 +318,7 @@ class Pkcs12Handler extends SignEngineHandler { return $this->$property; } + #[\Override] public function sign(): File { $signedContent = $this->getHandler() ->setCertificate($this->getCertificate()) diff --git a/lib/Handler/SignEngine/Pkcs7Handler.php b/lib/Handler/SignEngine/Pkcs7Handler.php index b66cc3e52..1387dd931 100644 --- a/lib/Handler/SignEngine/Pkcs7Handler.php +++ b/lib/Handler/SignEngine/Pkcs7Handler.php @@ -12,6 +12,7 @@ use DateTime; use OCP\Files\File; class Pkcs7Handler extends SignEngineHandler { + #[\Override] public function sign(): File { $p7sFile = $this->getP7sFile(); openssl_pkcs12_read($this->getCertificate(), $certificateData, $this->getPassword()); @@ -37,6 +38,7 @@ class Pkcs7Handler extends SignEngineHandler { /** * @todo Replace this method by a real implementation that retrieves the certificate chain and not just the file's last modified time. */ + #[\Override] public function getCertificateChain($resource): array { $metadata = stream_get_meta_data($resource); $lastModifiedTime = filemtime($metadata['uri']); diff --git a/lib/Handler/SignEngine/SignEngineHandler.php b/lib/Handler/SignEngine/SignEngineHandler.php index 931c29d7d..04fc7f8e5 100644 --- a/lib/Handler/SignEngine/SignEngineHandler.php +++ b/lib/Handler/SignEngine/SignEngineHandler.php @@ -43,24 +43,29 @@ abstract class SignEngineHandler implements ISignEngineHandler { /** * @return static */ + #[\Override] public function setInputFile(File $inputFile): self { $this->inputFile = $inputFile; return $this; } + #[\Override] public function getInputFile(): File { return $this->inputFile; } + #[\Override] public function setCertificate(string $certificate): self { $this->certificate = $certificate; return $this; } + #[\Override] public function getCertificate(): string { return $this->certificate; } + #[\Override] public function readCertificate(): array { return $this->getCertificateEngine() ->readCertificate( @@ -69,11 +74,13 @@ abstract class SignEngineHandler implements ISignEngineHandler { ); } + #[\Override] public function setPassword(string $password): self { $this->password = $password; return $this; } + #[\Override] public function getPassword(): string { return $this->password; } @@ -97,14 +104,17 @@ abstract class SignEngineHandler implements ISignEngineHandler { return $this->visibleElements; } + #[\Override] public function getSignedContent(): string { return $this->sign()->getContent(); } + #[\Override] public function getSignatureParams(): array { return $this->signatureParams; } + #[\Override] public function setSignatureParams(array $params): self { $this->signatureParams = $params; return $this; @@ -205,6 +215,7 @@ abstract class SignEngineHandler implements ISignEngineHandler { return $this->savePfx($uid, $content); } + #[\Override] public function getLastSignedDate(): \DateTime { $stream = $this->getFileStream(); diff --git a/lib/Helper/ConfigureCheckHelper.php b/lib/Helper/ConfigureCheckHelper.php index bb6347aec..84dbda6a3 100644 --- a/lib/Helper/ConfigureCheckHelper.php +++ b/lib/Helper/ConfigureCheckHelper.php @@ -52,6 +52,7 @@ class ConfigureCheckHelper implements JsonSerializable { return $this; } + #[\Override] public function jsonSerialize(): array { return [ 'status' => $this->getStatus(), diff --git a/lib/Listener/BeforeNodeDeletedListener.php b/lib/Listener/BeforeNodeDeletedListener.php index fc242e2cf..8b64ebb3e 100644 --- a/lib/Listener/BeforeNodeDeletedListener.php +++ b/lib/Listener/BeforeNodeDeletedListener.php @@ -30,6 +30,7 @@ class BeforeNodeDeletedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof BeforeNodeDeletedEvent) { $node = $event->getNode(); diff --git a/lib/Listener/LoadAdditionalListener.php b/lib/Listener/LoadAdditionalListener.php index 75ce489de..ba2e87dfc 100644 --- a/lib/Listener/LoadAdditionalListener.php +++ b/lib/Listener/LoadAdditionalListener.php @@ -25,6 +25,7 @@ class LoadAdditionalListener implements IEventListener { private CertificateEngineFactory $certificateEngineFactory, ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoadAdditionalScriptsEvent)) { return; diff --git a/lib/Listener/LoadSidebarListener.php b/lib/Listener/LoadSidebarListener.php index 6b6ac2a52..043225831 100644 --- a/lib/Listener/LoadSidebarListener.php +++ b/lib/Listener/LoadSidebarListener.php @@ -23,6 +23,7 @@ class LoadSidebarListener implements IEventListener { private IAppManager $appManager, ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoadSidebar)) { return; diff --git a/lib/Listener/MailNotifyListener.php b/lib/Listener/MailNotifyListener.php index e5544728b..d5d4b4dbd 100644 --- a/lib/Listener/MailNotifyListener.php +++ b/lib/Listener/MailNotifyListener.php @@ -35,6 +35,7 @@ class MailNotifyListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { /** @var SendSignNotificationEvent|SignedEvent $event */ match ($event::class) { diff --git a/lib/Listener/NotificationListener.php b/lib/Listener/NotificationListener.php index 539b15e9a..b28b82a01 100644 --- a/lib/Listener/NotificationListener.php +++ b/lib/Listener/NotificationListener.php @@ -36,6 +36,7 @@ class NotificationListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof SendSignNotificationEvent) { $this->sendSignNotification( diff --git a/lib/Listener/SignedCallbackListener.php b/lib/Listener/SignedCallbackListener.php index 497851fb5..d3f54339d 100644 --- a/lib/Listener/SignedCallbackListener.php +++ b/lib/Listener/SignedCallbackListener.php @@ -20,6 +20,7 @@ class SignedCallbackListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { /** @var SignedEvent */ if (!($event instanceof SignedEvent)) { diff --git a/lib/Listener/TwofactorGatewayListener.php b/lib/Listener/TwofactorGatewayListener.php index 5581c209f..d857c7a7f 100644 --- a/lib/Listener/TwofactorGatewayListener.php +++ b/lib/Listener/TwofactorGatewayListener.php @@ -41,6 +41,7 @@ class TwofactorGatewayListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { /** @var SendSignNotificationEvent|SignedEvent $event */ match ($event::class) { diff --git a/lib/Listener/UserDeletedListener.php b/lib/Listener/UserDeletedListener.php index a1c5ea63b..b72cc5897 100644 --- a/lib/Listener/UserDeletedListener.php +++ b/lib/Listener/UserDeletedListener.php @@ -21,6 +21,7 @@ class UserDeletedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof UserDeletedEvent)) { return; diff --git a/lib/Middleware/GlobalInjectionMiddleware.php b/lib/Middleware/GlobalInjectionMiddleware.php index 1bfaef522..350408e34 100644 --- a/lib/Middleware/GlobalInjectionMiddleware.php +++ b/lib/Middleware/GlobalInjectionMiddleware.php @@ -15,6 +15,7 @@ use OCP\AppFramework\Http\Response; use OCP\AppFramework\Middleware; class GlobalInjectionMiddleware extends Middleware { + #[\Override] public function afterController(Controller $controller, string $methodName, Response $response) { if ($controller instanceof ViewController) { $policy = new ContentSecurityPolicy(); diff --git a/lib/Middleware/InjectionMiddleware.php b/lib/Middleware/InjectionMiddleware.php index ce7223dc8..4be710262 100644 --- a/lib/Middleware/InjectionMiddleware.php +++ b/lib/Middleware/InjectionMiddleware.php @@ -69,6 +69,7 @@ class InjectionMiddleware extends Middleware { * @param string $methodName * @throws \Exception */ + #[\Override] public function beforeController(Controller $controller, string $methodName) { if ($controller instanceof AEnvironmentAwareController) { $apiVersion = $this->request->getParam('apiVersion'); @@ -198,6 +199,7 @@ class InjectionMiddleware extends Middleware { * @throws \Exception * @return Response */ + #[\Override] public function afterException($controller, $methodName, \Exception $exception): Response { if (str_contains($this->request->getHeader('Accept'), 'html')) { $template = 'external'; diff --git a/lib/Migration/DeleteOldBinaries.php b/lib/Migration/DeleteOldBinaries.php index 5c6531329..da76206c0 100644 --- a/lib/Migration/DeleteOldBinaries.php +++ b/lib/Migration/DeleteOldBinaries.php @@ -55,10 +55,12 @@ class DeleteOldBinaries implements IRepairStep { $this->appData = $appDataFactory->get('libresign'); } + #[\Override] public function getName(): string { return 'Delete old binaries'; } + #[\Override] public function run(IOutput $output): void { $this->scan(); $this->output = $output; diff --git a/lib/Migration/ResynchronizeDatabaseSequences.php b/lib/Migration/ResynchronizeDatabaseSequences.php index 295cd1e4f..f63ad9e62 100644 --- a/lib/Migration/ResynchronizeDatabaseSequences.php +++ b/lib/Migration/ResynchronizeDatabaseSequences.php @@ -24,10 +24,12 @@ class ResynchronizeDatabaseSequences implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Resynchronize database sequences'; } + #[\Override] public function run(IOutput $output): void { if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $tools = new \OC\DB\PgSqlTools($this->config); diff --git a/lib/Migration/Version10000Date20240625141149.php b/lib/Migration/Version10000Date20240625141149.php index 884f2911c..f53f8726d 100644 --- a/lib/Migration/Version10000Date20240625141149.php +++ b/lib/Migration/Version10000Date20240625141149.php @@ -21,6 +21,7 @@ class Version10000Date20240625141149 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version1000Date20210209004203.php b/lib/Migration/Version1000Date20210209004203.php index a0be7447d..fa1839f44 100644 --- a/lib/Migration/Version1000Date20210209004203.php +++ b/lib/Migration/Version1000Date20210209004203.php @@ -21,6 +21,7 @@ class Version1000Date20210209004203 extends SimpleMigrationStep { * @param array $options * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { $schema = $schemaClosure(); $table = $schema->createTable('libresign_file'); diff --git a/lib/Migration/Version1000Date20210209011129.php b/lib/Migration/Version1000Date20210209011129.php index 2b76f08f9..24a05a0c7 100644 --- a/lib/Migration/Version1000Date20210209011129.php +++ b/lib/Migration/Version1000Date20210209011129.php @@ -21,6 +21,7 @@ class Version1000Date20210209011129 extends SimpleMigrationStep { * @param array $options * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { $schema = $schemaClosure(); $table = $schema->createTable('libresign_file_user'); diff --git a/lib/Migration/Version1000Date20210502200600.php b/lib/Migration/Version1000Date20210502200600.php index 034efe289..d00d993f5 100644 --- a/lib/Migration/Version1000Date20210502200600.php +++ b/lib/Migration/Version1000Date20210502200600.php @@ -27,6 +27,7 @@ class Version1000Date20210502200600 extends SimpleMigrationStep { $this->connection = $connection; } + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { $query = $this->connection->getQueryBuilder(); $query->select('id', 'file_id') @@ -41,6 +42,7 @@ class Version1000Date20210502200600 extends SimpleMigrationStep { * * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -57,6 +59,7 @@ class Version1000Date20210502200600 extends SimpleMigrationStep { return $schema; } + #[\Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { foreach ($this->rows as $row) { $query = $this->connection->getQueryBuilder(); diff --git a/lib/Migration/Version1000Date20210502200800.php b/lib/Migration/Version1000Date20210502200800.php index f4420abef..97eb204a3 100644 --- a/lib/Migration/Version1000Date20210502200800.php +++ b/lib/Migration/Version1000Date20210502200800.php @@ -24,6 +24,7 @@ class Version1000Date20210502200800 extends SimpleMigrationStep { $this->connection = $connection; } + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { $query = $this->connection->getQueryBuilder(); $query->select('id', 'file_id2') @@ -38,6 +39,7 @@ class Version1000Date20210502200800 extends SimpleMigrationStep { * * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -54,6 +56,7 @@ class Version1000Date20210502200800 extends SimpleMigrationStep { return $schema; } + #[\Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { foreach ($this->rows as $row) { $query = $this->connection->getQueryBuilder(); diff --git a/lib/Migration/Version11000Date20250103005204.php b/lib/Migration/Version11000Date20250103005204.php index db17c89fe..10e2b6a11 100644 --- a/lib/Migration/Version11000Date20250103005204.php +++ b/lib/Migration/Version11000Date20250103005204.php @@ -31,6 +31,7 @@ class Version11000Date20250103005204 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version11000Date20250114182030.php b/lib/Migration/Version11000Date20250114182030.php index 3cf9aa1b8..52fadcbe5 100644 --- a/lib/Migration/Version11000Date20250114182030.php +++ b/lib/Migration/Version11000Date20250114182030.php @@ -32,6 +32,7 @@ class Version11000Date20250114182030 extends SimpleMigrationStep { * @param Closure(): ISchemaWrapper $schemaClosure * @param array $options */ + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { // BACKUP BEGIN $qb1 = $this->connection->getQueryBuilder(); diff --git a/lib/Migration/Version12000Date20250325143340.php b/lib/Migration/Version12000Date20250325143340.php index dd6683f7c..ff4ee0eb3 100644 --- a/lib/Migration/Version12000Date20250325143340.php +++ b/lib/Migration/Version12000Date20250325143340.php @@ -32,6 +32,7 @@ class Version12000Date20250325143340 extends SimpleMigrationStep { * @param Closure(): ISchemaWrapper $schemaClosure * @param array $options */ + #[\Override] public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $query = $this->connection->getQueryBuilder(); $query->select('id') @@ -71,6 +72,7 @@ class Version12000Date20250325143340 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version12000Date20250325155910.php b/lib/Migration/Version12000Date20250325155910.php index a9413a83c..64a5eb546 100644 --- a/lib/Migration/Version12000Date20250325155910.php +++ b/lib/Migration/Version12000Date20250325155910.php @@ -38,6 +38,7 @@ class Version12000Date20250325155910 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -67,6 +68,7 @@ class Version12000Date20250325155910 extends SimpleMigrationStep { * @param Closure(): ISchemaWrapper $schemaClosure * @param array $options */ + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $this->updateFile(); $this->updateSignRequest(); diff --git a/lib/Migration/Version12000Date20250325174734.php b/lib/Migration/Version12000Date20250325174734.php index 9d956760d..af59a1e19 100644 --- a/lib/Migration/Version12000Date20250325174734.php +++ b/lib/Migration/Version12000Date20250325174734.php @@ -21,6 +21,7 @@ class Version12000Date20250325174734 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version12000Date20250517134200.php b/lib/Migration/Version12000Date20250517134200.php index 345da20d5..97a4f8aac 100644 --- a/lib/Migration/Version12000Date20250517134200.php +++ b/lib/Migration/Version12000Date20250517134200.php @@ -27,6 +27,7 @@ class Version12000Date20250517134200 extends SimpleMigrationStep { * @param Closure(): ISchemaWrapper $schemaClosure * @param array $options */ + #[\Override] public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $keys = $this->config->getAppKeys(Application::APP_ID); if (in_array('notify_unsigned_user', $keys)) { diff --git a/lib/Migration/Version2040Date20210619135352.php b/lib/Migration/Version2040Date20210619135352.php index ed1fb3a4a..953916d87 100644 --- a/lib/Migration/Version2040Date20210619135352.php +++ b/lib/Migration/Version2040Date20210619135352.php @@ -24,6 +24,7 @@ class Version2040Date20210619135352 extends SimpleMigrationStep { * @param array $options * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { $schema = $schemaClosure(); $table = $schema->createTable('libresign_file_type'); diff --git a/lib/Migration/Version2040Date20210730022217.php b/lib/Migration/Version2040Date20210730022217.php index 98af27630..4cc6a1bcf 100644 --- a/lib/Migration/Version2040Date20210730022217.php +++ b/lib/Migration/Version2040Date20210730022217.php @@ -25,6 +25,7 @@ class Version2040Date20210730022217 extends SimpleMigrationStep { * * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version2040Date20211010194532.php b/lib/Migration/Version2040Date20211010194532.php index 29bc1d854..8a611718a 100644 --- a/lib/Migration/Version2040Date20211010194532.php +++ b/lib/Migration/Version2040Date20211010194532.php @@ -25,6 +25,7 @@ class Version2040Date20211010194532 extends SimpleMigrationStep { * * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version2040Date20211010200549.php b/lib/Migration/Version2040Date20211010200549.php index 5232d45d2..318451123 100644 --- a/lib/Migration/Version2040Date20211010200549.php +++ b/lib/Migration/Version2040Date20211010200549.php @@ -25,6 +25,7 @@ class Version2040Date20211010200549 extends SimpleMigrationStep { * * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version2040Date20211027183759.php b/lib/Migration/Version2040Date20211027183759.php index fb1d26693..34d2e1597 100644 --- a/lib/Migration/Version2040Date20211027183759.php +++ b/lib/Migration/Version2040Date20211027183759.php @@ -28,6 +28,7 @@ class Version2040Date20211027183759 extends SimpleMigrationStep { ) { } + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { $query = $this->connection->getQueryBuilder(); $query->select('id', 'node_id', 'user_id') @@ -42,6 +43,7 @@ class Version2040Date20211027183759 extends SimpleMigrationStep { * * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -56,6 +58,7 @@ class Version2040Date20211027183759 extends SimpleMigrationStep { return $schema; } + #[\Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { foreach ($this->rows as $row) { $userFolder = $this->root->getUserFolder($row['user_id']); diff --git a/lib/Migration/Version2040Date20211030204227.php b/lib/Migration/Version2040Date20211030204227.php index a3d23e2f1..18d501780 100644 --- a/lib/Migration/Version2040Date20211030204227.php +++ b/lib/Migration/Version2040Date20211030204227.php @@ -23,6 +23,7 @@ class Version2040Date20211030204227 extends SimpleMigrationStep { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { $schema = $schemaClosure(); /** @var Table */ diff --git a/lib/Migration/Version2040Date20220317150846.php b/lib/Migration/Version2040Date20220317150846.php index 90955facb..e50d06191 100644 --- a/lib/Migration/Version2040Date20220317150846.php +++ b/lib/Migration/Version2040Date20220317150846.php @@ -20,6 +20,7 @@ class Version2040Date20220317150846 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version7000Date20221026003343.php b/lib/Migration/Version7000Date20221026003343.php index c17eb3b2b..e0a54ec69 100644 --- a/lib/Migration/Version7000Date20221026003343.php +++ b/lib/Migration/Version7000Date20221026003343.php @@ -19,6 +19,7 @@ class Version7000Date20221026003343 extends SimpleMigrationStep { ) { } + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { $rootCert = []; if ($commonName = $this->appConfig->getValueString(Application::APP_ID, 'commonName')) { diff --git a/lib/Migration/Version7000Date20221028022904.php b/lib/Migration/Version7000Date20221028022904.php index b5decc252..db44ffb39 100644 --- a/lib/Migration/Version7000Date20221028022904.php +++ b/lib/Migration/Version7000Date20221028022904.php @@ -26,6 +26,7 @@ class Version7000Date20221028022904 extends SimpleMigrationStep { * This migration is to convert from the exposed format to this format: * {"commonName":"Test Company","names":[{"id":"C","value":"BR"},{"id":"O","value":"Organization"},{"id":"OU","value":"Organization Unit"}]} */ + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { $rootCert = $this->appConfig->getValueString(Application::APP_ID, 'rootCert'); $rootCert = json_decode($rootCert, true); diff --git a/lib/Migration/Version7000Date20230225154558.php b/lib/Migration/Version7000Date20230225154558.php index 7cede9064..734a66752 100644 --- a/lib/Migration/Version7000Date20230225154558.php +++ b/lib/Migration/Version7000Date20230225154558.php @@ -21,6 +21,7 @@ class Version7000Date20230225154558 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version7000Date20230327094452.php b/lib/Migration/Version7000Date20230327094452.php index 290168d21..d90b7d22a 100644 --- a/lib/Migration/Version7000Date20230327094452.php +++ b/lib/Migration/Version7000Date20230327094452.php @@ -27,6 +27,7 @@ class Version7000Date20230327094452 extends SimpleMigrationStep { * * {"commonName":"Test Company","names":{"C":"BR","O":"Organization","OU":"Organization Unit"}} */ + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { $rootCert = $this->appConfig->getValueString(Application::APP_ID, 'rootCert'); $rootCert = json_decode($rootCert, true); diff --git a/lib/Migration/Version8000Date20230402103824.php b/lib/Migration/Version8000Date20230402103824.php index 25f59600c..aad131c6e 100644 --- a/lib/Migration/Version8000Date20230402103824.php +++ b/lib/Migration/Version8000Date20230402103824.php @@ -21,6 +21,7 @@ class Version8000Date20230402103824 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version8000Date20230410230327.php b/lib/Migration/Version8000Date20230410230327.php index 5a776afb1..f85dbe938 100644 --- a/lib/Migration/Version8000Date20230410230327.php +++ b/lib/Migration/Version8000Date20230410230327.php @@ -26,6 +26,7 @@ class Version8000Date20230410230327 extends SimpleMigrationStep { $this->appData = $appDataFactory->get('libresign'); } + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { $libresignCliPath = $this->appConfig->getValueString(Application::APP_ID, 'libresign_cli_path'); if (!$libresignCliPath) { diff --git a/lib/Migration/Version8000Date20230420125331.php b/lib/Migration/Version8000Date20230420125331.php index 114ee47ca..34e7dde85 100644 --- a/lib/Migration/Version8000Date20230420125331.php +++ b/lib/Migration/Version8000Date20230420125331.php @@ -30,6 +30,7 @@ class Version8000Date20230420125331 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper */ $schema = $schemaClosure(); @@ -89,6 +90,7 @@ class Version8000Date20230420125331 extends SimpleMigrationStep { return $schema; } + #[\Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { $query = $this->connection->getQueryBuilder(); $query->select('*') diff --git a/lib/Migration/Version8000Date20230422191425.php b/lib/Migration/Version8000Date20230422191425.php index d8311fe20..c59dad868 100644 --- a/lib/Migration/Version8000Date20230422191425.php +++ b/lib/Migration/Version8000Date20230422191425.php @@ -20,6 +20,7 @@ class Version8000Date20230422191425 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version8000Date20230608004729.php b/lib/Migration/Version8000Date20230608004729.php index 2f6770ca2..b488e9329 100644 --- a/lib/Migration/Version8000Date20230608004729.php +++ b/lib/Migration/Version8000Date20230608004729.php @@ -20,6 +20,7 @@ class Version8000Date20230608004729 extends SimpleMigrationStep { ) { } + #[\Override] public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $cfsslBin = $this->appConfig->getValueString(Application::APP_ID, 'cfssl_bin'); $cfsslUrl = $this->appConfig->getValueString(Application::APP_ID, 'cfssl_url'); diff --git a/lib/Migration/Version8000Date20230730032402.php b/lib/Migration/Version8000Date20230730032402.php index 3fda983a2..90c6d3791 100644 --- a/lib/Migration/Version8000Date20230730032402.php +++ b/lib/Migration/Version8000Date20230730032402.php @@ -22,6 +22,7 @@ class Version8000Date20230730032402 extends SimpleMigrationStep { ) { } + #[\Override] public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $this->installService->installPdftk(); if ($rootCert = $this->appConfig->getValueArray(Application::APP_ID, 'rootCert')) { diff --git a/lib/Migration/Version8000Date20231102215331.php b/lib/Migration/Version8000Date20231102215331.php index 00867998c..9a41091a4 100644 --- a/lib/Migration/Version8000Date20231102215331.php +++ b/lib/Migration/Version8000Date20231102215331.php @@ -30,6 +30,7 @@ class Version8000Date20231102215331 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper */ $schema = $schemaClosure(); @@ -111,6 +112,7 @@ class Version8000Date20231102215331 extends SimpleMigrationStep { * @param Closure(): ISchemaWrapper $schemaClosure * @param array $options */ + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $qbFetch = $this->connection->getQueryBuilder(); $qbRestore = $this->connection->getQueryBuilder(); diff --git a/lib/Migration/Version8000Date20231103003922.php b/lib/Migration/Version8000Date20231103003922.php index 9e267e8ac..b2df766f8 100644 --- a/lib/Migration/Version8000Date20231103003922.php +++ b/lib/Migration/Version8000Date20231103003922.php @@ -27,6 +27,7 @@ class Version8000Date20231103003922 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version8000Date20240405142042.php b/lib/Migration/Version8000Date20240405142042.php index b9266b3a3..04166915c 100644 --- a/lib/Migration/Version8000Date20240405142042.php +++ b/lib/Migration/Version8000Date20240405142042.php @@ -38,6 +38,7 @@ class Version8000Date20240405142042 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index caa7ef746..479de576b 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -30,14 +30,17 @@ class Notifier implements INotifier { ) { } + #[\Override] public function getID(): string { return Application::APP_ID; } + #[\Override] public function getName(): string { return $this->factory->get(Application::APP_ID)->t('File sharing'); } + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== Application::APP_ID) { throw new UnknownActivityException(); diff --git a/lib/Service/IdentifyMethod/AbstractIdentifyMethod.php b/lib/Service/IdentifyMethod/AbstractIdentifyMethod.php index e5e64a5c4..3cfc3582c 100644 --- a/lib/Service/IdentifyMethod/AbstractIdentifyMethod.php +++ b/lib/Service/IdentifyMethod/AbstractIdentifyMethod.php @@ -47,40 +47,49 @@ abstract class AbstractIdentifyMethod implements IIdentifyMethod { $this->cleanEntity(); } + #[\Override] public static function getId(): string { $id = lcfirst(substr(strrchr(static::class, '\\'), 1)); return $id; } + #[\Override] public function getName(): string { return $this->name; } + #[\Override] public function getFriendlyName(): string { return $this->friendlyName; } + #[\Override] public function setFriendlyName(string $friendlyName): void { $this->friendlyName = $friendlyName; } + #[\Override] public function setCodeSentByUser(string $code): void { $this->codeSentByUser = $code; } + #[\Override] public function cleanEntity(): void { $this->entity = new IdentifyMethod(); $this->entity->setIdentifierKey($this->name); } + #[\Override] public function setEntity(IdentifyMethod $entity): void { $this->entity = $entity; } + #[\Override] public function getEntity(): IdentifyMethod { return $this->entity; } + #[\Override] public function signatureMethodsToArray(): array { return array_map(fn (AbstractSignatureMethod $method) => [ 'label' => $method->getFriendlyName(), @@ -93,6 +102,7 @@ abstract class AbstractIdentifyMethod implements IIdentifyMethod { return $this->availableSignatureMethods; } + #[\Override] public function getEmptyInstanceOfSignatureMethodByName(string $name): AbstractSignatureMethod { if (!in_array($name, $this->getAvailableSignatureMethods())) { throw new InvalidArgumentException(sprintf('%s is not a valid signature method of identify method %s', $name, $this->getName())); @@ -110,15 +120,18 @@ abstract class AbstractIdentifyMethod implements IIdentifyMethod { /** * @return AbstractSignatureMethod[] */ + #[\Override] public function getSignatureMethods(): array { return $this->signatureMethods; } + #[\Override] public function getSettings(): array { $this->getSettingsFromDatabase(); return $this->settings; } + #[\Override] public function notify(): bool { if (!$this->willNotify) { return false; @@ -133,19 +146,24 @@ abstract class AbstractIdentifyMethod implements IIdentifyMethod { return true; } + #[\Override] public function willNotifyUser(bool $willNotify): void { $this->willNotify = $willNotify; } + #[\Override] public function validateToRequest(): void { } + #[\Override] public function validateToCreateAccount(string $value): void { } + #[\Override] public function validateToIdentify(): void { } + #[\Override] public function validateToSign(): void { } @@ -354,11 +372,13 @@ abstract class AbstractIdentifyMethod implements IIdentifyMethod { return $customConfig; } + #[\Override] public function save(): void { $this->identifyService->save($this->getEntity()); $this->notify(); } + #[\Override] public function delete(): void { $this->identifyService->delete($this->getEntity()); } @@ -370,6 +390,7 @@ abstract class AbstractIdentifyMethod implements IIdentifyMethod { } } + #[\Override] public function validateToRenew(?IUser $user = null): void { $this->throwIfMaximumValidityExpired(); $this->throwIfAlreadySigned(); diff --git a/lib/Service/IdentifyMethod/Account.php b/lib/Service/IdentifyMethod/Account.php index e9f8dcf57..297079e1e 100644 --- a/lib/Service/IdentifyMethod/Account.php +++ b/lib/Service/IdentifyMethod/Account.php @@ -53,6 +53,7 @@ class Account extends AbstractIdentifyMethod { ); } + #[\Override] public function validateToRequest(): void { $signer = $this->userManager->get($this->entity->getIdentifierValue()); if (!$signer) { @@ -60,6 +61,7 @@ class Account extends AbstractIdentifyMethod { } } + #[\Override] public function validateToIdentify(): void { $signer = $this->getSigner(); $this->throwIfNotAuthenticated(); @@ -72,6 +74,7 @@ class Account extends AbstractIdentifyMethod { $this->updateIdentifiedAt(); } + #[\Override] public function validateToSign(): void { $signer = $this->getSigner(); $this->throwIfNotAuthenticated(); @@ -126,6 +129,7 @@ class Account extends AbstractIdentifyMethod { } } + #[\Override] public function getSettings(): array { if (!empty($this->settings)) { return $this->settings; diff --git a/lib/Service/IdentifyMethod/Email.php b/lib/Service/IdentifyMethod/Email.php index 30be6c60e..bd97a1d59 100644 --- a/lib/Service/IdentifyMethod/Email.php +++ b/lib/Service/IdentifyMethod/Email.php @@ -43,10 +43,12 @@ class Email extends AbstractIdentifyMethod { ); } + #[\Override] public function validateToRequest(): void { $this->throwIfInvalidEmail(); } + #[\Override] public function validateToIdentify(): void { $this->throwIfAccountAlreadyExists(); $this->throwIfIsAuthenticatedWithDifferentAccount(); @@ -59,6 +61,7 @@ class Email extends AbstractIdentifyMethod { $this->updateIdentifiedAt(); } + #[\Override] public function validateToSign(): void { $this->throwIfAccountAlreadyExists(); $this->throwIfIsAuthenticatedWithDifferentAccount(); @@ -171,6 +174,7 @@ class Email extends AbstractIdentifyMethod { ])); } + #[\Override] public function validateToCreateAccount(string $value): void { $this->throwIfInvalidEmail(); $this->throwIfNotAllowedToCreateAccount(); @@ -198,6 +202,7 @@ class Email extends AbstractIdentifyMethod { } } + #[\Override] public function getSettings(): array { if (!empty($this->settings)) { return $this->settings; diff --git a/lib/Service/IdentifyMethod/Signal.php b/lib/Service/IdentifyMethod/Signal.php index 0e0b8cfd8..6dabf6624 100644 --- a/lib/Service/IdentifyMethod/Signal.php +++ b/lib/Service/IdentifyMethod/Signal.php @@ -16,6 +16,7 @@ class Signal extends TwofactorGateway { ISignatureMethod::SIGNATURE_METHOD_SIGNAL, ]; + #[\Override] public function getFriendlyName(): string { // TRANSLATORS Name of possible authenticator method. This signalize that the signer could be identified by Signal return $this->identifyService->getL10n()->t('Signal'); diff --git a/lib/Service/IdentifyMethod/SignatureMethod/AbstractSignatureMethod.php b/lib/Service/IdentifyMethod/SignatureMethod/AbstractSignatureMethod.php index 24911422c..8eff23e74 100644 --- a/lib/Service/IdentifyMethod/SignatureMethod/AbstractSignatureMethod.php +++ b/lib/Service/IdentifyMethod/SignatureMethod/AbstractSignatureMethod.php @@ -13,14 +13,17 @@ use OCA\Libresign\Service\IdentifyMethod\AbstractIdentifyMethod; abstract class AbstractSignatureMethod extends AbstractIdentifyMethod implements ISignatureMethod { private bool $enabled = false; + #[\Override] public function enable(): void { $this->enabled = true; } + #[\Override] public function isEnabled(): bool { return $this->enabled; } + #[\Override] public function toArray(): array { return [ 'label' => $this->getFriendlyName(), diff --git a/lib/Service/IdentifyMethod/SignatureMethod/EmailToken.php b/lib/Service/IdentifyMethod/SignatureMethod/EmailToken.php index 87dfe68c2..9a970d971 100644 --- a/lib/Service/IdentifyMethod/SignatureMethod/EmailToken.php +++ b/lib/Service/IdentifyMethod/SignatureMethod/EmailToken.php @@ -25,10 +25,12 @@ class EmailToken extends AbstractSignatureMethod implements IToken { ); } + #[\Override] public function validateToSign(): void { $this->throwIfInvalidToken(); } + #[\Override] public function toArray(): array { $entity = $this->getEntity(); @@ -71,6 +73,7 @@ class EmailToken extends AbstractSignatureMethod implements IToken { return $blur->make(); } + #[\Override] public function requestCode(string $identifier, string $method): void { $signRequestMapper = $this->identifyService->getSignRequestMapper(); $signRequest = $signRequestMapper->getById($this->getEntity()->getSignRequestId()); diff --git a/lib/Service/IdentifyMethod/SignatureMethod/Password.php b/lib/Service/IdentifyMethod/SignatureMethod/Password.php index 9e96918a6..f3caa5b2c 100644 --- a/lib/Service/IdentifyMethod/SignatureMethod/Password.php +++ b/lib/Service/IdentifyMethod/SignatureMethod/Password.php @@ -27,6 +27,7 @@ class Password extends AbstractSignatureMethod { ); } + #[\Override] public function validateToSign(): void { $this->validateToIdentify(); try { @@ -39,6 +40,7 @@ class Password extends AbstractSignatureMethod { } } + #[\Override] public function validateToIdentify(): void { $this->pkcs12Handler->setPassword($this->codeSentByUser); $pfx = $this->pkcs12Handler->getPfxOfCurrentSigner($this->userSession->getUser()?->getUID()); @@ -47,6 +49,7 @@ class Password extends AbstractSignatureMethod { } } + #[\Override] public function toArray(): array { $return = parent::toArray(); $return['hasSignatureFile'] = $this->hasSignatureFile(); diff --git a/lib/Service/IdentifyMethod/SignatureMethod/TwofactorGatewayToken.php b/lib/Service/IdentifyMethod/SignatureMethod/TwofactorGatewayToken.php index 20fdeb47f..afa500194 100644 --- a/lib/Service/IdentifyMethod/SignatureMethod/TwofactorGatewayToken.php +++ b/lib/Service/IdentifyMethod/SignatureMethod/TwofactorGatewayToken.php @@ -23,10 +23,12 @@ class TwofactorGatewayToken extends AbstractSignatureMethod implements IToken { ); } + #[\Override] public function validateToSign(): void { $this->throwIfInvalidToken(); } + #[\Override] public function toArray(): array { $entity = $this->getEntity(); @@ -74,6 +76,7 @@ class TwofactorGatewayToken extends AbstractSignatureMethod implements IToken { return $start . str_repeat('*', $maskedLength) . $end; } + #[\Override] public function requestCode(string $identifier, string $method): void { $signRequestMapper = $this->identifyService->getSignRequestMapper(); $signRequest = $signRequestMapper->getById($this->getEntity()->getSignRequestId()); diff --git a/lib/Service/IdentifyMethod/Sms.php b/lib/Service/IdentifyMethod/Sms.php index 113262343..5bc10ae7a 100644 --- a/lib/Service/IdentifyMethod/Sms.php +++ b/lib/Service/IdentifyMethod/Sms.php @@ -16,6 +16,7 @@ class Sms extends TwofactorGateway { ISignatureMethod::SIGNATURE_METHOD_SMS, ]; + #[\Override] public function getFriendlyName(): string { // TRANSLATORS Name of possible authenticator method. This signalize that the signer could be identified by SMS return $this->identifyService->getL10n()->t('SMS'); diff --git a/lib/Service/IdentifyMethod/Telegram.php b/lib/Service/IdentifyMethod/Telegram.php index 84e6a38c1..d82667195 100644 --- a/lib/Service/IdentifyMethod/Telegram.php +++ b/lib/Service/IdentifyMethod/Telegram.php @@ -16,6 +16,7 @@ class Telegram extends TwofactorGateway { ISignatureMethod::SIGNATURE_METHOD_TELEGRAM, ]; + #[\Override] public function getFriendlyName(): string { // TRANSLATORS Name of possible authenticator method. This signalize that the signer could be identified by Telegram return $this->identifyService->getL10n()->t('Telegram'); diff --git a/lib/Service/IdentifyMethod/TwofactorGateway.php b/lib/Service/IdentifyMethod/TwofactorGateway.php index 3b863bdd1..ba8cec49a 100644 --- a/lib/Service/IdentifyMethod/TwofactorGateway.php +++ b/lib/Service/IdentifyMethod/TwofactorGateway.php @@ -36,6 +36,7 @@ class TwofactorGateway extends AbstractIdentifyMethod { ); } + #[\Override] public function validateToIdentify(): void { $this->throwIfMaximumValidityExpired(); $this->throwIfRenewalIntervalExpired(); @@ -45,6 +46,7 @@ class TwofactorGateway extends AbstractIdentifyMethod { $this->updateIdentifiedAt(); } + #[\Override] public function validateToSign(): void { $this->throwIfInvalidToken(); $this->throwIfMaximumValidityExpired(); @@ -70,6 +72,7 @@ class TwofactorGateway extends AbstractIdentifyMethod { return $gateway->isComplete(); } + #[\Override] public function getSettings(): array { if (!empty($this->settings)) { return $this->settings; diff --git a/lib/Service/IdentifyMethod/Whatsapp.php b/lib/Service/IdentifyMethod/Whatsapp.php index 2fa12c239..f5f2bfd9b 100644 --- a/lib/Service/IdentifyMethod/Whatsapp.php +++ b/lib/Service/IdentifyMethod/Whatsapp.php @@ -16,6 +16,7 @@ class Whatsapp extends TwofactorGateway { ISignatureMethod::SIGNATURE_METHOD_WHATSAPP, ]; + #[\Override] public function getFriendlyName(): string { // TRANSLATORS Name of possible authenticator method. This signalize that the signer could be identified by WhatsApp return $this->identifyService->getL10n()->t('WhatsApp'); diff --git a/lib/Service/IdentifyMethod/Xmpp.php b/lib/Service/IdentifyMethod/Xmpp.php index 44797f6d3..2ca471066 100644 --- a/lib/Service/IdentifyMethod/Xmpp.php +++ b/lib/Service/IdentifyMethod/Xmpp.php @@ -16,6 +16,7 @@ class Xmpp extends TwofactorGateway { ISignatureMethod::SIGNATURE_METHOD_XMPP, ]; + #[\Override] public function getFriendlyName(): string { // TRANSLATORS Name of possible authenticator method. This signalize that the signer could be identified by XMPP return $this->identifyService->getL10n()->t('XMPP'); diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index 648f6c10b..b924765b9 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -32,6 +32,7 @@ class Admin implements ISettings { private SignatureBackgroundService $signatureBackgroundService, ) { } + #[\Override] public function getForm(): TemplateResponse { Util::addScript(Application::APP_ID, 'libresign-settings'); try { @@ -66,6 +67,7 @@ class Admin implements ISettings { /** * @psalm-return 'libresign' */ + #[\Override] public function getSection(): string { return Application::APP_ID; } @@ -73,6 +75,7 @@ class Admin implements ISettings { /** * @psalm-return 100 */ + #[\Override] public function getPriority(): int { return 100; } diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php index ccb3e23b8..97bca9f29 100644 --- a/lib/Settings/AdminSettings.php +++ b/lib/Settings/AdminSettings.php @@ -23,6 +23,7 @@ class AdminSettings implements IIconSection { /** * {@inheritdoc} */ + #[\Override] public function getID(): string { return Application::APP_ID; } @@ -30,6 +31,7 @@ class AdminSettings implements IIconSection { /** * {@inheritdoc} */ + #[\Override] public function getName(): string { return $this->l->t('LibreSign'); } @@ -37,6 +39,7 @@ class AdminSettings implements IIconSection { /** * {@inheritdoc} */ + #[\Override] public function getPriority(): int { return 60; } @@ -44,6 +47,7 @@ class AdminSettings implements IIconSection { /** * {@inheritdoc} */ + #[\Override] public function getIcon(): string { return $this->urlGenerator->imagePath(Application::APP_ID, 'app-dark.svg'); }