diff --git a/apps/admin_audit/lib/AppInfo/Application.php b/apps/admin_audit/lib/AppInfo/Application.php index 077cc4c47ad..8c936b5accd 100644 --- a/apps/admin_audit/lib/AppInfo/Application.php +++ b/apps/admin_audit/lib/AppInfo/Application.php @@ -79,6 +79,7 @@ class Application extends App implements IBootstrap { parent::__construct('admin_audit'); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerService(IAuditLogger::class, function (ContainerInterface $c) { return new AuditLogger($c->get(ILogFactory::class), $c->get(IConfig::class)); @@ -132,6 +133,7 @@ class Application extends App implements IBootstrap { $context->registerEventListener(CacheEntryRemovedEvent::class, CacheEventListener::class); } + #[\Override] public function boot(IBootContext $context): void { /** @var IAuditLogger $logger */ $logger = $context->getAppContainer()->get(IAuditLogger::class); diff --git a/apps/admin_audit/lib/AuditLogger.php b/apps/admin_audit/lib/AuditLogger.php index a622794dc08..147f228851a 100644 --- a/apps/admin_audit/lib/AuditLogger.php +++ b/apps/admin_audit/lib/AuditLogger.php @@ -35,38 +35,47 @@ class AuditLogger implements IAuditLogger { $this->parentLogger = $logFactory->getCustomPsrLogger($logFile, $auditType, $auditTag); } + #[\Override] public function emergency($message, array $context = []): void { $this->parentLogger->emergency($message, $context); } + #[\Override] public function alert($message, array $context = []): void { $this->parentLogger->alert($message, $context); } + #[\Override] public function critical($message, array $context = []): void { $this->parentLogger->critical($message, $context); } + #[\Override] public function error($message, array $context = []): void { $this->parentLogger->error($message, $context); } + #[\Override] public function warning($message, array $context = []): void { $this->parentLogger->warning($message, $context); } + #[\Override] public function notice($message, array $context = []): void { $this->parentLogger->notice($message, $context); } + #[\Override] public function info($message, array $context = []): void { $this->parentLogger->info($message, $context); } + #[\Override] public function debug($message, array $context = []): void { $this->parentLogger->debug($message, $context); } + #[\Override] public function log($level, $message, array $context = []): void { $this->parentLogger->log($level, $message, $context); } diff --git a/apps/admin_audit/lib/BackgroundJobs/Rotate.php b/apps/admin_audit/lib/BackgroundJobs/Rotate.php index deb0f4a922c..bfc1b1d8a0d 100644 --- a/apps/admin_audit/lib/BackgroundJobs/Rotate.php +++ b/apps/admin_audit/lib/BackgroundJobs/Rotate.php @@ -24,6 +24,7 @@ class Rotate extends TimedJob { $this->setInterval(60 * 60 * 3); } + #[\Override] protected function run($argument): void { $default = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log'; $this->filePath = $this->config->getAppValue('admin_audit', 'logfile', $default); diff --git a/apps/admin_audit/lib/Listener/AppManagementEventListener.php b/apps/admin_audit/lib/Listener/AppManagementEventListener.php index c20bdd481d6..87b3f538fd3 100644 --- a/apps/admin_audit/lib/Listener/AppManagementEventListener.php +++ b/apps/admin_audit/lib/Listener/AppManagementEventListener.php @@ -20,6 +20,7 @@ use OCP\EventDispatcher\IEventListener; * @template-implements IEventListener */ class AppManagementEventListener extends Action implements IEventListener { + #[\Override] public function handle(Event $event): void { if ($event instanceof AppEnableEvent) { $this->appEnable($event); diff --git a/apps/admin_audit/lib/Listener/AuthEventListener.php b/apps/admin_audit/lib/Listener/AuthEventListener.php index 88be8555a4d..dc4d857f59c 100644 --- a/apps/admin_audit/lib/Listener/AuthEventListener.php +++ b/apps/admin_audit/lib/Listener/AuthEventListener.php @@ -22,6 +22,7 @@ use OCP\User\Events\UserLoggedInWithCookieEvent; * @template-implements IEventListener */ class AuthEventListener extends Action implements IEventListener { + #[\Override] public function handle(Event $event): void { if ($event instanceof BeforeUserLoggedInEvent) { $this->beforeUserLoggedIn($event); diff --git a/apps/admin_audit/lib/Listener/CacheEventListener.php b/apps/admin_audit/lib/Listener/CacheEventListener.php index 63d7017b3c0..76b0f94e4d7 100644 --- a/apps/admin_audit/lib/Listener/CacheEventListener.php +++ b/apps/admin_audit/lib/Listener/CacheEventListener.php @@ -19,6 +19,7 @@ use OCP\Files\Cache\CacheEntryRemovedEvent; * @template-implements IEventListener */ class CacheEventListener extends Action implements IEventListener { + #[\Override] public function handle(Event $event): void { if ($event instanceof CacheEntryInsertedEvent) { $this->entryInserted($event); diff --git a/apps/admin_audit/lib/Listener/ConsoleEventListener.php b/apps/admin_audit/lib/Listener/ConsoleEventListener.php index aa6029f2016..8527c6331fd 100644 --- a/apps/admin_audit/lib/Listener/ConsoleEventListener.php +++ b/apps/admin_audit/lib/Listener/ConsoleEventListener.php @@ -18,6 +18,7 @@ use OCP\EventDispatcher\IEventListener; * @template-implements IEventListener */ class ConsoleEventListener extends Action implements IEventListener { + #[\Override] public function handle(Event $event): void { if ($event instanceof ConsoleEvent) { $this->runCommand($event); diff --git a/apps/admin_audit/lib/Listener/CriticalActionPerformedEventListener.php b/apps/admin_audit/lib/Listener/CriticalActionPerformedEventListener.php index bc3652a08bc..38c6922b015 100644 --- a/apps/admin_audit/lib/Listener/CriticalActionPerformedEventListener.php +++ b/apps/admin_audit/lib/Listener/CriticalActionPerformedEventListener.php @@ -16,6 +16,7 @@ use OCP\Log\Audit\CriticalActionPerformedEvent; /** @template-implements IEventListener */ class CriticalActionPerformedEventListener extends Action implements IEventListener { + #[\Override] public function handle(Event $event): void { if (!($event instanceof CriticalActionPerformedEvent)) { return; diff --git a/apps/admin_audit/lib/Listener/FileEventListener.php b/apps/admin_audit/lib/Listener/FileEventListener.php index 46a4962123b..20c0a2831f9 100644 --- a/apps/admin_audit/lib/Listener/FileEventListener.php +++ b/apps/admin_audit/lib/Listener/FileEventListener.php @@ -23,6 +23,7 @@ use Psr\Log\LoggerInterface; * @template-implements IEventListener */ class FileEventListener extends Action implements IEventListener { + #[\Override] public function handle(Event $event): void { if ($event instanceof BeforePreviewFetchedEvent) { $this->beforePreviewFetched($event); diff --git a/apps/admin_audit/lib/Listener/GroupManagementEventListener.php b/apps/admin_audit/lib/Listener/GroupManagementEventListener.php index df937447e70..b17ff748296 100644 --- a/apps/admin_audit/lib/Listener/GroupManagementEventListener.php +++ b/apps/admin_audit/lib/Listener/GroupManagementEventListener.php @@ -21,6 +21,7 @@ use OCP\Group\Events\UserRemovedEvent; * @template-implements IEventListener */ class GroupManagementEventListener extends Action implements IEventListener { + #[\Override] public function handle(Event $event): void { if ($event instanceof UserAddedEvent) { $this->userAdded($event); diff --git a/apps/admin_audit/lib/Listener/SecurityEventListener.php b/apps/admin_audit/lib/Listener/SecurityEventListener.php index 17253aa384c..192433c54b9 100644 --- a/apps/admin_audit/lib/Listener/SecurityEventListener.php +++ b/apps/admin_audit/lib/Listener/SecurityEventListener.php @@ -19,6 +19,7 @@ use OCP\EventDispatcher\IEventListener; * @template-implements IEventListener */ class SecurityEventListener extends Action implements IEventListener { + #[\Override] public function handle(Event $event): void { if ($event instanceof TwoFactorProviderChallengePassed) { $this->twoFactorProviderChallengePassed($event); diff --git a/apps/admin_audit/lib/Listener/SharingEventListener.php b/apps/admin_audit/lib/Listener/SharingEventListener.php index 48827912053..3131a09aaab 100644 --- a/apps/admin_audit/lib/Listener/SharingEventListener.php +++ b/apps/admin_audit/lib/Listener/SharingEventListener.php @@ -20,6 +20,7 @@ use OCP\Share\IShare; * @template-implements IEventListener */ class SharingEventListener extends Action implements IEventListener { + #[\Override] public function handle(Event $event): void { if ($event instanceof ShareCreatedEvent) { $this->shareCreated($event); diff --git a/apps/admin_audit/lib/Listener/UserManagementEventListener.php b/apps/admin_audit/lib/Listener/UserManagementEventListener.php index c22d04dce9a..37767d11f4b 100644 --- a/apps/admin_audit/lib/Listener/UserManagementEventListener.php +++ b/apps/admin_audit/lib/Listener/UserManagementEventListener.php @@ -23,6 +23,7 @@ use OCP\User\Events\UserIdUnassignedEvent; * @template-implements IEventListener */ class UserManagementEventListener extends Action implements IEventListener { + #[\Override] public function handle(Event $event): void { if ($event instanceof UserCreatedEvent) { $this->userCreated($event); diff --git a/apps/cloud_federation_api/lib/AppInfo/Application.php b/apps/cloud_federation_api/lib/AppInfo/Application.php index e34b2f2dc3d..39238b3dae7 100644 --- a/apps/cloud_federation_api/lib/AppInfo/Application.php +++ b/apps/cloud_federation_api/lib/AppInfo/Application.php @@ -21,10 +21,12 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerCapability(Capabilities::class); } + #[\Override] public function boot(IBootContext $context): void { } } diff --git a/apps/cloud_federation_api/lib/Capabilities.php b/apps/cloud_federation_api/lib/Capabilities.php index a7417c43c2f..99b7ca528cc 100644 --- a/apps/cloud_federation_api/lib/Capabilities.php +++ b/apps/cloud_federation_api/lib/Capabilities.php @@ -26,6 +26,7 @@ class Capabilities implements ICapability, IInitialStateExcludedCapability { * @return array> * @throws OCMArgumentException */ + #[\Override] public function getCapabilities() { $provider = $this->ocmDiscoveryService->getLocalOCMProvider(false); return ['ocm' => $provider->jsonSerialize()]; diff --git a/apps/cloud_federation_api/lib/Migration/Version1016Date202502262004.php b/apps/cloud_federation_api/lib/Migration/Version1016Date202502262004.php index b582c827f91..7f0b6c760d5 100644 --- a/apps/cloud_federation_api/lib/Migration/Version1016Date202502262004.php +++ b/apps/cloud_federation_api/lib/Migration/Version1016Date202502262004.php @@ -24,6 +24,7 @@ class Version1016Date202502262004 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/comments/lib/Activity/Filter.php b/apps/comments/lib/Activity/Filter.php index 58777c3b03c..fe72acd3e6e 100644 --- a/apps/comments/lib/Activity/Filter.php +++ b/apps/comments/lib/Activity/Filter.php @@ -19,18 +19,22 @@ class Filter implements IFilter { ) { } + #[\Override] public function getIdentifier(): string { return 'comments'; } + #[\Override] public function getName(): string { return $this->l->t('Comments'); } + #[\Override] public function getPriority(): int { return 40; } + #[\Override] public function getIcon(): string { return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg')); } @@ -39,6 +43,7 @@ class Filter implements IFilter { * @param string[] $types * @return string[] An array of allowed apps from which activities should be displayed */ + #[\Override] public function filterTypes(array $types): array { return $types; } @@ -46,6 +51,7 @@ class Filter implements IFilter { /** * @return string[] An array of allowed apps from which activities should be displayed */ + #[\Override] public function allowedApps(): array { return ['comments']; } diff --git a/apps/comments/lib/Activity/Provider.php b/apps/comments/lib/Activity/Provider.php index a8c14b6686a..5ed94a50aa5 100644 --- a/apps/comments/lib/Activity/Provider.php +++ b/apps/comments/lib/Activity/Provider.php @@ -35,6 +35,7 @@ class Provider implements IProvider { * @throws UnknownActivityException * @since 11.0.0 */ + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== 'comments') { throw new UnknownActivityException(); diff --git a/apps/comments/lib/Activity/Setting.php b/apps/comments/lib/Activity/Setting.php index 2a44c0889f5..46bf8d8790a 100644 --- a/apps/comments/lib/Activity/Setting.php +++ b/apps/comments/lib/Activity/Setting.php @@ -17,38 +17,47 @@ class Setting extends ActivitySettings { ) { } + #[\Override] public function getIdentifier(): string { return 'comments'; } + #[\Override] public function getName(): string { return $this->l->t('Comments for files'); } + #[\Override] public function getGroupIdentifier(): string { return 'files'; } + #[\Override] public function getGroupName(): string { return $this->l->t('Files'); } + #[\Override] public function getPriority(): int { return 50; } + #[\Override] public function canChangeStream(): bool { return true; } + #[\Override] public function isDefaultEnabledStream(): bool { return true; } + #[\Override] public function canChangeMail(): bool { return true; } + #[\Override] public function isDefaultEnabledMail(): bool { return false; } diff --git a/apps/comments/lib/AppInfo/Application.php b/apps/comments/lib/AppInfo/Application.php index 9d1132f5ce5..f4c1546115a 100644 --- a/apps/comments/lib/AppInfo/Application.php +++ b/apps/comments/lib/AppInfo/Application.php @@ -32,6 +32,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID, $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerCapability(Capabilities::class); @@ -59,6 +60,7 @@ class Application extends App implements IBootstrap { $context->registerNotifierService(Notifier::class); } + #[\Override] public function boot(IBootContext $context): void { } } diff --git a/apps/comments/lib/Capabilities.php b/apps/comments/lib/Capabilities.php index 2057803d867..148b1db9ee4 100644 --- a/apps/comments/lib/Capabilities.php +++ b/apps/comments/lib/Capabilities.php @@ -14,6 +14,7 @@ class Capabilities implements ICapability { /** * @return array{files: array{comments: bool}} */ + #[\Override] public function getCapabilities(): array { return [ 'files' => [ diff --git a/apps/comments/lib/Collaboration/CommentersSorter.php b/apps/comments/lib/Collaboration/CommentersSorter.php index eb0ea469cfd..f0ecc7fb80b 100644 --- a/apps/comments/lib/Collaboration/CommentersSorter.php +++ b/apps/comments/lib/Collaboration/CommentersSorter.php @@ -15,6 +15,7 @@ class CommentersSorter implements ISorter { ) { } + #[\Override] public function getId(): string { return 'commenters'; } @@ -26,6 +27,7 @@ class CommentersSorter implements ISorter { * @param array &$sortArray * @param array $context */ + #[\Override] public function sort(array &$sortArray, array $context): void { if (!isset($context['itemType'], $context['itemId'])) { return; diff --git a/apps/comments/lib/Listener/CommentsEntityEventListener.php b/apps/comments/lib/Listener/CommentsEntityEventListener.php index 50e05bca539..b2ce7491211 100644 --- a/apps/comments/lib/Listener/CommentsEntityEventListener.php +++ b/apps/comments/lib/Listener/CommentsEntityEventListener.php @@ -21,6 +21,7 @@ class CommentsEntityEventListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof CommentsEntityEvent)) { // Unrelated diff --git a/apps/comments/lib/Listener/CommentsEventListener.php b/apps/comments/lib/Listener/CommentsEventListener.php index 55a1190ea11..69d4e4b8642 100644 --- a/apps/comments/lib/Listener/CommentsEventListener.php +++ b/apps/comments/lib/Listener/CommentsEventListener.php @@ -24,6 +24,7 @@ class CommentsEventListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof CommentsEvent) { return; diff --git a/apps/comments/lib/Listener/LoadAdditionalScripts.php b/apps/comments/lib/Listener/LoadAdditionalScripts.php index 81e1bfe5310..c0bb998c757 100644 --- a/apps/comments/lib/Listener/LoadAdditionalScripts.php +++ b/apps/comments/lib/Listener/LoadAdditionalScripts.php @@ -16,6 +16,7 @@ use OCP\Util; /** @template-implements IEventListener */ class LoadAdditionalScripts implements IEventListener { + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoadAdditionalScriptsEvent)) { return; diff --git a/apps/comments/lib/Listener/LoadSidebarScripts.php b/apps/comments/lib/Listener/LoadSidebarScripts.php index 8629883ba04..c111a62ad6b 100644 --- a/apps/comments/lib/Listener/LoadSidebarScripts.php +++ b/apps/comments/lib/Listener/LoadSidebarScripts.php @@ -26,6 +26,7 @@ class LoadSidebarScripts implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoadSidebar)) { return; diff --git a/apps/comments/lib/MaxAutoCompleteResultsInitialState.php b/apps/comments/lib/MaxAutoCompleteResultsInitialState.php index b4c8f8719db..d9852f538aa 100644 --- a/apps/comments/lib/MaxAutoCompleteResultsInitialState.php +++ b/apps/comments/lib/MaxAutoCompleteResultsInitialState.php @@ -17,10 +17,12 @@ class MaxAutoCompleteResultsInitialState extends InitialStateProvider { ) { } + #[\Override] public function getKey(): string { return 'maxAutoCompleteResults'; } + #[\Override] public function getData(): int { return (int)$this->config->getAppValue('comments', 'maxAutoCompleteResults', '10'); } diff --git a/apps/comments/lib/Notification/Notifier.php b/apps/comments/lib/Notification/Notifier.php index 607d087f03e..9f2061d8a1d 100644 --- a/apps/comments/lib/Notification/Notifier.php +++ b/apps/comments/lib/Notification/Notifier.php @@ -35,6 +35,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getID(): string { return 'comments'; } @@ -45,6 +46,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getName(): string { return $this->l10nFactory->get('comments')->t('Comments'); } @@ -57,6 +59,7 @@ class Notifier implements INotifier { * @throws AlreadyProcessedException When the notification is not needed anymore and should be deleted * @since 9.0.0 */ + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'comments') { throw new UnknownNotificationException(); diff --git a/apps/comments/lib/Search/CommentsSearchProvider.php b/apps/comments/lib/Search/CommentsSearchProvider.php index 4d316525f9b..ce62d0760f7 100644 --- a/apps/comments/lib/Search/CommentsSearchProvider.php +++ b/apps/comments/lib/Search/CommentsSearchProvider.php @@ -34,14 +34,17 @@ class CommentsSearchProvider implements IProvider { ) { } + #[\Override] public function getId(): string { return 'comments'; } + #[\Override] public function getName(): string { return $this->l10n->t('Comments'); } + #[\Override] public function getOrder(string $route, array $routeParameters): int { if ($route === 'files.View.index') { // Files first @@ -50,6 +53,7 @@ class CommentsSearchProvider implements IProvider { return 10; } + #[\Override] public function search(IUser $user, ISearchQuery $query): SearchResult { $userFolder = $this->rootFolder->getUserFolder($user->getUID()); diff --git a/apps/contactsinteraction/lib/AddressBook.php b/apps/contactsinteraction/lib/AddressBook.php index 601bc366993..6ec6ba5f12d 100644 --- a/apps/contactsinteraction/lib/AddressBook.php +++ b/apps/contactsinteraction/lib/AddressBook.php @@ -38,6 +38,7 @@ class AddressBook extends ExternalAddressBook implements IACL { * @inheritDoc * @throws Exception */ + #[\Override] public function delete(): void { throw new Exception('This addressbook is immutable'); } @@ -46,6 +47,7 @@ class AddressBook extends ExternalAddressBook implements IACL { * @inheritDoc * @throws Exception */ + #[\Override] public function createFile($name, $data = null) { throw new Exception('This addressbook is immutable'); } @@ -54,6 +56,7 @@ class AddressBook extends ExternalAddressBook implements IACL { * @inheritDoc * @throws NotFound */ + #[\Override] public function getChild($name): Card { try { return new Card( @@ -72,6 +75,7 @@ class AddressBook extends ExternalAddressBook implements IACL { /** * @inheritDoc */ + #[\Override] public function getChildren(): array { return array_map( function (RecentContact $contact) { @@ -88,6 +92,7 @@ class AddressBook extends ExternalAddressBook implements IACL { /** * @inheritDoc */ + #[\Override] public function childExists($name): bool { try { $this->mapper->find( @@ -103,6 +108,7 @@ class AddressBook extends ExternalAddressBook implements IACL { /** * @inheritDoc */ + #[\Override] public function getLastModified(): ?int { return $this->mapper->findLastUpdatedForUserId($this->getUid()); } @@ -111,6 +117,7 @@ class AddressBook extends ExternalAddressBook implements IACL { * @inheritDoc * @throws Exception */ + #[\Override] public function propPatch(PropPatch $propPatch) { throw new Exception('This addressbook is immutable'); } @@ -118,6 +125,7 @@ class AddressBook extends ExternalAddressBook implements IACL { /** * @inheritDoc */ + #[\Override] public function getProperties($properties): array { return [ 'principaluri' => $this->principalUri, @@ -127,6 +135,7 @@ class AddressBook extends ExternalAddressBook implements IACL { ]; } + #[\Override] public function getOwner(): string { return $this->principalUri; } @@ -134,6 +143,7 @@ class AddressBook extends ExternalAddressBook implements IACL { /** * @inheritDoc */ + #[\Override] public function getACL(): array { return [ [ diff --git a/apps/contactsinteraction/lib/AddressBookProvider.php b/apps/contactsinteraction/lib/AddressBookProvider.php index bf85409a143..5e4154ae7f0 100644 --- a/apps/contactsinteraction/lib/AddressBookProvider.php +++ b/apps/contactsinteraction/lib/AddressBookProvider.php @@ -25,6 +25,7 @@ class AddressBookProvider implements IAddressBookProvider { /** * @inheritDoc */ + #[\Override] public function getAppId(): string { return Application::APP_ID; } @@ -32,6 +33,7 @@ class AddressBookProvider implements IAddressBookProvider { /** * @inheritDoc */ + #[\Override] public function fetchAllForAddressBookHome(string $principalUri): array { return [ new AddressBook($this->mapper, $this->l10n, $principalUri) @@ -41,6 +43,7 @@ class AddressBookProvider implements IAddressBookProvider { /** * @inheritDoc */ + #[\Override] public function hasAddressBookInAddressBookHome(string $principalUri, string $uri): bool { return $uri === AddressBook::URI; } @@ -48,6 +51,7 @@ class AddressBookProvider implements IAddressBookProvider { /** * @inheritDoc */ + #[\Override] public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook { if ($uri === AddressBook::URI) { return new AddressBook($this->mapper, $this->l10n, $principalUri); diff --git a/apps/contactsinteraction/lib/AppInfo/Application.php b/apps/contactsinteraction/lib/AppInfo/Application.php index 6e3c1660ddc..e9f6fe49400 100644 --- a/apps/contactsinteraction/lib/AppInfo/Application.php +++ b/apps/contactsinteraction/lib/AppInfo/Application.php @@ -24,11 +24,13 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerEventListener(ContactInteractedWithEvent::class, ContactInteractionListener::class); $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); } + #[\Override] public function boot(IBootContext $context): void { } } diff --git a/apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php b/apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php index b89a2c1fbb3..218c7dec1c3 100644 --- a/apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php +++ b/apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php @@ -25,6 +25,7 @@ class CleanupJob extends TimedJob { } + #[\Override] protected function run(mixed $argument): void { $time = $this->time->getDateTime(); $time->modify('-7days'); diff --git a/apps/contactsinteraction/lib/Card.php b/apps/contactsinteraction/lib/Card.php index cfd6798ab06..813195c0bc9 100644 --- a/apps/contactsinteraction/lib/Card.php +++ b/apps/contactsinteraction/lib/Card.php @@ -28,6 +28,7 @@ class Card implements ICard, IACL { /** * @inheritDoc */ + #[\Override] public function getOwner(): ?string { return $this->principal; } @@ -35,6 +36,7 @@ class Card implements ICard, IACL { /** * @inheritDoc */ + #[\Override] public function getACL(): array { return [ [ @@ -55,6 +57,7 @@ class Card implements ICard, IACL { /** * @inheritDoc */ + #[\Override] public function put($data): ?string { throw new NotImplemented(); } @@ -62,6 +65,7 @@ class Card implements ICard, IACL { /** * @inheritDoc */ + #[\Override] public function get(): string { return $this->contact->getCard(); } @@ -69,6 +73,7 @@ class Card implements ICard, IACL { /** * @inheritDoc */ + #[\Override] public function getContentType(): ?string { return 'text/vcard; charset=utf-8'; } @@ -76,6 +81,7 @@ class Card implements ICard, IACL { /** * @inheritDoc */ + #[\Override] public function getETag(): ?string { return '"' . md5((string)$this->getLastModified()) . '"'; } @@ -83,6 +89,7 @@ class Card implements ICard, IACL { /** * @inheritDoc */ + #[\Override] public function getSize(): int { return strlen($this->contact->getCard()); } @@ -90,6 +97,7 @@ class Card implements ICard, IACL { /** * @inheritDoc */ + #[\Override] public function delete(): void { $this->mapper->delete($this->contact); } @@ -97,6 +105,7 @@ class Card implements ICard, IACL { /** * @inheritDoc */ + #[\Override] public function getName(): string { return (string)$this->contact->getId(); } @@ -104,6 +113,7 @@ class Card implements ICard, IACL { /** * @inheritDoc */ + #[\Override] public function setName($name): void { throw new NotImplemented(); } @@ -111,6 +121,7 @@ class Card implements ICard, IACL { /** * @inheritDoc */ + #[\Override] public function getLastModified(): ?int { return $this->contact->getLastContact(); } diff --git a/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php b/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php index dc5407a25ec..e61f23a7b18 100644 --- a/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php +++ b/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php @@ -39,6 +39,7 @@ class ContactInteractionListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof ContactInteractedWithEvent)) { return; diff --git a/apps/contactsinteraction/lib/Migration/FixVcardCategory.php b/apps/contactsinteraction/lib/Migration/FixVcardCategory.php index 80e37249a4b..4d49600f766 100644 --- a/apps/contactsinteraction/lib/Migration/FixVcardCategory.php +++ b/apps/contactsinteraction/lib/Migration/FixVcardCategory.php @@ -28,10 +28,12 @@ class FixVcardCategory implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Fix category of recent contacts vcards'; } + #[\Override] public function run(IOutput $output): void { $query = $this->connection->getQueryBuilder(); diff --git a/apps/contactsinteraction/lib/Migration/Version010000Date20200304152605.php b/apps/contactsinteraction/lib/Migration/Version010000Date20200304152605.php index d3298702519..4757635db9a 100644 --- a/apps/contactsinteraction/lib/Migration/Version010000Date20200304152605.php +++ b/apps/contactsinteraction/lib/Migration/Version010000Date20200304152605.php @@ -23,6 +23,7 @@ class Version010000Date20200304152605 extends SimpleMigrationStep { * * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php index f4b590a9280..69094f6da84 100644 --- a/apps/dav/lib/AppInfo/Application.php +++ b/apps/dav/lib/AppInfo/Application.php @@ -118,6 +118,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerServiceAlias('CardDAVSyncService', SyncService::class); $context->registerService(AppCalendarPlugin::class, function (ContainerInterface $c) { @@ -235,6 +236,7 @@ class Application extends App implements IBootstrap { $context->registerConfigLexicon(ConfigLexicon::class); } + #[\Override] public function boot(IBootContext $context): void { // Load all dav apps $context->getServerContainer()->get(IAppManager::class)->loadApps(['dav']); diff --git a/apps/dav/lib/Avatars/AvatarHome.php b/apps/dav/lib/Avatars/AvatarHome.php index c3b95db1f4f..a804969ab56 100644 --- a/apps/dav/lib/Avatars/AvatarHome.php +++ b/apps/dav/lib/Avatars/AvatarHome.php @@ -28,14 +28,17 @@ class AvatarHome implements ICollection { ) { } + #[\Override] public function createFile($name, $data = null) { throw new Forbidden('Permission denied to create a file'); } + #[\Override] public function createDirectory($name) { throw new Forbidden('Permission denied to create a folder'); } + #[\Override] public function getChild($name) { $elements = pathinfo($name); $ext = $elements['extension'] ?? ''; @@ -53,6 +56,7 @@ class AvatarHome implements ICollection { return new AvatarNode($size, $ext, $avatar); } + #[\Override] public function getChildren() { try { return [ @@ -63,6 +67,7 @@ class AvatarHome implements ICollection { } } + #[\Override] public function childExists($name) { try { $ret = $this->getChild($name); @@ -74,15 +79,18 @@ class AvatarHome implements ICollection { } } + #[\Override] public function delete() { throw new Forbidden('Permission denied to delete this folder'); } + #[\Override] public function getName() { [,$name] = Uri\split($this->principalInfo['uri']); return $name; } + #[\Override] public function setName($name) { throw new Forbidden('Permission denied to rename this folder'); } @@ -92,6 +100,7 @@ class AvatarHome implements ICollection { * * @return int|null */ + #[\Override] public function getLastModified() { return null; } diff --git a/apps/dav/lib/Avatars/AvatarNode.php b/apps/dav/lib/Avatars/AvatarNode.php index b3a605fbb02..951262f3a59 100644 --- a/apps/dav/lib/Avatars/AvatarNode.php +++ b/apps/dav/lib/Avatars/AvatarNode.php @@ -32,10 +32,12 @@ class AvatarNode extends File { * * @return string */ + #[\Override] public function getName() { return "$this->size.$this->ext"; } + #[\Override] public function get() { $image = $this->avatar->get($this->size); $res = $image->resource(); @@ -57,6 +59,7 @@ class AvatarNode extends File { * * @return string|null */ + #[\Override] public function getContentType() { if ($this->ext === 'png') { return 'image/png'; @@ -64,10 +67,12 @@ class AvatarNode extends File { return 'image/jpeg'; } + #[\Override] public function getETag() { return $this->avatar->getFile($this->size)->getEtag(); } + #[\Override] public function getLastModified() { return $this->avatar->getFile($this->size)->getMTime(); } diff --git a/apps/dav/lib/Avatars/RootCollection.php b/apps/dav/lib/Avatars/RootCollection.php index 033dcaf7a5c..c9c9b14ef5c 100644 --- a/apps/dav/lib/Avatars/RootCollection.php +++ b/apps/dav/lib/Avatars/RootCollection.php @@ -23,11 +23,13 @@ class RootCollection extends AbstractPrincipalCollection { * @param array $principalInfo * @return AvatarHome */ + #[\Override] public function getChildForPrincipal(array $principalInfo) { $avatarManager = Server::get(IAvatarManager::class); return new AvatarHome($principalInfo, $avatarManager); } + #[\Override] public function getName() { return 'avatars'; } diff --git a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php index 974c7cd3239..db2dc48f20e 100644 --- a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php @@ -39,6 +39,7 @@ class BuildReminderIndexBackgroundJob extends QueuedJob { $this->timeFactory = $timeFactory; } + #[\Override] public function run($argument) { $offset = (int)$argument['offset']; $stopAt = (int)$argument['stopAt']; diff --git a/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php b/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php index c6edac4f228..c80844297cd 100644 --- a/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php +++ b/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php @@ -24,6 +24,7 @@ class CalendarRetentionJob extends TimedJob { $this->setTimeSensitivity(self::TIME_SENSITIVE); } + #[\Override] protected function run($argument): void { $this->service->cleanUp(); } diff --git a/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php b/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php index 49b6b1607ef..c84c8d0b2a8 100644 --- a/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php +++ b/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php @@ -24,6 +24,7 @@ class CleanupDirectLinksJob extends TimedJob { $this->setTimeSensitivity(self::TIME_INSENSITIVE); } + #[\Override] protected function run($argument) { // Delete all shares expired 24 hours ago $this->mapper->deleteExpired($this->time->getTime() - 60 * 60 * 24); diff --git a/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php b/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php index a5fb8ca7bba..daceb0ad165 100644 --- a/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php +++ b/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php @@ -25,6 +25,7 @@ class CleanupInvitationTokenJob extends TimedJob { $this->setTimeSensitivity(self::TIME_INSENSITIVE); } + #[\Override] public function run($argument): void { $query = $this->db->getQueryBuilder(); $query->delete('calendar_invitations') diff --git a/apps/dav/lib/BackgroundJob/CleanupOrphanedChildrenJob.php b/apps/dav/lib/BackgroundJob/CleanupOrphanedChildrenJob.php index 0f574df084f..fc6521baf82 100644 --- a/apps/dav/lib/BackgroundJob/CleanupOrphanedChildrenJob.php +++ b/apps/dav/lib/BackgroundJob/CleanupOrphanedChildrenJob.php @@ -34,6 +34,7 @@ class CleanupOrphanedChildrenJob extends QueuedJob { parent::__construct($time); } + #[\Override] protected function run($argument): void { $childTable = $argument[self::ARGUMENT_CHILD_TABLE]; $parentTable = $argument[self::ARGUMENT_PARENT_TABLE]; diff --git a/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php b/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php index bc306d58fe1..c943f58115e 100644 --- a/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php +++ b/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php @@ -27,6 +27,7 @@ class DeleteOutdatedSchedulingObjects extends TimedJob { /** * @param array $argument */ + #[\Override] protected function run($argument): void { $time = $this->time->getTime() - (60 * 60); $this->calDavBackend->deleteOutdatedSchedulingObjects($time, 50000); diff --git a/apps/dav/lib/BackgroundJob/EventReminderJob.php b/apps/dav/lib/BackgroundJob/EventReminderJob.php index 0e21e06fc35..76617a30c42 100644 --- a/apps/dav/lib/BackgroundJob/EventReminderJob.php +++ b/apps/dav/lib/BackgroundJob/EventReminderJob.php @@ -35,6 +35,7 @@ class EventReminderJob extends TimedJob { * @throws NotificationTypeDoesNotExistException * @throws NoUserException */ + #[\Override] public function run($argument):void { if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') { return; diff --git a/apps/dav/lib/BackgroundJob/FederatedCalendarPeriodicSyncJob.php b/apps/dav/lib/BackgroundJob/FederatedCalendarPeriodicSyncJob.php index f64973fc558..df14a1b85a9 100644 --- a/apps/dav/lib/BackgroundJob/FederatedCalendarPeriodicSyncJob.php +++ b/apps/dav/lib/BackgroundJob/FederatedCalendarPeriodicSyncJob.php @@ -34,6 +34,7 @@ class FederatedCalendarPeriodicSyncJob extends TimedJob { $this->setInterval(3600); } + #[\Override] protected function run($argument): void { if (!$this->calendarFederationConfig->isFederationEnabled()) { return; diff --git a/apps/dav/lib/BackgroundJob/FederatedCalendarSyncJob.php b/apps/dav/lib/BackgroundJob/FederatedCalendarSyncJob.php index 9a3a7d89ca4..d3319187e9b 100644 --- a/apps/dav/lib/BackgroundJob/FederatedCalendarSyncJob.php +++ b/apps/dav/lib/BackgroundJob/FederatedCalendarSyncJob.php @@ -33,6 +33,7 @@ class FederatedCalendarSyncJob extends QueuedJob { $this->setAllowParallelRuns(false); } + #[\Override] protected function run($argument): void { if (!$this->calendarFederationConfig->isFederationEnabled()) { return; diff --git a/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php b/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php index 6d94f4810ed..b32759ac527 100644 --- a/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php @@ -23,6 +23,7 @@ class GenerateBirthdayCalendarBackgroundJob extends QueuedJob { parent::__construct($time); } + #[\Override] public function run($argument) { $userId = $argument['userId']; $purgeBeforeGenerating = $argument['purgeBeforeGenerating'] ?? false; diff --git a/apps/dav/lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php b/apps/dav/lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php index 60e638b1822..24dc4ba2b7e 100644 --- a/apps/dav/lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php +++ b/apps/dav/lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php @@ -35,6 +35,7 @@ class OutOfOfficeEventDispatcherJob extends QueuedJob { parent::__construct($time); } + #[\Override] public function run($argument): void { $id = $argument['id']; $event = $argument['event']; diff --git a/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php b/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php index 8746588acc7..b522ebb5b32 100644 --- a/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php +++ b/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php @@ -30,6 +30,7 @@ class PruneOutdatedSyncTokensJob extends TimedJob { $this->setTimeSensitivity(self::TIME_INSENSITIVE); } + #[\Override] public function run($argument) { $limit = max(1, (int)$this->config->getAppValue(Application::APP_ID, 'totalNumberOfSyncTokensToKeep', '10000')); $retention = max(7, (int)$this->config->getAppValue(Application::APP_ID, 'syncTokensRetentionDays', '60')) * 24 * 3600; diff --git a/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php b/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php index e96735ca50b..7e24a96df2f 100644 --- a/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php +++ b/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php @@ -33,6 +33,7 @@ class RefreshWebcalJob extends Job { * * @inheritdoc */ + #[\Override] public function start(IJobList $jobList): void { $subscription = $this->refreshWebcalService->getSubscription($this->argument['principaluri'], $this->argument['uri']); if (!$subscription) { @@ -69,6 +70,7 @@ class RefreshWebcalJob extends Job { /** * @param array $argument */ + #[\Override] protected function run($argument) { $this->refreshWebcalService->refreshSubscription($argument['principaluri'], $argument['uri']); } diff --git a/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php b/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php index 7ec5b7fba79..7ce7494aa19 100644 --- a/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php +++ b/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php @@ -34,6 +34,7 @@ class RegisterRegenerateBirthdayCalendars extends QueuedJob { /** * @inheritDoc */ + #[\Override] public function run($argument) { $this->userManager->callForSeenUsers(function (IUser $user): void { $this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [ diff --git a/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php b/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php index b7688ea32d8..13ccb1077b5 100644 --- a/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php @@ -27,6 +27,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { $this->setTimeSensitivity(self::TIME_SENSITIVE); } + #[\Override] public function run($argument): void { $this->resourceManager->update(); $this->roomManager->update(); diff --git a/apps/dav/lib/BackgroundJob/UploadCleanup.php b/apps/dav/lib/BackgroundJob/UploadCleanup.php index a394b7356bd..836b60e1b48 100644 --- a/apps/dav/lib/BackgroundJob/UploadCleanup.php +++ b/apps/dav/lib/BackgroundJob/UploadCleanup.php @@ -34,6 +34,7 @@ class UploadCleanup extends TimedJob { $this->setTimeSensitivity(self::TIME_INSENSITIVE); } + #[\Override] protected function run($argument) { $uid = $argument['uid']; $folder = $argument['folder']; diff --git a/apps/dav/lib/BackgroundJob/UserStatusAutomation.php b/apps/dav/lib/BackgroundJob/UserStatusAutomation.php index 027b3349802..ea4f67f7a14 100644 --- a/apps/dav/lib/BackgroundJob/UserStatusAutomation.php +++ b/apps/dav/lib/BackgroundJob/UserStatusAutomation.php @@ -49,6 +49,7 @@ class UserStatusAutomation extends TimedJob { /** * @inheritDoc */ + #[\Override] protected function run($argument) { if (!isset($argument['userId'])) { $this->jobList->remove(self::class, $argument); diff --git a/apps/dav/lib/BulkUpload/BulkUploadPlugin.php b/apps/dav/lib/BulkUpload/BulkUploadPlugin.php index 6a99dc82ec7..58e2275f165 100644 --- a/apps/dav/lib/BulkUpload/BulkUploadPlugin.php +++ b/apps/dav/lib/BulkUpload/BulkUploadPlugin.php @@ -27,6 +27,7 @@ class BulkUploadPlugin extends ServerPlugin { /** * Register listener on POST requests with the httpPost method. */ + #[\Override] public function initialize(Server $server): void { $server->on('method:POST', [$this, 'httpPost'], 10); } diff --git a/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php b/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php index 064cbbf39c1..f2f5e6a731c 100644 --- a/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php @@ -24,6 +24,7 @@ class Calendar implements IFilter { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'calendar'; } @@ -32,6 +33,7 @@ class Calendar implements IFilter { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('Calendar'); } @@ -42,6 +44,7 @@ class Calendar implements IFilter { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 40; } @@ -50,6 +53,7 @@ class Calendar implements IFilter { * @return string Full URL to an icon, empty string when none is given * @since 11.0.0 */ + #[\Override] public function getIcon() { return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar.svg')); } @@ -59,6 +63,7 @@ class Calendar implements IFilter { * @return string[] An array of allowed apps from which activities should be displayed * @since 11.0.0 */ + #[\Override] public function filterTypes(array $types) { return array_intersect(['calendar', 'calendar_event'], $types); } @@ -67,6 +72,7 @@ class Calendar implements IFilter { * @return string[] An array of allowed apps from which activities should be displayed * @since 11.0.0 */ + #[\Override] public function allowedApps() { return []; } diff --git a/apps/dav/lib/CalDAV/Activity/Filter/Todo.php b/apps/dav/lib/CalDAV/Activity/Filter/Todo.php index 3c2dd935203..eb0f0cbec69 100644 --- a/apps/dav/lib/CalDAV/Activity/Filter/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Filter/Todo.php @@ -24,6 +24,7 @@ class Todo implements IFilter { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'calendar_todo'; } @@ -32,6 +33,7 @@ class Todo implements IFilter { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('Tasks'); } @@ -42,6 +44,7 @@ class Todo implements IFilter { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 40; } @@ -50,6 +53,7 @@ class Todo implements IFilter { * @return string Full URL to an icon, empty string when none is given * @since 11.0.0 */ + #[\Override] public function getIcon() { return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg')); } @@ -59,6 +63,7 @@ class Todo implements IFilter { * @return string[] An array of allowed apps from which activities should be displayed * @since 11.0.0 */ + #[\Override] public function filterTypes(array $types) { return array_intersect(['calendar_todo'], $types); } @@ -67,6 +72,7 @@ class Todo implements IFilter { * @return string[] An array of allowed apps from which activities should be displayed * @since 11.0.0 */ + #[\Override] public function allowedApps() { return []; } diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php index 8c93ddae431..2cf52d3784c 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php @@ -59,6 +59,7 @@ class Calendar extends Base { * @throws UnknownActivityException * @since 11.0.0 */ + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar') { throw new UnknownActivityException(); diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Event.php b/apps/dav/lib/CalDAV/Activity/Provider/Event.php index 87551d7840b..f24379ef4b5 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Event.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Event.php @@ -97,6 +97,7 @@ class Event extends Base { * @throws UnknownActivityException * @since 11.0.0 */ + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_event') { throw new UnknownActivityException(); diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php index fc0625ec970..f51bc0af67c 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php @@ -19,6 +19,7 @@ class Todo extends Event { * @throws UnknownActivityException * @since 11.0.0 */ + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_todo') { throw new UnknownActivityException(); @@ -72,6 +73,7 @@ class Todo extends Event { * @param IEvent $event * @return array */ + #[\Override] protected function getParameters(IEvent $event) { $subject = $event->getSubject(); $parameters = $event->getSubjectParameters(); diff --git a/apps/dav/lib/CalDAV/Activity/Setting/CalDAVSetting.php b/apps/dav/lib/CalDAV/Activity/Setting/CalDAVSetting.php index 7ab7f16dbbb..5e128103e92 100644 --- a/apps/dav/lib/CalDAV/Activity/Setting/CalDAVSetting.php +++ b/apps/dav/lib/CalDAV/Activity/Setting/CalDAVSetting.php @@ -20,10 +20,12 @@ abstract class CalDAVSetting extends ActivitySettings { ) { } + #[\Override] public function getGroupIdentifier() { return 'calendar'; } + #[\Override] public function getGroupName() { return $this->l->t('Calendar, contacts and tasks'); } diff --git a/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php b/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php index 8e777048027..874f24a310c 100644 --- a/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php @@ -13,6 +13,7 @@ class Calendar extends CalDAVSetting { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'calendar'; } @@ -21,6 +22,7 @@ class Calendar extends CalDAVSetting { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('A calendar was modified'); } @@ -31,6 +33,7 @@ class Calendar extends CalDAVSetting { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 50; } @@ -39,6 +42,7 @@ class Calendar extends CalDAVSetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function canChangeStream() { return true; } @@ -47,6 +51,7 @@ class Calendar extends CalDAVSetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledStream() { return true; } @@ -55,6 +60,7 @@ class Calendar extends CalDAVSetting { * @return bool True when the option can be changed for the mail * @since 11.0.0 */ + #[\Override] public function canChangeMail() { return true; } @@ -63,6 +69,7 @@ class Calendar extends CalDAVSetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledMail() { return false; } diff --git a/apps/dav/lib/CalDAV/Activity/Setting/Event.php b/apps/dav/lib/CalDAV/Activity/Setting/Event.php index c10d37d8902..d6899e0fc1d 100644 --- a/apps/dav/lib/CalDAV/Activity/Setting/Event.php +++ b/apps/dav/lib/CalDAV/Activity/Setting/Event.php @@ -13,6 +13,7 @@ class Event extends CalDAVSetting { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'calendar_event'; } @@ -21,6 +22,7 @@ class Event extends CalDAVSetting { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('A calendar event was modified'); } @@ -31,6 +33,7 @@ class Event extends CalDAVSetting { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 50; } @@ -39,6 +42,7 @@ class Event extends CalDAVSetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function canChangeStream() { return true; } @@ -47,6 +51,7 @@ class Event extends CalDAVSetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledStream() { return true; } @@ -55,6 +60,7 @@ class Event extends CalDAVSetting { * @return bool True when the option can be changed for the mail * @since 11.0.0 */ + #[\Override] public function canChangeMail() { return true; } @@ -63,6 +69,7 @@ class Event extends CalDAVSetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledMail() { return false; } diff --git a/apps/dav/lib/CalDAV/Activity/Setting/Todo.php b/apps/dav/lib/CalDAV/Activity/Setting/Todo.php index 39bcd440112..76339678811 100644 --- a/apps/dav/lib/CalDAV/Activity/Setting/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Setting/Todo.php @@ -14,6 +14,7 @@ class Todo extends CalDAVSetting { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'calendar_todo'; } @@ -22,6 +23,7 @@ class Todo extends CalDAVSetting { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('A calendar to-do was modified'); } @@ -32,6 +34,7 @@ class Todo extends CalDAVSetting { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 50; } @@ -40,6 +43,7 @@ class Todo extends CalDAVSetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function canChangeStream() { return true; } @@ -48,6 +52,7 @@ class Todo extends CalDAVSetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledStream() { return true; } @@ -56,6 +61,7 @@ class Todo extends CalDAVSetting { * @return bool True when the option can be changed for the mail * @since 11.0.0 */ + #[\Override] public function canChangeMail() { return true; } @@ -64,6 +70,7 @@ class Todo extends CalDAVSetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledMail() { return false; } diff --git a/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php b/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php index 87d26324c32..1037f6dcf55 100644 --- a/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php +++ b/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php @@ -47,14 +47,17 @@ class AppCalendar extends ExternalCalendar { return Constants::PERMISSION_READ; } + #[\Override] public function getOwner(): ?string { return $this->principal; } + #[\Override] public function getGroup(): ?string { return null; } + #[\Override] public function getACL(): array { $acl = [ [ @@ -78,25 +81,30 @@ class AppCalendar extends ExternalCalendar { return $acl; } + #[\Override] public function setACL(array $acl): void { throw new Forbidden('Setting ACL is not supported on this node'); } + #[\Override] public function getSupportedPrivilegeSet(): ?array { // Use the default one return null; } + #[\Override] public function getLastModified(): ?int { // unknown return null; } + #[\Override] public function delete(): void { // No method for deleting a calendar in OCP\Calendar\ICalendar throw new Forbidden('Deleting an entry is not implemented'); } + #[\Override] public function createFile($name, $data = null) { if ($this->calendar instanceof ICreateFromString) { if (is_resource($data)) { @@ -109,6 +117,7 @@ class AppCalendar extends ExternalCalendar { } } + #[\Override] public function getProperties($properties) { return [ '{DAV:}displayname' => $this->calendar->getDisplayName() ?: $this->calendar->getKey(), @@ -117,6 +126,7 @@ class AppCalendar extends ExternalCalendar { ]; } + #[\Override] public function calendarQuery(array $filters) { $result = []; $objects = $this->getChildren(); @@ -143,6 +153,7 @@ class AppCalendar extends ExternalCalendar { return $result; } + #[\Override] public function childExists($name): bool { try { $this->getChild($name); @@ -152,6 +163,7 @@ class AppCalendar extends ExternalCalendar { } } + #[\Override] public function getChild($name) { // Try to get calendar by filename $children = $this->calendar->search($name, ['X-FILENAME']); @@ -171,6 +183,7 @@ class AppCalendar extends ExternalCalendar { /** * @return ICalendarObject[] */ + #[\Override] public function getChildren(): array { $objects = $this->calendar->search(''); // We need to group by UID (actually by filename but we do not have that information) @@ -188,6 +201,7 @@ class AppCalendar extends ExternalCalendar { }, $result); } + #[\Override] public function propPatch(PropPatch $propPatch): void { // no setDisplayColor or setDisplayName in \OCP\Calendar\ICalendar } diff --git a/apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php b/apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php index 5bb7bc66bc8..68d4fb44901 100644 --- a/apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php +++ b/apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php @@ -25,20 +25,24 @@ class AppCalendarPlugin implements ICalendarProvider { ) { } + #[\Override] public function getAppID(): string { return 'dav-wrapper'; } + #[\Override] public function fetchAllForCalendarHome(string $principalUri): array { return array_map(function ($calendar) use (&$principalUri) { return new AppCalendar($this->getAppID(), $calendar, $principalUri); }, $this->getWrappedCalendars($principalUri)); } + #[\Override] public function hasCalendarInCalendarHome(string $principalUri, string $calendarUri): bool { return count($this->getWrappedCalendars($principalUri, [ $calendarUri ])) > 0; } + #[\Override] public function getCalendarInCalendarHome(string $principalUri, string $calendarUri): ?ExternalCalendar { $calendars = $this->getWrappedCalendars($principalUri, [ $calendarUri ]); if (count($calendars) > 0) { diff --git a/apps/dav/lib/CalDAV/AppCalendar/CalendarObject.php b/apps/dav/lib/CalDAV/AppCalendar/CalendarObject.php index 3c62a26df54..89dfa19de35 100644 --- a/apps/dav/lib/CalDAV/AppCalendar/CalendarObject.php +++ b/apps/dav/lib/CalDAV/AppCalendar/CalendarObject.php @@ -27,14 +27,17 @@ class CalendarObject implements ICalendarObject, IACL { ) { } + #[\Override] public function getOwner() { return $this->calendar->getOwner(); } + #[\Override] public function getGroup() { return $this->calendar->getGroup(); } + #[\Override] public function getACL(): array { $acl = [ [ @@ -53,14 +56,17 @@ class CalendarObject implements ICalendarObject, IACL { return $acl; } + #[\Override] public function setACL(array $acl): void { throw new Forbidden('Setting ACL is not supported on this node'); } + #[\Override] public function getSupportedPrivilegeSet(): ?array { return null; } + #[\Override] public function put($data): void { if ($this->backend instanceof ICreateFromString && $this->calendar->getPermissions() & Constants::PERMISSION_UPDATE) { if (is_resource($data)) { @@ -72,22 +78,27 @@ class CalendarObject implements ICalendarObject, IACL { } } + #[\Override] public function get(): string { return $this->vobject->serialize(); } + #[\Override] public function getContentType(): string { return 'text/calendar; charset=utf-8'; } + #[\Override] public function getETag(): ?string { return null; } + #[\Override] public function getSize() { return mb_strlen($this->vobject->serialize()); } + #[\Override] public function delete(): void { if ($this->backend instanceof ICreateFromString && $this->calendar->getPermissions() & Constants::PERMISSION_DELETE) { /** @var \Sabre\VObject\Component[] */ @@ -105,6 +116,7 @@ class CalendarObject implements ICalendarObject, IACL { } } + #[\Override] public function getName(): string { // Every object is required to have an UID $base = $this->vobject->getBaseComponent(); @@ -118,10 +130,12 @@ class CalendarObject implements ICalendarObject, IACL { return (string)$base->UID . '.ics'; } + #[\Override] public function setName($name): void { throw new Forbidden('This calendar-object is read-only'); } + #[\Override] public function getLastModified(): ?int { $base = $this->vobject->getBaseComponent(); if ($base !== null && $this->vobject->getBaseComponent()->{'LAST-MODIFIED'}) { diff --git a/apps/dav/lib/CalDAV/Auth/PublicPrincipalPlugin.php b/apps/dav/lib/CalDAV/Auth/PublicPrincipalPlugin.php index ed89638451e..454afa79b22 100644 --- a/apps/dav/lib/CalDAV/Auth/PublicPrincipalPlugin.php +++ b/apps/dav/lib/CalDAV/Auth/PublicPrincipalPlugin.php @@ -14,6 +14,7 @@ use Sabre\DAV\Auth\Plugin; * Defines the public facing principal option */ class PublicPrincipalPlugin extends Plugin { + #[\Override] public function getCurrentPrincipal(): ?string { return 'principals/system/public'; } diff --git a/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php b/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php index 681709cdb6f..621f642bd21 100644 --- a/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php +++ b/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php @@ -52,6 +52,7 @@ class EnablePlugin extends ServerPlugin { * * @return string[] */ + #[\Override] public function getFeatures() { return ['nc-enable-birthday-calendar']; } @@ -64,6 +65,7 @@ class EnablePlugin extends ServerPlugin { * * @return string */ + #[\Override] public function getPluginName() { return 'nc-enable-birthday-calendar'; } @@ -78,6 +80,7 @@ class EnablePlugin extends ServerPlugin { * * @param Server $server */ + #[\Override] public function initialize(Server $server) { $this->server = $server; diff --git a/apps/dav/lib/CalDAV/CachedSubscription.php b/apps/dav/lib/CalDAV/CachedSubscription.php index 75ee5cb440f..c8a1a23102d 100644 --- a/apps/dav/lib/CalDAV/CachedSubscription.php +++ b/apps/dav/lib/CalDAV/CachedSubscription.php @@ -32,6 +32,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { /** * @return array */ + #[\Override] public function getACL() { return [ [ @@ -65,6 +66,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { /** * @return array */ + #[\Override] public function getChildACL() { return [ [ @@ -89,6 +91,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { /** * @return null|string */ + #[\Override] public function getOwner() { if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) { return $this->calendarInfo['{http://owncloud.org/ns}owner-principal']; @@ -97,6 +100,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { } + #[\Override] public function delete() { $this->caldavBackend->deleteSubscription($this->calendarInfo['id']); } @@ -104,6 +108,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { /** * @param PropPatch $propPatch */ + #[\Override] public function propPatch(PropPatch $propPatch) { $this->caldavBackend->updateSubscription($this->calendarInfo['id'], $propPatch); } @@ -113,6 +118,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { * @return CalendarObject|\Sabre\CalDAV\ICalendarObject * @throws NotFound */ + #[\Override] public function getChild($name) { $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); if (!$obj) { @@ -126,6 +132,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { /** * @return INode[] */ + #[\Override] public function getChildren(): array { $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id'], CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); @@ -141,6 +148,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { * @param array $paths * @return array */ + #[\Override] public function getMultipleChildren(array $paths):array { $objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); @@ -158,6 +166,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { * @return null|string * @throws MethodNotAllowed */ + #[\Override] public function createFile($name, $data = null) { throw new MethodNotAllowed('Creating objects in cached subscription is not allowed'); } @@ -166,6 +175,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { * @param string $name * @return bool */ + #[\Override] public function childExists($name):bool { $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); if (!$obj) { @@ -179,6 +189,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { * @param array $filters * @return array */ + #[\Override] public function calendarQuery(array $filters):array { return $this->caldavBackend->calendarQuery($this->calendarInfo['id'], $filters, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); } @@ -186,6 +197,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { /** * @inheritDoc */ + #[\Override] public function getChanges($syncToken, $syncLevel, $limit = null) { if (!$syncToken && $limit) { throw new UnsupportedLimitOnInitialSyncException(); diff --git a/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php b/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php index cc1bab6d4fc..3e72f9194ab 100644 --- a/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php +++ b/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php @@ -28,6 +28,7 @@ class CachedSubscriptionImpl implements ICalendar, ICalendarIsEnabled, ICalendar * @return string defining the technical unique key * @since 13.0.0 */ + #[\Override] public function getKey(): string { return (string)$this->calendarInfo['id']; } @@ -35,6 +36,7 @@ class CachedSubscriptionImpl implements ICalendar, ICalendarIsEnabled, ICalendar /** * {@inheritDoc} */ + #[\Override] public function getUri(): string { return $this->calendarInfo['uri']; } @@ -43,6 +45,7 @@ class CachedSubscriptionImpl implements ICalendar, ICalendarIsEnabled, ICalendar * In comparison to getKey() this function returns a human readable (maybe translated) name * @since 13.0.0 */ + #[\Override] public function getDisplayName(): ?string { return $this->calendarInfo['{DAV:}displayname']; } @@ -51,10 +54,12 @@ class CachedSubscriptionImpl implements ICalendar, ICalendarIsEnabled, ICalendar * Calendar color * @since 13.0.0 */ + #[\Override] public function getDisplayColor(): ?string { return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color']; } + #[\Override] public function search(string $pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null): array { return $this->backend->search($this->calendarInfo, $pattern, $searchProperties, $options, $limit, $offset); } @@ -63,6 +68,7 @@ class CachedSubscriptionImpl implements ICalendar, ICalendarIsEnabled, ICalendar * @return int build up using \OCP\Constants * @since 13.0.0 */ + #[\Override] public function getPermissions(): int { $permissions = $this->calendar->getACL(); $result = 0; @@ -80,18 +86,22 @@ class CachedSubscriptionImpl implements ICalendar, ICalendarIsEnabled, ICalendar /** * @since 32.0.0 */ + #[\Override] public function isEnabled(): bool { return $this->calendarInfo['{http://owncloud.org/ns}calendar-enabled'] ?? true; } + #[\Override] public function isWritable(): bool { return false; } + #[\Override] public function isDeleted(): bool { return false; } + #[\Override] public function isShared(): bool { return true; } diff --git a/apps/dav/lib/CalDAV/CachedSubscriptionObject.php b/apps/dav/lib/CalDAV/CachedSubscriptionObject.php index dc9141a61b8..4be1c30f0f1 100644 --- a/apps/dav/lib/CalDAV/CachedSubscriptionObject.php +++ b/apps/dav/lib/CalDAV/CachedSubscriptionObject.php @@ -21,6 +21,7 @@ class CachedSubscriptionObject extends \Sabre\CalDAV\CalendarObject { /** * @inheritdoc */ + #[\Override] public function get() { // Pre-populating the 'calendardata' is optional, if we don't have it // already we fetch it from the backend. @@ -36,6 +37,7 @@ class CachedSubscriptionObject extends \Sabre\CalDAV\CalendarObject { * @return string * @throws MethodNotAllowed */ + #[\Override] public function put($calendarData) { throw new MethodNotAllowed('Creating objects in a cached subscription is not allowed'); } @@ -43,6 +45,7 @@ class CachedSubscriptionObject extends \Sabre\CalDAV\CalendarObject { /** * @throws MethodNotAllowed */ + #[\Override] public function delete() { throw new MethodNotAllowed('Deleting objects in a cached subscription is not allowed'); } diff --git a/apps/dav/lib/CalDAV/CachedSubscriptionProvider.php b/apps/dav/lib/CalDAV/CachedSubscriptionProvider.php index d64f039d05b..efd46b4cfad 100644 --- a/apps/dav/lib/CalDAV/CachedSubscriptionProvider.php +++ b/apps/dav/lib/CalDAV/CachedSubscriptionProvider.php @@ -17,6 +17,7 @@ class CachedSubscriptionProvider implements ICalendarProvider { ) { } + #[\Override] public function getCalendars(string $principalUri, array $calendarUris = []): array { $calendarInfos = $this->calDavBackend->getSubscriptionsForUser($principalUri); diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 535e159d3a7..4f2b93c753c 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -319,6 +319,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param string $principalUri * @return array */ + #[\Override] public function getCalendarsForUser($principalUri) { return $this->atomic(function () use ($principalUri) { $principalUriOriginal = $principalUri; @@ -811,6 +812,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * * @throws CalendarException */ + #[\Override] public function createCalendar($principalUri, $calendarUri, array $properties) { if (strlen($calendarUri) > 255) { throw new CalendarException('URI too long. Calendar not created'); @@ -883,6 +885,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param PropPatch $propPatch * @return void */ + #[\Override] public function updateCalendar($calendarId, PropPatch $propPatch) { $supportedProperties = array_keys($this->propertyMap); $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; @@ -929,6 +932,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param mixed $calendarId * @return void */ + #[\Override] public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) { $this->publishStatusCache->remove((string)$calendarId); @@ -1127,6 +1131,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param int $calendarType * @return array */ + #[\Override] public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { $query = $this->db->getQueryBuilder(); $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification']) @@ -1239,6 +1244,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param int $calendarType * @return array|null */ + #[\Override] public function getCalendarObject($calendarId, $objectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR) { $key = $calendarId . '::' . $objectUri . '::' . $calendarType; if (isset($this->cachedObjects[$key])) { @@ -1292,6 +1298,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param int $calendarType * @return array */ + #[\Override] public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { if (empty($uris)) { return []; @@ -1350,6 +1357,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param int $calendarType * @return string */ + #[\Override] public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { $this->cachedObjects = []; $extraData = $this->getDenormalizedData($calendarData); @@ -1447,6 +1455,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param int $calendarType * @return string */ + #[\Override] public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { $this->cachedObjects = []; $extraData = $this->getDenormalizedData($calendarData); @@ -1560,6 +1569,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param bool $forceDeletePermanently * @return void */ + #[\Override] public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) { $this->cachedObjects = []; $this->atomic(function () use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void { @@ -1744,6 +1754,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param int $calendarType * @return array */ + #[\Override] public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { $componentType = null; $requirePostFilter = true; @@ -2442,6 +2453,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param string $uid * @return string|null */ + #[\Override] public function getCalendarObjectByUID($principalUri, $uid, $calendarUri = null) { $query = $this->db->getQueryBuilder(); $query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi') @@ -2553,6 +2565,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param int $calendarType * @return ?array */ + #[\Override] public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) { $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; @@ -2653,6 +2666,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param string $principalUri * @return array */ + #[\Override] public function getSubscriptionsForUser($principalUri) { $fields = array_column($this->subscriptionPropertyMap, 0); $fields[] = 'id'; @@ -2699,6 +2713,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param array $properties * @return mixed */ + #[\Override] public function createSubscription($principalUri, $uri, array $properties) { if (!isset($properties['{http://calendarserver.org/ns/}source'])) { throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions'); @@ -2759,6 +2774,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param PropPatch $propPatch * @return void */ + #[\Override] public function updateSubscription($subscriptionId, PropPatch $propPatch) { $supportedProperties = array_keys($this->subscriptionPropertyMap); $supportedProperties[] = '{http://calendarserver.org/ns/}source'; @@ -2800,6 +2816,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param mixed $subscriptionId * @return void */ + #[\Override] public function deleteSubscription($subscriptionId) { $this->atomic(function () use ($subscriptionId): void { $subscriptionRow = $this->getSubscriptionById($subscriptionId); @@ -2847,6 +2864,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param string $objectUri * @return array */ + #[\Override] public function getSchedulingObject($principalUri, $objectUri) { $query = $this->db->getQueryBuilder(); $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size']) @@ -2881,6 +2899,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param string $principalUri * @return array */ + #[\Override] public function getSchedulingObjects($principalUri) { $query = $this->db->getQueryBuilder(); $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size']) @@ -2910,6 +2929,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param string $objectUri * @return void */ + #[\Override] public function deleteSchedulingObject($principalUri, $objectUri) { $this->cachedObjects = []; $query = $this->db->getQueryBuilder(); @@ -2965,6 +2985,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param string $objectData * @return void */ + #[\Override] public function createSchedulingObject($principalUri, $objectUri, $objectData) { $this->cachedObjects = []; $query = $this->db->getQueryBuilder(); diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index 306562e83f5..99ed8cb3d4a 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -72,6 +72,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable * {@inheritdoc} * @throws Forbidden */ + #[\Override] public function updateShares(array $add, array $remove): void { if ($this->isShared()) { throw new Forbidden(); @@ -91,6 +92,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable * * @return list */ + #[\Override] public function getShares(): array { if ($this->isShared()) { return []; @@ -98,6 +100,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable return $this->caldavBackend->getShares($this->getResourceId()); } + #[\Override] public function getResourceId(): int { return $this->calendarInfo['id']; } @@ -114,6 +117,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable * @param list $acl * @return list */ + #[\Override] public function getACL() { $acl = [ [ @@ -210,10 +214,12 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable return $acl; } + #[\Override] public function getChildACL() { return $this->getACL(); } + #[\Override] public function getOwner(): ?string { if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) { return $this->calendarInfo['{http://owncloud.org/ns}owner-principal']; @@ -221,6 +227,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable return parent::getOwner(); } + #[\Override] public function delete() { if ($this->isShared()) { $this->caldavBackend->unshare($this, 'principal:' . $this->getPrincipalURI()); @@ -242,6 +249,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable ); } + #[\Override] public function propPatch(PropPatch $propPatch) { // parent::propPatch will only update calendars table // if calendar is shared, changes have to be made to the properties table @@ -250,6 +258,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable } } + #[\Override] public function getChild($name) { $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name, $this->getCalendarType()); @@ -266,6 +275,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable return new CalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj); } + #[\Override] public function getChildren() { $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id'], $this->getCalendarType()); $children = []; @@ -279,6 +289,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable return $children; } + #[\Override] public function getMultipleChildren(array $paths) { $objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths, $this->getCalendarType()); $children = []; @@ -292,6 +303,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable return $children; } + #[\Override] public function childExists($name) { $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name, $this->getCalendarType()); if (!$obj) { @@ -304,6 +316,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable return true; } + #[\Override] public function calendarQuery(array $filters) { $uris = $this->caldavBackend->calendarQuery($this->calendarInfo['id'], $filters, $this->getCalendarType()); if ($this->isShared()) { @@ -369,6 +382,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable /** * @inheritDoc */ + #[\Override] public function getChanges($syncToken, $syncLevel, $limit = null) { if (!$syncToken && $limit) { throw new UnsupportedLimitOnInitialSyncException(); @@ -380,6 +394,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable /** * @inheritDoc */ + #[\Override] public function restore(): void { $this->caldavBackend->restoreCalendar((int)$this->calendarInfo['id']); } @@ -391,6 +406,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable /** * @inheritDoc */ + #[\Override] public function moveInto($targetName, $sourcePath, INode $sourceNode) { if (!($sourceNode instanceof CalendarObject)) { return false; diff --git a/apps/dav/lib/CalDAV/CalendarHome.php b/apps/dav/lib/CalDAV/CalendarHome.php index 52f45f8aa31..311f4568df0 100644 --- a/apps/dav/lib/CalDAV/CalendarHome.php +++ b/apps/dav/lib/CalDAV/CalendarHome.php @@ -67,6 +67,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome { /** * @inheritdoc */ + #[\Override] public function createExtendedCollection($name, MkCol $mkCol): void { $reservedNames = [ BirthdayService::BIRTHDAY_CALENDAR_URI, @@ -83,6 +84,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome { /** * @inheritdoc */ + #[\Override] public function getChildren() { if ($this->cachedChildren) { return $this->cachedChildren; @@ -144,6 +146,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome { * * @return INode */ + #[\Override] public function getChild($name) { // Special nodes if ($name === 'inbox' && $this->caldavBackend instanceof SchedulingSupport) { diff --git a/apps/dav/lib/CalDAV/CalendarImpl.php b/apps/dav/lib/CalDAV/CalendarImpl.php index 2aa6ec68ea8..1324f02f75f 100644 --- a/apps/dav/lib/CalDAV/CalendarImpl.php +++ b/apps/dav/lib/CalDAV/CalendarImpl.php @@ -49,6 +49,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs * @return string defining the technical unique key * @since 13.0.0 */ + #[\Override] public function getKey(): string { return (string)$this->calendarInfo['id']; } @@ -56,6 +57,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs /** * {@inheritDoc} */ + #[\Override] public function getUri(): string { return $this->calendarInfo['uri']; } @@ -72,6 +74,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs * In comparison to getKey() this function returns a human readable (maybe translated) name * @since 13.0.0 */ + #[\Override] public function getDisplayName(): ?string { return $this->calendarInfo['{DAV:}displayname']; } @@ -80,6 +83,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs * Calendar color * @since 13.0.0 */ + #[\Override] public function getDisplayColor(): ?string { return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color']; } @@ -107,6 +111,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs return $vtimezone; } + #[\Override] public function search(string $pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null): array { return $this->backend->search($this->calendarInfo, $pattern, $searchProperties, $options, $limit, $offset); @@ -116,6 +121,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs * @return int build up using \OCP\Constants * @since 13.0.0 */ + #[\Override] public function getPermissions(): int { $permissions = $this->calendar->getACL(); $result = 0; @@ -144,6 +150,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs /** * @since 32.0.0 */ + #[\Override] public function isEnabled(): bool { return $this->calendarInfo['{http://owncloud.org/ns}calendar-enabled'] ?? true; } @@ -151,6 +158,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs /** * @since 31.0.0 */ + #[\Override] public function isWritable(): bool { return $this->calendar->canWrite(); } @@ -158,6 +166,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs /** * @since 26.0.0 */ + #[\Override] public function isDeleted(): bool { return $this->calendar->isDeleted(); } @@ -165,6 +174,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs /** * @since 31.0.0 */ + #[\Override] public function isShared(): bool { return $this->calendar->isShared(); } @@ -172,6 +182,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs /** * @since 33.0.1, 32.0.7, 31.0.14.1, 30.0.17.8 */ + #[\Override] public function getPublicToken(): ?string { return $this->calendar->getPublishStatus() ?: null; } @@ -216,11 +227,13 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs } } + #[\Override] public function createFromString(string $name, string $calendarData): void { $server = new EmbeddedCalDavServer(false); $this->createFromStringInServer($name, $calendarData, $server->getServer()); } + #[\Override] public function createFromStringMinimal(string $name, string $calendarData): void { $server = new InvitationResponseServer(false); $this->createFromStringInServer($name, $calendarData, $server->getServer()); @@ -229,6 +242,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs /** * @throws CalendarException */ + #[\Override] public function handleIMipMessage(string $name, string $calendarData): void { try { @@ -330,6 +344,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs * * @return Generator */ + #[\Override] public function export(?CalendarExportOptions $options = null): Generator { foreach ( $this->backend->exportCalendar( diff --git a/apps/dav/lib/CalDAV/CalendarObject.php b/apps/dav/lib/CalDAV/CalendarObject.php index 3b798e0b07e..d7821eab704 100644 --- a/apps/dav/lib/CalDAV/CalendarObject.php +++ b/apps/dav/lib/CalDAV/CalendarObject.php @@ -38,6 +38,7 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject { /** * @inheritdoc */ + #[\Override] public function get() { $data = parent::get(); @@ -148,6 +149,7 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject { return $this->calendarInfo['principaluri']; } + #[\Override] public function getOwner(): ?string { if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) { return $this->calendarInfo['{http://owncloud.org/ns}owner-principal']; diff --git a/apps/dav/lib/CalDAV/CalendarProvider.php b/apps/dav/lib/CalDAV/CalendarProvider.php index 87a8e99c3d1..06c60239b64 100644 --- a/apps/dav/lib/CalDAV/CalendarProvider.php +++ b/apps/dav/lib/CalDAV/CalendarProvider.php @@ -27,6 +27,7 @@ class CalendarProvider implements ICalendarProvider { ) { } + #[\Override] public function getCalendars(string $principalUri, array $calendarUris = []): array { /** @var array{uri: string, principaluri: string}[] $calendarInfos */ $calendarInfos = $this->calDavBackend->getCalendarsForUser($principalUri) ?? []; diff --git a/apps/dav/lib/CalDAV/CalendarRoot.php b/apps/dav/lib/CalDAV/CalendarRoot.php index 80a4037a3a6..97a056bc281 100644 --- a/apps/dav/lib/CalDAV/CalendarRoot.php +++ b/apps/dav/lib/CalDAV/CalendarRoot.php @@ -33,6 +33,7 @@ class CalendarRoot extends \Sabre\CalDAV\CalendarRoot { parent::__construct($principalBackend, $caldavBackend, $principalPrefix); } + #[\Override] public function getChildForPrincipal(array $principal) { [$prefix] = \Sabre\Uri\split($principal['uri']); if ($prefix === RemoteUserPrincipalBackend::PRINCIPAL_PREFIX) { @@ -54,6 +55,7 @@ class CalendarRoot extends \Sabre\CalDAV\CalendarRoot { ); } + #[\Override] public function getName() { if ($this->principalPrefix === 'principals/calendar-resources' || $this->principalPrefix === 'principals/calendar-rooms') { @@ -73,6 +75,7 @@ class CalendarRoot extends \Sabre\CalDAV\CalendarRoot { $this->returnCachedSubscriptions['principals/users/' . $principalUri] = true; } + #[\Override] public function childExists($name) { if (!($this->principalBackend instanceof Principal)) { return parent::childExists($name); diff --git a/apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php b/apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php index 8eab255b9ef..348852fb931 100644 --- a/apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php +++ b/apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php @@ -39,10 +39,12 @@ class CalendarFederationProvider implements ICloudFederationProvider { ) { } + #[\Override] public function getShareType(): string { return self::PROVIDER_ID; } + #[\Override] public function shareReceived(ICloudFederationShare $share): string { if (!$this->calendarFederationConfig->isFederationEnabled()) { $this->logger->debug('Received a federation invite but federation is disabled'); @@ -152,6 +154,7 @@ class CalendarFederationProvider implements ICloudFederationProvider { return (string)$calendar->getId(); } + #[\Override] public function notificationReceived( $notificationType, $providerId, @@ -172,6 +175,7 @@ class CalendarFederationProvider implements ICloudFederationProvider { /** * @return string[] */ + #[\Override] public function getSupportedShareTypes(): array { return [self::USER_SHARE_TYPE]; } diff --git a/apps/dav/lib/CalDAV/Federation/FederatedCalendar.php b/apps/dav/lib/CalDAV/Federation/FederatedCalendar.php index b5bfd1c2f9c..89255de2895 100644 --- a/apps/dav/lib/CalDAV/Federation/FederatedCalendar.php +++ b/apps/dav/lib/CalDAV/Federation/FederatedCalendar.php @@ -47,6 +47,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { return $this->federationInfo->getId(); } + #[\Override] public function getName(): string { return $this->federationInfo->getUri(); } @@ -54,6 +55,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { /** * @param string $name Name of the file */ + #[\Override] public function setName($name): void { throw new MethodNotAllowed('Renaming federated calendars is not allowed'); } @@ -66,10 +68,12 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { return $this->federationInfo->getPrincipaluri(); } + #[\Override] public function getOwner(): ?string { return $this->federationInfo->getSharedByPrincipal(); } + #[\Override] public function getGroup(): ?string { return null; } @@ -77,6 +81,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { /** * @return array */ + #[\Override] public function getACL(): array { if ($this->calendarACL !== null) { return $this->calendarACL; @@ -135,10 +140,12 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { return $acl; } + #[\Override] public function setACL(array $acl): void { throw new MethodNotAllowed('Changing ACLs on federated calendars is not allowed'); } + #[\Override] public function getSupportedPrivilegeSet(): ?array { return null; } @@ -146,6 +153,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { /** * @return array properties array, with property name as key */ + #[\Override] public function getProperties($properties): array { return [ self::DAV_PROPERTY_CALENDAR_LABEL => $this->federationInfo->getDisplayName(), @@ -154,6 +162,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { ]; } + #[\Override] public function propPatch(PropPatch $propPatch): void { $mutations = $propPatch->getMutations(); if (count($mutations) > 0) { @@ -176,10 +185,12 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { return $this->getACL(); } + #[\Override] public function getLastModified(): ?int { return $this->federationInfo->getLastSync(); } + #[\Override] public function delete(): void { $this->federatedCalendarMapper->deleteById($this->getResourceId()); } @@ -187,10 +198,12 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { /** * @param string $name Name of the file */ + #[\Override] public function createDirectory($name): void { throw new MethodNotAllowed('Creating nested collection is not allowed'); } + #[\Override] public function calendarQuery(array $filters): array { $uris = $this->caldavBackend->calendarQuery($this->federationInfo->getId(), $filters, $this->getCalendarType()); return $uris; @@ -199,6 +212,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { /** * @param string $name Name of the file */ + #[\Override] public function getChild($name): INode { $obj = $this->caldavBackend->getCalendarObject($this->federationInfo->getId(), $name, $this->getCalendarType()); @@ -212,6 +226,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { /** * @return array */ + #[\Override] public function getChildren(): array { $objs = $this->caldavBackend->getCalendarObjects($this->federationInfo->getId(), $this->getCalendarType()); @@ -228,6 +243,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { * * @return array */ + #[\Override] public function getMultipleChildren(array $paths): array { $objs = $this->caldavBackend->getMultipleCalendarObjects($this->federationInfo->getId(), $paths, $this->getCalendarType()); @@ -242,6 +258,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { /** * @param string $name Name of the file */ + #[\Override] public function childExists($name): bool { $obj = $this->caldavBackend->getCalendarObject($this->federationInfo->getId(), $name, $this->getCalendarType()); return $obj !== null; @@ -251,6 +268,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet { * @param string $name Name of the file * @param resource|string $data Initial payload */ + #[\Override] public function createFile($name, $data = null): string { if (is_resource($data)) { $data = stream_get_contents($data); diff --git a/apps/dav/lib/CalDAV/Federation/FederatedCalendarAuth.php b/apps/dav/lib/CalDAV/Federation/FederatedCalendarAuth.php index a5d71e48cf1..402d871d0be 100644 --- a/apps/dav/lib/CalDAV/Federation/FederatedCalendarAuth.php +++ b/apps/dav/lib/CalDAV/Federation/FederatedCalendarAuth.php @@ -57,6 +57,7 @@ class FederatedCalendarAuth implements BackendInterface { return null; } + #[\Override] public function check(RequestInterface $request, ResponseInterface $response): array { if (!str_starts_with($request->getPath(), 'remote-calendars/')) { return [false, 'This request is not for a federated calendar']; @@ -75,6 +76,7 @@ class FederatedCalendarAuth implements BackendInterface { return [true, $principal]; } + #[\Override] public function challenge(RequestInterface $request, ResponseInterface $response): void { // No special challenge is needed here } diff --git a/apps/dav/lib/CalDAV/Federation/FederatedCalendarImpl.php b/apps/dav/lib/CalDAV/Federation/FederatedCalendarImpl.php index 23db57f1f08..4cb95ef697b 100644 --- a/apps/dav/lib/CalDAV/Federation/FederatedCalendarImpl.php +++ b/apps/dav/lib/CalDAV/Federation/FederatedCalendarImpl.php @@ -23,22 +23,27 @@ class FederatedCalendarImpl implements ICalendar, ICalendarIsShared, ICalendarIs ) { } + #[\Override] public function getKey(): string { return (string)$this->calendarInfo['id']; } + #[\Override] public function getUri(): string { return $this->calendarInfo['uri']; } + #[\Override] public function getDisplayName(): ?string { return $this->calendarInfo['{DAV:}displayname']; } + #[\Override] public function getDisplayColor(): ?string { return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color']; } + #[\Override] public function search(string $pattern, array $searchProperties = [], array $options = [], ?int $limit = null, ?int $offset = null): array { return $this->calDavBackend->search( $this->calendarInfo, @@ -50,23 +55,28 @@ class FederatedCalendarImpl implements ICalendar, ICalendarIsShared, ICalendarIs ); } + #[\Override] public function getPermissions(): int { return $this->calendarInfo['{http://owncloud.org/ns}permissions'] ?? Constants::PERMISSION_READ; } + #[\Override] public function isDeleted(): bool { return false; } + #[\Override] public function isShared(): bool { return true; } + #[\Override] public function isWritable(): bool { $permissions = $this->getPermissions(); return ($permissions & Constants::PERMISSION_UPDATE) !== 0; } + #[\Override] public function isEnabled(): bool { return $this->calendarInfo['{http://owncloud.org/ns}calendar-enabled'] ?? true; } diff --git a/apps/dav/lib/CalDAV/Federation/FederatedCalendarObject.php b/apps/dav/lib/CalDAV/Federation/FederatedCalendarObject.php index 01fca3a6060..3a4c5ac6f2a 100644 --- a/apps/dav/lib/CalDAV/Federation/FederatedCalendarObject.php +++ b/apps/dav/lib/CalDAV/Federation/FederatedCalendarObject.php @@ -21,6 +21,7 @@ class FederatedCalendarObject implements ICalendarObject, IACL { ) { } + #[\Override] public function getName(): string { return $this->objectData['uri']; } @@ -28,10 +29,12 @@ class FederatedCalendarObject implements ICalendarObject, IACL { /** * @param string $name Name of the file */ + #[\Override] public function setName($name) { throw new \Exception('Not implemented'); } + #[\Override] public function get(): string { return $this->objectData['calendardata']; } @@ -39,6 +42,7 @@ class FederatedCalendarObject implements ICalendarObject, IACL { /** * @param resource|string $data contents of the file */ + #[\Override] public function put($data): string { $etag = $this->calendarObject->updateFile($this->objectData['uri'], $data); @@ -48,10 +52,12 @@ class FederatedCalendarObject implements ICalendarObject, IACL { return $etag; } + #[\Override] public function delete(): void { $this->calendarObject->deleteFile($this->objectData['uri']); } + #[\Override] public function getContentType(): ?string { $mime = 'text/calendar; charset=utf-8'; if (isset($this->objectData['component']) && $this->objectData['component']) { @@ -61,6 +67,7 @@ class FederatedCalendarObject implements ICalendarObject, IACL { return $mime; } + #[\Override] public function getETag(): string { if (isset($this->objectData['etag'])) { return $this->objectData['etag']; @@ -69,10 +76,12 @@ class FederatedCalendarObject implements ICalendarObject, IACL { } } + #[\Override] public function getLastModified(): int { return $this->objectData['lastmodified']; } + #[\Override] public function getSize(): int { if (isset($this->objectData['size'])) { return $this->objectData['size']; @@ -81,10 +90,12 @@ class FederatedCalendarObject implements ICalendarObject, IACL { } } + #[\Override] public function getOwner(): ?string { return $this->calendarObject->getPrincipalURI(); } + #[\Override] public function getGroup(): ?string { return null; } @@ -92,14 +103,17 @@ class FederatedCalendarObject implements ICalendarObject, IACL { /** * @return array */ + #[\Override] public function getACL(): array { return $this->calendarObject->getACL(); } + #[\Override] public function setACL(array $acl): void { throw new MethodNotAllowed('Changing ACLs on federated events is not allowed'); } + #[\Override] public function getSupportedPrivilegeSet(): ?array { return null; } diff --git a/apps/dav/lib/CalDAV/Federation/RemoteUserCalendarHome.php b/apps/dav/lib/CalDAV/Federation/RemoteUserCalendarHome.php index d7fd8985db6..5dfdc23b32b 100644 --- a/apps/dav/lib/CalDAV/Federation/RemoteUserCalendarHome.php +++ b/apps/dav/lib/CalDAV/Federation/RemoteUserCalendarHome.php @@ -28,6 +28,7 @@ class RemoteUserCalendarHome extends CalendarHome { parent::__construct($caldavBackend, $principalInfo); } + #[\Override] public function getChild($name) { // Remote users can only have incoming shared calendars so we can skip the rest of a regular // calendar home @@ -46,6 +47,7 @@ class RemoteUserCalendarHome extends CalendarHome { throw new NotFound("Node with name $name could not be found"); } + #[\Override] public function getChildren(): array { $objects = []; diff --git a/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php b/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php index 08dc10f7bf4..310db9a3088 100644 --- a/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php +++ b/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php @@ -34,6 +34,7 @@ class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin { /** * @inheritDoc */ + #[\Override] protected function generateResponse($path, $start, $end, $expand, $componentType, $format, $properties, ResponseInterface $response) { if (!isset($properties['{http://nextcloud.com/ns}refresh-interval'])) { $value = $this->config->getAppValue('dav', 'defaultRefreshIntervalExportedCalendars', self::DEFAULT_REFRESH_INTERVAL); @@ -46,6 +47,7 @@ class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin { /** * @inheritDoc */ + #[\Override] public function mergeObjects(array $properties, array $inputObjects) { $vcalendar = parent::mergeObjects($properties, $inputObjects); diff --git a/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php b/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php index edacdd42ea7..a985ff5e861 100644 --- a/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php +++ b/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php @@ -50,6 +50,7 @@ abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties { /** * @inheritDoc */ + #[\Override] final public function getName() { return implode(self::DELIMITER, [ self::PREFIX, @@ -61,6 +62,7 @@ abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties { /** * @inheritDoc */ + #[\Override] final public function setName($name) { throw new DAV\Exception\MethodNotAllowed('Renaming calendars is not yet supported'); } @@ -68,6 +70,7 @@ abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties { /** * @inheritDoc */ + #[\Override] final public function createDirectory($name) { throw new DAV\Exception\MethodNotAllowed('Creating collections in calendar objects is not allowed'); } diff --git a/apps/dav/lib/CalDAV/Outbox.php b/apps/dav/lib/CalDAV/Outbox.php index a2339790bed..22907fad07f 100644 --- a/apps/dav/lib/CalDAV/Outbox.php +++ b/apps/dav/lib/CalDAV/Outbox.php @@ -46,6 +46,7 @@ class Outbox extends \Sabre\CalDAV\Schedule\Outbox { * * @return array */ + #[\Override] public function getACL() { // getACL is called so frequently that we cache the config result if ($this->disableFreeBusy === null) { diff --git a/apps/dav/lib/CalDAV/Plugin.php b/apps/dav/lib/CalDAV/Plugin.php index 24448ae71ab..328e27f428e 100644 --- a/apps/dav/lib/CalDAV/Plugin.php +++ b/apps/dav/lib/CalDAV/Plugin.php @@ -20,6 +20,7 @@ class Plugin extends \Sabre\CalDAV\Plugin { * @param string $principalUrl * @return string|null */ + #[\Override] public function getCalendarHomeForPrincipal($principalUrl) { if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) { [, $principalId] = \Sabre\Uri\split($principalUrl); diff --git a/apps/dav/lib/CalDAV/Principal/Collection.php b/apps/dav/lib/CalDAV/Principal/Collection.php index b76fde66464..56805371168 100644 --- a/apps/dav/lib/CalDAV/Principal/Collection.php +++ b/apps/dav/lib/CalDAV/Principal/Collection.php @@ -19,6 +19,7 @@ class Collection extends \Sabre\CalDAV\Principal\Collection { * @param array $principalInfo * @return User */ + #[\Override] public function getChildForPrincipal(array $principalInfo) { return new User($this->principalBackend, $principalInfo); } diff --git a/apps/dav/lib/CalDAV/Principal/ProxyRead.php b/apps/dav/lib/CalDAV/Principal/ProxyRead.php index 80349464a22..d18ddd89eef 100644 --- a/apps/dav/lib/CalDAV/Principal/ProxyRead.php +++ b/apps/dav/lib/CalDAV/Principal/ProxyRead.php @@ -17,6 +17,7 @@ class ProxyRead extends \Sabre\CalDAV\Principal\ProxyRead implements DAVACL\IACL /** * @inheritDoc */ + #[\Override] public function getOwner() { return $this->principalInfo['uri']; } diff --git a/apps/dav/lib/CalDAV/Principal/ProxyWrite.php b/apps/dav/lib/CalDAV/Principal/ProxyWrite.php index 0d9d2dd9947..9a02c267767 100644 --- a/apps/dav/lib/CalDAV/Principal/ProxyWrite.php +++ b/apps/dav/lib/CalDAV/Principal/ProxyWrite.php @@ -17,6 +17,7 @@ class ProxyWrite extends \Sabre\CalDAV\Principal\ProxyWrite implements DAVACL\IA /** * @inheritDoc */ + #[\Override] public function getOwner() { return $this->principalInfo['uri']; } diff --git a/apps/dav/lib/CalDAV/Principal/User.php b/apps/dav/lib/CalDAV/Principal/User.php index f81ffbfbdf1..65b55befbed 100644 --- a/apps/dav/lib/CalDAV/Principal/User.php +++ b/apps/dav/lib/CalDAV/Principal/User.php @@ -27,6 +27,7 @@ class User extends \Sabre\CalDAV\Principal\User { * * @return array */ + #[\Override] public function getACL() { $acl = parent::getACL(); $acl[] = [ @@ -44,6 +45,7 @@ class User extends \Sabre\CalDAV\Principal\User { * * @return \Sabre\DAV\INode */ + #[\Override] public function getChild($name) { $principal = $this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/' . $name); if (!$principal) { @@ -65,6 +67,7 @@ class User extends \Sabre\CalDAV\Principal\User { * * @return \Sabre\DAV\INode[] */ + #[\Override] public function getChildren() { $r = []; if ($this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/calendar-proxy-read')) { diff --git a/apps/dav/lib/CalDAV/PublicCalendar.php b/apps/dav/lib/CalDAV/PublicCalendar.php index 9af6e544165..5decc50f823 100644 --- a/apps/dav/lib/CalDAV/PublicCalendar.php +++ b/apps/dav/lib/CalDAV/PublicCalendar.php @@ -15,6 +15,7 @@ class PublicCalendar extends Calendar { * @throws NotFound * @return PublicCalendarObject */ + #[\Override] public function getChild($name) { $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name); @@ -32,6 +33,7 @@ class PublicCalendar extends Calendar { /** * @return PublicCalendarObject[] */ + #[\Override] public function getChildren() { $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']); $children = []; @@ -49,6 +51,7 @@ class PublicCalendar extends Calendar { * @param string[] $paths * @return PublicCalendarObject[] */ + #[\Override] public function getMultipleChildren(array $paths) { $objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths); $children = []; @@ -66,6 +69,7 @@ class PublicCalendar extends Calendar { * public calendars are always shared * @return bool */ + #[\Override] public function isShared() { return true; } diff --git a/apps/dav/lib/CalDAV/PublicCalendarObject.php b/apps/dav/lib/CalDAV/PublicCalendarObject.php index a05b09b0deb..f98a3652d23 100644 --- a/apps/dav/lib/CalDAV/PublicCalendarObject.php +++ b/apps/dav/lib/CalDAV/PublicCalendarObject.php @@ -14,6 +14,7 @@ class PublicCalendarObject extends CalendarObject { * public calendars are always shared * @return bool */ + #[\Override] protected function isShared() { return true; } diff --git a/apps/dav/lib/CalDAV/PublicCalendarRoot.php b/apps/dav/lib/CalDAV/PublicCalendarRoot.php index edfb9f8dccc..3d7a97cedab 100644 --- a/apps/dav/lib/CalDAV/PublicCalendarRoot.php +++ b/apps/dav/lib/CalDAV/PublicCalendarRoot.php @@ -32,6 +32,7 @@ class PublicCalendarRoot extends Collection { /** * @inheritdoc */ + #[\Override] public function getName() { return 'public-calendars'; } @@ -39,6 +40,7 @@ class PublicCalendarRoot extends Collection { /** * @inheritdoc */ + #[\Override] public function getChild($name) { $calendar = $this->caldavBackend->getPublicCalendar($name); return new PublicCalendar($this->caldavBackend, $calendar, $this->l10n, $this->config, $this->logger); @@ -47,6 +49,7 @@ class PublicCalendarRoot extends Collection { /** * @inheritdoc */ + #[\Override] public function getChildren() { return []; } diff --git a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php index 167a5a20df0..5ba76dd418e 100644 --- a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php +++ b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php @@ -58,6 +58,7 @@ class PublishPlugin extends ServerPlugin { * * @return string[] */ + #[\Override] public function getFeatures() { // May have to be changed to be detected return ['oc-calendar-publishing', 'calendarserver-sharing']; @@ -71,6 +72,7 @@ class PublishPlugin extends ServerPlugin { * * @return string */ + #[\Override] public function getPluginName() { return 'oc-calendar-publishing'; } @@ -85,6 +87,7 @@ class PublishPlugin extends ServerPlugin { * * @param Server $server */ + #[\Override] public function initialize(Server $server) { $this->server = $server; diff --git a/apps/dav/lib/CalDAV/Publishing/Xml/Publisher.php b/apps/dav/lib/CalDAV/Publishing/Xml/Publisher.php index fb9b7298f9b..d5d0bc45603 100644 --- a/apps/dav/lib/CalDAV/Publishing/Xml/Publisher.php +++ b/apps/dav/lib/CalDAV/Publishing/Xml/Publisher.php @@ -47,6 +47,7 @@ class Publisher implements XmlSerializable { * @param Writer $writer * @return void */ + #[\Override] public function xmlSerialize(Writer $writer) { if (!$this->isPublished) { // for pre-publish-url diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php index 94edff98e52..c558c2a0547 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php @@ -52,6 +52,7 @@ abstract class AbstractProvider implements INotificationProvider { * @param IUser[] $users * @return void */ + #[\Override] abstract public function send(VEvent $vevent, ?string $calendarDisplayName, array $principalEmailAddresses, diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php index 611bd4953a1..22a1fa48fdd 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php @@ -54,6 +54,7 @@ class EmailProvider extends AbstractProvider { * @param array $users * @throws \Exception */ + #[\Override] public function send(VEvent $vevent, ?string $calendarDisplayName, array $principalEmailAddresses, diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php index a3f0cce547a..cfea7e1fc45 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php @@ -50,6 +50,7 @@ class PushProvider extends AbstractProvider { * @param IUser[] $users * @throws \Exception */ + #[\Override] public function send(VEvent $vevent, ?string $calendarDisplayName, array $principalEmailAddresses, diff --git a/apps/dav/lib/CalDAV/Reminder/Notifier.php b/apps/dav/lib/CalDAV/Reminder/Notifier.php index 137fb509f56..cefbc0ce548 100644 --- a/apps/dav/lib/CalDAV/Reminder/Notifier.php +++ b/apps/dav/lib/CalDAV/Reminder/Notifier.php @@ -49,6 +49,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getID():string { return Application::APP_ID; } @@ -59,6 +60,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getName():string { return $this->l10nFactory->get('dav')->t('Calendar'); } @@ -71,6 +73,7 @@ class Notifier implements INotifier { * @return INotification * @throws UnknownNotificationException */ + #[\Override] public function prepare(INotification $notification, string $languageCode):INotification { if ($notification->getApp() !== Application::APP_ID) { diff --git a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php index fa3ee937f22..993f460b7f3 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php @@ -65,6 +65,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { * @param string $prefixPath * @return string[] */ + #[\Override] public function getPrincipalsByPrefix($prefixPath): array { $principals = []; @@ -115,6 +116,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { * * @return array */ + #[\Override] public function getPrincipalByPath($path) { if (!str_starts_with($path, $this->principalPrefix)) { return null; @@ -186,6 +188,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { * @param PropPatch $propPatch * @return int */ + #[\Override] public function updatePrincipal($path, PropPatch $propPatch): int { return 0; } @@ -196,6 +199,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { * * @return array */ + #[\Override] public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') { $results = []; if (\count($searchProperties) === 0) { @@ -392,6 +396,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { * @return null|string * @throws Exception */ + #[\Override] public function findByUri($uri, $principalPrefix): ?string { $user = $this->userSession->getUser(); if (!$user) { diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index 6acbb503e24..01e4eb1f393 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -69,6 +69,7 @@ class IMipPlugin extends SabreIMipPlugin { parent::__construct(''); } + #[\Override] public function initialize(DAV\Server $server): void { parent::initialize($server); $server->on('beforeWriteContent', [$this, 'beforeWriteContent'], 10); @@ -97,6 +98,7 @@ class IMipPlugin extends SabreIMipPlugin { * @param Message $iTipMessage * @return void */ + #[\Override] public function schedule(Message $iTipMessage) { // Not sending any emails if the system considers the update insignificant diff --git a/apps/dav/lib/CalDAV/Schedule/Plugin.php b/apps/dav/lib/CalDAV/Schedule/Plugin.php index ac230901c0d..0bfcb17cb89 100644 --- a/apps/dav/lib/CalDAV/Schedule/Plugin.php +++ b/apps/dav/lib/CalDAV/Schedule/Plugin.php @@ -68,6 +68,7 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin { * @param Server $server * @return void */ + #[\Override] public function initialize(Server $server) { parent::initialize($server); $server->on('propFind', [$this, 'propFindDefaultCalendarUrl'], 90); @@ -85,6 +86,7 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin { /** * Returns an instance of the iTip\Broker. */ + #[\Override] protected function createITipBroker(): TipBroker { return new TipBroker(); } @@ -108,6 +110,7 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin { * @param INode $node * @return void */ + #[\Override] public function propFind(PropFind $propFind, INode $node) { if ($node instanceof IPrincipal) { // overwrite Sabre/Dav's implementation @@ -133,6 +136,7 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin { * @param string $principal * @return array */ + #[\Override] public function getAddressesForPrincipal($principal) { $result = parent::getAddressesForPrincipal($principal); @@ -156,6 +160,7 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin { * @param mixed $modified * @param mixed $isNew */ + #[\Override] public function calendarObjectChange(RequestInterface $request, ResponseInterface $response, VCalendar $vCal, $calendarPath, &$modified, $isNew) { // Save the first path we get as a calendar-object-change request if (!$this->pathOfCalendarObjectChange) { @@ -220,6 +225,7 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin { /** * @inheritDoc */ + #[\Override] public function beforeUnbind($path): void { // Do not generate iTip and iMip messages if scheduling is disabled for this message @@ -245,6 +251,7 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin { /** * @inheritDoc */ + #[\Override] public function scheduleLocalDelivery(ITip\Message $iTipMessage):void { /** @var VEvent|null $vevent */ $vevent = $iTipMessage->message->VEVENT ?? null; diff --git a/apps/dav/lib/CalDAV/Search/SearchPlugin.php b/apps/dav/lib/CalDAV/Search/SearchPlugin.php index 27e39a76305..b695276f7a8 100644 --- a/apps/dav/lib/CalDAV/Search/SearchPlugin.php +++ b/apps/dav/lib/CalDAV/Search/SearchPlugin.php @@ -30,6 +30,7 @@ class SearchPlugin extends ServerPlugin { * * @return string[] */ + #[\Override] public function getFeatures() { // May have to be changed to be detected return ['nc-calendar-search']; @@ -43,6 +44,7 @@ class SearchPlugin extends ServerPlugin { * * @return string */ + #[\Override] public function getPluginName() { return 'nc-calendar-search'; } @@ -57,6 +59,7 @@ class SearchPlugin extends ServerPlugin { * * @param Server $server */ + #[\Override] public function initialize(Server $server) { $this->server = $server; @@ -93,6 +96,7 @@ class SearchPlugin extends ServerPlugin { * @param string $uri * @return array */ + #[\Override] public function getSupportedReportSet($uri) { $node = $this->server->tree->getNodeForPath($uri); diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php index a95470a8b47..485fd33be2c 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php @@ -20,6 +20,7 @@ class CompFilter implements XmlDeserializable { * @throws BadRequest * @return string */ + #[\Override] public static function xmlDeserialize(Reader $reader) { $att = $reader->parseAttributes(); $componentName = $att['name']; diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php index 7c56a50cdd9..4ff684913b7 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php @@ -20,6 +20,7 @@ class LimitFilter implements XmlDeserializable { * @throws BadRequest * @return int */ + #[\Override] public static function xmlDeserialize(Reader $reader) { $value = $reader->parseInnerTree(); if (!is_int($value) && !is_string($value)) { diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php index 8e06b722c03..7e36bf65b3a 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php @@ -20,6 +20,7 @@ class OffsetFilter implements XmlDeserializable { * @throws BadRequest * @return int */ + #[\Override] public static function xmlDeserialize(Reader $reader) { $value = $reader->parseInnerTree(); if (!is_int($value) && !is_string($value)) { diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php index 057e337d0d3..fb69479c75b 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php @@ -20,6 +20,7 @@ class ParamFilter implements XmlDeserializable { * @throws BadRequest * @return string */ + #[\Override] public static function xmlDeserialize(Reader $reader) { $att = $reader->parseAttributes(); $property = $att['property']; diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/PropFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/PropFilter.php index 3ff265e80f5..e6a0151ae29 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/PropFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/PropFilter.php @@ -20,6 +20,7 @@ class PropFilter implements XmlDeserializable { * @throws BadRequest * @return string */ + #[\Override] public static function xmlDeserialize(Reader $reader) { $att = $reader->parseAttributes(); $componentName = $att['name']; diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php index 9445158f3db..a6e6846a206 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php @@ -20,6 +20,7 @@ class SearchTermFilter implements XmlDeserializable { * @throws BadRequest * @return string */ + #[\Override] public static function xmlDeserialize(Reader $reader) { $value = $reader->parseInnerTree(); if (!is_string($value)) { diff --git a/apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php b/apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php index 6ece88fa87b..e00b7095a57 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php @@ -66,6 +66,7 @@ class CalendarSearchReport implements XmlDeserializable { * @param Reader $reader * @return mixed */ + #[\Override] public static function xmlDeserialize(Reader $reader) { $elems = $reader->parseInnerTree([ '{http://nextcloud.com/ns}comp-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter', diff --git a/apps/dav/lib/CalDAV/Security/RateLimitingPlugin.php b/apps/dav/lib/CalDAV/Security/RateLimitingPlugin.php index ca5b0174166..80db53c9c70 100644 --- a/apps/dav/lib/CalDAV/Security/RateLimitingPlugin.php +++ b/apps/dav/lib/CalDAV/Security/RateLimitingPlugin.php @@ -34,6 +34,7 @@ class RateLimitingPlugin extends ServerPlugin { ) { } + #[\Override] public function initialize(DAV\Server $server): void { $server->on('beforeBind', [$this, 'beforeBind'], 1); } diff --git a/apps/dav/lib/CalDAV/TipBroker.php b/apps/dav/lib/CalDAV/TipBroker.php index 82a00171dfa..0bc48c2922a 100644 --- a/apps/dav/lib/CalDAV/TipBroker.php +++ b/apps/dav/lib/CalDAV/TipBroker.php @@ -41,6 +41,7 @@ class TipBroker extends Broker { * * @return VCalendar|null */ + #[\Override] protected function processMessageCancel(Message $itipMessage, ?VCalendar $existingObject = null) { if ($existingObject === null) { return null; @@ -88,6 +89,7 @@ class TipBroker extends Broker { * * @return array */ + #[\Override] protected function parseEventForOrganizer(VCalendar $calendar, array $eventInfo, array $oldEventInfo) { $messages = []; diff --git a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php index d8c429f2056..79128a72402 100644 --- a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php +++ b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php @@ -27,6 +27,7 @@ class DeletedCalendarObject implements IACL, ICalendarObject, IRestorable { ) { } + #[\Override] public function delete() { $this->calDavBackend->deleteCalendarObject( $this->objectData['calendarid'], @@ -36,26 +37,32 @@ class DeletedCalendarObject implements IACL, ICalendarObject, IRestorable { ); } + #[\Override] public function getName() { return $this->name; } + #[\Override] public function setName($name) { throw new Forbidden(); } + #[\Override] public function getLastModified() { return 0; } + #[\Override] public function put($data) { throw new Forbidden(); } + #[\Override] public function get() { return $this->objectData['calendardata']; } + #[\Override] public function getContentType() { $mime = 'text/calendar; charset=utf-8'; if (isset($this->objectData['component']) && $this->objectData['component']) { @@ -65,14 +72,17 @@ class DeletedCalendarObject implements IACL, ICalendarObject, IRestorable { return $mime; } + #[\Override] public function getETag() { return $this->objectData['etag']; } + #[\Override] public function getSize() { return (int)$this->objectData['size']; } + #[\Override] public function restore(): void { $this->calDavBackend->restoreCalendarObject($this->objectData); } @@ -85,6 +95,7 @@ class DeletedCalendarObject implements IACL, ICalendarObject, IRestorable { return $this->objectData['calendaruri']; } + #[\Override] public function getACL(): array { return [ [ @@ -100,6 +111,7 @@ class DeletedCalendarObject implements IACL, ICalendarObject, IRestorable { ]; } + #[\Override] public function getOwner() { return $this->principalUri; } diff --git a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php index f75e19689f1..01d806d006c 100644 --- a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php +++ b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php @@ -35,10 +35,12 @@ class DeletedCalendarObjectsCollection implements ICalendarObjectContainer, IACL /** * @see \OCA\DAV\CalDAV\Trashbin\DeletedCalendarObjectsCollection::calendarQuery */ + #[\Override] public function getChildren() { throw new NotImplemented(); } + #[\Override] public function getChild($name) { if (!preg_match("/(\d+)\\.ics/", $name, $matches)) { throw new NotFound(); @@ -65,14 +67,17 @@ class DeletedCalendarObjectsCollection implements ICalendarObjectContainer, IACL ); } + #[\Override] public function createFile($name, $data = null) { throw new Forbidden(); } + #[\Override] public function createDirectory($name) { throw new Forbidden(); } + #[\Override] public function childExists($name) { try { $this->getChild($name); @@ -83,22 +88,27 @@ class DeletedCalendarObjectsCollection implements ICalendarObjectContainer, IACL return true; } + #[\Override] public function delete() { throw new Forbidden(); } + #[\Override] public function getName(): string { return self::NAME; } + #[\Override] public function setName($name) { throw new Forbidden(); } + #[\Override] public function getLastModified(): int { return 0; } + #[\Override] public function calendarQuery(array $filters) { return array_map(function (array $calendarObjectInfo) { return $this->getRelativeObjectPath($calendarObjectInfo); @@ -112,10 +122,12 @@ class DeletedCalendarObjectsCollection implements ICalendarObjectContainer, IACL ); } + #[\Override] public function getOwner() { return $this->principalInfo['uri']; } + #[\Override] public function getACL(): array { return [ [ diff --git a/apps/dav/lib/CalDAV/Trashbin/Plugin.php b/apps/dav/lib/CalDAV/Trashbin/Plugin.php index 6f58b1f3110..14c33956225 100644 --- a/apps/dav/lib/CalDAV/Trashbin/Plugin.php +++ b/apps/dav/lib/CalDAV/Trashbin/Plugin.php @@ -42,6 +42,7 @@ class Plugin extends ServerPlugin { $this->disableTrashbin = $request->getHeader('X-NC-CalDAV-No-Trashbin') === '1'; } + #[\Override] public function initialize(Server $server): void { $this->server = $server; $server->on('beforeMethod:*', [$this, 'beforeMethod']); @@ -104,10 +105,12 @@ class Plugin extends ServerPlugin { } } + #[\Override] public function getFeatures(): array { return ['nc-calendar-trashbin']; } + #[\Override] public function getPluginName(): string { return 'nc-calendar-trashbin'; } diff --git a/apps/dav/lib/CalDAV/Trashbin/RestoreTarget.php b/apps/dav/lib/CalDAV/Trashbin/RestoreTarget.php index 6641148de2b..4a7b1d5915b 100644 --- a/apps/dav/lib/CalDAV/Trashbin/RestoreTarget.php +++ b/apps/dav/lib/CalDAV/Trashbin/RestoreTarget.php @@ -18,26 +18,32 @@ use Sabre\DAV\INode; class RestoreTarget implements ICollection, IMoveTarget { public const NAME = 'restore'; + #[\Override] public function createFile($name, $data = null) { throw new Forbidden(); } + #[\Override] public function createDirectory($name) { throw new Forbidden(); } + #[\Override] public function getChild($name) { throw new NotFound(); } + #[\Override] public function getChildren(): array { return []; } + #[\Override] public function childExists($name): bool { return false; } + #[\Override] public function moveInto($targetName, $sourcePath, INode $sourceNode): bool { if ($sourceNode instanceof IRestorable) { $sourceNode->restore(); @@ -47,18 +53,22 @@ class RestoreTarget implements ICollection, IMoveTarget { return false; } + #[\Override] public function delete() { throw new Forbidden(); } + #[\Override] public function getName(): string { return 'restore'; } + #[\Override] public function setName($name) { throw new Forbidden(); } + #[\Override] public function getLastModified() { return 0; } diff --git a/apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php b/apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php index 1c76bd2295d..568831c2b37 100644 --- a/apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php +++ b/apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php @@ -32,18 +32,22 @@ class TrashbinHome implements IACL, ICollection, IProperties { ) { } + #[\Override] public function getOwner(): string { return $this->principalInfo['uri']; } + #[\Override] public function createFile($name, $data = null) { throw new Forbidden('Permission denied to create files in the trashbin'); } + #[\Override] public function createDirectory($name) { throw new Forbidden('Permission denied to create a directory in the trashbin'); } + #[\Override] public function getChild($name): INode { switch ($name) { case RestoreTarget::NAME: @@ -58,6 +62,7 @@ class TrashbinHome implements IACL, ICollection, IProperties { throw new NotFound(); } + #[\Override] public function getChildren(): array { return [ new RestoreTarget(), @@ -68,6 +73,7 @@ class TrashbinHome implements IACL, ICollection, IProperties { ]; } + #[\Override] public function childExists($name): bool { return in_array($name, [ RestoreTarget::NAME, @@ -75,26 +81,32 @@ class TrashbinHome implements IACL, ICollection, IProperties { ], true); } + #[\Override] public function delete() { throw new Forbidden('Permission denied to delete the trashbin'); } + #[\Override] public function getName(): string { return self::NAME; } + #[\Override] public function setName($name) { throw new Forbidden('Permission denied to rename the trashbin'); } + #[\Override] public function getLastModified(): int { return 0; } + #[\Override] public function propPatch(PropPatch $propPatch): void { throw new Forbidden('not implemented'); } + #[\Override] public function getProperties($properties): array { return [ '{DAV:}resourcetype' => new ResourceType([ diff --git a/apps/dav/lib/CalDAV/UpcomingEvent.php b/apps/dav/lib/CalDAV/UpcomingEvent.php index e8b604f460a..ff884ae22fd 100644 --- a/apps/dav/lib/CalDAV/UpcomingEvent.php +++ b/apps/dav/lib/CalDAV/UpcomingEvent.php @@ -55,6 +55,7 @@ class UpcomingEvent implements JsonSerializable { /** * @see ResponseDefinitions */ + #[\Override] public function jsonSerialize(): array { return [ 'uri' => $this->uri, diff --git a/apps/dav/lib/CalDAV/Validation/CalDavValidatePlugin.php b/apps/dav/lib/CalDAV/Validation/CalDavValidatePlugin.php index b647e63e67b..dd5d9cb6c15 100644 --- a/apps/dav/lib/CalDAV/Validation/CalDavValidatePlugin.php +++ b/apps/dav/lib/CalDAV/Validation/CalDavValidatePlugin.php @@ -23,6 +23,7 @@ class CalDavValidatePlugin extends ServerPlugin { ) { } + #[\Override] public function initialize(Server $server): void { $server->on('beforeMethod:PUT', [$this, 'beforePut']); } diff --git a/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php b/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php index e07be39c7b4..d0727076125 100644 --- a/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php +++ b/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php @@ -74,6 +74,7 @@ class Plugin extends ServerPlugin { * * @param Server $server */ + #[\Override] public function initialize(Server $server) { $this->server = $server; $server->on('beforeMethod:*', [$this, 'beforeMethod'], 15); @@ -123,6 +124,7 @@ class Plugin extends ServerPlugin { * * @return string[] */ + #[\Override] public function getFeatures():array { return ['nc-calendar-webcal-cache']; } @@ -135,6 +137,7 @@ class Plugin extends ServerPlugin { * * @return string */ + #[\Override] public function getPluginName():string { return 'nc-calendar-webcal-cache'; } diff --git a/apps/dav/lib/Capabilities.php b/apps/dav/lib/Capabilities.php index 154bafc78e2..c437df76a82 100644 --- a/apps/dav/lib/Capabilities.php +++ b/apps/dav/lib/Capabilities.php @@ -22,6 +22,7 @@ class Capabilities implements ICapability { /** * @return array{dav: array{chunking: string, public_shares_chunking: bool, search_supports_creation_time: bool, search_supports_upload_time: bool, search_supports_last_activity: bool, bulkupload?: string, absence-supported?: bool, absence-replacement?: bool}} */ + #[\Override] public function getCapabilities() { $capabilities = [ 'dav' => [ diff --git a/apps/dav/lib/CardDAV/Activity/Filter.php b/apps/dav/lib/CardDAV/Activity/Filter.php index 7724fb59c16..cee7092bff4 100644 --- a/apps/dav/lib/CardDAV/Activity/Filter.php +++ b/apps/dav/lib/CardDAV/Activity/Filter.php @@ -23,6 +23,7 @@ class Filter implements IFilter { /** * @return string Lowercase a-z and underscore only identifier */ + #[\Override] public function getIdentifier(): string { return 'contacts'; } @@ -30,6 +31,7 @@ class Filter implements IFilter { /** * @return string A translated string */ + #[\Override] public function getName(): string { return $this->l->t('Contacts'); } @@ -39,6 +41,7 @@ class Filter implements IFilter { * the admin section. The filters are arranged in ascending order of the * priority values. It is required to return a value between 0 and 100. */ + #[\Override] public function getPriority(): int { return 40; } @@ -46,6 +49,7 @@ class Filter implements IFilter { /** * @return string Full URL to an icon, empty string when none is given */ + #[\Override] public function getIcon(): string { return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/contacts.svg')); } @@ -54,6 +58,7 @@ class Filter implements IFilter { * @param string[] $types * @return string[] An array of allowed apps from which activities should be displayed */ + #[\Override] public function filterTypes(array $types): array { return array_intersect(['contacts'], $types); } @@ -61,6 +66,7 @@ class Filter implements IFilter { /** * @return string[] An array of allowed apps from which activities should be displayed */ + #[\Override] public function allowedApps(): array { return []; } diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php b/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php index cdb9769401f..b505583d236 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php @@ -45,6 +45,7 @@ class Addressbook extends Base { * @return IEvent * @throws UnknownActivityException */ + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== 'dav' || $event->getType() !== 'contacts') { throw new UnknownActivityException(); diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Card.php b/apps/dav/lib/CardDAV/Activity/Provider/Card.php index acf23c00531..f1434e75eb9 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Card.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Card.php @@ -43,6 +43,7 @@ class Card extends Base { * @return IEvent * @throws UnknownActivityException */ + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== 'dav' || $event->getType() !== 'contacts') { throw new UnknownActivityException(); diff --git a/apps/dav/lib/CardDAV/Activity/Setting.php b/apps/dav/lib/CardDAV/Activity/Setting.php index cc68cf87c83..b498ebd3374 100644 --- a/apps/dav/lib/CardDAV/Activity/Setting.php +++ b/apps/dav/lib/CardDAV/Activity/Setting.php @@ -14,6 +14,7 @@ class Setting extends CalDAVSetting { /** * @return string Lowercase a-z and underscore only identifier */ + #[\Override] public function getIdentifier(): string { return 'contacts'; } @@ -21,6 +22,7 @@ class Setting extends CalDAVSetting { /** * @return string A translated string */ + #[\Override] public function getName(): string { return $this->l->t('A contact or address book was modified'); } @@ -30,6 +32,7 @@ class Setting extends CalDAVSetting { * the admin section. The filters are arranged in ascending order of the * priority values. It is required to return a value between 0 and 100. */ + #[\Override] public function getPriority(): int { return 50; } @@ -37,6 +40,7 @@ class Setting extends CalDAVSetting { /** * @return bool True when the option can be changed for the stream */ + #[\Override] public function canChangeStream(): bool { return true; } @@ -44,6 +48,7 @@ class Setting extends CalDAVSetting { /** * @return bool True when the option can be changed for the stream */ + #[\Override] public function isDefaultEnabledStream(): bool { return true; } @@ -51,6 +56,7 @@ class Setting extends CalDAVSetting { /** * @return bool True when the option can be changed for the mail */ + #[\Override] public function canChangeMail(): bool { return true; } @@ -58,6 +64,7 @@ class Setting extends CalDAVSetting { /** * @return bool True when the option can be changed for the stream */ + #[\Override] public function isDefaultEnabledMail(): bool { return false; } diff --git a/apps/dav/lib/CardDAV/AddressBook.php b/apps/dav/lib/CardDAV/AddressBook.php index 4d30d507a7d..b02edb145a7 100644 --- a/apps/dav/lib/CardDAV/AddressBook.php +++ b/apps/dav/lib/CardDAV/AddressBook.php @@ -60,6 +60,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov * @param list $remove * @throws Forbidden */ + #[\Override] public function updateShares(array $add, array $remove): void { if ($this->isShared()) { throw new Forbidden(); @@ -78,6 +79,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov * * @return list */ + #[\Override] public function getShares(): array { if ($this->isShared()) { return []; @@ -85,6 +87,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov return $this->carddavBackend->getShares($this->getResourceId()); } + #[\Override] public function getACL() { $acl = [ [ @@ -142,10 +145,12 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov }); } + #[\Override] public function getChildACL() { return $this->getACL(); } + #[\Override] public function getChild($name) { $obj = $this->carddavBackend->getCard($this->addressBookInfo['id'], $name); if (!$obj) { @@ -155,6 +160,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov return new Card($this->carddavBackend, $this->addressBookInfo, $obj); } + #[\Override] public function getChildren() { $objs = $this->carddavBackend->getCards($this->addressBookInfo['id']); $children = []; @@ -166,6 +172,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov return $children; } + #[\Override] public function getMultipleChildren(array $paths) { $objs = $this->carddavBackend->getMultipleCards($this->addressBookInfo['id'], $paths); $children = []; @@ -177,10 +184,12 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov return $children; } + #[\Override] public function getResourceId(): int { return $this->addressBookInfo['id']; } + #[\Override] public function getOwner(): ?string { if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { return $this->addressBookInfo['{http://owncloud.org/ns}owner-principal']; @@ -188,6 +197,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov return parent::getOwner(); } + #[\Override] public function delete() { if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { $principal = 'principal:' . parent::getOwner(); @@ -207,6 +217,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov parent::delete(); } + #[\Override] public function propPatch(PropPatch $propPatch) { if (!isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { parent::propPatch($propPatch); @@ -232,6 +243,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov return true; } + #[\Override] public function getChanges($syncToken, $syncLevel, $limit = null) { return parent::getChanges($syncToken, $syncLevel, $limit); @@ -240,6 +252,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov /** * @inheritDoc */ + #[\Override] public function moveInto($targetName, $sourcePath, INode $sourceNode) { if (!($sourceNode instanceof Card)) { return false; diff --git a/apps/dav/lib/CardDAV/AddressBookImpl.php b/apps/dav/lib/CardDAV/AddressBookImpl.php index 6a10941d257..f22e38a41b4 100644 --- a/apps/dav/lib/CardDAV/AddressBookImpl.php +++ b/apps/dav/lib/CardDAV/AddressBookImpl.php @@ -41,6 +41,7 @@ class AddressBookImpl implements IAddressBookEnabled, ICreateContactFromString { * @return string defining the technical unique key * @since 5.0.0 */ + #[\Override] public function getKey() { return (string)$this->addressBookInfo['id']; } @@ -49,6 +50,7 @@ class AddressBookImpl implements IAddressBookEnabled, ICreateContactFromString { * @return string defining the unique uri * @since 16.0.0 */ + #[\Override] public function getUri(): string { return $this->addressBookInfo['uri']; } @@ -59,6 +61,7 @@ class AddressBookImpl implements IAddressBookEnabled, ICreateContactFromString { * @return mixed * @since 5.0.0 */ + #[\Override] public function getDisplayName() { return $this->addressBookInfo['{DAV:}displayname']; } @@ -82,6 +85,7 @@ class AddressBookImpl implements IAddressBookEnabled, ICreateContactFromString { * ] * @since 5.0.0 */ + #[\Override] public function search($pattern, $searchProperties, $options) { $results = $this->backend->search($this->getKey(), $pattern, $searchProperties, $options); @@ -100,6 +104,7 @@ class AddressBookImpl implements IAddressBookEnabled, ICreateContactFromString { * @return array an array representing the contact just created or updated * @since 5.0.0 */ + #[\Override] public function createOrUpdate($properties) { $update = false; if (!isset($properties['URI'])) { // create a new contact @@ -149,6 +154,7 @@ class AddressBookImpl implements IAddressBookEnabled, ICreateContactFromString { * @return mixed * @since 5.0.0 */ + #[\Override] public function getPermissions() { $permissions = $this->addressBook->getACL(); $result = 0; @@ -179,6 +185,7 @@ class AddressBookImpl implements IAddressBookEnabled, ICreateContactFromString { * @return bool successful or not * @since 5.0.0 */ + #[\Override] public function delete($id) { $uri = $this->backend->getCardUri($id); return $this->backend->deleteCard($this->addressBookInfo['id'], $uri); @@ -298,6 +305,7 @@ class AddressBookImpl implements IAddressBookEnabled, ICreateContactFromString { /** * @inheritDoc */ + #[\Override] public function isShared(): bool { if (!isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { return false; @@ -310,6 +318,7 @@ class AddressBookImpl implements IAddressBookEnabled, ICreateContactFromString { /** * @inheritDoc */ + #[\Override] public function isSystemAddressBook(): bool { return $this->addressBookInfo['principaluri'] === 'principals/system/system' && ( $this->addressBookInfo['uri'] === 'system' @@ -317,6 +326,7 @@ class AddressBookImpl implements IAddressBookEnabled, ICreateContactFromString { ); } + #[\Override] public function isEnabled(): bool { if (!$this->userId) { return true; @@ -338,6 +348,7 @@ class AddressBookImpl implements IAddressBookEnabled, ICreateContactFromString { return true; } + #[\Override] public function createFromString(string $name, string $vcfData): void { $this->backend->createCard($this->getKey(), $name, $vcfData); } diff --git a/apps/dav/lib/CardDAV/AddressBookRoot.php b/apps/dav/lib/CardDAV/AddressBookRoot.php index 5679a03545e..7f713f85e0f 100644 --- a/apps/dav/lib/CardDAV/AddressBookRoot.php +++ b/apps/dav/lib/CardDAV/AddressBookRoot.php @@ -40,10 +40,12 @@ class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot { * * @return \Sabre\DAV\INode */ + #[\Override] public function getChildForPrincipal(array $principal) { return new UserAddressBooks($this->carddavBackend, $principal['uri'], $this->pluginManager, $this->user, $this->groupManager); } + #[\Override] public function getName() { if ($this->principalPrefix === 'principals') { return parent::getName(); diff --git a/apps/dav/lib/CardDAV/Card.php b/apps/dav/lib/CardDAV/Card.php index 8cd4fd7e5ee..0cd307b4f5c 100644 --- a/apps/dav/lib/CardDAV/Card.php +++ b/apps/dav/lib/CardDAV/Card.php @@ -33,6 +33,7 @@ class Card extends \Sabre\CardDAV\Card { return $this->addressBookInfo['principaluri']; } + #[\Override] public function getOwner(): ?string { if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { return $this->addressBookInfo['{http://owncloud.org/ns}owner-principal']; diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index ecc9b7c135d..14f03e6ce8f 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -99,6 +99,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param string $principalUri * @return array */ + #[\Override] public function getAddressBooksForUser($principalUri) { return $this->atomic(function () use ($principalUri) { $principalUriOriginal = $principalUri; @@ -302,6 +303,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param \Sabre\DAV\PropPatch $propPatch * @return void */ + #[\Override] public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) { $supportedProperties = [ '{DAV:}displayname', @@ -353,6 +355,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @throws BadRequest * @throws Exception */ + #[\Override] public function createAddressBook($principalUri, $url, array $properties) { if (strlen($url) > 255) { throw new BadRequest('URI too long. Address book not created'); @@ -416,6 +419,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param mixed $addressBookId * @return void */ + #[\Override] public function deleteAddressBook($addressBookId) { $this->atomic(function () use ($addressBookId): void { $addressBookId = (int)$addressBookId; @@ -472,6 +476,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param mixed $addressbookId * @return array */ + #[\Override] public function getCards($addressbookId) { $query = $this->db->getQueryBuilder(); $query->select(['id', 'addressbookid', 'uri', 'lastmodified', 'etag', 'size', 'carddata', 'uid']) @@ -516,6 +521,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param string $cardUri * @return array */ + #[\Override] public function getCard($addressBookId, $cardUri) { $query = $this->db->getQueryBuilder(); $query->select(['id', 'addressbookid', 'uri', 'lastmodified', 'etag', 'size', 'carddata', 'uid']) @@ -552,6 +558,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param array $uris * @return array */ + #[\Override] public function getMultipleCards($addressBookId, array $uris) { if (empty($uris)) { return []; @@ -612,6 +619,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param bool $checkAlreadyExists * @return string */ + #[\Override] public function createCard($addressBookId, $cardUri, $cardData, bool $checkAlreadyExists = true) { $etag = md5($cardData); $uid = $this->getUID($cardData); @@ -684,6 +692,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param string $cardData * @return string */ + #[\Override] public function updateCard($addressBookId, $cardUri, $cardData) { $uid = $this->getUID($cardData); $etag = md5($cardData); @@ -771,6 +780,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param string $cardUri * @return bool */ + #[\Override] public function deleteCard($addressBookId, $cardUri) { return $this->atomic(function () use ($addressBookId, $cardUri) { $addressBookData = $this->getAddressBookById($addressBookId); @@ -858,6 +868,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param int|null $limit * @return array */ + #[\Override] public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) { $maxLimit = $this->config->getSystemValueInt('carddav_sync_request_truncation', 2500); $limit = ($limit === null) ? $maxLimit : min($limit, $maxLimit); diff --git a/apps/dav/lib/CardDAV/HasPhotoPlugin.php b/apps/dav/lib/CardDAV/HasPhotoPlugin.php index 6e2e0423910..07217901da9 100644 --- a/apps/dav/lib/CardDAV/HasPhotoPlugin.php +++ b/apps/dav/lib/CardDAV/HasPhotoPlugin.php @@ -27,6 +27,7 @@ class HasPhotoPlugin extends ServerPlugin { * @param Server $server * @return void */ + #[\Override] public function initialize(Server $server) { $server->on('propFind', [$this, 'propFind']); } @@ -62,6 +63,7 @@ class HasPhotoPlugin extends ServerPlugin { * * @return string */ + #[\Override] public function getPluginName() { return 'vcard-has-photo'; } @@ -77,6 +79,7 @@ class HasPhotoPlugin extends ServerPlugin { * * @return array */ + #[\Override] public function getPluginInfo() { return [ 'name' => $this->getPluginName(), diff --git a/apps/dav/lib/CardDAV/ImageExportPlugin.php b/apps/dav/lib/CardDAV/ImageExportPlugin.php index e4b1047173d..088d8d4efcf 100644 --- a/apps/dav/lib/CardDAV/ImageExportPlugin.php +++ b/apps/dav/lib/CardDAV/ImageExportPlugin.php @@ -37,6 +37,7 @@ class ImageExportPlugin extends ServerPlugin { * @param Server $server * @return void */ + #[\Override] public function initialize(Server $server) { $this->server = $server; $this->server->on('method:GET', [$this, 'httpGet'], 90); diff --git a/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php b/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php index 372906a6ae8..46eb6e2a625 100644 --- a/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php +++ b/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php @@ -41,6 +41,7 @@ abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties { /** * @inheritDoc */ + #[\Override] final public function getName() { return implode(self::DELIMITER, [ self::PREFIX, @@ -52,6 +53,7 @@ abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties { /** * @inheritDoc */ + #[\Override] final public function setName($name) { throw new DAV\Exception\MethodNotAllowed('Renaming address books is not yet supported'); } @@ -59,6 +61,7 @@ abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties { /** * @inheritDoc */ + #[\Override] final public function createDirectory($name) { throw new DAV\Exception\MethodNotAllowed('Creating collections in address book objects is not allowed'); } diff --git a/apps/dav/lib/CardDAV/MultiGetExportPlugin.php b/apps/dav/lib/CardDAV/MultiGetExportPlugin.php index 9d6b0df838e..4759bd33563 100644 --- a/apps/dav/lib/CardDAV/MultiGetExportPlugin.php +++ b/apps/dav/lib/CardDAV/MultiGetExportPlugin.php @@ -25,6 +25,7 @@ class MultiGetExportPlugin extends DAV\ServerPlugin { * @param Server $server * @return void */ + #[\Override] public function initialize(Server $server) { $this->server = $server; $this->server->on('afterMethod:REPORT', [$this, 'httpReport'], 90); @@ -80,6 +81,7 @@ class MultiGetExportPlugin extends DAV\ServerPlugin { * * @return string */ + #[\Override] public function getPluginName() { return 'vcf-multi-get-intercept-and-export'; } @@ -95,6 +97,7 @@ class MultiGetExportPlugin extends DAV\ServerPlugin { * * @return array */ + #[\Override] public function getPluginInfo() { return [ 'name' => $this->getPluginName(), diff --git a/apps/dav/lib/CardDAV/Notification/Notifier.php b/apps/dav/lib/CardDAV/Notification/Notifier.php index 268d0590b46..d9e6a259f50 100644 --- a/apps/dav/lib/CardDAV/Notification/Notifier.php +++ b/apps/dav/lib/CardDAV/Notification/Notifier.php @@ -25,6 +25,7 @@ class Notifier implements INotifier { /** * @inheritDoc */ + #[\Override] public function getID(): string { return Application::APP_ID; } @@ -32,6 +33,7 @@ class Notifier implements INotifier { /** * @inheritDoc */ + #[\Override] public function getName(): string { return $this->l10nFactory->get(Application::APP_ID)->t('Contacts'); } @@ -39,6 +41,7 @@ class Notifier implements INotifier { /** * @inheritDoc */ + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== Application::APP_ID) { throw new UnknownNotificationException(); diff --git a/apps/dav/lib/CardDAV/Plugin.php b/apps/dav/lib/CardDAV/Plugin.php index 0ec10306ceb..09123790c2e 100644 --- a/apps/dav/lib/CardDAV/Plugin.php +++ b/apps/dav/lib/CardDAV/Plugin.php @@ -13,6 +13,7 @@ use Sabre\DAV\PropFind; use Sabre\DAV\Server; class Plugin extends \Sabre\CardDAV\Plugin { + #[\Override] public function initialize(Server $server) { $server->on('propFind', [$this, 'propFind']); parent::initialize($server); @@ -24,6 +25,7 @@ class Plugin extends \Sabre\CardDAV\Plugin { * @param string $principal * @return string|null */ + #[\Override] protected function getAddressbookHomeForPrincipal($principal) { if (strrpos($principal, 'principals/users', -strlen($principal)) !== false) { [, $principalId] = \Sabre\Uri\split($principal); diff --git a/apps/dav/lib/CardDAV/Security/CardDavRateLimitingPlugin.php b/apps/dav/lib/CardDAV/Security/CardDavRateLimitingPlugin.php index 3e18a1341b0..a06cd18aa81 100644 --- a/apps/dav/lib/CardDAV/Security/CardDavRateLimitingPlugin.php +++ b/apps/dav/lib/CardDAV/Security/CardDavRateLimitingPlugin.php @@ -38,6 +38,7 @@ class CardDavRateLimitingPlugin extends ServerPlugin { $this->logger = $logger; } + #[\Override] public function initialize(DAV\Server $server): void { $server->on('beforeBind', [$this, 'beforeBind'], 1); } diff --git a/apps/dav/lib/CardDAV/SystemAddressbook.php b/apps/dav/lib/CardDAV/SystemAddressbook.php index 636089dbab0..6984298d1c2 100644 --- a/apps/dav/lib/CardDAV/SystemAddressbook.php +++ b/apps/dav/lib/CardDAV/SystemAddressbook.php @@ -53,6 +53,7 @@ class SystemAddressbook extends AddressBook { * 'Allow username autocompletion in share dialog' + 'Allow username autocompletion to users based on phone number integration' -> show only the same user * 'Allow username autocompletion in share dialog' + 'Allow username autocompletion to users within the same groups' + 'Allow username autocompletion to users based on phone number integration' -> show only users in intersecting groups */ + #[\Override] public function getChildren() { $shareEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; $shareEnumerationGroup = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_group', 'no') === 'yes'; @@ -101,6 +102,7 @@ class SystemAddressbook extends AddressBook { * @return Card[] * @throws NotFound */ + #[\Override] public function getMultipleChildren($paths): array { $shareEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; $shareEnumerationGroup = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_group', 'no') === 'yes'; @@ -164,6 +166,7 @@ class SystemAddressbook extends AddressBook { * @throws NotFound * @throws Forbidden */ + #[\Override] public function getChild($name): Card { $user = $this->userSession->getUser(); $shareEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; @@ -211,6 +214,7 @@ class SystemAddressbook extends AddressBook { } return new Card($this->carddavBackend, $this->addressBookInfo, $obj); } + #[\Override] public function getChanges($syncToken, $syncLevel, $limit = null) { if (!$this->carddavBackend instanceof SyncSupport) { @@ -320,6 +324,7 @@ class SystemAddressbook extends AddressBook { * @return mixed * @throws Forbidden */ + #[\Override] public function delete() { if ($this->isFederation()) { parent::delete(); @@ -327,6 +332,7 @@ class SystemAddressbook extends AddressBook { throw new Forbidden(); } + #[\Override] public function getACL() { return array_filter(parent::getACL(), function ($acl) { if (in_array($acl['privilege'], ['{DAV:}write', '{DAV:}all'], true)) { diff --git a/apps/dav/lib/CardDAV/UserAddressBooks.php b/apps/dav/lib/CardDAV/UserAddressBooks.php index ed18f5da0e1..00ee75b7992 100644 --- a/apps/dav/lib/CardDAV/UserAddressBooks.php +++ b/apps/dav/lib/CardDAV/UserAddressBooks.php @@ -56,6 +56,7 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome { * * @return IAddressBook[] */ + #[\Override] public function getChildren() { /** @var string|array $principal */ $principal = $this->principalUri; @@ -109,6 +110,7 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome { return array_merge($objects, ...$objectsFromPlugins); } + #[\Override] public function createExtendedCollection($name, MkCol $mkCol) { if (ExternalAddressBook::doesViolateReservedName($name)) { throw new MethodNotAllowed('The resource you tried to create has a reserved name'); @@ -129,6 +131,7 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome { * * @return array */ + #[\Override] public function getACL() { $acl = parent::getACL(); if ($this->principalUri === 'principals/system/system') { diff --git a/apps/dav/lib/CardDAV/Validation/CardDavValidatePlugin.php b/apps/dav/lib/CardDAV/Validation/CardDavValidatePlugin.php index a5fd80ec124..bef08961d1a 100644 --- a/apps/dav/lib/CardDAV/Validation/CardDavValidatePlugin.php +++ b/apps/dav/lib/CardDAV/Validation/CardDavValidatePlugin.php @@ -23,6 +23,7 @@ class CardDavValidatePlugin extends ServerPlugin { ) { } + #[\Override] public function initialize(Server $server): void { $server->on('beforeMethod:PUT', [$this, 'beforePut']); } diff --git a/apps/dav/lib/CardDAV/Xml/Groups.php b/apps/dav/lib/CardDAV/Xml/Groups.php index 07aeecb3fa2..b709b0fe502 100644 --- a/apps/dav/lib/CardDAV/Xml/Groups.php +++ b/apps/dav/lib/CardDAV/Xml/Groups.php @@ -21,6 +21,7 @@ class Groups implements XmlSerializable { ) { } + #[\Override] public function xmlSerialize(Writer $writer) { foreach ($this->groups as $group) { $writer->writeElement('{' . self::NS_OWNCLOUD . '}group', $group); diff --git a/apps/dav/lib/Command/ClearCalendarUnshares.php b/apps/dav/lib/Command/ClearCalendarUnshares.php index bb367a9cd0f..5da78645dc0 100644 --- a/apps/dav/lib/Command/ClearCalendarUnshares.php +++ b/apps/dav/lib/Command/ClearCalendarUnshares.php @@ -44,6 +44,7 @@ class ClearCalendarUnshares extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this->addArgument( 'uid', @@ -52,6 +53,7 @@ class ClearCalendarUnshares extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = (string)$input->getArgument('uid'); if (!$this->userManager->userExists($user)) { diff --git a/apps/dav/lib/Command/ClearContactsPhotoCache.php b/apps/dav/lib/Command/ClearContactsPhotoCache.php index 82e64c3145a..3a40df212f9 100644 --- a/apps/dav/lib/Command/ClearContactsPhotoCache.php +++ b/apps/dav/lib/Command/ClearContactsPhotoCache.php @@ -32,6 +32,7 @@ class ClearContactsPhotoCache extends Command { parent::__construct(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $photoCacheAppData = $this->appDataFactory->get('dav-photocache'); diff --git a/apps/dav/lib/Command/CreateAddressBook.php b/apps/dav/lib/Command/CreateAddressBook.php index 9626edeba26..7373a6db8e2 100644 --- a/apps/dav/lib/Command/CreateAddressBook.php +++ b/apps/dav/lib/Command/CreateAddressBook.php @@ -22,6 +22,7 @@ class CreateAddressBook extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('dav:create-addressbook') @@ -34,6 +35,7 @@ class CreateAddressBook extends Command { 'Name of the addressbook'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = $input->getArgument('user'); if (!$this->userManager->userExists($user)) { diff --git a/apps/dav/lib/Command/CreateCalendar.php b/apps/dav/lib/Command/CreateCalendar.php index c48db3bb65c..492d6c86769 100644 --- a/apps/dav/lib/Command/CreateCalendar.php +++ b/apps/dav/lib/Command/CreateCalendar.php @@ -40,6 +40,7 @@ class CreateCalendar extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('dav:create-calendar') @@ -52,6 +53,7 @@ class CreateCalendar extends Command { 'Name of the calendar'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = $input->getArgument('user'); if (!$this->userManager->userExists($user)) { diff --git a/apps/dav/lib/Command/CreateSubscription.php b/apps/dav/lib/Command/CreateSubscription.php index 1364070e530..07d116f6419 100644 --- a/apps/dav/lib/Command/CreateSubscription.php +++ b/apps/dav/lib/Command/CreateSubscription.php @@ -26,6 +26,7 @@ class CreateSubscription extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('dav:create-subscription') @@ -44,6 +45,7 @@ class CreateSubscription extends Command { 'Hex color code for the calendar color'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = $input->getArgument('user'); if (!$this->userManager->userExists($user)) { diff --git a/apps/dav/lib/Command/DeleteCalendar.php b/apps/dav/lib/Command/DeleteCalendar.php index f6dbed856e6..748637fba89 100644 --- a/apps/dav/lib/Command/DeleteCalendar.php +++ b/apps/dav/lib/Command/DeleteCalendar.php @@ -32,6 +32,7 @@ class DeleteCalendar extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('dav:delete-calendar') @@ -52,6 +53,7 @@ class DeleteCalendar extends Command { 'Force delete skipping trashbin'); } + #[\Override] protected function execute( InputInterface $input, OutputInterface $output, diff --git a/apps/dav/lib/Command/DeleteSubscription.php b/apps/dav/lib/Command/DeleteSubscription.php index db0cb6295c9..ccde42e77b6 100644 --- a/apps/dav/lib/Command/DeleteSubscription.php +++ b/apps/dav/lib/Command/DeleteSubscription.php @@ -31,6 +31,7 @@ class DeleteSubscription extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->addArgument( @@ -45,6 +46,7 @@ class DeleteSubscription extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = (string)$input->getArgument('uid'); if (!$this->userManager->userExists($user)) { diff --git a/apps/dav/lib/Command/ExportCalendar.php b/apps/dav/lib/Command/ExportCalendar.php index 006b6c331c8..af9076eb5a6 100644 --- a/apps/dav/lib/Command/ExportCalendar.php +++ b/apps/dav/lib/Command/ExportCalendar.php @@ -39,6 +39,7 @@ class ExportCalendar extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this->setName('calendar:export') ->setDescription('Export calendar data from supported calendars to disk or stdout') @@ -48,6 +49,7 @@ class ExportCalendar extends Command { ->addOption('location', null, InputOption::VALUE_REQUIRED, 'Location of where to write the output. Defaults to stdout'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $userId = $input->getArgument('uid'); $calendarId = $input->getArgument('uri'); diff --git a/apps/dav/lib/Command/FixCalendarSyncCommand.php b/apps/dav/lib/Command/FixCalendarSyncCommand.php index cb31355c10d..7b56abd3048 100644 --- a/apps/dav/lib/Command/FixCalendarSyncCommand.php +++ b/apps/dav/lib/Command/FixCalendarSyncCommand.php @@ -27,6 +27,7 @@ class FixCalendarSyncCommand extends Command { parent::__construct('dav:fix-missing-caldav-changes'); } + #[\Override] protected function configure(): void { $this->setDescription('Insert missing calendarchanges rows for existing events'); $this->addArgument( @@ -37,6 +38,7 @@ class FixCalendarSyncCommand extends Command { ); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $userArg = $input->getArgument('user'); if ($userArg !== null) { diff --git a/apps/dav/lib/Command/GetAbsenceCommand.php b/apps/dav/lib/Command/GetAbsenceCommand.php index 50d8df4ab38..4727617b5d1 100644 --- a/apps/dav/lib/Command/GetAbsenceCommand.php +++ b/apps/dav/lib/Command/GetAbsenceCommand.php @@ -25,6 +25,7 @@ class GetAbsenceCommand extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this->setName('dav:absence:get'); $this->addArgument( @@ -34,6 +35,7 @@ class GetAbsenceCommand extends Command { ); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $userId = $input->getArgument('user-id'); diff --git a/apps/dav/lib/Command/ImportCalendar.php b/apps/dav/lib/Command/ImportCalendar.php index 769bc6cd888..74f8e8901ea 100644 --- a/apps/dav/lib/Command/ImportCalendar.php +++ b/apps/dav/lib/Command/ImportCalendar.php @@ -41,6 +41,7 @@ class ImportCalendar extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this->setName('calendar:import') ->setDescription('Import calendar data to supported calendars from disk or stdin') @@ -57,6 +58,7 @@ class ImportCalendar extends Command { ->addOption('show-errors', null, InputOption::VALUE_NONE, 'show all errored items after processing'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $userId = $input->getArgument('uid'); $calendarId = $input->getArgument('uri'); diff --git a/apps/dav/lib/Command/ListAddressbooks.php b/apps/dav/lib/Command/ListAddressbooks.php index c0b6e63ccb8..29b1872aee4 100644 --- a/apps/dav/lib/Command/ListAddressbooks.php +++ b/apps/dav/lib/Command/ListAddressbooks.php @@ -24,6 +24,7 @@ class ListAddressbooks extends Command { parent::__construct('dav:list-addressbooks'); } + #[\Override] protected function configure(): void { $this ->setDescription('List all addressbooks of a user') @@ -32,6 +33,7 @@ class ListAddressbooks extends Command { 'User for whom all addressbooks will be listed'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = $input->getArgument('uid'); if (!$this->userManager->userExists($user)) { diff --git a/apps/dav/lib/Command/ListCalendarShares.php b/apps/dav/lib/Command/ListCalendarShares.php index 2729bc80530..9a8254f84ef 100644 --- a/apps/dav/lib/Command/ListCalendarShares.php +++ b/apps/dav/lib/Command/ListCalendarShares.php @@ -37,6 +37,7 @@ class ListCalendarShares extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this->addArgument( 'uid', @@ -52,6 +53,7 @@ class ListCalendarShares extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = (string)$input->getArgument('uid'); if (!$this->userManager->userExists($user)) { diff --git a/apps/dav/lib/Command/ListCalendars.php b/apps/dav/lib/Command/ListCalendars.php index 408a7e5247f..ae3016a7d37 100644 --- a/apps/dav/lib/Command/ListCalendars.php +++ b/apps/dav/lib/Command/ListCalendars.php @@ -23,6 +23,7 @@ class ListCalendars extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('dav:list-calendars') @@ -32,6 +33,7 @@ class ListCalendars extends Command { 'User for whom all calendars will be listed'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = $input->getArgument('uid'); if (!$this->userManager->userExists($user)) { diff --git a/apps/dav/lib/Command/ListSubscriptions.php b/apps/dav/lib/Command/ListSubscriptions.php index 67753f25973..adbca1c8dd6 100644 --- a/apps/dav/lib/Command/ListSubscriptions.php +++ b/apps/dav/lib/Command/ListSubscriptions.php @@ -33,6 +33,7 @@ class ListSubscriptions extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this->addArgument( 'uid', @@ -41,6 +42,7 @@ class ListSubscriptions extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = (string)$input->getArgument('uid'); if (!$this->userManager->userExists($user)) { diff --git a/apps/dav/lib/Command/MoveCalendar.php b/apps/dav/lib/Command/MoveCalendar.php index b8acc191cc3..d66ae14d30e 100644 --- a/apps/dav/lib/Command/MoveCalendar.php +++ b/apps/dav/lib/Command/MoveCalendar.php @@ -38,6 +38,7 @@ class MoveCalendar extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('dav:move-calendar') @@ -54,6 +55,7 @@ class MoveCalendar extends Command { ->addOption('force', 'f', InputOption::VALUE_NONE, 'Force the migration by removing existing shares and renaming calendars in case of conflicts'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $userOrigin = $input->getArgument('sourceuid'); $userDestination = $input->getArgument('destinationuid'); diff --git a/apps/dav/lib/Command/RemoveInvalidShares.php b/apps/dav/lib/Command/RemoveInvalidShares.php index 3128bca03e2..d5b189e7cff 100644 --- a/apps/dav/lib/Command/RemoveInvalidShares.php +++ b/apps/dav/lib/Command/RemoveInvalidShares.php @@ -30,12 +30,14 @@ class RemoveInvalidShares extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('dav:remove-invalid-shares') ->setDescription('Remove invalid dav shares'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $query = $this->connection->getQueryBuilder(); $result = $query->selectDistinct('principaluri') diff --git a/apps/dav/lib/Command/RetentionCleanupCommand.php b/apps/dav/lib/Command/RetentionCleanupCommand.php index f1c941af20e..16f3b7deb36 100644 --- a/apps/dav/lib/Command/RetentionCleanupCommand.php +++ b/apps/dav/lib/Command/RetentionCleanupCommand.php @@ -20,6 +20,7 @@ class RetentionCleanupCommand extends Command { parent::__construct('dav:retention:clean-up'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $this->service->cleanUp(); diff --git a/apps/dav/lib/Command/SendEventReminders.php b/apps/dav/lib/Command/SendEventReminders.php index 6fff7d62f1f..8ef98e6879f 100644 --- a/apps/dav/lib/Command/SendEventReminders.php +++ b/apps/dav/lib/Command/SendEventReminders.php @@ -30,12 +30,14 @@ class SendEventReminders extends Command { /** * @inheritDoc */ + #[\Override] protected function configure():void { $this ->setName('dav:send-event-reminders') ->setDescription('Sends event reminders'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') { $output->writeln('Sending event reminders disabled!'); diff --git a/apps/dav/lib/Command/SetAbsenceCommand.php b/apps/dav/lib/Command/SetAbsenceCommand.php index bf91a163f95..7e3d964793e 100644 --- a/apps/dav/lib/Command/SetAbsenceCommand.php +++ b/apps/dav/lib/Command/SetAbsenceCommand.php @@ -25,6 +25,7 @@ class SetAbsenceCommand extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this->setName('dav:absence:set'); $this->addArgument( @@ -59,6 +60,7 @@ class SetAbsenceCommand extends Command { ); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $userId = $input->getArgument('user-id'); diff --git a/apps/dav/lib/Command/SyncBirthdayCalendar.php b/apps/dav/lib/Command/SyncBirthdayCalendar.php index db1ebb6ecb5..bc15e9a6c95 100644 --- a/apps/dav/lib/Command/SyncBirthdayCalendar.php +++ b/apps/dav/lib/Command/SyncBirthdayCalendar.php @@ -26,6 +26,7 @@ class SyncBirthdayCalendar extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('dav:sync-birthday-calendar') @@ -35,6 +36,7 @@ class SyncBirthdayCalendar extends Command { 'User for whom the birthday calendar will be synchronized'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $this->verifyEnabled(); diff --git a/apps/dav/lib/Command/SyncSystemAddressBook.php b/apps/dav/lib/Command/SyncSystemAddressBook.php index b8b7f53a905..ad0b84167d9 100644 --- a/apps/dav/lib/Command/SyncSystemAddressBook.php +++ b/apps/dav/lib/Command/SyncSystemAddressBook.php @@ -24,12 +24,14 @@ class SyncSystemAddressBook extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('dav:sync-system-addressbook') ->setDescription('Synchronizes users to the system addressbook'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $output->writeln('Syncing users ...'); $progress = new ProgressBar($output); diff --git a/apps/dav/lib/Comments/CommentNode.php b/apps/dav/lib/Comments/CommentNode.php index 5dbefa82d93..34cecdf8065 100644 --- a/apps/dav/lib/Comments/CommentNode.php +++ b/apps/dav/lib/Comments/CommentNode.php @@ -101,6 +101,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { * * @return void */ + #[\Override] public function delete() { $this->checkWriteAccessOnComment(); $this->commentsManager->delete($this->comment->getId()); @@ -113,6 +114,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { * * @return string */ + #[\Override] public function getName() { return $this->comment->getId(); } @@ -123,6 +125,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { * @param string $name The new name * @throws MethodNotAllowed */ + #[\Override] public function setName($name) { throw new MethodNotAllowed(); } @@ -130,6 +133,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { /** * Returns the last modification time, as a unix timestamp */ + #[\Override] public function getLastModified(): ?int { return null; } @@ -170,6 +174,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { * @param PropPatch $propPatch * @return void */ + #[\Override] public function propPatch(PropPatch $propPatch) { // other properties than 'message' are read only $propPatch->handle(self::PROPERTY_NAME_MESSAGE, [$this, 'updateComment']); @@ -190,6 +195,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { * @param array $properties * @return array */ + #[\Override] public function getProperties($properties) { $properties = array_keys($this->properties); diff --git a/apps/dav/lib/Comments/CommentsPlugin.php b/apps/dav/lib/Comments/CommentsPlugin.php index be9984004e5..45752ab3264 100644 --- a/apps/dav/lib/Comments/CommentsPlugin.php +++ b/apps/dav/lib/Comments/CommentsPlugin.php @@ -62,6 +62,7 @@ class CommentsPlugin extends ServerPlugin { * @param Server $server * @return void */ + #[\Override] public function initialize(Server $server) { $this->server = $server; if (!str_starts_with($this->server->getRequestUri(), 'comments/')) { @@ -121,6 +122,7 @@ class CommentsPlugin extends ServerPlugin { * @param string $uri * @return array */ + #[\Override] public function getSupportedReportSet($uri) { return [self::REPORT_NAME]; } diff --git a/apps/dav/lib/Comments/EntityCollection.php b/apps/dav/lib/Comments/EntityCollection.php index fadb5f5dabd..3a8d4c2b82e 100644 --- a/apps/dav/lib/Comments/EntityCollection.php +++ b/apps/dav/lib/Comments/EntityCollection.php @@ -74,6 +74,7 @@ class EntityCollection extends RootCollection implements IProperties { * @return \Sabre\DAV\INode * @throws NotFound */ + #[\Override] public function getChild($name) { try { $comment = $this->commentsManager->get($name); @@ -98,6 +99,7 @@ class EntityCollection extends RootCollection implements IProperties { * * @return \Sabre\DAV\INode[] */ + #[\Override] public function getChildren() { return $this->findChildren(); } @@ -132,6 +134,7 @@ class EntityCollection extends RootCollection implements IProperties { * @param string $name * @return bool */ + #[\Override] public function childExists($name) { try { $comment = $this->commentsManager->get($name); @@ -155,6 +158,7 @@ class EntityCollection extends RootCollection implements IProperties { /** * @inheritdoc */ + #[\Override] public function propPatch(PropPatch $propPatch) { $propPatch->handle(self::PROPERTY_NAME_READ_MARKER, [$this, 'setReadMarker']); } @@ -162,6 +166,7 @@ class EntityCollection extends RootCollection implements IProperties { /** * @inheritdoc */ + #[\Override] public function getProperties($properties) { $marker = null; $user = $this->userSession->getUser(); diff --git a/apps/dav/lib/Comments/EntityTypeCollection.php b/apps/dav/lib/Comments/EntityTypeCollection.php index 1c8533ca375..9ac12699fc1 100644 --- a/apps/dav/lib/Comments/EntityTypeCollection.php +++ b/apps/dav/lib/Comments/EntityTypeCollection.php @@ -53,6 +53,7 @@ class EntityTypeCollection extends RootCollection { * @return \Sabre\DAV\INode * @throws NotFound */ + #[\Override] public function getChild($name) { if (!$this->childExists($name)) { throw new NotFound('Entity does not exist or is not available'); @@ -73,6 +74,7 @@ class EntityTypeCollection extends RootCollection { * @return \Sabre\DAV\INode[] * @throws MethodNotAllowed */ + #[\Override] public function getChildren() { throw new MethodNotAllowed('No permission to list folder contents'); } @@ -83,6 +85,7 @@ class EntityTypeCollection extends RootCollection { * @param string $name * @return bool */ + #[\Override] public function childExists($name) { return call_user_func($this->childExistsFunction, $name); } diff --git a/apps/dav/lib/Comments/RootCollection.php b/apps/dav/lib/Comments/RootCollection.php index 493d73ec531..2368e453a55 100644 --- a/apps/dav/lib/Comments/RootCollection.php +++ b/apps/dav/lib/Comments/RootCollection.php @@ -73,6 +73,7 @@ class RootCollection implements ICollection { * @return null|string * @throws Forbidden */ + #[\Override] public function createFile($name, $data = null) { throw new Forbidden('Cannot create comments by id'); } @@ -83,6 +84,7 @@ class RootCollection implements ICollection { * @param string $name * @throws Forbidden */ + #[\Override] public function createDirectory($name) { throw new Forbidden('Permission denied to create collections'); } @@ -97,6 +99,7 @@ class RootCollection implements ICollection { * @return \Sabre\DAV\INode * @throws NotFound */ + #[\Override] public function getChild($name) { $this->initCollections(); if (isset($this->entityTypeCollections[$name])) { @@ -110,6 +113,7 @@ class RootCollection implements ICollection { * * @return \Sabre\DAV\INode[] */ + #[\Override] public function getChildren() { $this->initCollections(); assert(!is_null($this->entityTypeCollections)); @@ -122,6 +126,7 @@ class RootCollection implements ICollection { * @param string $name * @return bool */ + #[\Override] public function childExists($name) { $this->initCollections(); assert(!is_null($this->entityTypeCollections)); @@ -133,6 +138,7 @@ class RootCollection implements ICollection { * * @throws Forbidden */ + #[\Override] public function delete() { throw new Forbidden('Permission denied to delete this collection'); } @@ -144,6 +150,7 @@ class RootCollection implements ICollection { * * @return string */ + #[\Override] public function getName() { return $this->name; } @@ -154,6 +161,7 @@ class RootCollection implements ICollection { * @param string $name The new name * @throws Forbidden */ + #[\Override] public function setName($name) { throw new Forbidden('Permission denied to rename this collection'); } @@ -163,6 +171,7 @@ class RootCollection implements ICollection { * * @return ?int */ + #[\Override] public function getLastModified() { return null; } diff --git a/apps/dav/lib/ConfigLexicon.php b/apps/dav/lib/ConfigLexicon.php index 921c6f2036b..e036a3b4b54 100644 --- a/apps/dav/lib/ConfigLexicon.php +++ b/apps/dav/lib/ConfigLexicon.php @@ -23,10 +23,12 @@ use OCP\Config\ValueType; class ConfigLexicon implements ILexicon { public const SYSTEM_ADDRESSBOOK_EXPOSED = 'system_addressbook_exposed'; + #[\Override] public function getStrictness(): Strictness { return Strictness::NOTICE; } + #[\Override] public function getAppConfigs(): array { return [ new Entry( @@ -39,6 +41,7 @@ class ConfigLexicon implements ILexicon { ]; } + #[\Override] public function getUserConfigs(): array { return []; } diff --git a/apps/dav/lib/Connector/LegacyDAVACL.php b/apps/dav/lib/Connector/LegacyDAVACL.php index 40ce53b8ab0..0e0221f49da 100644 --- a/apps/dav/lib/Connector/LegacyDAVACL.php +++ b/apps/dav/lib/Connector/LegacyDAVACL.php @@ -17,6 +17,7 @@ class LegacyDAVACL extends DavAclPlugin { /** * @inheritdoc */ + #[\Override] public function getCurrentUserPrincipals() { $principalV2 = $this->getCurrentUserPrincipal(); @@ -42,6 +43,7 @@ class LegacyDAVACL extends DavAclPlugin { return "principals/$name"; } + #[\Override] public function propFind(PropFind $propFind, INode $node) { /* Overload current-user-principal */ $propFind->handle('{DAV:}current-user-principal', function () { diff --git a/apps/dav/lib/Connector/LegacyPublicAuth.php b/apps/dav/lib/Connector/LegacyPublicAuth.php index 03d18853de0..c5d02802d4c 100644 --- a/apps/dav/lib/Connector/LegacyPublicAuth.php +++ b/apps/dav/lib/Connector/LegacyPublicAuth.php @@ -50,6 +50,7 @@ class LegacyPublicAuth extends AbstractBasic { * @return bool * @throws \Sabre\DAV\Exception\NotAuthenticated */ + #[\Override] protected function validateUserPass($username, $password) { $this->throttler->sleepDelayOrThrowOnMax($this->request->getRemoteAddress(), self::BRUTEFORCE_ACTION); diff --git a/apps/dav/lib/Connector/Sabre/AddExtraHeadersPlugin.php b/apps/dav/lib/Connector/Sabre/AddExtraHeadersPlugin.php index e31ba26bd95..8aa4f581548 100644 --- a/apps/dav/lib/Connector/Sabre/AddExtraHeadersPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AddExtraHeadersPlugin.php @@ -29,6 +29,7 @@ class AddExtraHeadersPlugin extends \Sabre\DAV\ServerPlugin { ) { } + #[\Override] public function initialize(Server $server): void { $this->server = $server; diff --git a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php index 0e2b1c58748..68460c04e26 100644 --- a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php @@ -24,6 +24,7 @@ class AnonymousOptionsPlugin extends ServerPlugin { * @param \Sabre\DAV\Server $server * @return void */ + #[\Override] public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; // before auth diff --git a/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php b/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php index 9cff113140a..238d30868ca 100644 --- a/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php @@ -40,6 +40,7 @@ class AppleQuirksPlugin extends ServerPlugin { * * @return void */ + #[\Override] public function initialize(Server $server) { $server->on('beforeMethod:REPORT', [$this, 'beforeReport'], 0); $server->on('report', [$this, 'report'], 0); diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php index 5ef33958c9b..5c5bbe8f355 100644 --- a/apps/dav/lib/Connector/Sabre/Auth.php +++ b/apps/dav/lib/Connector/Sabre/Auth.php @@ -73,6 +73,7 @@ class Auth extends AbstractBasic { * @return bool * @throws PasswordLoginForbidden */ + #[\Override] protected function validateUserPass($username, $password) { if ($this->userSession->isLoggedIn() && $this->isDavAuthenticated($this->userSession->getUser()->getUID()) @@ -104,6 +105,7 @@ class Auth extends AbstractBasic { * @throws NotAuthenticated * @throws ServiceUnavailable */ + #[\Override] public function check(RequestInterface $request, ResponseInterface $response) { try { return $this->auth($request, $response); diff --git a/apps/dav/lib/Connector/Sabre/BearerAuth.php b/apps/dav/lib/Connector/Sabre/BearerAuth.php index 23453ae8efb..305f79cb0e0 100644 --- a/apps/dav/lib/Connector/Sabre/BearerAuth.php +++ b/apps/dav/lib/Connector/Sabre/BearerAuth.php @@ -38,6 +38,7 @@ class BearerAuth extends AbstractBearer { /** * {@inheritdoc} */ + #[\Override] public function validateBearerToken($bearerToken) { \OC_Util::setupFS(); @@ -59,6 +60,7 @@ class BearerAuth extends AbstractBearer { * @param RequestInterface $request * @param ResponseInterface $response */ + #[\Override] public function challenge(RequestInterface $request, ResponseInterface $response): void { // Legacy ownCloud clients still authenticate via OAuth2 $enableOcClients = $this->config->getSystemValueBool('oauth2.enable_oc_clients', false); diff --git a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php index 061f20bd9ae..695a5d7f4bf 100644 --- a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php +++ b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php @@ -32,6 +32,7 @@ class BlockLegacyClientPlugin extends ServerPlugin { /** * @return void */ + #[\Override] public function initialize(Server $server) { $this->server = $server; $this->server->on('beforeMethod:*', [$this, 'beforeHandler'], 200); diff --git a/apps/dav/lib/Connector/Sabre/CachingTree.php b/apps/dav/lib/Connector/Sabre/CachingTree.php index 5d72b530f58..3d71bea0814 100644 --- a/apps/dav/lib/Connector/Sabre/CachingTree.php +++ b/apps/dav/lib/Connector/Sabre/CachingTree.php @@ -23,6 +23,7 @@ class CachingTree extends Tree { * @param string $path * @return void */ + #[\Override] public function markDirty($path) { // We don't care enough about sub-paths // flushing the entire cache diff --git a/apps/dav/lib/Connector/Sabre/ChecksumList.php b/apps/dav/lib/Connector/Sabre/ChecksumList.php index 75d1d718de1..e2d5a7b9cf7 100644 --- a/apps/dav/lib/Connector/Sabre/ChecksumList.php +++ b/apps/dav/lib/Connector/Sabre/ChecksumList.php @@ -45,6 +45,7 @@ class ChecksumList implements XmlSerializable { * @param Writer $writer * @return void */ + #[\Override] public function xmlSerialize(Writer $writer) { foreach ($this->checksums as $checksum) { $writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum); diff --git a/apps/dav/lib/Connector/Sabre/ChecksumUpdatePlugin.php b/apps/dav/lib/Connector/Sabre/ChecksumUpdatePlugin.php index 18009080585..6302e51fb07 100644 --- a/apps/dav/lib/Connector/Sabre/ChecksumUpdatePlugin.php +++ b/apps/dav/lib/Connector/Sabre/ChecksumUpdatePlugin.php @@ -17,16 +17,19 @@ use Sabre\HTTP\ResponseInterface; class ChecksumUpdatePlugin extends ServerPlugin { protected ?Server $server = null; + #[\Override] public function initialize(Server $server) { $this->server = $server; $server->on('method:PATCH', [$this, 'httpPatch']); } + #[\Override] public function getPluginName(): string { return 'checksumupdate'; } /** @return string[] */ + #[\Override] public function getFeatures(): array { return ['nextcloud-checksum-update']; } diff --git a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php index de0a4aa972d..036e6bde80d 100644 --- a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php @@ -42,6 +42,7 @@ class CommentPropertiesPlugin extends ServerPlugin { * @param \Sabre\DAV\Server $server * @return void */ + #[\Override] public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; diff --git a/apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php b/apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php index 609ac295b4c..afa63990dc7 100644 --- a/apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php +++ b/apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php @@ -27,6 +27,7 @@ class CopyEtagHeaderPlugin extends \Sabre\DAV\ServerPlugin { * * @return void */ + #[\Override] public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; diff --git a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php index 100d719ef01..3f96aed1d09 100644 --- a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php +++ b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php @@ -32,6 +32,7 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin { $this->allowUnauthenticatedAccess = false; } + #[\Override] public function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) { $access = parent::checkPrivileges($uri, $privileges, $recursion, false); if ($access === false && $throwExceptions) { @@ -68,6 +69,7 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin { return $access; } + #[\Override] public function propFind(PropFind $propFind, INode $node) { if ($node instanceof Node) { // files don't use dav acls @@ -89,6 +91,7 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin { return parent::propFind($propFind, $node); } + #[\Override] public function beforeMethod(RequestInterface $request, ResponseInterface $response) { $path = $request->getPath(); diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index d9bfa6e1127..73860e6cbcf 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -100,6 +100,7 @@ class Directory extends Node implements * @throws \Sabre\DAV\Exception\Forbidden * @throws \Sabre\DAV\Exception\ServiceUnavailable */ + #[\Override] public function createFile($name, $data = null) { try { if (!$this->fileView->isCreatable($this->path)) { @@ -148,6 +149,7 @@ class Directory extends Node implements * @throws \Sabre\DAV\Exception\Forbidden * @throws \Sabre\DAV\Exception\ServiceUnavailable */ + #[\Override] public function createDirectory($name) { try { if (!$this->info->isCreatable()) { @@ -180,6 +182,7 @@ class Directory extends Node implements * @throws \Sabre\DAV\Exception\NotFound * @throws \Sabre\DAV\Exception\ServiceUnavailable */ + #[\Override] public function getChild($name, $info = null, ?IRequest $request = null, ?IL10N $l10n = null) { $storage = $this->info->getStorage(); $allowDirectory = false; @@ -240,6 +243,7 @@ class Directory extends Node implements * @throws \Sabre\DAV\Exception\Locked * @throws Forbidden */ + #[\Override] public function getChildren() { if (!is_null($this->dirContent)) { return $this->dirContent; @@ -277,6 +281,7 @@ class Directory extends Node implements * @param string $name * @return bool */ + #[\Override] public function childExists($name) { // note: here we do NOT resolve the chunk file name to the real file name // to make sure we return false when checking for file existence with a chunk @@ -296,6 +301,7 @@ class Directory extends Node implements * @throws FileLocked * @throws \Sabre\DAV\Exception\Forbidden */ + #[\Override] public function delete() { if ($this->path === '' || $this->path === '/' || !$this->info->isDeletable()) { throw new \Sabre\DAV\Exception\Forbidden(); @@ -322,6 +328,7 @@ class Directory extends Node implements * * @return array */ + #[\Override] public function getQuotaInfo() { if ($this->quotaInfo) { return $this->quotaInfo; @@ -381,6 +388,7 @@ class Directory extends Node implements * @throws FileLocked * @throws \Sabre\DAV\Exception\Forbidden */ + #[\Override] public function moveInto($targetName, $fullSourcePath, INode $sourceNode) { if (!$sourceNode instanceof Node) { // it's a file of another kind, like FutureFile @@ -459,6 +467,7 @@ class Directory extends Node implements } + #[\Override] public function copyInto($targetName, $sourcePath, INode $sourceNode) { if ($sourceNode instanceof File || $sourceNode instanceof Directory) { try { @@ -494,10 +503,12 @@ class Directory extends Node implements return false; } + #[\Override] public function getNode(): Folder { return $this->node; } + #[\Override] public function getNodeForPath($path): INode { $storage = $this->info->getStorage(); $allowDirectory = false; diff --git a/apps/dav/lib/Connector/Sabre/DummyGetResponsePlugin.php b/apps/dav/lib/Connector/Sabre/DummyGetResponsePlugin.php index f6baceb748b..6a092f35cef 100644 --- a/apps/dav/lib/Connector/Sabre/DummyGetResponsePlugin.php +++ b/apps/dav/lib/Connector/Sabre/DummyGetResponsePlugin.php @@ -32,6 +32,7 @@ class DummyGetResponsePlugin extends \Sabre\DAV\ServerPlugin { * @param \Sabre\DAV\Server $server * @return void */ + #[\Override] public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; $this->server->on('method:GET', [$this, 'httpGet'], 200); diff --git a/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php b/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php index 65d8d30719b..12a93188632 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php +++ b/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php @@ -21,6 +21,7 @@ class BadGateway extends \Sabre\DAV\Exception { * * @return int */ + #[\Override] public function getHTTPCode() { return 502; } diff --git a/apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php b/apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php index eb892f91cda..12c451f5579 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php +++ b/apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php @@ -22,6 +22,7 @@ class EntityTooLarge extends \Sabre\DAV\Exception { * * @return int */ + #[\Override] public function getHTTPCode() { return 413; } diff --git a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php index 38708e945e9..9e02d0d1949 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php +++ b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php @@ -27,6 +27,7 @@ class FileLocked extends \Sabre\DAV\Exception { * * @return int */ + #[\Override] public function getHTTPCode() { return 423; } diff --git a/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php b/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php index 95d4b3ab514..9ad510d39b1 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php +++ b/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php @@ -31,6 +31,7 @@ class Forbidden extends \Sabre\DAV\Exception\Forbidden { * @param \DOMElement $errorNode * @return void */ + #[\Override] public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) { // set ownCloud namespace diff --git a/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php b/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php index dfc08aa8b88..7a4a67ee778 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php +++ b/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php @@ -30,6 +30,7 @@ class InvalidPath extends Exception { * * @return int */ + #[\Override] public function getHTTPCode() { return 400; } @@ -42,6 +43,7 @@ class InvalidPath extends Exception { * @param \DOMElement $errorNode * @return void */ + #[\Override] public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) { // set ownCloud namespace diff --git a/apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php b/apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php index f5cc117fafc..a9afce3e71e 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php +++ b/apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php @@ -14,6 +14,7 @@ use Sabre\DAV\Server; class PasswordLoginForbidden extends NotAuthenticated { public const NS_OWNCLOUD = 'http://owncloud.org/ns'; + #[\Override] public function getHTTPCode() { return 401; } @@ -26,6 +27,7 @@ class PasswordLoginForbidden extends NotAuthenticated { * @param DOMElement $errorNode * @return void */ + #[\Override] public function serialize(Server $server, DOMElement $errorNode) { // set ownCloud namespace diff --git a/apps/dav/lib/Connector/Sabre/Exception/TooManyRequests.php b/apps/dav/lib/Connector/Sabre/Exception/TooManyRequests.php index 67455fc9474..1d490ea4051 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/TooManyRequests.php +++ b/apps/dav/lib/Connector/Sabre/Exception/TooManyRequests.php @@ -15,6 +15,7 @@ use Sabre\DAV\Server; class TooManyRequests extends NotAuthenticated { public const NS_OWNCLOUD = 'http://owncloud.org/ns'; + #[\Override] public function getHTTPCode() { return 429; } @@ -27,6 +28,7 @@ class TooManyRequests extends NotAuthenticated { * @param DOMElement $errorNode * @return void */ + #[\Override] public function serialize(Server $server, DOMElement $errorNode) { // set ownCloud namespace diff --git a/apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php b/apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php index 84420dd75d5..cd468023391 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php +++ b/apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php @@ -22,6 +22,7 @@ class UnsupportedMediaType extends \Sabre\DAV\Exception { * * @return int */ + #[\Override] public function getHTTPCode() { return 415; } diff --git a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php index 7aab4f576d7..1909a2c4305 100644 --- a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php +++ b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php @@ -89,6 +89,7 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin { * @param \Sabre\DAV\Server $server * @return void */ + #[\Override] public function initialize(\Sabre\DAV\Server $server) { $server->on('exception', [$this, 'logException'], 10); } diff --git a/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php b/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php index b0c5a079ce1..5ce2613dab1 100644 --- a/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php @@ -35,6 +35,7 @@ class FakeLockerPlugin extends ServerPlugin { private $server; /** {@inheritDoc} */ + #[\Override] public function initialize(Server $server) { $this->server = $server; $this->server->on('method:LOCK', [$this, 'fakeLockProvider'], 1); @@ -49,6 +50,7 @@ class FakeLockerPlugin extends ServerPlugin { * @param string $path * @return string[] */ + #[\Override] public function getHTTPMethods($path) { return [ 'LOCK', @@ -61,6 +63,7 @@ class FakeLockerPlugin extends ServerPlugin { * * @return integer[] */ + #[\Override] public function getFeatures() { return [2]; } diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index f200838ba6b..853390d9c64 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -109,6 +109,7 @@ class File extends Node implements IFile { * @throws FileLocked * @return string|null */ + #[\Override] public function put($data) { try { $exists = $this->fileView->file_exists($this->path); @@ -458,6 +459,7 @@ class File extends Node implements IFile { * @throws Forbidden * @throws ServiceUnavailable */ + #[\Override] public function get() { //throw exception if encryption is disabled but files are still encrypted try { @@ -514,6 +516,7 @@ class File extends Node implements IFile { * @throws Forbidden * @throws ServiceUnavailable */ + #[\Override] public function delete() { if (!$this->info->isDeletable()) { throw new Forbidden(); @@ -540,6 +543,7 @@ class File extends Node implements IFile { * * @return string */ + #[\Override] public function getContentType() { $mimeType = $this->info->getMimetype(); @@ -645,6 +649,7 @@ class File extends Node implements IFile { return $this->fileView->hash($type, $this->path); } + #[\Override] public function getNode(): \OCP\Files\File { return $this->node; } diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index fdc3398436f..51c3845adc4 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -112,6 +112,7 @@ class FilesPlugin extends ServerPlugin { * * @return void */ + #[\Override] public function initialize(Server $server) { $server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; $server->xml->namespaceMap[self::NS_NEXTCLOUD] = 'nc'; diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php index b59d1373af5..510ef678f78 100644 --- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php @@ -80,6 +80,7 @@ class FilesReportPlugin extends ServerPlugin { * @param \Sabre\DAV\Server $server * @return void */ + #[\Override] public function initialize(\Sabre\DAV\Server $server) { $server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; @@ -95,6 +96,7 @@ class FilesReportPlugin extends ServerPlugin { * @param string $uri * @return array */ + #[\Override] public function getSupportedReportSet($uri) { return [self::REPORT_NAME]; } diff --git a/apps/dav/lib/Connector/Sabre/LockPlugin.php b/apps/dav/lib/Connector/Sabre/LockPlugin.php index 6640771dc31..338c2528d07 100644 --- a/apps/dav/lib/Connector/Sabre/LockPlugin.php +++ b/apps/dav/lib/Connector/Sabre/LockPlugin.php @@ -32,6 +32,7 @@ class LockPlugin extends ServerPlugin { /** * {@inheritdoc} */ + #[\Override] public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; $this->server->on('beforeMethod:*', [$this, 'getLock'], 50); diff --git a/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php b/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php index d5ab7f09dfa..1f05b2c8ae4 100644 --- a/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php +++ b/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php @@ -48,6 +48,7 @@ class MaintenancePlugin extends ServerPlugin { * @param \Sabre\DAV\Server $server * @return void */ + #[\Override] public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; $this->server->on('beforeMethod:*', [$this, 'checkMaintenanceMode'], 1); diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index 68b6c82adef..799a273aaf6 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -101,6 +101,7 @@ abstract class Node implements INode { /** * Returns the name of the node */ + #[\Override] public function getName(): string { return $this->info->getName(); } @@ -129,6 +130,7 @@ abstract class Node implements INode { * @throws PreConditionNotMetException * @throws LockedException */ + #[\Override] public function setName($name): void { if (!$this->canRename()) { throw new Forbidden(''); @@ -157,6 +159,7 @@ abstract class Node implements INode { * * @return int timestamp as integer */ + #[\Override] public function getLastModified(): int { return $this->info->getMtime(); } diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php index bfbdfb33db0..afff6c0fe39 100644 --- a/apps/dav/lib/Connector/Sabre/ObjectTree.php +++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php @@ -60,6 +60,7 @@ class ObjectTree extends CachingTree { * @throws \Sabre\DAV\Exception\NotFound * @throws \Sabre\DAV\Exception\ServiceUnavailable */ + #[\Override] public function getNodeForPath($path) { if (!$this->fileView) { throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); @@ -151,6 +152,7 @@ class ObjectTree extends CachingTree { * @throws \Sabre\DAV\Exception\ServiceUnavailable * @return void */ + #[\Override] public function copy($sourcePath, $destinationPath) { if (!$this->fileView) { throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index e0abc82c6cc..31395f61ae9 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -76,6 +76,7 @@ class Principal implements BackendInterface { * @param string $prefixPath * @return string[] */ + #[\Override] public function getPrincipalsByPrefix($prefixPath) { $principals = []; @@ -96,6 +97,7 @@ class Principal implements BackendInterface { * @param string $path * @return array */ + #[\Override] public function getPrincipalByPath($path) { return $this->getPrincipalPropertiesByPath($path); } @@ -180,6 +182,7 @@ class Principal implements BackendInterface { * @return array * @throws Exception */ + #[\Override] public function getGroupMembership($principal, $needGroups = false) { [$prefix, $name] = \Sabre\Uri\split($principal); @@ -217,6 +220,7 @@ class Principal implements BackendInterface { * @param PropPatch $propPatch * @return int */ + #[\Override] public function updatePrincipal($path, PropPatch $propPatch) { // Updating schedule-default-calendar-URL is handled in CustomPropertiesBackend return 0; @@ -408,6 +412,7 @@ class Principal implements BackendInterface { * @param string $test * @return array */ + #[\Override] public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') { if (count($searchProperties) === 0) { return []; @@ -427,6 +432,7 @@ class Principal implements BackendInterface { * @param string $principalPrefix * @return string */ + #[\Override] public function findByUri($uri, $principalPrefix) { // If sharing is disabled, return the empty array $shareAPIEnabled = $this->shareManager->shareApiEnabled(); diff --git a/apps/dav/lib/Connector/Sabre/PropFindMonitorPlugin.php b/apps/dav/lib/Connector/Sabre/PropFindMonitorPlugin.php index 38538fdcff0..78ca10d5eb4 100644 --- a/apps/dav/lib/Connector/Sabre/PropFindMonitorPlugin.php +++ b/apps/dav/lib/Connector/Sabre/PropFindMonitorPlugin.php @@ -32,6 +32,7 @@ class PropFindMonitorPlugin extends ServerPlugin { private SabreServer $server; + #[\Override] public function initialize(SabreServer $server): void { $this->server = $server; $this->server->on('afterResponse', [$this, 'afterResponse']); diff --git a/apps/dav/lib/Connector/Sabre/PropFindPreloadNotifyPlugin.php b/apps/dav/lib/Connector/Sabre/PropFindPreloadNotifyPlugin.php index c7b0c64132c..94328b8be96 100644 --- a/apps/dav/lib/Connector/Sabre/PropFindPreloadNotifyPlugin.php +++ b/apps/dav/lib/Connector/Sabre/PropFindPreloadNotifyPlugin.php @@ -23,6 +23,7 @@ class PropFindPreloadNotifyPlugin extends ServerPlugin { private Server $server; + #[\Override] public function initialize(Server $server): void { $this->server = $server; $this->server->on('propFind', [$this, 'collectionPreloadNotifier' ], 1); diff --git a/apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php b/apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php index 15daf1f34b6..bbdb66df4ed 100644 --- a/apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php +++ b/apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php @@ -32,6 +32,7 @@ class PropfindCompressionPlugin extends ServerPlugin { * @param \Sabre\DAV\Server $server * @return void */ + #[\Override] public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; $this->server->on('afterMethod:PROPFIND', [$this, 'compressResponse'], 100); diff --git a/apps/dav/lib/Connector/Sabre/PublicAuth.php b/apps/dav/lib/Connector/Sabre/PublicAuth.php index f8b19b36d6f..912e5800aec 100644 --- a/apps/dav/lib/Connector/Sabre/PublicAuth.php +++ b/apps/dav/lib/Connector/Sabre/PublicAuth.php @@ -59,6 +59,7 @@ class PublicAuth extends AbstractBasic { * @throws MaxDelayReached * @throws ServiceUnavailable */ + #[\Override] public function check(RequestInterface $request, ResponseInterface $response): array { try { $this->throttler->sleepDelayOrThrowOnMax($this->request->getRemoteAddress(), self::BRUTEFORCE_ACTION); @@ -162,6 +163,7 @@ class PublicAuth extends AbstractBasic { * @return bool * @throws NotAuthenticated */ + #[\Override] protected function validateUserPass($username, $password) { $this->throttler->sleepDelayOrThrowOnMax($this->request->getRemoteAddress(), self::BRUTEFORCE_ACTION); diff --git a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php index 71b74c4e507..df28c02242a 100644 --- a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php +++ b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php @@ -54,6 +54,7 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin { * @param \Sabre\DAV\Server $server The Sabre\DAV server instance. * @return void */ + #[\Override] public function initialize(\Sabre\DAV\Server $server): void { $this->server = $server; diff --git a/apps/dav/lib/Connector/Sabre/RequestIdHeaderPlugin.php b/apps/dav/lib/Connector/Sabre/RequestIdHeaderPlugin.php index 5484bab9237..aeb248bc701 100644 --- a/apps/dav/lib/Connector/Sabre/RequestIdHeaderPlugin.php +++ b/apps/dav/lib/Connector/Sabre/RequestIdHeaderPlugin.php @@ -18,6 +18,7 @@ class RequestIdHeaderPlugin extends \Sabre\DAV\ServerPlugin { ) { } + #[\Override] public function initialize(\Sabre\DAV\Server $server) { $server->on('afterMethod:*', [$this, 'afterMethod']); } diff --git a/apps/dav/lib/Connector/Sabre/Server.php b/apps/dav/lib/Connector/Sabre/Server.php index c6e55c79af2..ca756a34174 100644 --- a/apps/dav/lib/Connector/Sabre/Server.php +++ b/apps/dav/lib/Connector/Sabre/Server.php @@ -105,6 +105,7 @@ class Server extends \Sabre\DAV\Server { $parentFn($eventName, $wrappedCallback, $priority); } + #[\Override] public function removeListener( string $eventName, callable $listener, @@ -130,6 +131,7 @@ class Server extends \Sabre\DAV\Server { return $removed; } + #[\Override] public function removeAllListeners(?string $eventName = null): void { parent::removeAllListeners($eventName); @@ -197,6 +199,7 @@ class Server extends \Sabre\DAV\Server { * * @return void */ + #[\Override] public function start() { try { // If nginx (pre-1.2) is used as a proxy server, and SabreDAV as an diff --git a/apps/dav/lib/Connector/Sabre/ShareTypeList.php b/apps/dav/lib/Connector/Sabre/ShareTypeList.php index 0b66ed27576..9ab4117efdb 100644 --- a/apps/dav/lib/Connector/Sabre/ShareTypeList.php +++ b/apps/dav/lib/Connector/Sabre/ShareTypeList.php @@ -45,6 +45,7 @@ class ShareTypeList implements Element { * @param Reader $reader * @return mixed */ + #[\Override] public static function xmlDeserialize(Reader $reader) { $shareTypes = []; @@ -66,6 +67,7 @@ class ShareTypeList implements Element { * @param Writer $writer * @return void */ + #[\Override] public function xmlSerialize(Writer $writer) { foreach ($this->shareTypes as $shareType) { $writer->writeElement('{' . self::NS_OWNCLOUD . '}share-type', $shareType); diff --git a/apps/dav/lib/Connector/Sabre/ShareeList.php b/apps/dav/lib/Connector/Sabre/ShareeList.php index 909c29fc24b..4074742408f 100644 --- a/apps/dav/lib/Connector/Sabre/ShareeList.php +++ b/apps/dav/lib/Connector/Sabre/ShareeList.php @@ -30,6 +30,7 @@ class ShareeList implements XmlSerializable { * @param Writer $writer * @return void */ + #[\Override] public function xmlSerialize(Writer $writer) { foreach ($this->shares as $share) { $writer->startElement('{' . self::NS_NEXTCLOUD . '}sharee'); diff --git a/apps/dav/lib/Connector/Sabre/SharesPlugin.php b/apps/dav/lib/Connector/Sabre/SharesPlugin.php index 5a4f187ef3c..d1837d3204d 100644 --- a/apps/dav/lib/Connector/Sabre/SharesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/SharesPlugin.php @@ -65,6 +65,7 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin { * * @return void */ + #[\Override] public function initialize(Server $server) { $server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; $server->xml->elementMap[self::SHARETYPES_PROPERTYNAME] = ShareTypeList::class; diff --git a/apps/dav/lib/Connector/Sabre/TagList.php b/apps/dav/lib/Connector/Sabre/TagList.php index 9a5cd0d51cf..87265763361 100644 --- a/apps/dav/lib/Connector/Sabre/TagList.php +++ b/apps/dav/lib/Connector/Sabre/TagList.php @@ -60,6 +60,7 @@ class TagList implements Element { * @param Reader $reader * @return mixed */ + #[\Override] public static function xmlDeserialize(Reader $reader) { $tags = []; @@ -94,6 +95,7 @@ class TagList implements Element { * @param Writer $writer * @return void */ + #[\Override] public function xmlSerialize(Writer $writer) { foreach ($this->tags as $tag) { $writer->writeElement('{' . self::NS_OWNCLOUD . '}tag', $tag); diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php index a295d97aa64..9f9c3be24c5 100644 --- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php @@ -85,6 +85,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin { * @param \Sabre\DAV\Server $server * @return void */ + #[\Override] public function initialize(\Sabre\DAV\Server $server) { $server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; $server->xml->elementMap[self::TAGS_PROPERTYNAME] = TagList::class; diff --git a/apps/dav/lib/Connector/Sabre/UserIdHeaderPlugin.php b/apps/dav/lib/Connector/Sabre/UserIdHeaderPlugin.php index 738e08b615a..480ba9bcc1d 100644 --- a/apps/dav/lib/Connector/Sabre/UserIdHeaderPlugin.php +++ b/apps/dav/lib/Connector/Sabre/UserIdHeaderPlugin.php @@ -18,6 +18,7 @@ class UserIdHeaderPlugin extends \Sabre\DAV\ServerPlugin { ) { } + #[\Override] public function initialize(\Sabre\DAV\Server $server): void { $server->on('beforeMethod:*', [$this, 'beforeMethod']); } diff --git a/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php b/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php index 3ccf0a6e24c..38ce71b0f2f 100644 --- a/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php +++ b/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php @@ -60,6 +60,7 @@ class ZipFolderPlugin extends ServerPlugin { * * This method should set up the required event subscriptions. */ + #[\Override] public function initialize(Server $server): void { $this->server = $server; $this->server->on('method:GET', $this->handleDownload(...), 100); diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php index 77ba45182c9..ffd30794618 100644 --- a/apps/dav/lib/DAV/GroupPrincipalBackend.php +++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php @@ -47,6 +47,7 @@ class GroupPrincipalBackend implements BackendInterface { * @param string $prefixPath * @return string[] */ + #[\Override] public function getPrincipalsByPrefix($prefixPath) { $principals = []; @@ -69,6 +70,7 @@ class GroupPrincipalBackend implements BackendInterface { * @param string $path * @return array */ + #[\Override] public function getPrincipalByPath($path) { $elements = explode('/', $path, 3); if ($elements[0] !== 'principals') { @@ -94,6 +96,7 @@ class GroupPrincipalBackend implements BackendInterface { * @return array * @throws Exception */ + #[\Override] public function getGroupMemberSet($principal) { $elements = explode('/', $principal); if ($elements[0] !== 'principals') { @@ -121,6 +124,7 @@ class GroupPrincipalBackend implements BackendInterface { * @return array * @throws Exception */ + #[\Override] public function getGroupMembership($principal) { return []; } @@ -134,6 +138,7 @@ class GroupPrincipalBackend implements BackendInterface { * @param string[] $members * @throws Exception */ + #[\Override] public function setGroupMemberSet($principal, array $members) { throw new Exception('Setting members of the group is not supported yet'); } @@ -143,6 +148,7 @@ class GroupPrincipalBackend implements BackendInterface { * @param PropPatch $propPatch * @return int */ + #[\Override] public function updatePrincipal($path, PropPatch $propPatch) { return 0; } @@ -153,6 +159,7 @@ class GroupPrincipalBackend implements BackendInterface { * @param string $test * @return array */ + #[\Override] public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') { $results = []; @@ -240,6 +247,7 @@ class GroupPrincipalBackend implements BackendInterface { * @param string $principalPrefix * @return string */ + #[\Override] public function findByUri($uri, $principalPrefix) { // If sharing is disabled, return the empty array if (!$this->groupSharingEnabled()) { diff --git a/apps/dav/lib/DAV/PublicAuth.php b/apps/dav/lib/DAV/PublicAuth.php index c2b4ada173a..aeaa6113de9 100644 --- a/apps/dav/lib/DAV/PublicAuth.php +++ b/apps/dav/lib/DAV/PublicAuth.php @@ -51,6 +51,7 @@ class PublicAuth implements BackendInterface { * @param ResponseInterface $response * @return array */ + #[\Override] public function check(RequestInterface $request, ResponseInterface $response) { if ($this->isRequestPublic($request)) { return [true, 'principals/system/public']; @@ -61,6 +62,7 @@ class PublicAuth implements BackendInterface { /** * @inheritdoc */ + #[\Override] public function challenge(RequestInterface $request, ResponseInterface $response) { } diff --git a/apps/dav/lib/DAV/RemoteUserPrincipalBackend.php b/apps/dav/lib/DAV/RemoteUserPrincipalBackend.php index 20fbd0194ce..9e6ea002254 100644 --- a/apps/dav/lib/DAV/RemoteUserPrincipalBackend.php +++ b/apps/dav/lib/DAV/RemoteUserPrincipalBackend.php @@ -31,6 +31,7 @@ class RemoteUserPrincipalBackend implements BackendInterface { ) { } + #[\Override] public function getPrincipalsByPrefix($prefixPath) { if ($prefixPath !== self::PRINCIPAL_PREFIX) { return []; @@ -44,6 +45,7 @@ class RemoteUserPrincipalBackend implements BackendInterface { return $this->principals; } + #[\Override] public function getPrincipalByPath($path) { [$prefix] = \Sabre\Uri\split($path); if ($prefix !== self::PRINCIPAL_PREFIX) { @@ -63,15 +65,18 @@ class RemoteUserPrincipalBackend implements BackendInterface { return $principal; } + #[\Override] public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) { throw new \Sabre\DAV\Exception('Updating remote user principal is not supported'); } + #[\Override] public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') { // Searching is not supported return []; } + #[\Override] public function findByUri($uri, $principalPrefix) { if (str_starts_with($uri, 'principal:')) { $principal = substr($uri, strlen('principal:')); @@ -84,10 +89,12 @@ class RemoteUserPrincipalBackend implements BackendInterface { return null; } + #[\Override] public function getGroupMemberSet($principal) { return []; } + #[\Override] public function getGroupMembership($principal) { // TODO: for now the group principal has only one member, the user itself $principal = $this->getPrincipalByPath($principal); @@ -98,6 +105,7 @@ class RemoteUserPrincipalBackend implements BackendInterface { return [$principal['uri']]; } + #[\Override] public function setGroupMemberSet($principal, array $members) { throw new \Sabre\DAV\Exception('Adding members to remote user is not supported'); } diff --git a/apps/dav/lib/DAV/Sharing/Plugin.php b/apps/dav/lib/DAV/Sharing/Plugin.php index 9c5c002b42b..bdc5a552a8a 100644 --- a/apps/dav/lib/DAV/Sharing/Plugin.php +++ b/apps/dav/lib/DAV/Sharing/Plugin.php @@ -53,6 +53,7 @@ class Plugin extends ServerPlugin { * * @return string[] */ + #[\Override] public function getFeatures() { return ['oc-resource-sharing']; } @@ -65,6 +66,7 @@ class Plugin extends ServerPlugin { * * @return string */ + #[\Override] public function getPluginName() { return 'oc-resource-sharing'; } @@ -80,6 +82,7 @@ class Plugin extends ServerPlugin { * @param Server $server * @return void */ + #[\Override] public function initialize(Server $server) { $this->server = $server; $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = ShareRequest::class; diff --git a/apps/dav/lib/DAV/Sharing/Xml/Invite.php b/apps/dav/lib/DAV/Sharing/Xml/Invite.php index 7a20dbe6df7..bde3dee98da 100644 --- a/apps/dav/lib/DAV/Sharing/Xml/Invite.php +++ b/apps/dav/lib/DAV/Sharing/Xml/Invite.php @@ -93,6 +93,7 @@ class Invite implements XmlSerializable { * @param Writer $writer * @return void */ + #[\Override] public function xmlSerialize(Writer $writer) { $cs = '{' . Plugin::NS_OWNCLOUD . '}'; diff --git a/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php b/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php index fad8e522838..75d7e98b009 100644 --- a/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php +++ b/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php @@ -26,6 +26,7 @@ class ShareRequest implements XmlDeserializable { ) { } + #[\Override] public static function xmlDeserialize(Reader $reader) { $elements = $reader->parseInnerTree([ '{' . Plugin::NS_OWNCLOUD . '}set' => 'Sabre\\Xml\\Element\\KeyValue', diff --git a/apps/dav/lib/DAV/SystemPrincipalBackend.php b/apps/dav/lib/DAV/SystemPrincipalBackend.php index 9760d68f05f..4813f6d6ea3 100644 --- a/apps/dav/lib/DAV/SystemPrincipalBackend.php +++ b/apps/dav/lib/DAV/SystemPrincipalBackend.php @@ -27,6 +27,7 @@ class SystemPrincipalBackend extends AbstractBackend { * @param string $prefixPath * @return array */ + #[\Override] public function getPrincipalsByPrefix($prefixPath) { $principals = []; @@ -52,6 +53,7 @@ class SystemPrincipalBackend extends AbstractBackend { * @param string $path * @return array */ + #[\Override] public function getPrincipalByPath($path) { if ($path === 'principals/system/system') { $principal = [ @@ -87,6 +89,7 @@ class SystemPrincipalBackend extends AbstractBackend { * @param \Sabre\DAV\PropPatch $propPatch * @return void */ + #[\Override] public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) { } @@ -119,6 +122,7 @@ class SystemPrincipalBackend extends AbstractBackend { * @param string $test * @return array */ + #[\Override] public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') { return []; } @@ -129,6 +133,7 @@ class SystemPrincipalBackend extends AbstractBackend { * @param string $principal * @return array */ + #[\Override] public function getGroupMemberSet($principal) { // TODO: for now the group principal has only one member, the user itself $principal = $this->getPrincipalByPath($principal); @@ -145,6 +150,7 @@ class SystemPrincipalBackend extends AbstractBackend { * @param string $principal * @return array */ + #[\Override] public function getGroupMembership($principal) { [$prefix, ] = \Sabre\Uri\split($principal); @@ -168,6 +174,7 @@ class SystemPrincipalBackend extends AbstractBackend { * @param array $members * @return void */ + #[\Override] public function setGroupMemberSet($principal, array $members) { throw new \Sabre\DAV\Exception('Setting members of the group is not supported yet'); } diff --git a/apps/dav/lib/DAV/ViewOnlyPlugin.php b/apps/dav/lib/DAV/ViewOnlyPlugin.php index 0e92253a2ff..b0e2cd46800 100644 --- a/apps/dav/lib/DAV/ViewOnlyPlugin.php +++ b/apps/dav/lib/DAV/ViewOnlyPlugin.php @@ -38,6 +38,7 @@ class ViewOnlyPlugin extends ServerPlugin { * * This method should set up the required event subscriptions. */ + #[\Override] public function initialize(Server $server): void { $this->server = $server; //priority 90 to make sure the plugin is called before diff --git a/apps/dav/lib/Db/Absence.php b/apps/dav/lib/Db/Absence.php index d7cd46087c3..28bcef93d13 100644 --- a/apps/dav/lib/Db/Absence.php +++ b/apps/dav/lib/Db/Absence.php @@ -85,6 +85,7 @@ class Absence extends Entity implements JsonSerializable { ); } + #[\Override] public function jsonSerialize(): array { return [ 'userId' => $this->userId, diff --git a/apps/dav/lib/Direct/DirectFile.php b/apps/dav/lib/Direct/DirectFile.php index 7f41dd65f41..12b5d317c9d 100644 --- a/apps/dav/lib/Direct/DirectFile.php +++ b/apps/dav/lib/Direct/DirectFile.php @@ -28,10 +28,12 @@ class DirectFile implements IFile { ) { } + #[\Override] public function put($data) { throw new Forbidden(); } + #[\Override] public function get() { $this->getFile(); @@ -40,12 +42,14 @@ class DirectFile implements IFile { return $this->file->fopen('rb'); } + #[\Override] public function getContentType() { $this->getFile(); return $this->file->getMimeType(); } + #[\Override] public function getETag() { $this->getFile(); @@ -56,24 +60,29 @@ class DirectFile implements IFile { * @psalm-suppress ImplementedReturnTypeMismatch \Sabre\DAV\IFile::getSize signature does not support 32bit * @return int|float */ + #[\Override] public function getSize() { $this->getFile(); return $this->file->getSize(); } + #[\Override] public function delete() { throw new Forbidden(); } + #[\Override] public function getName() { return $this->direct->getToken(); } + #[\Override] public function setName($name) { throw new Forbidden(); } + #[\Override] public function getLastModified() { $this->getFile(); diff --git a/apps/dav/lib/Direct/DirectHome.php b/apps/dav/lib/Direct/DirectHome.php index ac411c9b52f..514576b29d9 100644 --- a/apps/dav/lib/Direct/DirectHome.php +++ b/apps/dav/lib/Direct/DirectHome.php @@ -32,14 +32,17 @@ class DirectHome implements ICollection { ) { } + #[\Override] public function createFile($name, $data = null) { throw new Forbidden(); } + #[\Override] public function createDirectory($name) { throw new Forbidden(); } + #[\Override] public function getChild($name): DirectFile { try { $direct = $this->mapper->getByToken($name); @@ -59,26 +62,32 @@ class DirectHome implements ICollection { } } + #[\Override] public function getChildren() { throw new MethodNotAllowed('Listing members of this collection is disabled'); } + #[\Override] public function childExists($name): bool { return false; } + #[\Override] public function delete() { throw new Forbidden(); } + #[\Override] public function getName(): string { return 'direct'; } + #[\Override] public function setName($name) { throw new Forbidden(); } + #[\Override] public function getLastModified(): int { return 0; } diff --git a/apps/dav/lib/Exception/UnsupportedLimitOnInitialSyncException.php b/apps/dav/lib/Exception/UnsupportedLimitOnInitialSyncException.php index c6b7f8564c5..264c034423d 100644 --- a/apps/dav/lib/Exception/UnsupportedLimitOnInitialSyncException.php +++ b/apps/dav/lib/Exception/UnsupportedLimitOnInitialSyncException.php @@ -19,6 +19,7 @@ class UnsupportedLimitOnInitialSyncException extends InsufficientStorage { /** * @inheritDoc */ + #[\Override] public function serialize(Server $server, \DOMElement $errorNode) { $errorNode->appendChild($errorNode->ownerDocument->createElementNS('DAV:', 'd:number-of-matches-within-limits')); } diff --git a/apps/dav/lib/Files/BrowserErrorPagePlugin.php b/apps/dav/lib/Files/BrowserErrorPagePlugin.php index 85ed975a409..8f77946f9b3 100644 --- a/apps/dav/lib/Files/BrowserErrorPagePlugin.php +++ b/apps/dav/lib/Files/BrowserErrorPagePlugin.php @@ -32,6 +32,7 @@ class BrowserErrorPagePlugin extends ServerPlugin { * @param Server $server * @return void */ + #[\Override] public function initialize(Server $server) { $this->server = $server; $server->on('exception', [$this, 'logException'], 1000); diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php index 7c44e132c08..206d812bd43 100644 --- a/apps/dav/lib/Files/FileSearchBackend.php +++ b/apps/dav/lib/Files/FileSearchBackend.php @@ -59,10 +59,12 @@ class FileSearchBackend implements ISearchBackend { /** * Search endpoint will be remote.php/dav */ + #[\Override] public function getArbiterPath(): string { return ''; } + #[\Override] public function isValidScope(string $href, $depth, ?string $path): bool { // only allow scopes inside the dav server if (is_null($path)) { @@ -77,6 +79,7 @@ class FileSearchBackend implements ISearchBackend { } } + #[\Override] public function getPropertyDefinitionsForScope(string $href, ?string $path): array { // all valid scopes support the same schema @@ -138,6 +141,7 @@ class FileSearchBackend implements ISearchBackend { * @param INode[] $nodes * @param string[] $requestProperties */ + #[\Override] public function preloadPropertyFor(array $nodes, array $requestProperties): void { $this->server->emit('preloadProperties', [$nodes, $requestProperties]); } @@ -163,6 +167,7 @@ class FileSearchBackend implements ISearchBackend { * @param Query $search * @return SearchResult[] */ + #[\Override] public function search(Query $search): array { switch (count($search->from)) { case 0: diff --git a/apps/dav/lib/Files/FilesHome.php b/apps/dav/lib/Files/FilesHome.php index ab3a9b68c13..391df3e4cca 100644 --- a/apps/dav/lib/Files/FilesHome.php +++ b/apps/dav/lib/Files/FilesHome.php @@ -28,15 +28,18 @@ class FilesHome extends Directory { parent::__construct($view, $userFolder); } + #[\Override] public function delete() { throw new Forbidden('Permission denied to delete home folder'); } + #[\Override] public function getName(): string { [,$name] = \Sabre\Uri\split($this->principalInfo['uri']); return $name; } + #[\Override] public function setName($name): void { throw new Forbidden('Permission denied to rename this folder'); } diff --git a/apps/dav/lib/Files/LazySearchBackend.php b/apps/dav/lib/Files/LazySearchBackend.php index 6ba539ddd87..f9cdbf289cc 100644 --- a/apps/dav/lib/Files/LazySearchBackend.php +++ b/apps/dav/lib/Files/LazySearchBackend.php @@ -19,6 +19,7 @@ class LazySearchBackend implements ISearchBackend { $this->backend = $backend; } + #[\Override] public function getArbiterPath(): string { if ($this->backend) { return $this->backend->getArbiterPath(); @@ -27,6 +28,7 @@ class LazySearchBackend implements ISearchBackend { } } + #[\Override] public function isValidScope(string $href, $depth, ?string $path): bool { if ($this->backend) { return $this->backend->getArbiterPath(); @@ -34,6 +36,7 @@ class LazySearchBackend implements ISearchBackend { return false; } + #[\Override] public function getPropertyDefinitionsForScope(string $href, ?String $path): array { if ($this->backend) { return $this->backend->getPropertyDefinitionsForScope($href, $path); @@ -41,6 +44,7 @@ class LazySearchBackend implements ISearchBackend { return []; } + #[\Override] public function search(Query $query): array { if ($this->backend) { return $this->backend->search($query); @@ -48,6 +52,7 @@ class LazySearchBackend implements ISearchBackend { return []; } + #[\Override] public function preloadPropertyFor(array $nodes, array $requestProperties): void { if ($this->backend) { $this->backend->preloadPropertyFor($nodes, $requestProperties); diff --git a/apps/dav/lib/Files/RootCollection.php b/apps/dav/lib/Files/RootCollection.php index 2c01d1ff4ba..c18cd1e7a1b 100644 --- a/apps/dav/lib/Files/RootCollection.php +++ b/apps/dav/lib/Files/RootCollection.php @@ -27,6 +27,7 @@ class RootCollection extends AbstractPrincipalCollection { * @param array $principalInfo * @return INode */ + #[\Override] public function getChildForPrincipal(array $principalInfo) { [,$name] = \Sabre\Uri\split($principalInfo['uri']); $user = Server::get(IUserSession::class)->getUser(); @@ -43,6 +44,7 @@ class RootCollection extends AbstractPrincipalCollection { return new FilesHome($principalInfo, $userFolder); } + #[\Override] public function getName() { return 'files'; } diff --git a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php index 606f526b18b..b3871474afe 100644 --- a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php +++ b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php @@ -35,6 +35,7 @@ class FilesDropPlugin extends ServerPlugin { * This initializes the plugin. * It is ONLY initialized by the server on a file drop request. */ + #[\Override] public function initialize(\Sabre\DAV\Server $server): void { $server->on('beforeMethod:*', [$this, 'beforeMethod'], 999); $server->on('method:MKCOL', [$this, 'onMkcol']); diff --git a/apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php b/apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php index 11b328d2194..548a04f4fed 100644 --- a/apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php +++ b/apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php @@ -38,6 +38,7 @@ class PublicLinkCheckPlugin extends ServerPlugin { * * @return void */ + #[\Override] public function initialize(\Sabre\DAV\Server $server) { $server->on('beforeMethod:*', [$this, 'beforeMethod']); } diff --git a/apps/dav/lib/Files/Sharing/RootCollection.php b/apps/dav/lib/Files/Sharing/RootCollection.php index dd585fbb59b..e7cb0f00f22 100644 --- a/apps/dav/lib/Files/Sharing/RootCollection.php +++ b/apps/dav/lib/Files/Sharing/RootCollection.php @@ -22,10 +22,12 @@ class RootCollection extends AbstractPrincipalCollection { parent::__construct($principalBackend, $principalPrefix); } + #[\Override] public function getChildForPrincipal(array $principalInfo): INode { return $this->root; } + #[\Override] public function getName() { return 'files'; } diff --git a/apps/dav/lib/Listener/ActivityUpdaterListener.php b/apps/dav/lib/Listener/ActivityUpdaterListener.php index f291e424c41..26170803436 100644 --- a/apps/dav/lib/Listener/ActivityUpdaterListener.php +++ b/apps/dav/lib/Listener/ActivityUpdaterListener.php @@ -36,6 +36,7 @@ class ActivityUpdaterListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof CalendarCreatedEvent) { try { diff --git a/apps/dav/lib/Listener/AddMissingIndicesListener.php b/apps/dav/lib/Listener/AddMissingIndicesListener.php index d3a1cf4b224..2370dffa350 100644 --- a/apps/dav/lib/Listener/AddMissingIndicesListener.php +++ b/apps/dav/lib/Listener/AddMissingIndicesListener.php @@ -16,6 +16,7 @@ use OCP\EventDispatcher\IEventListener; */ class AddMissingIndicesListener implements IEventListener { + #[\Override] public function handle(Event $event): void { if (!($event instanceof AddMissingIndicesEvent)) { return; diff --git a/apps/dav/lib/Listener/AddressbookListener.php b/apps/dav/lib/Listener/AddressbookListener.php index 4e38ce50dfd..fe91aae65c9 100644 --- a/apps/dav/lib/Listener/AddressbookListener.php +++ b/apps/dav/lib/Listener/AddressbookListener.php @@ -27,6 +27,7 @@ class AddressbookListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof AddressBookCreatedEvent) { try { diff --git a/apps/dav/lib/Listener/BirthdayListener.php b/apps/dav/lib/Listener/BirthdayListener.php index 3a464d668f9..68a31667400 100644 --- a/apps/dav/lib/Listener/BirthdayListener.php +++ b/apps/dav/lib/Listener/BirthdayListener.php @@ -22,6 +22,7 @@ class BirthdayListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof CardCreatedEvent || $event instanceof CardUpdatedEvent) { $cardData = $event->getCardData(); diff --git a/apps/dav/lib/Listener/CalendarContactInteractionListener.php b/apps/dav/lib/Listener/CalendarContactInteractionListener.php index d14af77ac52..1f7556a361e 100644 --- a/apps/dav/lib/Listener/CalendarContactInteractionListener.php +++ b/apps/dav/lib/Listener/CalendarContactInteractionListener.php @@ -41,6 +41,7 @@ class CalendarContactInteractionListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (($user = $this->userSession->getUser()) === null) { // Without user context we can't do anything diff --git a/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php b/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php index 0cfc435eb8c..3b67774107d 100644 --- a/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php +++ b/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php @@ -29,6 +29,7 @@ class CalendarDeletionDefaultUpdaterListener implements IEventListener { /** * In case the user has set their default calendar to the deleted one */ + #[\Override] public function handle(Event $event): void { if (!($event instanceof CalendarDeletedEvent)) { // Not what we subscribed to diff --git a/apps/dav/lib/Listener/CalendarFederationNotificationListener.php b/apps/dav/lib/Listener/CalendarFederationNotificationListener.php index 2c3a36c734f..6dc438bc09b 100644 --- a/apps/dav/lib/Listener/CalendarFederationNotificationListener.php +++ b/apps/dav/lib/Listener/CalendarFederationNotificationListener.php @@ -33,6 +33,7 @@ class CalendarFederationNotificationListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof CalendarObjectCreatedEvent) && !($event instanceof CalendarObjectUpdatedEvent) diff --git a/apps/dav/lib/Listener/CalendarObjectReminderUpdaterListener.php b/apps/dav/lib/Listener/CalendarObjectReminderUpdaterListener.php index a58fb3524ab..c87c157484b 100644 --- a/apps/dav/lib/Listener/CalendarObjectReminderUpdaterListener.php +++ b/apps/dav/lib/Listener/CalendarObjectReminderUpdaterListener.php @@ -36,6 +36,7 @@ class CalendarObjectReminderUpdaterListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof CalendarMovedToTrashEvent) { try { diff --git a/apps/dav/lib/Listener/CalendarPublicationListener.php b/apps/dav/lib/Listener/CalendarPublicationListener.php index 94a0a208d4e..e2a3c705892 100644 --- a/apps/dav/lib/Listener/CalendarPublicationListener.php +++ b/apps/dav/lib/Listener/CalendarPublicationListener.php @@ -26,6 +26,7 @@ class CalendarPublicationListener implements IEventListener { /** * In case the user has set their default calendar to the deleted one */ + #[\Override] public function handle(Event $event): void { if ($event instanceof CalendarPublishedEvent) { $this->logger->debug('Creating activity for Calendar being published'); diff --git a/apps/dav/lib/Listener/CalendarShareUpdateListener.php b/apps/dav/lib/Listener/CalendarShareUpdateListener.php index b673d5d2e42..6ff42798f32 100644 --- a/apps/dav/lib/Listener/CalendarShareUpdateListener.php +++ b/apps/dav/lib/Listener/CalendarShareUpdateListener.php @@ -25,6 +25,7 @@ class CalendarShareUpdateListener implements IEventListener { /** * In case the user has set their default calendar to the deleted one */ + #[\Override] public function handle(Event $event): void { if (!($event instanceof CalendarShareUpdatedEvent)) { // Not what we subscribed to diff --git a/apps/dav/lib/Listener/CardListener.php b/apps/dav/lib/Listener/CardListener.php index b9fd1a7f64b..73c0b1979df 100644 --- a/apps/dav/lib/Listener/CardListener.php +++ b/apps/dav/lib/Listener/CardListener.php @@ -27,6 +27,7 @@ class CardListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof CardCreatedEvent) { try { diff --git a/apps/dav/lib/Listener/ClearPhotoCacheListener.php b/apps/dav/lib/Listener/ClearPhotoCacheListener.php index eb599d33871..b467d556dc5 100644 --- a/apps/dav/lib/Listener/ClearPhotoCacheListener.php +++ b/apps/dav/lib/Listener/ClearPhotoCacheListener.php @@ -21,6 +21,7 @@ class ClearPhotoCacheListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof CardUpdatedEvent || $event instanceof CardDeletedEvent) { $cardData = $event->getCardData(); diff --git a/apps/dav/lib/Listener/DavAdminSettingsListener.php b/apps/dav/lib/Listener/DavAdminSettingsListener.php index 69966676e34..eb7fb93287e 100644 --- a/apps/dav/lib/Listener/DavAdminSettingsListener.php +++ b/apps/dav/lib/Listener/DavAdminSettingsListener.php @@ -23,6 +23,7 @@ class DavAdminSettingsListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { /** @var DeclarativeSettingsGetValueEvent|DeclarativeSettingsSetValueEvent $event */ diff --git a/apps/dav/lib/Listener/OutOfOfficeListener.php b/apps/dav/lib/Listener/OutOfOfficeListener.php index 45728aa35d3..6f0bddde995 100644 --- a/apps/dav/lib/Listener/OutOfOfficeListener.php +++ b/apps/dav/lib/Listener/OutOfOfficeListener.php @@ -43,6 +43,7 @@ class OutOfOfficeListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof OutOfOfficeScheduledEvent) { $userId = $event->getData()->getUser()->getUID(); diff --git a/apps/dav/lib/Listener/SabrePluginAuthInitListener.php b/apps/dav/lib/Listener/SabrePluginAuthInitListener.php index 562c9411cdf..2fa8bebc255 100644 --- a/apps/dav/lib/Listener/SabrePluginAuthInitListener.php +++ b/apps/dav/lib/Listener/SabrePluginAuthInitListener.php @@ -26,6 +26,7 @@ class SabrePluginAuthInitListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof SabrePluginAuthInitEvent)) { return; diff --git a/apps/dav/lib/Listener/SubscriptionListener.php b/apps/dav/lib/Listener/SubscriptionListener.php index fc9dfcf122d..8a8779f6100 100644 --- a/apps/dav/lib/Listener/SubscriptionListener.php +++ b/apps/dav/lib/Listener/SubscriptionListener.php @@ -31,6 +31,7 @@ class SubscriptionListener implements IEventListener { /** * In case the user has set their default calendar to the deleted one */ + #[\Override] public function handle(Event $event): void { if ($event instanceof SubscriptionCreatedEvent) { $subscriptionId = $event->getSubscriptionId(); diff --git a/apps/dav/lib/Listener/TrustedServerRemovedListener.php b/apps/dav/lib/Listener/TrustedServerRemovedListener.php index 9adbcfc14c2..028297d2189 100644 --- a/apps/dav/lib/Listener/TrustedServerRemovedListener.php +++ b/apps/dav/lib/Listener/TrustedServerRemovedListener.php @@ -20,6 +20,7 @@ class TrustedServerRemovedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof TrustedServerRemovedEvent) { return; diff --git a/apps/dav/lib/Listener/UserEventsListener.php b/apps/dav/lib/Listener/UserEventsListener.php index abf1c56ad4b..b7d1157a989 100644 --- a/apps/dav/lib/Listener/UserEventsListener.php +++ b/apps/dav/lib/Listener/UserEventsListener.php @@ -57,6 +57,7 @@ class UserEventsListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof UserCreatedEvent) { $this->postCreateUser($event->getUser()); diff --git a/apps/dav/lib/Listener/UserPreferenceListener.php b/apps/dav/lib/Listener/UserPreferenceListener.php index 5f5fed05348..93085d163ca 100644 --- a/apps/dav/lib/Listener/UserPreferenceListener.php +++ b/apps/dav/lib/Listener/UserPreferenceListener.php @@ -22,6 +22,7 @@ class UserPreferenceListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof BeforePreferenceSetEvent) { if ($event->getAppId() === 'dav' && $event->getConfigKey() === 'user_status_automation' && $event->getConfigValue() === 'yes') { diff --git a/apps/dav/lib/Migration/BuildCalendarSearchIndex.php b/apps/dav/lib/Migration/BuildCalendarSearchIndex.php index 0ff7355b724..2a40e18e720 100644 --- a/apps/dav/lib/Migration/BuildCalendarSearchIndex.php +++ b/apps/dav/lib/Migration/BuildCalendarSearchIndex.php @@ -26,6 +26,7 @@ class BuildCalendarSearchIndex implements IRepairStep { /** * @return string */ + #[\Override] public function getName() { return 'Registering building of calendar search index as background job'; } @@ -33,6 +34,7 @@ class BuildCalendarSearchIndex implements IRepairStep { /** * @param IOutput $output */ + #[\Override] public function run(IOutput $output) { // only run once if ($this->config->getAppValue('dav', 'buildCalendarSearchIndex') === 'yes') { diff --git a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php index d9642a09f38..06ac9ec222a 100644 --- a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php @@ -26,6 +26,7 @@ class BuildCalendarSearchIndexBackgroundJob extends QueuedJob { parent::__construct($timeFactory); } + #[\Override] public function run($argument) { $offset = (int)$argument['offset']; $stopAt = (int)$argument['stopAt']; diff --git a/apps/dav/lib/Migration/BuildSocialSearchIndex.php b/apps/dav/lib/Migration/BuildSocialSearchIndex.php index e6163bd2346..48e2a6bde57 100644 --- a/apps/dav/lib/Migration/BuildSocialSearchIndex.php +++ b/apps/dav/lib/Migration/BuildSocialSearchIndex.php @@ -23,6 +23,7 @@ class BuildSocialSearchIndex implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Register building of social profile search index as background job'; } @@ -30,6 +31,7 @@ class BuildSocialSearchIndex implements IRepairStep { /** * @param IOutput $output */ + #[\Override] public function run(IOutput $output) { // only run once if ($this->config->getValueBool('dav', 'builtSocialSearchIndex')) { diff --git a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php index 5b44df2b69e..1ae5704ad19 100644 --- a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php @@ -27,6 +27,7 @@ class BuildSocialSearchIndexBackgroundJob extends QueuedJob { parent::__construct($timeFactory); } + #[\Override] public function run($argument) { $offset = $argument['offset']; $stopAt = $argument['stopAt']; diff --git a/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php b/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php index 42c419a733b..4826f730397 100644 --- a/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php +++ b/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php @@ -23,10 +23,12 @@ class CalDAVRemoveEmptyValue implements IRepairStep { ) { } + #[\Override] public function getName() { return 'Fix broken values of calendar objects'; } + #[\Override] public function run(IOutput $output) { $pattern = ';VALUE=:'; $count = $warnings = 0; diff --git a/apps/dav/lib/Migration/ChunkCleanup.php b/apps/dav/lib/Migration/ChunkCleanup.php index edd9a26109e..5ba45a1516a 100644 --- a/apps/dav/lib/Migration/ChunkCleanup.php +++ b/apps/dav/lib/Migration/ChunkCleanup.php @@ -29,10 +29,12 @@ class ChunkCleanup implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Chunk cleanup scheduler'; } + #[\Override] public function run(IOutput $output) { // If we already ran this onec there is no need to run it again if ($this->config->getAppValue('dav', 'chunks_migrated', '0') === '1') { diff --git a/apps/dav/lib/Migration/CreateSystemAddressBookStep.php b/apps/dav/lib/Migration/CreateSystemAddressBookStep.php index ec07c72e7a7..f038a5c177e 100644 --- a/apps/dav/lib/Migration/CreateSystemAddressBookStep.php +++ b/apps/dav/lib/Migration/CreateSystemAddressBookStep.php @@ -20,10 +20,12 @@ class CreateSystemAddressBookStep implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Create system address book'; } + #[\Override] public function run(IOutput $output): void { $this->syncService->ensureLocalSystemAddressBookExists(); } diff --git a/apps/dav/lib/Migration/DeleteSchedulingObjects.php b/apps/dav/lib/Migration/DeleteSchedulingObjects.php index 00d8b4cc28d..1a08d086921 100644 --- a/apps/dav/lib/Migration/DeleteSchedulingObjects.php +++ b/apps/dav/lib/Migration/DeleteSchedulingObjects.php @@ -23,10 +23,12 @@ class DeleteSchedulingObjects implements IRepairStepExpensive { ) { } + #[\Override] public function getName(): string { return 'Handle outdated scheduling events'; } + #[\Override] public function run(IOutput $output): void { $output->info('Cleaning up old scheduling events'); $time = $this->time->getTime() - (60 * 60); diff --git a/apps/dav/lib/Migration/DisableSystemAddressBook.php b/apps/dav/lib/Migration/DisableSystemAddressBook.php index 8c7f712275c..57743bf4934 100644 --- a/apps/dav/lib/Migration/DisableSystemAddressBook.php +++ b/apps/dav/lib/Migration/DisableSystemAddressBook.php @@ -32,6 +32,7 @@ class DisableSystemAddressBook implements IRepairStep { /** * @inheritdoc */ + #[\Override] public function getName() { return 'Disable system address book'; } @@ -39,6 +40,7 @@ class DisableSystemAddressBook implements IRepairStep { /** * @inheritdoc */ + #[\Override] public function run(IOutput $output) { // If the system address book exposure was previously set skip the repair step if ($this->appConfig->hasAppKey(ConfigLexicon::SYSTEM_ADDRESSBOOK_EXPOSED) === true) { diff --git a/apps/dav/lib/Migration/FixBirthdayCalendarComponent.php b/apps/dav/lib/Migration/FixBirthdayCalendarComponent.php index 6833ca2ffa6..6264a5e81ce 100644 --- a/apps/dav/lib/Migration/FixBirthdayCalendarComponent.php +++ b/apps/dav/lib/Migration/FixBirthdayCalendarComponent.php @@ -21,6 +21,7 @@ class FixBirthdayCalendarComponent implements IRepairStep { /** * @inheritdoc */ + #[\Override] public function getName() { return 'Fix component of birthday calendars'; } @@ -28,6 +29,7 @@ class FixBirthdayCalendarComponent implements IRepairStep { /** * @inheritdoc */ + #[\Override] public function run(IOutput $output) { $query = $this->connection->getQueryBuilder(); $updated = $query->update('calendars') diff --git a/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php b/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php index 2c98bf5f0cb..a15cf95f2ae 100644 --- a/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php +++ b/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php @@ -31,6 +31,7 @@ class RefreshWebcalJobRegistrar implements IRepairStep { /** * @inheritdoc */ + #[\Override] public function getName() { return 'Registering background jobs to update cache for webcal calendars'; } @@ -38,6 +39,7 @@ class RefreshWebcalJobRegistrar implements IRepairStep { /** * @inheritdoc */ + #[\Override] public function run(IOutput $output): void { $query = $this->connection->getQueryBuilder(); $query->select(['principaluri', 'uri']) diff --git a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php index ec9f3bce45d..3a1a5ac5e3f 100644 --- a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php +++ b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php @@ -29,6 +29,7 @@ class RegenerateBirthdayCalendars implements IRepairStep { /** * @return string */ + #[\Override] public function getName() { return 'Regenerating birthday calendars to use new icons and fix old birthday events without year'; } @@ -36,6 +37,7 @@ class RegenerateBirthdayCalendars implements IRepairStep { /** * @param IOutput $output */ + #[\Override] public function run(IOutput $output) { // only run once if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes') { diff --git a/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php b/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php index 7f74390f883..ccae2deb254 100644 --- a/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php @@ -40,6 +40,7 @@ class RegisterBuildReminderIndexBackgroundJob implements IRepairStep { /** * @return string */ + #[\Override] public function getName() { return 'Registering building of calendar reminder index as background job'; } @@ -47,6 +48,7 @@ class RegisterBuildReminderIndexBackgroundJob implements IRepairStep { /** * @param IOutput $output */ + #[\Override] public function run(IOutput $output) { // only run once if ($this->config->getAppValue('dav', self::CONFIG_KEY) === 'yes') { diff --git a/apps/dav/lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php b/apps/dav/lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php index 9d77aefafd2..e511c1a4ffe 100644 --- a/apps/dav/lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php +++ b/apps/dav/lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php @@ -20,10 +20,12 @@ class RegisterUpdateCalendarResourcesRoomBackgroundJob implements IRepairStep { ) { } + #[\Override] public function getName() { return 'Register a background job to update rooms and resources'; } + #[\Override] public function run(IOutput $output) { $this->jobList->add(UpdateCalendarResourcesRoomsBackgroundJob::class); } diff --git a/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php b/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php index 4aae1515f9e..23cea72d40d 100644 --- a/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php +++ b/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php @@ -23,6 +23,7 @@ class RemoveClassifiedEventActivity implements IRepairStep { /** * @inheritdoc */ + #[\Override] public function getName() { return 'Remove activity entries of private events'; } @@ -30,6 +31,7 @@ class RemoveClassifiedEventActivity implements IRepairStep { /** * @inheritdoc */ + #[\Override] public function run(IOutput $output) { if (!$this->connection->tableExists('activity')) { return; diff --git a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php index 29b586c08cb..db5a8f5c7d9 100644 --- a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php +++ b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php @@ -32,6 +32,7 @@ class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep { /** * @inheritdoc */ + #[\Override] public function getName(): string { return 'Clean up old calendar subscriptions from deleted users that were not cleaned-up'; } @@ -39,6 +40,7 @@ class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep { /** * @inheritdoc */ + #[\Override] public function run(IOutput $output) { $nbSubscriptions = $this->countSubscriptions(); diff --git a/apps/dav/lib/Migration/RemoveObjectProperties.php b/apps/dav/lib/Migration/RemoveObjectProperties.php index 18220353cc3..c5a7daeea82 100644 --- a/apps/dav/lib/Migration/RemoveObjectProperties.php +++ b/apps/dav/lib/Migration/RemoveObjectProperties.php @@ -21,10 +21,12 @@ class RemoveObjectProperties implements IRepairStepExpensive { ) { } + #[\Override] public function getName(): string { return 'Remove invalid object properties'; } + #[\Override] public function run(IOutput $output): void { $query = $this->connection->getQueryBuilder(); $updated = $query->delete('properties') diff --git a/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php b/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php index 143dc3cd1e6..39fd8f246d9 100644 --- a/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php +++ b/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php @@ -19,10 +19,12 @@ class RemoveOrphanEventsAndContacts implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Queue jobs to clean up orphan event and contact data'; } + #[\Override] public function run(IOutput $output): void { $this->queueJob('calendarobjects', 'calendars', 'calendarid', '%d events without a calendar have been cleaned up'); $this->queueJob('calendarobjects_props', 'calendarobjects', 'objectid', '%d properties without an events have been cleaned up'); diff --git a/apps/dav/lib/Migration/Version1004Date20170825134824.php b/apps/dav/lib/Migration/Version1004Date20170825134824.php index ed089861d76..153db25ae83 100644 --- a/apps/dav/lib/Migration/Version1004Date20170825134824.php +++ b/apps/dav/lib/Migration/Version1004Date20170825134824.php @@ -18,6 +18,7 @@ class Version1004Date20170825134824 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1004Date20170919104507.php b/apps/dav/lib/Migration/Version1004Date20170919104507.php index 678d92d2b83..929b4c39373 100644 --- a/apps/dav/lib/Migration/Version1004Date20170919104507.php +++ b/apps/dav/lib/Migration/Version1004Date20170919104507.php @@ -19,6 +19,7 @@ class Version1004Date20170919104507 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1004Date20170924124212.php b/apps/dav/lib/Migration/Version1004Date20170924124212.php index 4d221e91132..04daf171a59 100644 --- a/apps/dav/lib/Migration/Version1004Date20170924124212.php +++ b/apps/dav/lib/Migration/Version1004Date20170924124212.php @@ -19,6 +19,7 @@ class Version1004Date20170924124212 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1004Date20170926103422.php b/apps/dav/lib/Migration/Version1004Date20170926103422.php index 333bdd197ff..0a48ceeac7b 100644 --- a/apps/dav/lib/Migration/Version1004Date20170926103422.php +++ b/apps/dav/lib/Migration/Version1004Date20170926103422.php @@ -20,6 +20,7 @@ class Version1004Date20170926103422 extends BigIntMigration { * ['table1' => ['column1', 'column2'], ...] * @since 13.0.0 */ + #[\Override] protected function getColumnsByTable() { return [ 'addressbooks' => ['id'], diff --git a/apps/dav/lib/Migration/Version1005Date20180413093149.php b/apps/dav/lib/Migration/Version1005Date20180413093149.php index db071c65d98..41d4d0c8389 100644 --- a/apps/dav/lib/Migration/Version1005Date20180413093149.php +++ b/apps/dav/lib/Migration/Version1005Date20180413093149.php @@ -21,6 +21,7 @@ class Version1005Date20180413093149 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ diff --git a/apps/dav/lib/Migration/Version1005Date20180530124431.php b/apps/dav/lib/Migration/Version1005Date20180530124431.php index b5f9ff26962..26c8589431b 100644 --- a/apps/dav/lib/Migration/Version1005Date20180530124431.php +++ b/apps/dav/lib/Migration/Version1005Date20180530124431.php @@ -20,6 +20,7 @@ class Version1005Date20180530124431 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1006Date20180619154313.php b/apps/dav/lib/Migration/Version1006Date20180619154313.php index 231861a68c4..23d2a691875 100644 --- a/apps/dav/lib/Migration/Version1006Date20180619154313.php +++ b/apps/dav/lib/Migration/Version1006Date20180619154313.php @@ -23,6 +23,7 @@ class Version1006Date20180619154313 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1006Date20180628111625.php b/apps/dav/lib/Migration/Version1006Date20180628111625.php index f4be26e6ad0..3d657969ca0 100644 --- a/apps/dav/lib/Migration/Version1006Date20180628111625.php +++ b/apps/dav/lib/Migration/Version1006Date20180628111625.php @@ -21,6 +21,7 @@ class Version1006Date20180628111625 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1008Date20181030113700.php b/apps/dav/lib/Migration/Version1008Date20181030113700.php index d2354a185df..a63485d3153 100644 --- a/apps/dav/lib/Migration/Version1008Date20181030113700.php +++ b/apps/dav/lib/Migration/Version1008Date20181030113700.php @@ -23,6 +23,7 @@ class Version1008Date20181030113700 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1008Date20181105104826.php b/apps/dav/lib/Migration/Version1008Date20181105104826.php index 3ca80b5a00e..b899e4c6541 100644 --- a/apps/dav/lib/Migration/Version1008Date20181105104826.php +++ b/apps/dav/lib/Migration/Version1008Date20181105104826.php @@ -33,6 +33,7 @@ class Version1008Date20181105104826 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -51,6 +52,7 @@ class Version1008Date20181105104826 extends SimpleMigrationStep { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { $qb = $this->connection->getQueryBuilder(); $qb->update('calendarsubscriptions') diff --git a/apps/dav/lib/Migration/Version1008Date20181105104833.php b/apps/dav/lib/Migration/Version1008Date20181105104833.php index 3d4094d8072..c81e2b45012 100644 --- a/apps/dav/lib/Migration/Version1008Date20181105104833.php +++ b/apps/dav/lib/Migration/Version1008Date20181105104833.php @@ -21,6 +21,7 @@ class Version1008Date20181105104833 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1008Date20181105110300.php b/apps/dav/lib/Migration/Version1008Date20181105110300.php index 520b950d8ff..093094baa8e 100644 --- a/apps/dav/lib/Migration/Version1008Date20181105110300.php +++ b/apps/dav/lib/Migration/Version1008Date20181105110300.php @@ -33,6 +33,7 @@ class Version1008Date20181105110300 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -50,6 +51,7 @@ class Version1008Date20181105110300 extends SimpleMigrationStep { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { $qb = $this->connection->getQueryBuilder(); $qb->update('calendarsubscriptions') diff --git a/apps/dav/lib/Migration/Version1008Date20181105112049.php b/apps/dav/lib/Migration/Version1008Date20181105112049.php index eb18eacb0b1..e67deb09ce4 100644 --- a/apps/dav/lib/Migration/Version1008Date20181105112049.php +++ b/apps/dav/lib/Migration/Version1008Date20181105112049.php @@ -21,6 +21,7 @@ class Version1008Date20181105112049 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1008Date20181114084440.php b/apps/dav/lib/Migration/Version1008Date20181114084440.php index 3718f16f54a..cd6aafc4b40 100644 --- a/apps/dav/lib/Migration/Version1008Date20181114084440.php +++ b/apps/dav/lib/Migration/Version1008Date20181114084440.php @@ -22,6 +22,7 @@ class Version1008Date20181114084440 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1011Date20190725113607.php b/apps/dav/lib/Migration/Version1011Date20190725113607.php index 4524dca9c83..5420c7ebf9d 100644 --- a/apps/dav/lib/Migration/Version1011Date20190725113607.php +++ b/apps/dav/lib/Migration/Version1011Date20190725113607.php @@ -25,6 +25,7 @@ class Version1011Date20190725113607 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1011Date20190806104428.php b/apps/dav/lib/Migration/Version1011Date20190806104428.php index 183dcd4bf1e..f1503f7940c 100644 --- a/apps/dav/lib/Migration/Version1011Date20190806104428.php +++ b/apps/dav/lib/Migration/Version1011Date20190806104428.php @@ -24,6 +24,7 @@ class Version1011Date20190806104428 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1012Date20190808122342.php b/apps/dav/lib/Migration/Version1012Date20190808122342.php index 717bcbc1119..47f64bb9767 100644 --- a/apps/dav/lib/Migration/Version1012Date20190808122342.php +++ b/apps/dav/lib/Migration/Version1012Date20190808122342.php @@ -25,6 +25,7 @@ class Version1012Date20190808122342 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 17.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options):?ISchemaWrapper { diff --git a/apps/dav/lib/Migration/Version1016Date20201109085907.php b/apps/dav/lib/Migration/Version1016Date20201109085907.php index f0f4b8b77c1..d27b03b0bf7 100644 --- a/apps/dav/lib/Migration/Version1016Date20201109085907.php +++ b/apps/dav/lib/Migration/Version1016Date20201109085907.php @@ -20,6 +20,7 @@ class Version1016Date20201109085907 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/apps/dav/lib/Migration/Version1017Date20210216083742.php b/apps/dav/lib/Migration/Version1017Date20210216083742.php index 43bece200b8..2bff85746bc 100644 --- a/apps/dav/lib/Migration/Version1017Date20210216083742.php +++ b/apps/dav/lib/Migration/Version1017Date20210216083742.php @@ -23,6 +23,7 @@ class Version1017Date20210216083742 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/apps/dav/lib/Migration/Version1018Date20210312100735.php b/apps/dav/lib/Migration/Version1018Date20210312100735.php index 8199d3e9cd2..697952bf984 100644 --- a/apps/dav/lib/Migration/Version1018Date20210312100735.php +++ b/apps/dav/lib/Migration/Version1018Date20210312100735.php @@ -22,6 +22,7 @@ class Version1018Date20210312100735 extends SimpleMigrationStep { * @param array $options * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1024Date20211221144219.php b/apps/dav/lib/Migration/Version1024Date20211221144219.php index 656a50809cd..6715c6b25ae 100644 --- a/apps/dav/lib/Migration/Version1024Date20211221144219.php +++ b/apps/dav/lib/Migration/Version1024Date20211221144219.php @@ -25,6 +25,7 @@ class Version1024Date20211221144219 extends SimpleMigrationStep { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { } @@ -35,6 +36,7 @@ class Version1024Date20211221144219 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @throws SchemaException */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -56,6 +58,7 @@ class Version1024Date20211221144219 extends SimpleMigrationStep { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { } } diff --git a/apps/dav/lib/Migration/Version1029Date20221114151721.php b/apps/dav/lib/Migration/Version1029Date20221114151721.php index dba5e0b1a48..3b9b753d30d 100644 --- a/apps/dav/lib/Migration/Version1029Date20221114151721.php +++ b/apps/dav/lib/Migration/Version1029Date20221114151721.php @@ -24,6 +24,7 @@ class Version1029Date20221114151721 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @throws SchemaException */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1031Date20240610134258.php b/apps/dav/lib/Migration/Version1031Date20240610134258.php index c1242ceb7db..9daa0ce8d58 100644 --- a/apps/dav/lib/Migration/Version1031Date20240610134258.php +++ b/apps/dav/lib/Migration/Version1031Date20240610134258.php @@ -20,6 +20,7 @@ use OCP\Migration\SimpleMigrationStep; #[AddColumn(table: 'dav_absence', name: 'replacement_user_id', type: ColumnType::STRING)] #[AddColumn(table: 'dav_absence', name: 'replacement_user_display_name', type: ColumnType::STRING)] class Version1031Date20240610134258 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1038Date20260302000000.php b/apps/dav/lib/Migration/Version1038Date20260302000000.php index ae5f147b82c..8d401700ed5 100644 --- a/apps/dav/lib/Migration/Version1038Date20260302000000.php +++ b/apps/dav/lib/Migration/Version1038Date20260302000000.php @@ -19,6 +19,7 @@ use OCP\Migration\SimpleMigrationStep; #[AddColumn(table: 'calendars', name: 'default_alarm', type: ColumnType::STRING)] class Version1038Date20260302000000 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Paginate/PaginatePlugin.php b/apps/dav/lib/Paginate/PaginatePlugin.php index 740c14b64ff..e1639189c15 100644 --- a/apps/dav/lib/Paginate/PaginatePlugin.php +++ b/apps/dav/lib/Paginate/PaginatePlugin.php @@ -31,6 +31,7 @@ class PaginatePlugin extends ServerPlugin { ) { } + #[\Override] public function initialize(Server $server): void { $this->server = $server; $server->on('beforeMultiStatus', [$this, 'onMultiStatus']); @@ -39,6 +40,7 @@ class PaginatePlugin extends ServerPlugin { $server->on('method:REPORT', [$this, 'onMethod'], 1); } + #[\Override] public function getFeatures(): array { return ['nc-paginate']; } diff --git a/apps/dav/lib/Profiler/ProfilerPlugin.php b/apps/dav/lib/Profiler/ProfilerPlugin.php index 455760fc2bf..97e22b4388a 100644 --- a/apps/dav/lib/Profiler/ProfilerPlugin.php +++ b/apps/dav/lib/Profiler/ProfilerPlugin.php @@ -20,6 +20,7 @@ class ProfilerPlugin extends \Sabre\DAV\ServerPlugin { } /** @return void */ + #[\Override] public function initialize(Server $server) { $server->on('afterMethod:*', [$this, 'afterMethod']); } diff --git a/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php b/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php index 74c69a467ae..f67724e011b 100644 --- a/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php +++ b/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php @@ -29,11 +29,13 @@ class AppleProvisioningNode implements INode, IProperties { /** * @return string */ + #[\Override] public function getName() { return self::FILENAME; } + #[\Override] public function setName($name) { throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden'); } @@ -41,6 +43,7 @@ class AppleProvisioningNode implements INode, IProperties { /** * @return null */ + #[\Override] public function getLastModified() { return null; } @@ -48,6 +51,7 @@ class AppleProvisioningNode implements INode, IProperties { /** * @throws Forbidden */ + #[\Override] public function delete() { throw new Forbidden(self::FILENAME . ' may not be deleted.'); } @@ -56,6 +60,7 @@ class AppleProvisioningNode implements INode, IProperties { * @param array $properties * @return array */ + #[\Override] public function getProperties($properties) { $datetime = $this->timeFactory->getDateTime(); @@ -69,6 +74,7 @@ class AppleProvisioningNode implements INode, IProperties { * @param PropPatch $propPatch * @throws Forbidden */ + #[\Override] public function propPatch(PropPatch $propPatch) { throw new Forbidden(self::FILENAME . '\'s properties may not be altered.'); } diff --git a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php index 7e7008c019d..3c2a6119e0d 100644 --- a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php +++ b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php @@ -41,6 +41,7 @@ class AppleProvisioningPlugin extends ServerPlugin { /** * @param Server $server */ + #[\Override] public function initialize(Server $server) { $this->server = $server; $this->server->on('method:GET', [$this, 'httpGet'], 90); diff --git a/apps/dav/lib/Search/ContactsSearchProvider.php b/apps/dav/lib/Search/ContactsSearchProvider.php index f4a4cde23f4..0e75611f936 100644 --- a/apps/dav/lib/Search/ContactsSearchProvider.php +++ b/apps/dav/lib/Search/ContactsSearchProvider.php @@ -53,6 +53,7 @@ class ContactsSearchProvider implements IFilteringProvider { /** * @inheritDoc */ + #[\Override] public function getId(): string { return 'contacts'; } @@ -60,10 +61,12 @@ class ContactsSearchProvider implements IFilteringProvider { /** * @inheritDoc */ + #[\Override] public function getName(): string { return $this->l10n->t('Contacts'); } + #[\Override] public function getOrder(string $route, array $routeParameters): ?int { if ($this->appManager->isEnabledForUser('contacts')) { return $route === 'contacts.Page.index' ? -1 : 25; @@ -72,6 +75,7 @@ class ContactsSearchProvider implements IFilteringProvider { return null; } + #[\Override] public function search(IUser $user, ISearchQuery $query): SearchResult { if (!$this->appManager->isEnabledForUser('contacts', $user)) { return SearchResult::complete($this->getName(), []); @@ -169,6 +173,7 @@ class ContactsSearchProvider implements IFilteringProvider { return (string)$emailAddresses[0]; } + #[\Override] public function getSupportedFilters(): array { return [ 'term', @@ -179,10 +184,12 @@ class ContactsSearchProvider implements IFilteringProvider { ]; } + #[\Override] public function getAlternateIds(): array { return []; } + #[\Override] public function getCustomFilters(): array { return [ new FilterDefinition('company'), diff --git a/apps/dav/lib/Search/EventsSearchProvider.php b/apps/dav/lib/Search/EventsSearchProvider.php index c29127f9de7..efe12bc54e2 100644 --- a/apps/dav/lib/Search/EventsSearchProvider.php +++ b/apps/dav/lib/Search/EventsSearchProvider.php @@ -57,6 +57,7 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering /** * @inheritDoc */ + #[\Override] public function getId(): string { return 'calendar'; } @@ -64,6 +65,7 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering /** * @inheritDoc */ + #[\Override] public function getName(): string { return $this->l10n->t('Events'); } @@ -71,6 +73,7 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering /** * @inheritDoc */ + #[\Override] public function getOrder(string $route, array $routeParameters): ?int { if ($this->appManager->isEnabledForUser('calendar')) { return $route === 'calendar.View.index' ? -1 : 30; @@ -82,6 +85,7 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering /** * @inheritDoc */ + #[\Override] public function search( IUser $user, ISearchQuery $query, @@ -270,6 +274,7 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering return $dtStart->format('Y-m-d') === $dtEnd->format('Y-m-d'); } + #[\Override] public function getSupportedFilters(): array { return [ 'term', @@ -279,10 +284,12 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering ]; } + #[\Override] public function getAlternateIds(): array { return []; } + #[\Override] public function getCustomFilters(): array { return []; } diff --git a/apps/dav/lib/Search/TasksSearchProvider.php b/apps/dav/lib/Search/TasksSearchProvider.php index 23e4ab3c1fd..fcdaf385df3 100644 --- a/apps/dav/lib/Search/TasksSearchProvider.php +++ b/apps/dav/lib/Search/TasksSearchProvider.php @@ -43,6 +43,7 @@ class TasksSearchProvider extends ACalendarSearchProvider { /** * @inheritDoc */ + #[\Override] public function getId(): string { return 'tasks'; } @@ -50,6 +51,7 @@ class TasksSearchProvider extends ACalendarSearchProvider { /** * @inheritDoc */ + #[\Override] public function getName(): string { return $this->l10n->t('Tasks'); } @@ -57,6 +59,7 @@ class TasksSearchProvider extends ACalendarSearchProvider { /** * @inheritDoc */ + #[\Override] public function getOrder(string $route, array $routeParameters): ?int { if ($this->appManager->isEnabledForUser('tasks')) { return $route === 'tasks.Page.index' ? -1 : 35; @@ -68,6 +71,7 @@ class TasksSearchProvider extends ACalendarSearchProvider { /** * @inheritDoc */ + #[\Override] public function search( IUser $user, ISearchQuery $query, diff --git a/apps/dav/lib/Settings/Admin/SystemAddressBookSettings.php b/apps/dav/lib/Settings/Admin/SystemAddressBookSettings.php index 2f7b9f8fcc9..abc69ad29fb 100644 --- a/apps/dav/lib/Settings/Admin/SystemAddressBookSettings.php +++ b/apps/dav/lib/Settings/Admin/SystemAddressBookSettings.php @@ -18,6 +18,7 @@ class SystemAddressBookSettings implements IDeclarativeSettingsForm { ) { } + #[\Override] public function getSchema(): array { return [ 'id' => 'dav-admin-system-address-book', diff --git a/apps/dav/lib/Settings/AvailabilitySettings.php b/apps/dav/lib/Settings/AvailabilitySettings.php index 092c2a2db4f..555fa7f34e3 100644 --- a/apps/dav/lib/Settings/AvailabilitySettings.php +++ b/apps/dav/lib/Settings/AvailabilitySettings.php @@ -31,6 +31,7 @@ class AvailabilitySettings implements ISettings { ) { } + #[\Override] public function getForm(): TemplateResponse { $this->initialState->provideInitialState( 'user_status_automation', @@ -62,10 +63,12 @@ class AvailabilitySettings implements ISettings { return new TemplateResponse(Application::APP_ID, 'settings-personal-availability'); } + #[\Override] public function getSection(): string { return 'availability'; } + #[\Override] public function getPriority(): int { return 10; } diff --git a/apps/dav/lib/Settings/CalDAVSettings.php b/apps/dav/lib/Settings/CalDAVSettings.php index bffcfef9020..9bf9154a569 100644 --- a/apps/dav/lib/Settings/CalDAVSettings.php +++ b/apps/dav/lib/Settings/CalDAVSettings.php @@ -41,6 +41,7 @@ class CalDAVSettings implements IDelegatedSettings { ) { } + #[\Override] public function getForm(): TemplateResponse { $this->initialState->provideInitialState('userSyncCalendarsDocUrl', $this->urlGenerator->linkToDocs('user-sync-calendars')); foreach (self::defaults as $key => $default) { @@ -53,6 +54,7 @@ class CalDAVSettings implements IDelegatedSettings { return new TemplateResponse(Application::APP_ID, 'settings-admin-caldav'); } + #[\Override] public function getSection(): ?string { if (!$this->appManager->isBackendRequired(IAppManager::BACKEND_CALDAV)) { return null; @@ -64,14 +66,17 @@ class CalDAVSettings implements IDelegatedSettings { /** * @return int */ + #[\Override] public function getPriority() { return 10; } + #[\Override] public function getName(): ?string { return null; // Only setting in this section } + #[\Override] public function getAuthorizedAppConfig(): array { return [ 'dav' => ['/(' . implode('|', array_keys(self::defaults)) . ')/'] diff --git a/apps/dav/lib/Settings/ExampleContentSettings.php b/apps/dav/lib/Settings/ExampleContentSettings.php index c158ce1f13c..79f29aeb7a0 100644 --- a/apps/dav/lib/Settings/ExampleContentSettings.php +++ b/apps/dav/lib/Settings/ExampleContentSettings.php @@ -28,6 +28,7 @@ class ExampleContentSettings implements ISettings { ) { } + #[\Override] public function getForm(): TemplateResponse { $calendarEnabled = $this->appManager->isEnabledForUser('calendar'); $contactsEnabled = $this->appManager->isEnabledForUser('contacts'); @@ -59,6 +60,7 @@ class ExampleContentSettings implements ISettings { return new TemplateResponse(Application::APP_ID, 'settings-admin-example-content'); } + #[\Override] public function getSection(): ?string { if (!$this->appManager->isEnabledForUser('contacts') && !$this->appManager->isEnabledForUser('calendar')) { @@ -68,6 +70,7 @@ class ExampleContentSettings implements ISettings { return 'groupware'; } + #[\Override] public function getPriority(): int { return 10; } diff --git a/apps/dav/lib/SetupChecks/NeedsSystemAddressBookSync.php b/apps/dav/lib/SetupChecks/NeedsSystemAddressBookSync.php index c3f0742a640..4e424c9d205 100644 --- a/apps/dav/lib/SetupChecks/NeedsSystemAddressBookSync.php +++ b/apps/dav/lib/SetupChecks/NeedsSystemAddressBookSync.php @@ -21,14 +21,17 @@ class NeedsSystemAddressBookSync implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('DAV system address book'); } + #[\Override] public function getCategory(): string { return 'dav'; } + #[\Override] public function run(): SetupResult { if ($this->config->getAppValue('dav', 'needs_system_address_book_sync', 'no') === 'no') { return SetupResult::success($this->l10n->t('No outstanding DAV system address book sync.')); diff --git a/apps/dav/lib/SetupChecks/SystemAddressBookSize.php b/apps/dav/lib/SetupChecks/SystemAddressBookSize.php index 746ce609e47..6143119fb85 100644 --- a/apps/dav/lib/SetupChecks/SystemAddressBookSize.php +++ b/apps/dav/lib/SetupChecks/SystemAddressBookSize.php @@ -25,14 +25,17 @@ class SystemAddressBookSize implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('DAV system address book size'); } + #[\Override] public function getCategory(): string { return 'dav'; } + #[\Override] public function run(): SetupResult { if (!$this->appConfig->getValueBool(Application::APP_ID, ConfigLexicon::SYSTEM_ADDRESSBOOK_EXPOSED)) { return SetupResult::success($this->l10n->t('The system address book is disabled')); diff --git a/apps/dav/lib/SetupChecks/WebdavEndpoint.php b/apps/dav/lib/SetupChecks/WebdavEndpoint.php index c2574202fcd..e493c6c5a4c 100644 --- a/apps/dav/lib/SetupChecks/WebdavEndpoint.php +++ b/apps/dav/lib/SetupChecks/WebdavEndpoint.php @@ -31,14 +31,17 @@ class WebdavEndpoint implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'network'; } + #[\Override] public function getName(): string { return $this->l10n->t('WebDAV endpoint'); } + #[\Override] public function run(): SetupResult { $urls = [ ['propfind', '/remote.php/webdav', [207, 401]], diff --git a/apps/dav/lib/Storage/PublicOwnerWrapper.php b/apps/dav/lib/Storage/PublicOwnerWrapper.php index a0f1607d971..23c7aca944c 100644 --- a/apps/dav/lib/Storage/PublicOwnerWrapper.php +++ b/apps/dav/lib/Storage/PublicOwnerWrapper.php @@ -25,6 +25,7 @@ class PublicOwnerWrapper extends Wrapper { $this->owner = $parameters['owner']; } + #[\Override] public function getOwner(string $path): string|false { $owner = parent::getOwner($path); if ($owner !== false) { diff --git a/apps/dav/lib/Storage/PublicShareWrapper.php b/apps/dav/lib/Storage/PublicShareWrapper.php index fb0db4dca4c..61bb7d0d1ac 100644 --- a/apps/dav/lib/Storage/PublicShareWrapper.php +++ b/apps/dav/lib/Storage/PublicShareWrapper.php @@ -27,6 +27,7 @@ class PublicShareWrapper extends Wrapper implements ISharedStorage { $this->share = $parameters['share']; } + #[\Override] public function getShare(): IShare { $storage = parent::getWrapperStorage(); if (method_exists($storage, 'getShare')) { diff --git a/apps/dav/lib/SystemTag/SystemTagList.php b/apps/dav/lib/SystemTag/SystemTagList.php index b55f10164d7..5013f992f20 100644 --- a/apps/dav/lib/SystemTag/SystemTagList.php +++ b/apps/dav/lib/SystemTag/SystemTagList.php @@ -43,10 +43,12 @@ class SystemTagList implements Element { return $this->tags; } + #[\Override] public static function xmlDeserialize(Reader $reader): void { // unsupported/unused } + #[\Override] public function xmlSerialize(Writer $writer): void { foreach ($this->tags as $tag) { $writer->startElement('{' . self::NS_NEXTCLOUD . '}system-tag'); diff --git a/apps/dav/lib/SystemTag/SystemTagMappingNode.php b/apps/dav/lib/SystemTag/SystemTagMappingNode.php index 12d604a7d6e..bb01f92171a 100644 --- a/apps/dav/lib/SystemTag/SystemTagMappingNode.php +++ b/apps/dav/lib/SystemTag/SystemTagMappingNode.php @@ -64,6 +64,7 @@ class SystemTagMappingNode implements \Sabre\DAV\INode { * * @return string */ + #[\Override] public function getName() { return $this->tag->getId(); } @@ -77,6 +78,7 @@ class SystemTagMappingNode implements \Sabre\DAV\INode { * * @return never */ + #[\Override] public function setName($name) { throw new MethodNotAllowed(); } @@ -86,6 +88,7 @@ class SystemTagMappingNode implements \Sabre\DAV\INode { * * @return null */ + #[\Override] public function getLastModified() { return null; } @@ -95,6 +98,7 @@ class SystemTagMappingNode implements \Sabre\DAV\INode { * * @return void */ + #[\Override] public function delete() { try { if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) { diff --git a/apps/dav/lib/SystemTag/SystemTagNode.php b/apps/dav/lib/SystemTag/SystemTagNode.php index 2341d4823ba..3416442d220 100644 --- a/apps/dav/lib/SystemTag/SystemTagNode.php +++ b/apps/dav/lib/SystemTag/SystemTagNode.php @@ -55,6 +55,7 @@ class SystemTagNode implements \Sabre\DAV\ICollection { * * @return string */ + #[\Override] public function getName() { return $this->tag->getId(); } @@ -77,6 +78,7 @@ class SystemTagNode implements \Sabre\DAV\ICollection { * * @return never */ + #[\Override] public function setName($name) { throw new MethodNotAllowed(); } @@ -133,6 +135,7 @@ class SystemTagNode implements \Sabre\DAV\ICollection { * * @return null */ + #[\Override] public function getLastModified() { return null; } @@ -140,6 +143,7 @@ class SystemTagNode implements \Sabre\DAV\ICollection { /** * @return void */ + #[\Override] public function delete() { try { if (!$this->isAdmin) { @@ -173,23 +177,28 @@ class SystemTagNode implements \Sabre\DAV\ICollection { $this->referenceFileId = $referenceFileId; } + #[\Override] public function createFile($name, $data = null) { throw new MethodNotAllowed(); } + #[\Override] public function createDirectory($name) { throw new MethodNotAllowed(); } + #[\Override] public function getChild($name) { return new SystemTagObjectType($this->tag, $name, $this->tagManager, $this->tagMapper); } + #[\Override] public function childExists($name) { $objectTypes = $this->tagMapper->getAvailableObjectTypes(); return in_array($name, $objectTypes); } + #[\Override] public function getChildren() { $objectTypes = $this->tagMapper->getAvailableObjectTypes(); return array_map( diff --git a/apps/dav/lib/SystemTag/SystemTagObjectType.php b/apps/dav/lib/SystemTag/SystemTagObjectType.php index 9157da12a91..f36e3cb4460 100644 --- a/apps/dav/lib/SystemTag/SystemTagObjectType.php +++ b/apps/dav/lib/SystemTag/SystemTagObjectType.php @@ -51,33 +51,42 @@ class SystemTagObjectType implements \Sabre\DAV\IFile { return $this->tag; } + #[\Override] public function getName() { return $this->type; } + #[\Override] public function getLastModified() { return null; } + #[\Override] public function getETag() { return '"' . $this->tag->getETag() . '"'; } + #[\Override] public function setName($name) { throw new MethodNotAllowed(); } + #[\Override] public function put($data) { throw new MethodNotAllowed(); } + #[\Override] public function get() { throw new MethodNotAllowed(); } + #[\Override] public function delete() { throw new MethodNotAllowed(); } + #[\Override] public function getContentType() { throw new MethodNotAllowed(); } + #[\Override] public function getSize() { throw new MethodNotAllowed(); } diff --git a/apps/dav/lib/SystemTag/SystemTagPlugin.php b/apps/dav/lib/SystemTag/SystemTagPlugin.php index 34f9b365389..d9652436adc 100644 --- a/apps/dav/lib/SystemTag/SystemTagPlugin.php +++ b/apps/dav/lib/SystemTag/SystemTagPlugin.php @@ -87,6 +87,7 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { * @param \Sabre\DAV\Server $server * @return void */ + #[\Override] public function initialize(\Sabre\DAV\Server $server) { $server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; $server->xml->namespaceMap[self::NS_NEXTCLOUD] = 'nc'; diff --git a/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php b/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php index b854db7b94d..b49ee269b6d 100644 --- a/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php @@ -56,6 +56,7 @@ class SystemTagsByIdCollection implements ICollection { * * @return never */ + #[\Override] public function createFile($name, $data = null) { throw new Forbidden('Cannot create tags by id'); } @@ -65,6 +66,7 @@ class SystemTagsByIdCollection implements ICollection { * * @return never */ + #[\Override] public function createDirectory($name) { throw new Forbidden('Permission denied to create collections'); } @@ -74,6 +76,7 @@ class SystemTagsByIdCollection implements ICollection { * * @return SystemTagNode */ + #[\Override] public function getChild($name) { try { $tag = $this->tagManager->getTagsByIds([$name]); @@ -94,6 +97,7 @@ class SystemTagsByIdCollection implements ICollection { * * @psalm-return array */ + #[\Override] public function getChildren() { $visibilityFilter = true; if ($this->isAdmin()) { @@ -109,6 +113,7 @@ class SystemTagsByIdCollection implements ICollection { /** * @param string $name */ + #[\Override] public function childExists($name) { try { $tag = $this->tagManager->getTagsByIds([$name]); @@ -127,6 +132,7 @@ class SystemTagsByIdCollection implements ICollection { /** * @return never */ + #[\Override] public function delete() { throw new Forbidden('Permission denied to delete this collection'); } @@ -136,6 +142,7 @@ class SystemTagsByIdCollection implements ICollection { * * @psalm-return 'systemtags' */ + #[\Override] public function getName() { return 'systemtags'; } @@ -143,6 +150,7 @@ class SystemTagsByIdCollection implements ICollection { /** * @return never */ + #[\Override] public function setName($name) { throw new Forbidden('Permission denied to rename this collection'); } @@ -152,6 +160,7 @@ class SystemTagsByIdCollection implements ICollection { * * @return null */ + #[\Override] public function getLastModified() { return null; } diff --git a/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php b/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php index 472726c74a7..b3feb410533 100644 --- a/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php @@ -37,10 +37,12 @@ class SystemTagsInUseCollection extends SimpleCollection { } } + #[\Override] public function setName($name): void { throw new Forbidden('Permission denied to rename this collection'); } + #[\Override] public function getChild($name): self { if ($this->mediaType !== '') { throw new NotFound('Invalid media type'); @@ -53,6 +55,7 @@ class SystemTagsInUseCollection extends SimpleCollection { * @throws NotPermittedException * @throws Forbidden */ + #[\Override] public function getChildren(): array { $user = $this->userSession->getUser(); $userFolder = null; diff --git a/apps/dav/lib/SystemTag/SystemTagsObjectList.php b/apps/dav/lib/SystemTag/SystemTagsObjectList.php index 64e8b1bbebb..c3f9e86f832 100644 --- a/apps/dav/lib/SystemTag/SystemTagsObjectList.php +++ b/apps/dav/lib/SystemTag/SystemTagsObjectList.php @@ -40,6 +40,7 @@ class SystemTagsObjectList implements XmlSerializable, XmlDeserializable { return $this->objects; } + #[\Override] public static function xmlDeserialize(Reader $reader) { $tree = $reader->parseInnerTree(); if ($tree === null) { @@ -74,6 +75,7 @@ class SystemTagsObjectList implements XmlSerializable, XmlDeserializable { * @param Writer $writer * @return void */ + #[\Override] public function xmlSerialize(Writer $writer) { foreach ($this->objects as $objectsId => $type) { $writer->startElement(SystemTagPlugin::OBJECTIDS_PROPERTYNAME); diff --git a/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php b/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php index da58f9bf308..0c047c5d7c7 100644 --- a/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php @@ -35,6 +35,7 @@ class SystemTagsObjectMappingCollection implements ICollection { /** * @return void */ + #[\Override] public function createFile($name, $data = null) { $tagId = $name; try { @@ -59,6 +60,7 @@ class SystemTagsObjectMappingCollection implements ICollection { /** * @return never */ + #[\Override] public function createDirectory($name) { throw new Forbidden('Permission denied to create collections'); } @@ -66,6 +68,7 @@ class SystemTagsObjectMappingCollection implements ICollection { /** * @return SystemTagMappingNode */ + #[\Override] public function getChild($tagName) { try { if ($this->tagMapper->haveTag([$this->objectId], $this->objectType, $tagName, true)) { @@ -88,6 +91,7 @@ class SystemTagsObjectMappingCollection implements ICollection { * * @psalm-return list */ + #[\Override] public function getChildren() { $tagIds = current($this->tagMapper->getTagIdsForObjects([$this->objectId], $this->objectType)); if (empty($tagIds)) { @@ -105,6 +109,7 @@ class SystemTagsObjectMappingCollection implements ICollection { }, $tags)); } + #[\Override] public function childExists($tagId) { try { $result = $this->tagMapper->haveTag([$this->objectId], $this->objectType, $tagId, true); @@ -128,10 +133,12 @@ class SystemTagsObjectMappingCollection implements ICollection { /** * @return never */ + #[\Override] public function delete() { throw new Forbidden('Permission denied to delete this collection'); } + #[\Override] public function getName() { return $this->objectId; } @@ -139,6 +146,7 @@ class SystemTagsObjectMappingCollection implements ICollection { /** * @return never */ + #[\Override] public function setName($name) { throw new Forbidden('Permission denied to rename this collection'); } @@ -148,6 +156,7 @@ class SystemTagsObjectMappingCollection implements ICollection { * * @return null */ + #[\Override] public function getLastModified() { return null; } diff --git a/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php b/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php index 9bd66ca0d61..37c00f46eef 100644 --- a/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php @@ -39,6 +39,7 @@ class SystemTagsObjectTypeCollection implements ICollection { * * @throws Forbidden */ + #[\Override] public function createFile($name, $data = null) { throw new Forbidden('Permission denied to create nodes'); } @@ -50,6 +51,7 @@ class SystemTagsObjectTypeCollection implements ICollection { * * @return never */ + #[\Override] public function createDirectory($name) { throw new Forbidden('Permission denied to create collections'); } @@ -60,6 +62,7 @@ class SystemTagsObjectTypeCollection implements ICollection { * @return SystemTagsObjectMappingCollection * @throws NotFound */ + #[\Override] public function getChild($objectName) { // make sure the object exists and is reachable if (!$this->childExists($objectName)) { @@ -78,6 +81,7 @@ class SystemTagsObjectTypeCollection implements ICollection { /** * @return never */ + #[\Override] public function getChildren() { // do not list object ids throw new MethodNotAllowed(); @@ -89,6 +93,7 @@ class SystemTagsObjectTypeCollection implements ICollection { * @param string $name * @return bool */ + #[\Override] public function childExists($name) { return call_user_func($this->childExistsFunction, $name); } @@ -96,10 +101,12 @@ class SystemTagsObjectTypeCollection implements ICollection { /** * @return never */ + #[\Override] public function delete() { throw new Forbidden('Permission denied to delete this collection'); } + #[\Override] public function getName() { return $this->objectType; } @@ -111,6 +118,7 @@ class SystemTagsObjectTypeCollection implements ICollection { * * @return never */ + #[\Override] public function setName($name) { throw new Forbidden('Permission denied to rename this collection'); } @@ -120,6 +128,7 @@ class SystemTagsObjectTypeCollection implements ICollection { * * @return null */ + #[\Override] public function getLastModified() { return null; } diff --git a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php index 0839a5bc995..1d794a143ab 100644 --- a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php @@ -81,10 +81,12 @@ class SystemTagsRelationsCollection extends SimpleCollection { parent::__construct('root', $children); } + #[\Override] public function getName() { return 'systemtags-relations'; } + #[\Override] public function setName($name) { throw new Forbidden('Permission denied to rename this collection'); } diff --git a/apps/dav/lib/Upload/AssemblyStream.php b/apps/dav/lib/Upload/AssemblyStream.php index e58fef48425..bf6ee16bc9d 100644 --- a/apps/dav/lib/Upload/AssemblyStream.php +++ b/apps/dav/lib/Upload/AssemblyStream.php @@ -48,6 +48,7 @@ class AssemblyStream implements \Icewind\Streams\File { * @param string &$opened_path * @return bool */ + #[\Override] public function stream_open($path, $mode, $options, &$opened_path) { $this->loadContext('assembly'); @@ -68,6 +69,7 @@ class AssemblyStream implements \Icewind\Streams\File { * @param int $whence * @return bool */ + #[\Override] public function stream_seek($offset, $whence = SEEK_SET) { if ($whence === SEEK_CUR) { $offset = $this->stream_tell() + $offset; @@ -113,6 +115,7 @@ class AssemblyStream implements \Icewind\Streams\File { /** * @return int */ + #[\Override] public function stream_tell() { return $this->pos; } @@ -121,6 +124,7 @@ class AssemblyStream implements \Icewind\Streams\File { * @param int $count * @return string */ + #[\Override] public function stream_read($count) { if (is_null($this->currentStream)) { if ($this->currentNode < count($this->nodes)) { @@ -165,6 +169,7 @@ class AssemblyStream implements \Icewind\Streams\File { * @param string $data * @return int */ + #[\Override] public function stream_write($data) { return false; } @@ -175,6 +180,7 @@ class AssemblyStream implements \Icewind\Streams\File { * @param int $arg2 * @return bool */ + #[\Override] public function stream_set_option($option, $arg1, $arg2) { return false; } @@ -183,6 +189,7 @@ class AssemblyStream implements \Icewind\Streams\File { * @param int $size * @return bool */ + #[\Override] public function stream_truncate($size) { return false; } @@ -190,6 +197,7 @@ class AssemblyStream implements \Icewind\Streams\File { /** * @return array */ + #[\Override] public function stream_stat() { return [ 'size' => $this->size, @@ -200,6 +208,7 @@ class AssemblyStream implements \Icewind\Streams\File { * @param int $operation * @return bool */ + #[\Override] public function stream_lock($operation) { return false; } @@ -207,6 +216,7 @@ class AssemblyStream implements \Icewind\Streams\File { /** * @return bool */ + #[\Override] public function stream_flush() { return false; } @@ -214,6 +224,7 @@ class AssemblyStream implements \Icewind\Streams\File { /** * @return bool */ + #[\Override] public function stream_eof() { return $this->pos >= $this->size || ($this->currentNode >= count($this->nodes) && $this->currentNode === null); } @@ -221,6 +232,7 @@ class AssemblyStream implements \Icewind\Streams\File { /** * @return bool */ + #[\Override] public function stream_close() { return true; } diff --git a/apps/dav/lib/Upload/ChunkingPlugin.php b/apps/dav/lib/Upload/ChunkingPlugin.php index 8cc8f7d6c61..d23b2374b76 100644 --- a/apps/dav/lib/Upload/ChunkingPlugin.php +++ b/apps/dav/lib/Upload/ChunkingPlugin.php @@ -26,6 +26,7 @@ class ChunkingPlugin extends ServerPlugin { /** * @inheritdoc */ + #[\Override] public function initialize(Server $server) { $server->on('beforeMove', [$this, 'beforeMove']); $this->server = $server; diff --git a/apps/dav/lib/Upload/ChunkingV2Plugin.php b/apps/dav/lib/Upload/ChunkingV2Plugin.php index eb8607584d4..a0b059abfb8 100644 --- a/apps/dav/lib/Upload/ChunkingV2Plugin.php +++ b/apps/dav/lib/Upload/ChunkingV2Plugin.php @@ -68,6 +68,7 @@ class ChunkingV2Plugin extends ServerPlugin { /** * @inheritdoc */ + #[\Override] public function initialize(Server $server) { $server->on('beforeMethod:GET', $this->beforeGet(...)); $server->on('beforeMethod:PUT', [$this, 'beforePut']); diff --git a/apps/dav/lib/Upload/FutureFile.php b/apps/dav/lib/Upload/FutureFile.php index ba37c56978d..c8375db2488 100644 --- a/apps/dav/lib/Upload/FutureFile.php +++ b/apps/dav/lib/Upload/FutureFile.php @@ -33,6 +33,7 @@ class FutureFile implements \Sabre\DAV\IFile { /** * @inheritdoc */ + #[\Override] public function put($data) { throw new Forbidden('Permission denied to put into this file'); } @@ -40,6 +41,7 @@ class FutureFile implements \Sabre\DAV\IFile { /** * @inheritdoc */ + #[\Override] public function get() { $nodes = $this->root->getChildren(); return AssemblyStream::wrap($nodes); @@ -52,6 +54,7 @@ class FutureFile implements \Sabre\DAV\IFile { /** * @inheritdoc */ + #[\Override] public function getContentType() { return 'application/octet-stream'; } @@ -59,6 +62,7 @@ class FutureFile implements \Sabre\DAV\IFile { /** * @inheritdoc */ + #[\Override] public function getETag() { return $this->root->getETag(); } @@ -66,6 +70,7 @@ class FutureFile implements \Sabre\DAV\IFile { /** * @inheritdoc */ + #[\Override] public function getSize() { $children = $this->root->getChildren(); $sizes = array_map(function ($node) { @@ -79,6 +84,7 @@ class FutureFile implements \Sabre\DAV\IFile { /** * @inheritdoc */ + #[\Override] public function delete() { $this->root->delete(); } @@ -86,6 +92,7 @@ class FutureFile implements \Sabre\DAV\IFile { /** * @inheritdoc */ + #[\Override] public function getName() { return $this->name; } @@ -93,6 +100,7 @@ class FutureFile implements \Sabre\DAV\IFile { /** * @inheritdoc */ + #[\Override] public function setName($name) { throw new Forbidden('Permission denied to rename this file'); } @@ -100,6 +108,7 @@ class FutureFile implements \Sabre\DAV\IFile { /** * @inheritdoc */ + #[\Override] public function getLastModified() { return $this->root->getLastModified(); } diff --git a/apps/dav/lib/Upload/PartFile.php b/apps/dav/lib/Upload/PartFile.php index 11900997a90..1c8d4aabf55 100644 --- a/apps/dav/lib/Upload/PartFile.php +++ b/apps/dav/lib/Upload/PartFile.php @@ -25,6 +25,7 @@ class PartFile implements IFile { /** * @inheritdoc */ + #[\Override] public function put($data) { throw new Forbidden('Permission denied to put into this file'); } @@ -32,6 +33,7 @@ class PartFile implements IFile { /** * @inheritdoc */ + #[\Override] public function get() { throw new Forbidden('Permission denied to get this file'); } @@ -43,6 +45,7 @@ class PartFile implements IFile { /** * @inheritdoc */ + #[\Override] public function getContentType() { return 'application/octet-stream'; } @@ -50,6 +53,7 @@ class PartFile implements IFile { /** * @inheritdoc */ + #[\Override] public function getETag() { return $this->partInfo['ETag']; } @@ -57,6 +61,7 @@ class PartFile implements IFile { /** * @inheritdoc */ + #[\Override] public function getSize() { return $this->partInfo['Size']; } @@ -64,6 +69,7 @@ class PartFile implements IFile { /** * @inheritdoc */ + #[\Override] public function delete() { $this->root->delete(); } @@ -71,6 +77,7 @@ class PartFile implements IFile { /** * @inheritdoc */ + #[\Override] public function getName() { return $this->partInfo['PartNumber']; } @@ -78,6 +85,7 @@ class PartFile implements IFile { /** * @inheritdoc */ + #[\Override] public function setName($name) { throw new Forbidden('Permission denied to rename this file'); } @@ -85,6 +93,7 @@ class PartFile implements IFile { /** * @inheritdoc */ + #[\Override] public function getLastModified() { return $this->partInfo['LastModified']; } diff --git a/apps/dav/lib/Upload/RootCollection.php b/apps/dav/lib/Upload/RootCollection.php index e8dc4daca22..9f722dc98a7 100644 --- a/apps/dav/lib/Upload/RootCollection.php +++ b/apps/dav/lib/Upload/RootCollection.php @@ -32,6 +32,7 @@ class RootCollection extends AbstractPrincipalCollection { /** * @inheritdoc */ + #[\Override] public function getChildForPrincipal(array $principalInfo): UploadHome { return new UploadHome( $principalInfo, @@ -45,6 +46,7 @@ class RootCollection extends AbstractPrincipalCollection { /** * @inheritdoc */ + #[\Override] public function getName(): string { return 'uploads'; } diff --git a/apps/dav/lib/Upload/UploadAutoMkcolPlugin.php b/apps/dav/lib/Upload/UploadAutoMkcolPlugin.php index a7030ba1133..b217430d4da 100644 --- a/apps/dav/lib/Upload/UploadAutoMkcolPlugin.php +++ b/apps/dav/lib/Upload/UploadAutoMkcolPlugin.php @@ -27,6 +27,7 @@ class UploadAutoMkcolPlugin extends ServerPlugin { private Server $server; + #[\Override] public function initialize(Server $server): void { $server->on('beforeMethod:PUT', [$this, 'beforeMethod']); $this->server = $server; diff --git a/apps/dav/lib/Upload/UploadFile.php b/apps/dav/lib/Upload/UploadFile.php index 7301e855cfe..9d2f3654abf 100644 --- a/apps/dav/lib/Upload/UploadFile.php +++ b/apps/dav/lib/Upload/UploadFile.php @@ -17,10 +17,12 @@ class UploadFile implements IFile { ) { } + #[\Override] public function put($data) { return $this->file->put($data); } + #[\Override] public function get() { return $this->file->get(); } @@ -29,10 +31,12 @@ class UploadFile implements IFile { return $this->file->getId(); } + #[\Override] public function getContentType() { return $this->file->getContentType(); } + #[\Override] public function getETag() { return $this->file->getETag(); } @@ -41,22 +45,27 @@ class UploadFile implements IFile { * @psalm-suppress ImplementedReturnTypeMismatch \Sabre\DAV\IFile::getSize signature does not support 32bit * @return int|float */ + #[\Override] public function getSize() { return $this->file->getSize(); } + #[\Override] public function delete() { $this->file->delete(); } + #[\Override] public function getName() { return $this->file->getName(); } + #[\Override] public function setName($name) { $this->file->setName($name); } + #[\Override] public function getLastModified() { return $this->file->getLastModified(); } diff --git a/apps/dav/lib/Upload/UploadFolder.php b/apps/dav/lib/Upload/UploadFolder.php index 8890d472f87..44c790d186c 100644 --- a/apps/dav/lib/Upload/UploadFolder.php +++ b/apps/dav/lib/Upload/UploadFolder.php @@ -25,6 +25,7 @@ class UploadFolder implements ICollection { ) { } + #[\Override] public function createFile($name, $data = null) { // TODO: verify name - should be a simple number try { @@ -38,10 +39,12 @@ class UploadFolder implements ICollection { } } + #[\Override] public function createDirectory($name) { throw new Forbidden('Permission denied to create file (filename ' . $name . ')'); } + #[\Override] public function getChild($name) { if ($name === '.file') { return new FutureFile($this->node, '.file'); @@ -49,6 +52,7 @@ class UploadFolder implements ICollection { return new UploadFile($this->node->getChild($name)); } + #[\Override] public function getChildren() { $tmpChildren = $this->node->getChildren(); @@ -79,6 +83,7 @@ class UploadFolder implements ICollection { return $children; } + #[\Override] public function childExists($name) { if ($name === '.file') { return true; @@ -86,6 +91,7 @@ class UploadFolder implements ICollection { return $this->node->childExists($name); } + #[\Override] public function delete() { $this->node->delete(); @@ -93,14 +99,17 @@ class UploadFolder implements ICollection { $this->cleanupService->removeJob($this->uid, $this->getName()); } + #[\Override] public function getName() { return $this->node->getName(); } + #[\Override] public function setName($name) { throw new Forbidden('Permission denied to rename this folder'); } + #[\Override] public function getLastModified() { return $this->node->getLastModified(); } diff --git a/apps/dav/lib/Upload/UploadHome.php b/apps/dav/lib/Upload/UploadHome.php index b5274cbe6fc..4fbba0ad91b 100644 --- a/apps/dav/lib/Upload/UploadHome.php +++ b/apps/dav/lib/Upload/UploadHome.php @@ -42,10 +42,12 @@ class UploadHome implements ICollection { } } + #[\Override] public function createFile($name, $data = null) { throw new Forbidden('Permission denied to create file (filename ' . $name . ')'); } + #[\Override] public function createDirectory($name) { $this->impl()->createDirectory($name); @@ -53,6 +55,7 @@ class UploadHome implements ICollection { $this->cleanupService->addJob($this->uid, $name); } + #[\Override] public function getChild($name): UploadFolder { return new UploadFolder( $this->impl()->getChild($name), @@ -62,10 +65,12 @@ class UploadHome implements ICollection { ); } + #[\Override] public function getChildren(): array { throw new MethodNotAllowed('Listing members of this collection is disabled'); } + #[\Override] public function childExists($name): bool { try { $this->getChild($name); @@ -75,19 +80,23 @@ class UploadHome implements ICollection { } } + #[\Override] public function delete() { $this->impl()->delete(); } + #[\Override] public function getName() { [,$name] = \Sabre\Uri\split($this->principalInfo['uri']); return $name; } + #[\Override] public function setName($name) { throw new Forbidden('Permission denied to rename this folder'); } + #[\Override] public function getLastModified() { return $this->impl()->getLastModified(); } diff --git a/apps/dav/lib/UserMigration/CalendarMigrator.php b/apps/dav/lib/UserMigration/CalendarMigrator.php index eee5fb6fb0b..8dd94d6d4cf 100644 --- a/apps/dav/lib/UserMigration/CalendarMigrator.php +++ b/apps/dav/lib/UserMigration/CalendarMigrator.php @@ -67,6 +67,7 @@ class CalendarMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getId(): string { return 'calendar'; } @@ -74,6 +75,7 @@ class CalendarMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getDisplayName(): string { return $this->l10n->t('Calendar'); } @@ -81,6 +83,7 @@ class CalendarMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getDescription(): string { return $this->l10n->t('Calendars including events, details and attendees'); } @@ -88,6 +91,7 @@ class CalendarMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getEstimatedExportSize(IUser $user): int|float { $principalUri = self::USERS_URI_ROOT . $user->getUID(); $calendars = $this->calendarManager->getCalendarsForPrincipal($principalUri); @@ -237,6 +241,7 @@ class CalendarMigrator implements IMigrator, ISizeEstimationMigrator { * * @throws CalendarMigratorException */ + #[\Override] public function import(IUser $user, IImportSource $importSource, OutputInterface $output): void { $output->writeln('Importing calendaring data…'); if ($importSource->getMigratorVersion($this->getId()) === null) { diff --git a/apps/dav/lib/UserMigration/ContactsMigrator.php b/apps/dav/lib/UserMigration/ContactsMigrator.php index 96d623938a3..826d40f7329 100644 --- a/apps/dav/lib/UserMigration/ContactsMigrator.php +++ b/apps/dav/lib/UserMigration/ContactsMigrator.php @@ -179,6 +179,7 @@ class ContactsMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getEstimatedExportSize(IUser $user): int|float { $addressBookExports = $this->getAddressBookExports($user, new NullOutput()); $addressBookCount = count($addressBookExports); @@ -200,6 +201,7 @@ class ContactsMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function export(IUser $user, IExportDestination $exportDestination, OutputInterface $output): void { $output->writeln('Exporting contacts into ' . ContactsMigrator::PATH_ROOT . '…'); @@ -310,6 +312,7 @@ class ContactsMigrator implements IMigrator, ISizeEstimationMigrator { * * @throws ContactsMigratorException */ + #[\Override] public function import(IUser $user, IImportSource $importSource, OutputInterface $output): void { if ($importSource->getMigratorVersion($this->getId()) === null) { $output->writeln('No version for ' . static::class . ', skipping import…'); @@ -377,6 +380,7 @@ class ContactsMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getId(): string { return 'contacts'; } @@ -384,6 +388,7 @@ class ContactsMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getDisplayName(): string { return $this->l10n->t('Contacts'); } @@ -391,6 +396,7 @@ class ContactsMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getDescription(): string { return $this->l10n->t('Contacts and groups'); } diff --git a/apps/encryption/lib/AppInfo/Application.php b/apps/encryption/lib/AppInfo/Application.php index 1112a43fa08..7497f56fcf4 100644 --- a/apps/encryption/lib/AppInfo/Application.php +++ b/apps/encryption/lib/AppInfo/Application.php @@ -45,9 +45,11 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID, $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { } + #[\Override] public function boot(IBootContext $context): void { $context->injectFn(function (IManager $encryptionManager) use ($context): void { if (!($encryptionManager instanceof \OC\Encryption\Manager)) { diff --git a/apps/encryption/lib/Command/CleanOrphanedKeys.php b/apps/encryption/lib/Command/CleanOrphanedKeys.php index b8481eaf24d..526f5ea5742 100644 --- a/apps/encryption/lib/Command/CleanOrphanedKeys.php +++ b/apps/encryption/lib/Command/CleanOrphanedKeys.php @@ -43,6 +43,7 @@ class CleanOrphanedKeys extends Command { } + #[\Override] protected function configure(): void { $this ->setName('encryption:clean-orphaned-keys') @@ -54,6 +55,7 @@ class CleanOrphanedKeys extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $users = []; $userId = $input->getArgument('user'); diff --git a/apps/encryption/lib/Command/DisableMasterKey.php b/apps/encryption/lib/Command/DisableMasterKey.php index 409753f39f0..ff12ff9b93d 100644 --- a/apps/encryption/lib/Command/DisableMasterKey.php +++ b/apps/encryption/lib/Command/DisableMasterKey.php @@ -25,12 +25,14 @@ class DisableMasterKey extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('encryption:disable-master-key') ->setDescription('Disable the master key and use per-user keys instead. Only available for fresh installations with no existing encrypted data! There is no way to enable it again.'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $isMasterKeyEnabled = $this->util->isMasterKeyEnabled(); diff --git a/apps/encryption/lib/Command/DropLegacyFileKey.php b/apps/encryption/lib/Command/DropLegacyFileKey.php index 704ab52b6c1..38ed644456d 100644 --- a/apps/encryption/lib/Command/DropLegacyFileKey.php +++ b/apps/encryption/lib/Command/DropLegacyFileKey.php @@ -34,12 +34,14 @@ class DropLegacyFileKey extends Command { $this->rootView = new View(); } + #[\Override] protected function configure(): void { $this ->setName('encryption:drop-legacy-filekey') ->setDescription('Scan the files for the legacy filekey format using RC4 and get rid of it (if master key is enabled)'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $result = true; diff --git a/apps/encryption/lib/Command/EnableMasterKey.php b/apps/encryption/lib/Command/EnableMasterKey.php index 1a65530495e..20b425c83f1 100644 --- a/apps/encryption/lib/Command/EnableMasterKey.php +++ b/apps/encryption/lib/Command/EnableMasterKey.php @@ -26,12 +26,14 @@ class EnableMasterKey extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('encryption:enable-master-key') ->setDescription('Enable the master key. Only available for fresh installations with no existing encrypted data! There is also no way to disable it again.'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $isAlreadyEnabled = $this->util->isMasterKeyEnabled(); diff --git a/apps/encryption/lib/Command/FixEncryptedVersion.php b/apps/encryption/lib/Command/FixEncryptedVersion.php index f33311028c0..65dc89a7b6b 100644 --- a/apps/encryption/lib/Command/FixEncryptedVersion.php +++ b/apps/encryption/lib/Command/FixEncryptedVersion.php @@ -39,6 +39,7 @@ class FixEncryptedVersion extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); @@ -62,6 +63,7 @@ class FixEncryptedVersion extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $skipSignatureCheck = $this->config->getSystemValueBool('encryption_skip_signature_check', false); $this->supportLegacy = $this->config->getSystemValueBool('encryption.legacy_format_support', false); diff --git a/apps/encryption/lib/Command/FixKeyLocation.php b/apps/encryption/lib/Command/FixKeyLocation.php index 805d7f4e0b8..fb64db93f06 100644 --- a/apps/encryption/lib/Command/FixKeyLocation.php +++ b/apps/encryption/lib/Command/FixKeyLocation.php @@ -52,6 +52,7 @@ class FixKeyLocation extends Command { } + #[\Override] protected function configure(): void { parent::configure(); @@ -62,6 +63,7 @@ class FixKeyLocation extends Command { ->addArgument('user', InputArgument::REQUIRED, 'User id to fix the key locations for'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $dryRun = $input->getOption('dry-run'); $userId = $input->getArgument('user'); diff --git a/apps/encryption/lib/Command/RecoverUser.php b/apps/encryption/lib/Command/RecoverUser.php index 8da962ac8b1..63fa4dfcd2b 100644 --- a/apps/encryption/lib/Command/RecoverUser.php +++ b/apps/encryption/lib/Command/RecoverUser.php @@ -26,6 +26,7 @@ class RecoverUser extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('encryption:recover-user') @@ -38,6 +39,7 @@ class RecoverUser extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $isMasterKeyEnabled = $this->util->isMasterKeyEnabled(); diff --git a/apps/encryption/lib/Command/ScanLegacyFormat.php b/apps/encryption/lib/Command/ScanLegacyFormat.php index 0a1946ecc89..36a3a0d4588 100644 --- a/apps/encryption/lib/Command/ScanLegacyFormat.php +++ b/apps/encryption/lib/Command/ScanLegacyFormat.php @@ -34,12 +34,14 @@ class ScanLegacyFormat extends Command { $this->rootView = new View(); } + #[\Override] protected function configure(): void { $this ->setName('encryption:scan:legacy-format') ->setDescription('Scan the files for the legacy format'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $result = true; diff --git a/apps/encryption/lib/Crypto/Encryption.php b/apps/encryption/lib/Crypto/Encryption.php index daeb9859b41..f28d31d6dd5 100644 --- a/apps/encryption/lib/Crypto/Encryption.php +++ b/apps/encryption/lib/Crypto/Encryption.php @@ -75,6 +75,7 @@ class Encryption implements IEncryptionModule { /** * @return string defining the technical unique id */ + #[\Override] public function getId() { return self::ID; } @@ -84,6 +85,7 @@ class Encryption implements IEncryptionModule { * * @return string */ + #[\Override] public function getDisplayName() { return self::DISPLAY_NAME; } @@ -103,6 +105,7 @@ class Encryption implements IEncryptionModule { * written to the header, in case of a write operation * or if no additional data is needed return a empty array */ + #[\Override] public function begin($path, $user, $mode, array $header, array $accessList) { $this->path = $this->getPathToRealFile($path); $this->accessList = $accessList; @@ -190,6 +193,7 @@ class Encryption implements IEncryptionModule { * @throws \Exception * @throws MultiKeyEncryptException */ + #[\Override] public function end($path, $position = '0') { $result = ''; if ($this->isWriteOperation) { @@ -248,6 +252,7 @@ class Encryption implements IEncryptionModule { * @param int $position * @return string encrypted data */ + #[\Override] public function encrypt($data, $position = 0) { // If extra data is left over from the last round, make sure it // is integrated into the next block @@ -306,6 +311,7 @@ class Encryption implements IEncryptionModule { * @return string decrypted data * @throws DecryptionFailedException */ + #[\Override] public function decrypt($data, $position = 0) { if (empty($this->fileKey)) { $msg = 'Cannot decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you.'; @@ -326,6 +332,7 @@ class Encryption implements IEncryptionModule { * @param array $accessList who has access to the file contains the key 'users' and 'public' * @return bool */ + #[\Override] public function update($path, $uid, array $accessList) { if (empty($accessList)) { if (isset(self::$rememberVersion[$path])) { @@ -376,6 +383,7 @@ class Encryption implements IEncryptionModule { * @param string $path * @return boolean */ + #[\Override] public function shouldEncrypt($path) { if ($this->util->shouldEncryptHomeStorage() === false) { $storage = $this->util->getStorage($path); @@ -420,6 +428,7 @@ class Encryption implements IEncryptionModule { * @param bool $signed * @return int */ + #[\Override] public function getUnencryptedBlockSize($signed = false) { if ($this->useLegacyBase64Encoding) { return $signed ? 6072 : 6126; @@ -437,6 +446,7 @@ class Encryption implements IEncryptionModule { * @return bool * @throws DecryptionFailedException */ + #[\Override] public function isReadable($path, $uid) { $fileKey = $this->keyManager->getFileKey($path, null); if (empty($fileKey)) { @@ -464,6 +474,7 @@ class Encryption implements IEncryptionModule { * @param InputInterface $input * @param OutputInterface $output write some status information to the terminal during encryption */ + #[\Override] public function encryptAll(InputInterface $input, OutputInterface $output) { $this->encryptAll->encryptAll($input, $output); } @@ -476,6 +487,7 @@ class Encryption implements IEncryptionModule { * @param string $user * @return bool */ + #[\Override] public function prepareDecryptAll(InputInterface $input, OutputInterface $output, $user = '') { return $this->decryptAll->prepare($input, $output, $user); } @@ -536,6 +548,7 @@ class Encryption implements IEncryptionModule { * @return boolean * @since 9.1.0 */ + #[\Override] public function isReadyForUser($user) { if ($this->util->isMasterKeyEnabled()) { return true; @@ -548,6 +561,7 @@ class Encryption implements IEncryptionModule { * * @return bool */ + #[\Override] public function needDetailedAccessList() { return !$this->util->isMasterKeyEnabled(); } diff --git a/apps/encryption/lib/Listeners/BeforeTemplateRenderedListener.php b/apps/encryption/lib/Listeners/BeforeTemplateRenderedListener.php index 008911bd6c6..75d11d1f83b 100644 --- a/apps/encryption/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/apps/encryption/lib/Listeners/BeforeTemplateRenderedListener.php @@ -18,6 +18,7 @@ use OCP\Util; /** @template-implements IEventListener */ class BeforeTemplateRenderedListener implements IEventListener { + #[\Override] public function handle(Event $event): void { if (!($event instanceof BeforeTemplateRenderedEvent)) { // Unrelated diff --git a/apps/encryption/lib/Listeners/UserEventsListener.php b/apps/encryption/lib/Listeners/UserEventsListener.php index 76fe31e63b6..5a0320e8228 100644 --- a/apps/encryption/lib/Listeners/UserEventsListener.php +++ b/apps/encryption/lib/Listeners/UserEventsListener.php @@ -44,6 +44,7 @@ class UserEventsListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof UserCreatedEvent) { $this->onUserCreated($event->getUid(), $event->getPassword()); diff --git a/apps/encryption/lib/Migration/SetMasterKeyStatus.php b/apps/encryption/lib/Migration/SetMasterKeyStatus.php index 5f98308de89..e3b90e9ff90 100644 --- a/apps/encryption/lib/Migration/SetMasterKeyStatus.php +++ b/apps/encryption/lib/Migration/SetMasterKeyStatus.php @@ -29,6 +29,7 @@ class SetMasterKeyStatus implements IRepairStep { * @return string * @since 9.1.0 */ + #[\Override] public function getName() { return 'Write default encryption module configuration to the database'; } @@ -36,6 +37,7 @@ class SetMasterKeyStatus implements IRepairStep { /** * @param IOutput $output */ + #[\Override] public function run(IOutput $output) { if (!$this->shouldRun()) { return; diff --git a/apps/encryption/lib/Settings/Admin.php b/apps/encryption/lib/Settings/Admin.php index 6b6c54c999b..422d338d45e 100644 --- a/apps/encryption/lib/Settings/Admin.php +++ b/apps/encryption/lib/Settings/Admin.php @@ -40,6 +40,7 @@ class Admin implements ISettings { /** * @return TemplateResponse */ + #[\Override] public function getForm() { $crypt = new Crypt( $this->logger, @@ -75,6 +76,7 @@ class Admin implements ISettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection() { return 'security'; } @@ -86,6 +88,7 @@ class Admin implements ISettings { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 11; } diff --git a/apps/encryption/lib/Settings/Personal.php b/apps/encryption/lib/Settings/Personal.php index cac6ff249eb..f047850bd33 100644 --- a/apps/encryption/lib/Settings/Personal.php +++ b/apps/encryption/lib/Settings/Personal.php @@ -32,6 +32,7 @@ class Personal implements ISettings { * @return TemplateResponse returns the instance with all parameters set, ready to be rendered * @since 9.1 */ + #[\Override] public function getForm() { $recoveryAdminEnabled = $this->appConfig->getValueBool('encryption', 'recoveryAdminEnabled'); $privateKeySet = $this->session->isPrivateKeySet(); @@ -55,6 +56,7 @@ class Personal implements ISettings { return new TemplateResponse(Application::APP_ID, 'settings', renderAs: ''); } + #[\Override] public function getSection() { if (!$this->manager->isEnabled()) { return null; @@ -71,6 +73,7 @@ class Personal implements ISettings { * E.g.: 70 * @since 9.1 */ + #[\Override] public function getPriority() { return 80; } diff --git a/apps/federatedfilesharing/lib/AppInfo/Application.php b/apps/federatedfilesharing/lib/AppInfo/Application.php index ca22ce2cbc6..a46644a2485 100644 --- a/apps/federatedfilesharing/lib/AppInfo/Application.php +++ b/apps/federatedfilesharing/lib/AppInfo/Application.php @@ -27,11 +27,13 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class); $context->registerNotifierService(Notifier::class); } + #[\Override] public function boot(IBootContext $context): void { $context->injectFn(Closure::fromCallable([$this, 'registerCloudFederationProvider'])); } diff --git a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php index 9d66cd71812..25a2f0e5ce1 100644 --- a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php +++ b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php @@ -39,6 +39,7 @@ class RetryJob extends Job { /** * Run the job, then remove it from the jobList */ + #[\Override] public function start(IJobList $jobList): void { if ($this->shouldRun($this->argument)) { parent::start($jobList); @@ -49,6 +50,7 @@ class RetryJob extends Job { } } + #[\Override] protected function run($argument) { $remote = $argument['remote']; $remoteId = $argument['remoteId']; diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 1302f2ca980..9ac9018233c 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -288,6 +288,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl /** * Update a share. */ + #[\Override] public function update(IShare $share): IShare { /* * We allow updating the permissions of federated shares @@ -391,6 +392,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl /** * @inheritdoc */ + #[\Override] public function move(IShare $share, $recipient) { /* * This function does nothing yet as it is just for outgoing @@ -399,6 +401,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl return $share; } + #[\Override] public function getChildren(IShare $parent): array { $children = []; @@ -425,6 +428,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl * @throws ShareNotFound * @throws HintException */ + #[\Override] public function delete(IShare $share) { [, $remote] = $this->addressHandler->splitUserRemote($share->getSharedWith()); @@ -484,6 +488,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl /** * @inheritdoc */ + #[\Override] public function deleteFromSelf(IShare $share, $recipient) { // nothing to do here. Technically deleteFromSelf in the context of federated // shares is a umount of an external storage. This is handled here @@ -491,11 +496,13 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl // TODO move this code over to this app } + #[\Override] public function restore(IShare $share, string $recipient): IShare { throw new GenericShareException('not implemented'); } + #[\Override] public function getSharesInFolder($userId, Folder $node, $reshares, $shallow = true) { if (!$shallow) { throw new \Exception('non-shallow getSharesInFolder is no longer supported'); @@ -503,6 +510,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl return $this->getSharesInFolderInternal($userId, $node, $reshares); } + #[\Override] public function getAllSharesInFolder(Folder $node): array { return $this->getSharesInFolderInternal(null, $node, null); } @@ -554,6 +562,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl /** * @inheritdoc */ + #[\Override] public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset) { $qb = $this->dbConnection->getQueryBuilder(); $qb->select('*') @@ -610,6 +619,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl /** * @inheritdoc */ + #[\Override] public function getShareById($id, $recipientId = null) { $qb = $this->dbConnection->getQueryBuilder(); @@ -641,6 +651,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl * @param Node $path * @return IShare[] */ + #[\Override] public function getSharesByPath(Node $path) { $qb = $this->dbConnection->getQueryBuilder(); @@ -663,6 +674,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl /** * @inheritdoc */ + #[\Override] public function getSharedWith($userId, $shareType, $node, $limit, $offset) { /** @var IShare[] $shares */ $shares = []; @@ -829,6 +841,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl * @param string $uid * @param int $shareType */ + #[\Override] public function userDeleted($uid, $shareType) { //TODO: probably a good idea to send unshare info to remote servers @@ -845,6 +858,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl ->executeStatement(); } + #[\Override] public function groupDeleted($gid) { $qb = $this->dbConnection->getQueryBuilder(); $qb->select('id') @@ -867,6 +881,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl ->executeStatement(); } + #[\Override] public function userDeletedFromGroup($uid, $gid) { $qb = $this->dbConnection->getQueryBuilder(); $qb->select('id') @@ -978,6 +993,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl return $result === 'yes'; } + #[\Override] public function getAccessList($nodes, $currentAccess) { $ids = []; foreach ($nodes as $node) { @@ -1011,6 +1027,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl return ['remote' => $remote]; } + #[\Override] public function getAllShares(): iterable { $qb = $this->dbConnection->getQueryBuilder(); diff --git a/apps/federatedfilesharing/lib/Listeners/LoadAdditionalScriptsListener.php b/apps/federatedfilesharing/lib/Listeners/LoadAdditionalScriptsListener.php index b8a4a7d03e7..b936f462e88 100644 --- a/apps/federatedfilesharing/lib/Listeners/LoadAdditionalScriptsListener.php +++ b/apps/federatedfilesharing/lib/Listeners/LoadAdditionalScriptsListener.php @@ -29,6 +29,7 @@ class LoadAdditionalScriptsListener implements IEventListener { $this->appManager = $appManager; } + #[\Override] public function handle(Event $event): void { if (!$event instanceof LoadAdditionalScriptsEvent) { return; diff --git a/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php b/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php index 27197ab67f6..be002fe7952 100644 --- a/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php +++ b/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php @@ -21,6 +21,7 @@ class Version1010Date20200630191755 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php b/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php index 30c3e4f584b..133b2a1da80 100644 --- a/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php +++ b/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php @@ -23,6 +23,7 @@ class Version1011Date20201120125158 extends SimpleMigrationStep { ) { } + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -42,6 +43,7 @@ class Version1011Date20201120125158 extends SimpleMigrationStep { return null; } + #[\Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { $qb = $this->connection->getQueryBuilder(); $qb->update('federated_reshares') diff --git a/apps/federatedfilesharing/lib/Notifier.php b/apps/federatedfilesharing/lib/Notifier.php index 10b57c578a2..7bf90e33650 100644 --- a/apps/federatedfilesharing/lib/Notifier.php +++ b/apps/federatedfilesharing/lib/Notifier.php @@ -41,6 +41,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getID(): string { return 'federatedfilesharing'; } @@ -51,6 +52,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getName(): string { return $this->factory->get('federatedfilesharing')->t('Federated sharing'); } @@ -61,6 +63,7 @@ class Notifier implements INotifier { * @return INotification * @throws UnknownNotificationException */ + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'files_sharing' || $notification->getObjectType() !== 'remote_share') { // Not my app => throw diff --git a/apps/federatedfilesharing/lib/Settings/Admin.php b/apps/federatedfilesharing/lib/Settings/Admin.php index 20b7ca62ad0..79c17467873 100644 --- a/apps/federatedfilesharing/lib/Settings/Admin.php +++ b/apps/federatedfilesharing/lib/Settings/Admin.php @@ -32,6 +32,7 @@ class Admin implements IDelegatedSettings { /** * @return TemplateResponse */ + #[\Override] public function getForm() { $this->initialState->provideInitialState('internalOnly', $this->gsConfig->onlyInternalFederation()); @@ -53,6 +54,7 @@ class Admin implements IDelegatedSettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection() { return 'sharing'; } @@ -64,14 +66,17 @@ class Admin implements IDelegatedSettings { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 20; } + #[\Override] public function getName(): ?string { return $this->l->t('Federated Cloud Sharing'); } + #[\Override] public function getAuthorizedAppConfig(): array { return [ 'files_sharing' => [ diff --git a/apps/federatedfilesharing/lib/Settings/Personal.php b/apps/federatedfilesharing/lib/Settings/Personal.php index 01239fbe140..07895cfbba3 100644 --- a/apps/federatedfilesharing/lib/Settings/Personal.php +++ b/apps/federatedfilesharing/lib/Settings/Personal.php @@ -32,6 +32,7 @@ class Personal implements ISettings { * @return TemplateResponse returns the instance with all parameters set, ready to be rendered * @since 9.1 */ + #[\Override] public function getForm(): TemplateResponse { $cloudID = $this->userSession->getUser()->getCloudId(); $url = 'https://nextcloud.com/sharing#' . $cloudID; @@ -52,6 +53,7 @@ class Personal implements ISettings { * @return string the section ID, e.g. 'sharing' * @since 9.1 */ + #[\Override] public function getSection(): ?string { if ($this->federatedShareProvider->isIncomingServer2serverShareEnabled() || $this->federatedShareProvider->isIncomingServer2serverGroupShareEnabled()) { @@ -68,6 +70,7 @@ class Personal implements ISettings { * E.g.: 70 * @since 9.1 */ + #[\Override] public function getPriority(): int { return 40; } diff --git a/apps/federatedfilesharing/lib/Settings/PersonalSection.php b/apps/federatedfilesharing/lib/Settings/PersonalSection.php index c56795308cb..b5170e6d8e4 100644 --- a/apps/federatedfilesharing/lib/Settings/PersonalSection.php +++ b/apps/federatedfilesharing/lib/Settings/PersonalSection.php @@ -26,6 +26,7 @@ class PersonalSection implements IIconSection { * @returns string * @since 13.0.0 */ + #[\Override] public function getIcon() { return $this->urlGenerator->imagePath('core', 'actions/share.svg'); } @@ -37,6 +38,7 @@ class PersonalSection implements IIconSection { * @returns string * @since 9.1 */ + #[\Override] public function getID() { return 'sharing'; } @@ -48,6 +50,7 @@ class PersonalSection implements IIconSection { * @return string * @since 9.1 */ + #[\Override] public function getName() { return $this->l->t('Sharing'); } @@ -60,6 +63,7 @@ class PersonalSection implements IIconSection { * E.g.: 70 * @since 9.1 */ + #[\Override] public function getPriority() { return 15; } diff --git a/apps/federation/lib/AppInfo/Application.php b/apps/federation/lib/AppInfo/Application.php index 737db41bfa1..375cfcdd55d 100644 --- a/apps/federation/lib/AppInfo/Application.php +++ b/apps/federation/lib/AppInfo/Application.php @@ -27,11 +27,13 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID, $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerEventListener(SabrePluginAuthInitEvent::class, SabrePluginAuthInitListener::class); $context->registerEventListener(TrustedServerRemovedEvent::class, TrustedServerRemovedListener::class); } + #[\Override] public function boot(IBootContext $context): void { } } diff --git a/apps/federation/lib/BackgroundJob/GetSharedSecret.php b/apps/federation/lib/BackgroundJob/GetSharedSecret.php index dc57db9fd62..fdfa24fb566 100644 --- a/apps/federation/lib/BackgroundJob/GetSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/GetSharedSecret.php @@ -53,6 +53,7 @@ class GetSharedSecret extends Job { /** * Run the job, then remove it from the joblist */ + #[\Override] public function start(IJobList $jobList): void { $target = $this->argument['url']; // only execute if target is still in the list of trusted domains @@ -71,6 +72,7 @@ class GetSharedSecret extends Job { parent::start($jobList); } + #[\Override] protected function run($argument) { $target = $argument['url']; $created = isset($argument['created']) ? (int)$argument['created'] : $this->time->getTime(); diff --git a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php index 4d57d1f6aef..3818f9e1462 100644 --- a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php @@ -58,6 +58,7 @@ class RequestSharedSecret extends Job { /** * run the job, then remove it from the joblist */ + #[\Override] public function start(IJobList $jobList): void { $target = $this->argument['url']; // only execute if target is still in the list of trusted domains @@ -84,6 +85,7 @@ class RequestSharedSecret extends Job { * @param array $argument * @return void */ + #[\Override] protected function run($argument) { $target = $argument['url']; $created = isset($argument['created']) ? (int)$argument['created'] : $this->time->getTime(); diff --git a/apps/federation/lib/Command/SyncFederationAddressBooks.php b/apps/federation/lib/Command/SyncFederationAddressBooks.php index 72d6a9099ee..f50147274a9 100644 --- a/apps/federation/lib/Command/SyncFederationAddressBooks.php +++ b/apps/federation/lib/Command/SyncFederationAddressBooks.php @@ -23,6 +23,7 @@ class SyncFederationAddressBooks extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('federation:sync-addressbooks') @@ -30,6 +31,7 @@ class SyncFederationAddressBooks extends Command { ->addOption('full', null, InputOption::VALUE_NONE, 'Perform a full sync instead of a delta sync'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $progress = new ProgressBar($output); $progress->start(); diff --git a/apps/federation/lib/Command/SyncFederationCalendars.php b/apps/federation/lib/Command/SyncFederationCalendars.php index b7961778f41..bf65d914640 100644 --- a/apps/federation/lib/Command/SyncFederationCalendars.php +++ b/apps/federation/lib/Command/SyncFederationCalendars.php @@ -22,12 +22,14 @@ class SyncFederationCalendars extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('federation:sync-calendars') ->setDescription('Synchronize all incoming federated calendar shares'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $calendarCount = $this->federatedCalendarMapper->countAll(); if ($calendarCount === 0) { diff --git a/apps/federation/lib/DAV/FedAuth.php b/apps/federation/lib/DAV/FedAuth.php index 45bf422c104..76af6e3e187 100644 --- a/apps/federation/lib/DAV/FedAuth.php +++ b/apps/federation/lib/DAV/FedAuth.php @@ -40,6 +40,7 @@ class FedAuth extends AbstractBasic { * @param string $password * @return bool */ + #[\Override] protected function validateUserPass($username, $password) { return $this->db->auth($username, $password); } @@ -47,6 +48,7 @@ class FedAuth extends AbstractBasic { /** * @inheritdoc */ + #[\Override] public function challenge(RequestInterface $request, ResponseInterface $response) { } } diff --git a/apps/federation/lib/Listener/SabrePluginAuthInitListener.php b/apps/federation/lib/Listener/SabrePluginAuthInitListener.php index 514a893fb39..efc6d4b2e42 100644 --- a/apps/federation/lib/Listener/SabrePluginAuthInitListener.php +++ b/apps/federation/lib/Listener/SabrePluginAuthInitListener.php @@ -24,6 +24,7 @@ class SabrePluginAuthInitListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof SabrePluginAuthInitEvent)) { return; diff --git a/apps/federation/lib/Listener/TrustedServerRemovedListener.php b/apps/federation/lib/Listener/TrustedServerRemovedListener.php index ba5239d6424..2f03ece97b7 100644 --- a/apps/federation/lib/Listener/TrustedServerRemovedListener.php +++ b/apps/federation/lib/Listener/TrustedServerRemovedListener.php @@ -23,6 +23,7 @@ class TrustedServerRemovedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof TrustedServerRemovedEvent) { return; diff --git a/apps/federation/lib/Migration/Version1010Date20200630191302.php b/apps/federation/lib/Migration/Version1010Date20200630191302.php index c1a7c38cfc7..27a0efd0cfb 100644 --- a/apps/federation/lib/Migration/Version1010Date20200630191302.php +++ b/apps/federation/lib/Migration/Version1010Date20200630191302.php @@ -22,6 +22,7 @@ class Version1010Date20200630191302 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/federation/lib/Settings/Admin.php b/apps/federation/lib/Settings/Admin.php index 202cb51a645..449db1f07c0 100644 --- a/apps/federation/lib/Settings/Admin.php +++ b/apps/federation/lib/Settings/Admin.php @@ -29,6 +29,7 @@ class Admin implements IDelegatedSettings { /** * @return TemplateResponse */ + #[\Override] public function getForm() { $parameters = [ 'trustedServers' => $this->trustedServers->getServers(), @@ -45,6 +46,7 @@ class Admin implements IDelegatedSettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection() { return 'sharing'; } @@ -56,14 +58,17 @@ class Admin implements IDelegatedSettings { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 30; } + #[\Override] public function getName(): ?string { return $this->l->t('Trusted servers'); } + #[\Override] public function getAuthorizedAppConfig(): array { return []; // Handled by custom controller } diff --git a/apps/federation/lib/SyncJob.php b/apps/federation/lib/SyncJob.php index 1e09ca2b054..c73e9ea2b3e 100644 --- a/apps/federation/lib/SyncJob.php +++ b/apps/federation/lib/SyncJob.php @@ -25,6 +25,7 @@ class SyncJob extends TimedJob { $this->setTimeSensitivity(self::TIME_INSENSITIVE); } + #[\Override] protected function run($argument) { $this->syncService->syncThemAll(function ($url, $ex): void { if ($ex instanceof \Exception) { diff --git a/apps/files/lib/Activity/FavoriteProvider.php b/apps/files/lib/Activity/FavoriteProvider.php index e56b13b902a..a2529b17874 100644 --- a/apps/files/lib/Activity/FavoriteProvider.php +++ b/apps/files/lib/Activity/FavoriteProvider.php @@ -44,6 +44,7 @@ class FavoriteProvider implements IProvider { * @throws UnknownActivityException * @since 11.0.0 */ + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'files' || $event->getType() !== 'favorite') { throw new UnknownActivityException(); diff --git a/apps/files/lib/Activity/Filter/Favorites.php b/apps/files/lib/Activity/Filter/Favorites.php index 0159dd20b82..5aed2dd22e7 100644 --- a/apps/files/lib/Activity/Filter/Favorites.php +++ b/apps/files/lib/Activity/Filter/Favorites.php @@ -36,6 +36,7 @@ class Favorites implements IFilter { * @return string Lowercase a-z only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'files_favorites'; } @@ -44,6 +45,7 @@ class Favorites implements IFilter { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('Favorites'); } @@ -52,6 +54,7 @@ class Favorites implements IFilter { * @return int * @since 11.0.0 */ + #[\Override] public function getPriority() { return 10; } @@ -60,6 +63,7 @@ class Favorites implements IFilter { * @return string Full URL to an icon, empty string when none is given * @since 11.0.0 */ + #[\Override] public function getIcon() { return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star-dark.svg')); } @@ -69,6 +73,7 @@ class Favorites implements IFilter { * @return string[] An array of allowed apps from which activities should be displayed * @since 11.0.0 */ + #[\Override] public function filterTypes(array $types) { return array_intersect([ 'file_created', @@ -82,6 +87,7 @@ class Favorites implements IFilter { * @return string[] An array of allowed apps from which activities should be displayed * @since 11.0.0 */ + #[\Override] public function allowedApps() { return ['files']; } diff --git a/apps/files/lib/Activity/Filter/FileChanges.php b/apps/files/lib/Activity/Filter/FileChanges.php index b625f5461fe..fa726bf414d 100644 --- a/apps/files/lib/Activity/Filter/FileChanges.php +++ b/apps/files/lib/Activity/Filter/FileChanges.php @@ -28,6 +28,7 @@ class FileChanges implements IFilter { * @return string Lowercase a-z only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'files'; } @@ -36,6 +37,7 @@ class FileChanges implements IFilter { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('File changes'); } @@ -44,6 +46,7 @@ class FileChanges implements IFilter { * @return int * @since 11.0.0 */ + #[\Override] public function getPriority() { return 30; } @@ -52,6 +55,7 @@ class FileChanges implements IFilter { * @return string Full URL to an icon, empty string when none is given * @since 11.0.0 */ + #[\Override] public function getIcon() { return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/files.svg')); } @@ -61,6 +65,7 @@ class FileChanges implements IFilter { * @return string[] An array of allowed apps from which activities should be displayed * @since 11.0.0 */ + #[\Override] public function filterTypes(array $types) { return array_intersect([ 'file_created', @@ -74,6 +79,7 @@ class FileChanges implements IFilter { * @return string[] An array of allowed apps from which activities should be displayed * @since 11.0.0 */ + #[\Override] public function allowedApps() { return ['files']; } diff --git a/apps/files/lib/Activity/Provider.php b/apps/files/lib/Activity/Provider.php index d50ebd57ff5..7344cf2b06c 100644 --- a/apps/files/lib/Activity/Provider.php +++ b/apps/files/lib/Activity/Provider.php @@ -52,6 +52,7 @@ class Provider implements IProvider { * @throws UnknownActivityException * @since 11.0.0 */ + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'files') { throw new UnknownActivityException(); diff --git a/apps/files/lib/Activity/Settings/FavoriteAction.php b/apps/files/lib/Activity/Settings/FavoriteAction.php index 0da3232c4fb..6dd6b62cb9c 100644 --- a/apps/files/lib/Activity/Settings/FavoriteAction.php +++ b/apps/files/lib/Activity/Settings/FavoriteAction.php @@ -13,6 +13,7 @@ class FavoriteAction extends FileActivitySettings { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'favorite'; } @@ -21,6 +22,7 @@ class FavoriteAction extends FileActivitySettings { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('A file has been added to or removed from your favorites'); } @@ -31,6 +33,7 @@ class FavoriteAction extends FileActivitySettings { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 5; } @@ -39,6 +42,7 @@ class FavoriteAction extends FileActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function canChangeStream() { return false; } @@ -47,6 +51,7 @@ class FavoriteAction extends FileActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledStream() { return true; } @@ -55,6 +60,7 @@ class FavoriteAction extends FileActivitySettings { * @return bool True when the option can be changed for the mail * @since 11.0.0 */ + #[\Override] public function canChangeMail() { return false; } @@ -63,6 +69,7 @@ class FavoriteAction extends FileActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledMail() { return false; } @@ -71,6 +78,7 @@ class FavoriteAction extends FileActivitySettings { * @return bool True when the option can be changed for the notification * @since 20.0.0 */ + #[\Override] public function canChangeNotification() { return false; } diff --git a/apps/files/lib/Activity/Settings/FileActivitySettings.php b/apps/files/lib/Activity/Settings/FileActivitySettings.php index 0ca7100832f..a7d0db4bddf 100644 --- a/apps/files/lib/Activity/Settings/FileActivitySettings.php +++ b/apps/files/lib/Activity/Settings/FileActivitySettings.php @@ -20,10 +20,12 @@ abstract class FileActivitySettings extends ActivitySettings { ) { } + #[\Override] public function getGroupIdentifier() { return 'files'; } + #[\Override] public function getGroupName() { return $this->l->t('Files'); } diff --git a/apps/files/lib/Activity/Settings/FileChanged.php b/apps/files/lib/Activity/Settings/FileChanged.php index f5f98dd30d3..72b46798ebb 100644 --- a/apps/files/lib/Activity/Settings/FileChanged.php +++ b/apps/files/lib/Activity/Settings/FileChanged.php @@ -13,6 +13,7 @@ class FileChanged extends FileActivitySettings { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'file_changed'; } @@ -21,6 +22,7 @@ class FileChanged extends FileActivitySettings { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('A file or folder has been changed'); } @@ -31,22 +33,27 @@ class FileChanged extends FileActivitySettings { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 2; } + #[\Override] public function canChangeMail() { return true; } + #[\Override] public function isDefaultEnabledMail() { return false; } + #[\Override] public function canChangeNotification() { return true; } + #[\Override] public function isDefaultEnabledNotification() { return false; } diff --git a/apps/files/lib/Activity/Settings/FileFavoriteChanged.php b/apps/files/lib/Activity/Settings/FileFavoriteChanged.php index 52e0fcaeb76..a743cb5ac67 100644 --- a/apps/files/lib/Activity/Settings/FileFavoriteChanged.php +++ b/apps/files/lib/Activity/Settings/FileFavoriteChanged.php @@ -13,6 +13,7 @@ class FileFavoriteChanged extends FileActivitySettings { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'file_favorite_changed'; } @@ -21,6 +22,7 @@ class FileFavoriteChanged extends FileActivitySettings { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('A favorite file or folder has been changed'); } @@ -31,6 +33,7 @@ class FileFavoriteChanged extends FileActivitySettings { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 1; } @@ -39,6 +42,7 @@ class FileFavoriteChanged extends FileActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function canChangeStream() { return true; } @@ -47,6 +51,7 @@ class FileFavoriteChanged extends FileActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledStream() { return true; } @@ -55,10 +60,12 @@ class FileFavoriteChanged extends FileActivitySettings { * @return bool True when the option can be changed for the mail * @since 11.0.0 */ + #[\Override] public function canChangeMail() { return false; } + #[\Override] public function canChangeNotification() { return false; } @@ -67,10 +74,12 @@ class FileFavoriteChanged extends FileActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledMail() { return false; } + #[\Override] public function isDefaultEnabledNotification() { return false; } diff --git a/apps/files/lib/AdvancedCapabilities.php b/apps/files/lib/AdvancedCapabilities.php index 22f990f0cf8..7ecc1d89cb6 100644 --- a/apps/files/lib/AdvancedCapabilities.php +++ b/apps/files/lib/AdvancedCapabilities.php @@ -28,6 +28,7 @@ class AdvancedCapabilities implements ICapability, IInitialStateExcludedCapabili * * @return array{files: array{'windows_compatible_filenames': bool}} */ + #[\Override] public function getCapabilities(): array { return [ 'files' => [ diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php index 34883bb5be3..46835945d68 100644 --- a/apps/files/lib/AppInfo/Application.php +++ b/apps/files/lib/AppInfo/Application.php @@ -64,6 +64,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID, $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { /** * Controllers @@ -130,6 +131,7 @@ class Application extends App implements IBootstrap { } + #[\Override] public function boot(IBootContext $context): void { $context->injectFn(Closure::fromCallable([$this, 'registerCollaboration'])); $context->injectFn([Listener::class, 'register']); diff --git a/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php b/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php index a1032b2787d..193c4051c92 100644 --- a/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php +++ b/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php @@ -27,6 +27,7 @@ class CleanupDirectEditingTokens extends TimedJob { * @param array $argument unused argument * @throws \Exception */ + #[\Override] public function run($argument) { $this->manager->cleanup(); } diff --git a/apps/files/lib/BackgroundJob/CleanupFileLocks.php b/apps/files/lib/BackgroundJob/CleanupFileLocks.php index 91bb145884b..81ed3a0c1fd 100644 --- a/apps/files/lib/BackgroundJob/CleanupFileLocks.php +++ b/apps/files/lib/BackgroundJob/CleanupFileLocks.php @@ -31,6 +31,7 @@ class CleanupFileLocks extends TimedJob { * @param array $argument unused argument * @throws \Exception */ + #[\Override] public function run($argument) { $lockingProvider = Server::get(ILockingProvider::class); if ($lockingProvider instanceof DBLockingProvider) { diff --git a/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php b/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php index 8a20b6dfb0c..bd98452675e 100644 --- a/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php +++ b/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php @@ -33,6 +33,7 @@ class DeleteExpiredOpenLocalEditor extends TimedJob { * * @param array $argument unused argument */ + #[\Override] public function run($argument): void { $this->mapper->deleteExpiredTokens($this->time->getTime()); } diff --git a/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php b/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php index b4e38224812..55a3dfe80f4 100644 --- a/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php +++ b/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php @@ -36,6 +36,7 @@ class DeleteOrphanedItems extends TimedJob { * * @param array $argument unused argument */ + #[\Override] public function run($argument) { $this->cleanSystemTags(); $this->cleanUserTags(); diff --git a/apps/files/lib/BackgroundJob/SanitizeFilenames.php b/apps/files/lib/BackgroundJob/SanitizeFilenames.php index 429fe0ab509..a0c54687bf0 100644 --- a/apps/files/lib/BackgroundJob/SanitizeFilenames.php +++ b/apps/files/lib/BackgroundJob/SanitizeFilenames.php @@ -56,6 +56,7 @@ class SanitizeFilenames extends QueuedJob { * @param array $argument unused argument * @throws \Exception */ + #[\Override] public function run($argument) { $this->charReplacement = strval($argument['charReplacement']) ?: null; if (isset($argument['errorsOnly'])) { diff --git a/apps/files/lib/BackgroundJob/ScanFiles.php b/apps/files/lib/BackgroundJob/ScanFiles.php index da178f4c369..445de92a4fb 100644 --- a/apps/files/lib/BackgroundJob/ScanFiles.php +++ b/apps/files/lib/BackgroundJob/ScanFiles.php @@ -126,6 +126,7 @@ class ScanFiles extends TimedJob { * @param $argument * @throws \Exception */ + #[\Override] protected function run($argument) { if ($this->config->getSystemValueBool('files_no_background_scan', false)) { return; diff --git a/apps/files/lib/BackgroundJob/TransferOwnership.php b/apps/files/lib/BackgroundJob/TransferOwnership.php index de8d1989733..8b7bd7e553f 100644 --- a/apps/files/lib/BackgroundJob/TransferOwnership.php +++ b/apps/files/lib/BackgroundJob/TransferOwnership.php @@ -35,6 +35,7 @@ class TransferOwnership extends QueuedJob { parent::__construct($timeFactory); } + #[\Override] protected function run($argument) { $id = $argument['id']; diff --git a/apps/files/lib/Capabilities.php b/apps/files/lib/Capabilities.php index 43eb270922f..04c60de0ff8 100644 --- a/apps/files/lib/Capabilities.php +++ b/apps/files/lib/Capabilities.php @@ -28,6 +28,7 @@ class Capabilities implements ICapability { * * @return array{files: array{'$comment': ?string, bigfilechunking: bool, blacklisted_files: list, forbidden_filenames: list, forbidden_filename_basenames: list, forbidden_filename_characters: list, forbidden_filename_extensions: list, chunked_upload: array{max_size: int, max_parallel_count: int}, file_conversions: list}} */ + #[\Override] public function getCapabilities(): array { return [ 'files' => [ diff --git a/apps/files/lib/Collaboration/Resources/ResourceProvider.php b/apps/files/lib/Collaboration/Resources/ResourceProvider.php index 9723ccac53e..38c6aebbbb2 100644 --- a/apps/files/lib/Collaboration/Resources/ResourceProvider.php +++ b/apps/files/lib/Collaboration/Resources/ResourceProvider.php @@ -47,6 +47,7 @@ class ResourceProvider implements IProvider { * @return array * @since 16.0.0 */ + #[\Override] public function getResourceRichObject(IResource $resource): array { if (isset($this->nodes[(int)$resource->getId()])) { $node = $this->nodes[(int)$resource->getId()]->getPath(); @@ -81,6 +82,7 @@ class ResourceProvider implements IProvider { * @return bool * @since 16.0.0 */ + #[\Override] public function canAccessResource(IResource $resource, ?IUser $user = null): bool { if (!$user instanceof IUser) { return false; @@ -103,6 +105,7 @@ class ResourceProvider implements IProvider { * @return string * @since 16.0.0 */ + #[\Override] public function getType(): string { return self::RESOURCE_TYPE; } diff --git a/apps/files/lib/Command/Copy.php b/apps/files/lib/Command/Copy.php index ad0dfa90de1..1d905e73e98 100644 --- a/apps/files/lib/Command/Copy.php +++ b/apps/files/lib/Command/Copy.php @@ -25,6 +25,7 @@ class Copy extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files:copy') @@ -35,6 +36,7 @@ class Copy extends Command { ->addOption('no-target-directory', 'T', InputOption::VALUE_NONE, 'When target path is folder, overwrite the folder instead of copying into the folder'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $sourceInput = $input->getArgument('source'); $targetInput = $input->getArgument('target'); diff --git a/apps/files/lib/Command/Delete.php b/apps/files/lib/Command/Delete.php index d984f839c91..0558a6778b7 100644 --- a/apps/files/lib/Command/Delete.php +++ b/apps/files/lib/Command/Delete.php @@ -26,6 +26,7 @@ class Delete extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files:delete') @@ -34,6 +35,7 @@ class Delete extends Command { ->addOption('force', 'f', InputOption::VALUE_NONE, "Don't ask for configuration and don't output any warnings"); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $fileInput = $input->getArgument('file'); $inputIsId = is_numeric($fileInput); diff --git a/apps/files/lib/Command/DeleteOrphanedFiles.php b/apps/files/lib/Command/DeleteOrphanedFiles.php index 8f2ccbe0551..7d8012ea157 100644 --- a/apps/files/lib/Command/DeleteOrphanedFiles.php +++ b/apps/files/lib/Command/DeleteOrphanedFiles.php @@ -26,6 +26,7 @@ class DeleteOrphanedFiles extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files:cleanup') @@ -34,6 +35,7 @@ class DeleteOrphanedFiles extends Command { ->addOption('skip-filecache-extended', null, InputOption::VALUE_NONE, 'don\'t remove orphaned entries from filecache_extended'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $fileIdsByStorage = []; diff --git a/apps/files/lib/Command/Get.php b/apps/files/lib/Command/Get.php index 60e028f615e..81b9c308385 100644 --- a/apps/files/lib/Command/Get.php +++ b/apps/files/lib/Command/Get.php @@ -22,6 +22,7 @@ class Get extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files:get') @@ -30,6 +31,7 @@ class Get extends Command { ->addArgument('output', InputArgument::OPTIONAL, 'Target local file to output to, defaults to STDOUT'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $fileInput = $input->getArgument('file'); $outputName = $input->getArgument('output'); diff --git a/apps/files/lib/Command/Mount/ListMounts.php b/apps/files/lib/Command/Mount/ListMounts.php index 487e769ad2c..ae72d236c97 100644 --- a/apps/files/lib/Command/Mount/ListMounts.php +++ b/apps/files/lib/Command/Mount/ListMounts.php @@ -28,6 +28,7 @@ class ListMounts extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -37,6 +38,7 @@ class ListMounts extends Base { ->addOption('cached-only', null, InputOption::VALUE_NONE, 'Only return cached mounts, prevents filesystem setup'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $userId = $input->getArgument('user'); $cachedOnly = $input->getOption('cached-only'); diff --git a/apps/files/lib/Command/Mount/Refresh.php b/apps/files/lib/Command/Mount/Refresh.php index d78433cd28f..3995345041a 100644 --- a/apps/files/lib/Command/Mount/Refresh.php +++ b/apps/files/lib/Command/Mount/Refresh.php @@ -25,6 +25,7 @@ class Refresh extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files:mount:refresh') @@ -32,6 +33,7 @@ class Refresh extends Command { ->addArgument('user', InputArgument::REQUIRED, 'User to refresh mounts for'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $userId = $input->getArgument('user'); $user = $this->userManager->get($userId); diff --git a/apps/files/lib/Command/Move.php b/apps/files/lib/Command/Move.php index 29dd8860b2a..ab4b9f86bfa 100644 --- a/apps/files/lib/Command/Move.php +++ b/apps/files/lib/Command/Move.php @@ -26,6 +26,7 @@ class Move extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files:move') @@ -35,6 +36,7 @@ class Move extends Command { ->addOption('force', 'f', InputOption::VALUE_NONE, "Don't ask for configuration and don't output any warnings"); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $sourceInput = $input->getArgument('source'); $targetInput = $input->getArgument('target'); diff --git a/apps/files/lib/Command/Object/Delete.php b/apps/files/lib/Command/Object/Delete.php index 07613ecc616..575bf5df069 100644 --- a/apps/files/lib/Command/Object/Delete.php +++ b/apps/files/lib/Command/Object/Delete.php @@ -23,6 +23,7 @@ class Delete extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files:object:delete') @@ -31,6 +32,7 @@ class Delete extends Command { ->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket to delete the object from, only required in cases where it can't be determined from the config"); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $object = $input->getArgument('object'); $objectStore = $this->objectUtils->getObjectStore($input->getOption('bucket'), $output); diff --git a/apps/files/lib/Command/Object/Get.php b/apps/files/lib/Command/Object/Get.php index c32de020c5a..dc88ff6a94d 100644 --- a/apps/files/lib/Command/Object/Get.php +++ b/apps/files/lib/Command/Object/Get.php @@ -21,6 +21,7 @@ class Get extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files:object:get') @@ -30,6 +31,7 @@ class Get extends Command { ->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket to get the object from, only required in cases where it can't be determined from the config"); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $object = $input->getArgument('object'); $outputName = $input->getArgument('output'); diff --git a/apps/files/lib/Command/Object/Info.php b/apps/files/lib/Command/Object/Info.php index 6748de37cfe..14b2ac1aed9 100644 --- a/apps/files/lib/Command/Object/Info.php +++ b/apps/files/lib/Command/Object/Info.php @@ -25,6 +25,7 @@ class Info extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -34,6 +35,7 @@ class Info extends Base { ->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket to get the object from, only required in cases where it can't be determined from the config"); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $object = $input->getArgument('object'); $objectStore = $this->objectUtils->getObjectStore($input->getOption('bucket'), $output); diff --git a/apps/files/lib/Command/Object/ListObject.php b/apps/files/lib/Command/Object/ListObject.php index 5d30232e09f..d72ad3ca776 100644 --- a/apps/files/lib/Command/Object/ListObject.php +++ b/apps/files/lib/Command/Object/ListObject.php @@ -23,6 +23,7 @@ class ListObject extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -31,6 +32,7 @@ class ListObject extends Base { ->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket to list the objects from, only required in cases where it can't be determined from the config"); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $objectStore = $this->objectUtils->getObjectStore($input->getOption('bucket'), $output); if (!$objectStore) { diff --git a/apps/files/lib/Command/Object/Multi/Rename.php b/apps/files/lib/Command/Object/Multi/Rename.php index 562c68eb07f..92a2718df63 100644 --- a/apps/files/lib/Command/Object/Multi/Rename.php +++ b/apps/files/lib/Command/Object/Multi/Rename.php @@ -27,6 +27,7 @@ class Rename extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -36,6 +37,7 @@ class Rename extends Base { ->addArgument('target', InputArgument::REQUIRED, 'New name for the object store configuration'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $source = $input->getArgument('source'); $target = $input->getArgument('target'); diff --git a/apps/files/lib/Command/Object/Multi/Users.php b/apps/files/lib/Command/Object/Multi/Users.php index e8f7d012641..d33e8d7deca 100644 --- a/apps/files/lib/Command/Object/Multi/Users.php +++ b/apps/files/lib/Command/Object/Multi/Users.php @@ -26,6 +26,7 @@ class Users extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -36,6 +37,7 @@ class Users extends Base { ->addOption('user', 'u', InputOption::VALUE_REQUIRED, 'Only show the mapping for the specified user, ignores all other options'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { if ($userId = $input->getOption('user')) { $user = $this->userManager->get($userId); diff --git a/apps/files/lib/Command/Object/Orphans.php b/apps/files/lib/Command/Object/Orphans.php index f7132540fc8..0376ac672af 100644 --- a/apps/files/lib/Command/Object/Orphans.php +++ b/apps/files/lib/Command/Object/Orphans.php @@ -38,6 +38,7 @@ class Orphans extends Base { return $this->query; } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -46,6 +47,7 @@ class Orphans extends Base { ->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket to list the objects from, only required in cases where it can't be determined from the config"); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $objectStore = $this->objectUtils->getObjectStore($input->getOption('bucket'), $output); if (!$objectStore) { diff --git a/apps/files/lib/Command/Object/Put.php b/apps/files/lib/Command/Object/Put.php index 8516eb51183..97bd0009ba0 100644 --- a/apps/files/lib/Command/Object/Put.php +++ b/apps/files/lib/Command/Object/Put.php @@ -25,6 +25,7 @@ class Put extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files:object:put') @@ -35,6 +36,7 @@ class Put extends Command { ; } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $object = $input->getArgument('object'); $inputName = (string)$input->getArgument('input'); diff --git a/apps/files/lib/Command/Put.php b/apps/files/lib/Command/Put.php index 7deeb6b7772..6de11c7a881 100644 --- a/apps/files/lib/Command/Put.php +++ b/apps/files/lib/Command/Put.php @@ -25,6 +25,7 @@ class Put extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files:put') @@ -33,6 +34,7 @@ class Put extends Command { ->addArgument('file', InputArgument::REQUIRED, 'Target Nextcloud file path to write to or fileid of existing file'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $fileOutput = $input->getArgument('file'); $inputName = $input->getArgument('input'); diff --git a/apps/files/lib/Command/RepairTree.php b/apps/files/lib/Command/RepairTree.php index d536a4e7b68..3964cfb012f 100644 --- a/apps/files/lib/Command/RepairTree.php +++ b/apps/files/lib/Command/RepairTree.php @@ -24,6 +24,7 @@ class RepairTree extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files:repair-tree') @@ -33,6 +34,7 @@ class RepairTree extends Command { ->addOption('path', 'p', InputOption::VALUE_OPTIONAL, 'If set, only repair files within the given path', null); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $rows = $this->findBrokenTreeBits( $input->getOption('storage-id'), diff --git a/apps/files/lib/Command/SanitizeFilenames.php b/apps/files/lib/Command/SanitizeFilenames.php index 5cdebffdeba..a7475f1dae1 100644 --- a/apps/files/lib/Command/SanitizeFilenames.php +++ b/apps/files/lib/Command/SanitizeFilenames.php @@ -45,6 +45,7 @@ class SanitizeFilenames extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); @@ -70,6 +71,7 @@ class SanitizeFilenames extends Base { } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $this->charReplacement = $input->getOption('char-replacement'); // check if replacement is needed diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php index 71582e00c6e..16830f1806b 100644 --- a/apps/files/lib/Command/Scan.php +++ b/apps/files/lib/Command/Scan.php @@ -55,6 +55,7 @@ class Scan extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); @@ -196,6 +197,7 @@ class Scan extends Base { return substr_count($mountPoint->getMountPoint(), '/') <= 3; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $inputPath = $input->getOption('path'); if ($inputPath) { diff --git a/apps/files/lib/Command/ScanAppData.php b/apps/files/lib/Command/ScanAppData.php index ac9e0630dbd..1399229c294 100644 --- a/apps/files/lib/Command/ScanAppData.php +++ b/apps/files/lib/Command/ScanAppData.php @@ -44,6 +44,7 @@ class ScanAppData extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); @@ -137,6 +138,7 @@ class ScanAppData extends Base { } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { # restrict the verbosity level to VERBOSITY_VERBOSE if ($output->getVerbosity() > OutputInterface::VERBOSITY_VERBOSE) { diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php index 05016bbc0b1..c38cd9af4f3 100644 --- a/apps/files/lib/Command/TransferOwnership.php +++ b/apps/files/lib/Command/TransferOwnership.php @@ -35,6 +35,7 @@ class TransferOwnership extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files:transfer-ownership') @@ -85,6 +86,7 @@ class TransferOwnership extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { /** diff --git a/apps/files/lib/Command/WindowsCompatibleFilenames.php b/apps/files/lib/Command/WindowsCompatibleFilenames.php index 84a1b277824..9d8e17d4e0f 100644 --- a/apps/files/lib/Command/WindowsCompatibleFilenames.php +++ b/apps/files/lib/Command/WindowsCompatibleFilenames.php @@ -21,6 +21,7 @@ class WindowsCompatibleFilenames extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); @@ -31,6 +32,7 @@ class WindowsCompatibleFilenames extends Base { ->addOption('disable', description: 'Disable windows naming constraints'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if ($input->getOption('enable')) { if ($this->service->hasFilesWindowsSupport()) { diff --git a/apps/files/lib/ConfigLexicon.php b/apps/files/lib/ConfigLexicon.php index cdd20d4d8b1..d177001d4ac 100644 --- a/apps/files/lib/ConfigLexicon.php +++ b/apps/files/lib/ConfigLexicon.php @@ -27,10 +27,12 @@ class ConfigLexicon implements ILexicon { public const RECENT_FILES_GROUP_MIME_TYPES = 'recent_files_group_mime_types'; public const RECENT_FILES_GROUP_TIMESPAN_MINUTES = 'recent_files_group_timespan_minutes'; + #[\Override] public function getStrictness(): Strictness { return Strictness::IGNORE; } + #[\Override] public function getAppConfigs(): array { return [ new Entry( @@ -72,6 +74,7 @@ class ConfigLexicon implements ILexicon { ]; } + #[\Override] public function getUserConfigs(): array { return []; } diff --git a/apps/files/lib/Dashboard/FavoriteWidget.php b/apps/files/lib/Dashboard/FavoriteWidget.php index 6789686331c..5091d787127 100644 --- a/apps/files/lib/Dashboard/FavoriteWidget.php +++ b/apps/files/lib/Dashboard/FavoriteWidget.php @@ -40,32 +40,39 @@ class FavoriteWidget implements IIconWidget, IAPIWidgetV2, IButtonWidget, IOptio ) { } + #[\Override] public function getId(): string { return Application::APP_ID . '-favorites'; } + #[\Override] public function getTitle(): string { return $this->l10n->t('Favorite files'); } + #[\Override] public function getOrder(): int { return 0; } + #[\Override] public function getIconClass(): string { return 'icon-starred-dark'; } + #[\Override] public function getIconUrl(): string { return $this->urlGenerator->getAbsoluteURL( $this->urlGenerator->imagePath('core', 'actions/star-dark.svg') ); } + #[\Override] public function getUrl(): ?string { return $this->urlGenerator->linkToRouteAbsolute('files.View.indexView', ['view' => 'favorites']); } + #[\Override] public function load(): void { } @@ -117,6 +124,7 @@ class FavoriteWidget implements IIconWidget, IAPIWidgetV2, IButtonWidget, IOptio return $favoriteNodes; } + #[\Override] public function getItemsV2(string $userId, ?string $since = null, int $limit = 7): WidgetItems { $items = $this->getItems($userId, $limit); return new WidgetItems( @@ -125,6 +133,7 @@ class FavoriteWidget implements IIconWidget, IAPIWidgetV2, IButtonWidget, IOptio ); } + #[\Override] public function getWidgetButtons(string $userId): array { return [ new WidgetButton( @@ -135,6 +144,7 @@ class FavoriteWidget implements IIconWidget, IAPIWidgetV2, IButtonWidget, IOptio ]; } + #[\Override] public function getWidgetOptions(): WidgetOptions { return new WidgetOptions(roundItemIcons: false); } diff --git a/apps/files/lib/DirectEditingCapabilities.php b/apps/files/lib/DirectEditingCapabilities.php index 5bceef9305f..b51cabc583c 100644 --- a/apps/files/lib/DirectEditingCapabilities.php +++ b/apps/files/lib/DirectEditingCapabilities.php @@ -22,6 +22,7 @@ class DirectEditingCapabilities implements ICapability, IInitialStateExcludedCap /** * @return array{files: array{directEditing: array{url: string, etag: string, supportsFileId: bool}}} */ + #[\Override] public function getCapabilities() { return [ 'files' => [ diff --git a/apps/files/lib/Listener/LoadSearchPluginsListener.php b/apps/files/lib/Listener/LoadSearchPluginsListener.php index 4cc4ca22f83..cd429b5ac74 100644 --- a/apps/files/lib/Listener/LoadSearchPluginsListener.php +++ b/apps/files/lib/Listener/LoadSearchPluginsListener.php @@ -15,6 +15,7 @@ use OCP\Util; /** @template-implements IEventListener */ class LoadSearchPluginsListener implements IEventListener { + #[\Override] public function handle(Event $event): void { if (!$event instanceof LoadSearchPlugins) { return; diff --git a/apps/files/lib/Listener/LoadSidebarListener.php b/apps/files/lib/Listener/LoadSidebarListener.php index 78b48ab1ce0..397e1974bd6 100644 --- a/apps/files/lib/Listener/LoadSidebarListener.php +++ b/apps/files/lib/Listener/LoadSidebarListener.php @@ -16,6 +16,7 @@ use OCP\Util; /** @template-implements IEventListener */ class LoadSidebarListener implements IEventListener { + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoadSidebar)) { return; diff --git a/apps/files/lib/Listener/NodeAddedToFavoriteListener.php b/apps/files/lib/Listener/NodeAddedToFavoriteListener.php index 827c1851d3d..86b98669c22 100644 --- a/apps/files/lib/Listener/NodeAddedToFavoriteListener.php +++ b/apps/files/lib/Listener/NodeAddedToFavoriteListener.php @@ -19,6 +19,7 @@ class NodeAddedToFavoriteListener implements IEventListener { private IActivityManager $activityManager, ) { } + #[\Override] public function handle(Event $event):void { if (!($event instanceof NodeAddedToFavorite)) { return; diff --git a/apps/files/lib/Listener/NodeRemovedFromFavoriteListener.php b/apps/files/lib/Listener/NodeRemovedFromFavoriteListener.php index fe39d4af540..5decf02f5d8 100644 --- a/apps/files/lib/Listener/NodeRemovedFromFavoriteListener.php +++ b/apps/files/lib/Listener/NodeRemovedFromFavoriteListener.php @@ -19,6 +19,7 @@ class NodeRemovedFromFavoriteListener implements IEventListener { private IActivityManager $activityManager, ) { } + #[\Override] public function handle(Event $event):void { if (!($event instanceof NodeRemovedFromFavorite)) { return; diff --git a/apps/files/lib/Listener/RenderReferenceEventListener.php b/apps/files/lib/Listener/RenderReferenceEventListener.php index b7470e5acf5..e56321a0a1a 100644 --- a/apps/files/lib/Listener/RenderReferenceEventListener.php +++ b/apps/files/lib/Listener/RenderReferenceEventListener.php @@ -15,6 +15,7 @@ use OCP\Util; /** @template-implements IEventListener */ class RenderReferenceEventListener implements IEventListener { + #[\Override] public function handle(Event $event): void { if (!$event instanceof RenderReferenceEvent) { return; diff --git a/apps/files/lib/Listener/SyncLivePhotosListener.php b/apps/files/lib/Listener/SyncLivePhotosListener.php index a353f8bf9fc..a3213310b48 100644 --- a/apps/files/lib/Listener/SyncLivePhotosListener.php +++ b/apps/files/lib/Listener/SyncLivePhotosListener.php @@ -49,6 +49,7 @@ class SyncLivePhotosListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($this->userFolder === null) { return; diff --git a/apps/files/lib/Migration/Version11301Date20191205150729.php b/apps/files/lib/Migration/Version11301Date20191205150729.php index 2e3d72c7ece..ae47e85e3bc 100644 --- a/apps/files/lib/Migration/Version11301Date20191205150729.php +++ b/apps/files/lib/Migration/Version11301Date20191205150729.php @@ -21,6 +21,7 @@ class Version11301Date20191205150729 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/files/lib/Migration/Version12101Date20221011153334.php b/apps/files/lib/Migration/Version12101Date20221011153334.php index ed4d8bef90b..7da980044a2 100644 --- a/apps/files/lib/Migration/Version12101Date20221011153334.php +++ b/apps/files/lib/Migration/Version12101Date20221011153334.php @@ -16,6 +16,7 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version12101Date20221011153334 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/files/lib/Notification/Notifier.php b/apps/files/lib/Notification/Notifier.php index 6acc312c126..9f32001707f 100644 --- a/apps/files/lib/Notification/Notifier.php +++ b/apps/files/lib/Notification/Notifier.php @@ -36,10 +36,12 @@ class Notifier implements INotifier, IDismissableNotifier { ) { } + #[\Override] public function getID(): string { return 'files'; } + #[\Override] public function getName(): string { return $this->l10nFactory->get('files')->t('Files'); } @@ -50,6 +52,7 @@ class Notifier implements INotifier, IDismissableNotifier { * @return INotification * @throws UnknownNotificationException When the notification was not prepared by a notifier */ + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'files') { throw new UnknownNotificationException('Unhandled app'); @@ -244,6 +247,7 @@ class Notifier implements INotifier, IDismissableNotifier { return $notification; } + #[\Override] public function dismissNotification(INotification $notification): void { if ($notification->getApp() !== 'files') { throw new UnknownNotificationException('Unhandled app'); diff --git a/apps/files/lib/Search/FilesSearchProvider.php b/apps/files/lib/Search/FilesSearchProvider.php index f71d58c6fae..b171b2a7456 100644 --- a/apps/files/lib/Search/FilesSearchProvider.php +++ b/apps/files/lib/Search/FilesSearchProvider.php @@ -47,6 +47,7 @@ class FilesSearchProvider implements IFilteringProvider { /** * @inheritDoc */ + #[\Override] public function getId(): string { return 'files'; } @@ -54,6 +55,7 @@ class FilesSearchProvider implements IFilteringProvider { /** * @inheritDoc */ + #[\Override] public function getName(): string { return $this->l10n->t('Files'); } @@ -61,6 +63,7 @@ class FilesSearchProvider implements IFilteringProvider { /** * @inheritDoc */ + #[\Override] public function getOrder(string $route, array $routeParameters): int { if ($route === 'files.View.index') { // Before comments @@ -69,6 +72,7 @@ class FilesSearchProvider implements IFilteringProvider { return 5; } + #[\Override] public function getSupportedFilters(): array { return [ 'term', @@ -85,10 +89,12 @@ class FilesSearchProvider implements IFilteringProvider { ]; } + #[\Override] public function getAlternateIds(): array { return []; } + #[\Override] public function getCustomFilters(): array { return [ new FilterDefinition('min-size', FilterDefinition::TYPE_INT), @@ -100,6 +106,7 @@ class FilesSearchProvider implements IFilteringProvider { ]; } + #[\Override] public function search(IUser $user, ISearchQuery $query): SearchResult { $userFolder = $this->rootFolder->getUserFolder($user->getUID()); $fileQuery = $this->buildSearchQuery($query, $user); diff --git a/apps/files/lib/Settings/AdminSettings.php b/apps/files/lib/Settings/AdminSettings.php index e6ece40445b..f09b42912f1 100644 --- a/apps/files/lib/Settings/AdminSettings.php +++ b/apps/files/lib/Settings/AdminSettings.php @@ -26,14 +26,17 @@ class AdminSettings implements ISettings { ) { } + #[\Override] public function getSection(): string { return 'server'; } + #[\Override] public function getPriority(): int { return 10; } + #[\Override] public function getForm(): TemplateResponse { $windowSupport = $this->service->hasFilesWindowsSupport(); $this->initialState->provideInitialState('filesCompatibilitySettings', [ diff --git a/apps/files/lib/Settings/PersonalSettings.php b/apps/files/lib/Settings/PersonalSettings.php index fe43265bc13..d0a060d5d60 100644 --- a/apps/files/lib/Settings/PersonalSettings.php +++ b/apps/files/lib/Settings/PersonalSettings.php @@ -14,15 +14,18 @@ use OCP\Settings\ISettings; use OCP\Util; class PersonalSettings implements ISettings { + #[\Override] public function getForm(): TemplateResponse { Util::addScript(Application::APP_ID, 'settings-personal'); return new TemplateResponse(Application::APP_ID, 'settings-personal'); } + #[\Override] public function getSection(): string { return 'sharing'; } + #[\Override] public function getPriority(): int { return 90; } diff --git a/apps/files_external/lib/AppInfo/Application.php b/apps/files_external/lib/AppInfo/Application.php index cd2606f19ab..19160f5e9e5 100644 --- a/apps/files_external/lib/AppInfo/Application.php +++ b/apps/files_external/lib/AppInfo/Application.php @@ -76,6 +76,7 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide parent::__construct(self::APP_ID, $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); $context->registerEventListener(GroupDeletedEvent::class, GroupDeletedListener::class); @@ -92,6 +93,7 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide $context->registerConfigLexicon(ConfigLexicon::class); } + #[\Override] public function boot(IBootContext $context): void { $context->injectFn(function (IMountProviderCollection $mountProviderCollection, ConfigAdapter $configAdapter): void { $mountProviderCollection->registerProvider($configAdapter); @@ -108,6 +110,7 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide /** * @{inheritdoc} */ + #[\Override] public function getBackends() { $container = $this->getContainer(); @@ -130,6 +133,7 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide /** * @{inheritdoc} */ + #[\Override] public function getAuthMechanisms() { $container = $this->getContainer(); diff --git a/apps/files_external/lib/BackgroundJob/CredentialsCleanup.php b/apps/files_external/lib/BackgroundJob/CredentialsCleanup.php index 90a5ae17ab2..1888b16fcfc 100644 --- a/apps/files_external/lib/BackgroundJob/CredentialsCleanup.php +++ b/apps/files_external/lib/BackgroundJob/CredentialsCleanup.php @@ -31,6 +31,7 @@ class CredentialsCleanup extends TimedJob { $this->setTimeSensitivity(self::TIME_INSENSITIVE); } + #[\Override] protected function run($argument) { $this->userManager->callForSeenUsers(function (IUser $user): void { $storages = $this->userGlobalStoragesService->getAllStoragesForUser($user); diff --git a/apps/files_external/lib/Command/Applicable.php b/apps/files_external/lib/Command/Applicable.php index 4d5e264bfaf..43e42665a8a 100644 --- a/apps/files_external/lib/Command/Applicable.php +++ b/apps/files_external/lib/Command/Applicable.php @@ -28,6 +28,7 @@ class Applicable extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files_external:applicable') @@ -65,6 +66,7 @@ class Applicable extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $mountId = $input->getArgument('mount_id'); try { diff --git a/apps/files_external/lib/Command/Backends.php b/apps/files_external/lib/Command/Backends.php index 55479787fe7..5f610f8b367 100644 --- a/apps/files_external/lib/Command/Backends.php +++ b/apps/files_external/lib/Command/Backends.php @@ -23,6 +23,7 @@ class Backends extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files_external:backends') @@ -39,6 +40,7 @@ class Backends extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $authBackends = $this->backendService->getAuthMechanisms(); $storageBackends = $this->backendService->getBackends(); diff --git a/apps/files_external/lib/Command/Config.php b/apps/files_external/lib/Command/Config.php index 883b4a2f3e7..0247beaba5f 100644 --- a/apps/files_external/lib/Command/Config.php +++ b/apps/files_external/lib/Command/Config.php @@ -23,6 +23,7 @@ class Config extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files_external:config') @@ -43,6 +44,7 @@ class Config extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $mountId = $input->getArgument('mount_id'); $key = $input->getArgument('key'); diff --git a/apps/files_external/lib/Command/Create.php b/apps/files_external/lib/Command/Create.php index 3307015518a..60a2df28dc8 100644 --- a/apps/files_external/lib/Command/Create.php +++ b/apps/files_external/lib/Command/Create.php @@ -38,6 +38,7 @@ class Create extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files_external:create') @@ -78,6 +79,7 @@ class Create extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = (string)$input->getOption('user'); $mountPoint = $input->getArgument('mount_point'); diff --git a/apps/files_external/lib/Command/Delete.php b/apps/files_external/lib/Command/Delete.php index 9f121250f7d..af2135ed064 100644 --- a/apps/files_external/lib/Command/Delete.php +++ b/apps/files_external/lib/Command/Delete.php @@ -33,6 +33,7 @@ class Delete extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files_external:delete') @@ -50,6 +51,7 @@ class Delete extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $mountId = $input->getArgument('mount_id'); try { diff --git a/apps/files_external/lib/Command/Dependencies.php b/apps/files_external/lib/Command/Dependencies.php index 01e60abe505..54107b3651f 100644 --- a/apps/files_external/lib/Command/Dependencies.php +++ b/apps/files_external/lib/Command/Dependencies.php @@ -20,6 +20,7 @@ class Dependencies extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files_external:dependencies') @@ -27,6 +28,7 @@ class Dependencies extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $storageBackends = $this->backendService->getBackends(); diff --git a/apps/files_external/lib/Command/Export.php b/apps/files_external/lib/Command/Export.php index ef8b894dafd..2bbf5b1237e 100644 --- a/apps/files_external/lib/Command/Export.php +++ b/apps/files_external/lib/Command/Export.php @@ -16,6 +16,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Export extends ListCommand { + #[\Override] protected function configure(): void { $this ->setName('files_external:export') @@ -32,6 +33,7 @@ class Export extends ListCommand { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager); $listInput = new ArrayInput([], $listCommand->getDefinition()); diff --git a/apps/files_external/lib/Command/Import.php b/apps/files_external/lib/Command/Import.php index a9ed76fbe40..b4aabf2d192 100644 --- a/apps/files_external/lib/Command/Import.php +++ b/apps/files_external/lib/Command/Import.php @@ -35,6 +35,7 @@ class Import extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files_external:import') @@ -59,6 +60,7 @@ class Import extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = (string)$input->getOption('user'); $path = $input->getArgument('path'); diff --git a/apps/files_external/lib/Command/ListCommand.php b/apps/files_external/lib/Command/ListCommand.php index 350916b6c2c..3ca9c7725c1 100644 --- a/apps/files_external/lib/Command/ListCommand.php +++ b/apps/files_external/lib/Command/ListCommand.php @@ -33,6 +33,7 @@ class ListCommand extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files_external:list') @@ -60,6 +61,7 @@ class ListCommand extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { /** @var StorageConfig[] $mounts */ if ($input->getOption('all')) { diff --git a/apps/files_external/lib/Command/Notify.php b/apps/files_external/lib/Command/Notify.php index 3706ad2fd3e..b5ea3e9fa5f 100644 --- a/apps/files_external/lib/Command/Notify.php +++ b/apps/files_external/lib/Command/Notify.php @@ -34,6 +34,7 @@ class Notify extends StorageAuthBase { parent::__construct($globalService, $userManager); } + #[\Override] protected function configure(): void { $this ->setName('files_external:notify') @@ -72,6 +73,7 @@ class Notify extends StorageAuthBase { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { [$mount, $storage] = $this->createStorage($input, $output); if ($storage === null) { diff --git a/apps/files_external/lib/Command/Option.php b/apps/files_external/lib/Command/Option.php index 3fda3fcb3cf..6bf582543c7 100644 --- a/apps/files_external/lib/Command/Option.php +++ b/apps/files_external/lib/Command/Option.php @@ -12,6 +12,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Output\OutputInterface; class Option extends Config { + #[\Override] protected function configure(): void { $this ->setName('files_external:option') @@ -34,6 +35,7 @@ class Option extends Config { /** * @param string $key */ + #[\Override] protected function getOption(StorageConfig $mount, $key, OutputInterface $output): void { $value = $mount->getMountOption($key); if (!is_string($value)) { // show bools and objects correctly @@ -46,6 +48,7 @@ class Option extends Config { * @param string $key * @param string $value */ + #[\Override] protected function setOption(StorageConfig $mount, $key, $value, OutputInterface $output): void { $decoded = json_decode($value, true); if (!is_null($decoded)) { diff --git a/apps/files_external/lib/Command/Scan.php b/apps/files_external/lib/Command/Scan.php index 75d98878baa..29efee44748 100644 --- a/apps/files_external/lib/Command/Scan.php +++ b/apps/files_external/lib/Command/Scan.php @@ -30,6 +30,7 @@ class Scan extends StorageAuthBase { parent::__construct($globalService, $userManager); } + #[\Override] protected function configure(): void { $this ->setName('files_external:scan') @@ -63,6 +64,7 @@ class Scan extends StorageAuthBase { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { [, $storage] = $this->createStorage($input, $output); if ($storage === null) { diff --git a/apps/files_external/lib/Command/Verify.php b/apps/files_external/lib/Command/Verify.php index ecebbe0f7e6..80ba831e6f5 100644 --- a/apps/files_external/lib/Command/Verify.php +++ b/apps/files_external/lib/Command/Verify.php @@ -27,6 +27,7 @@ class Verify extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files_external:verify') @@ -44,6 +45,7 @@ class Verify extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $mountId = $input->getArgument('mount_id'); $configInput = $input->getOption('config'); diff --git a/apps/files_external/lib/Config/ExternalMountPoint.php b/apps/files_external/lib/Config/ExternalMountPoint.php index 97569ed2913..26e11446e6d 100644 --- a/apps/files_external/lib/Config/ExternalMountPoint.php +++ b/apps/files_external/lib/Config/ExternalMountPoint.php @@ -24,6 +24,7 @@ class ExternalMountPoint extends MountPoint { parent::__construct($storage, $mountpoint, $arguments, $loader, $mountOptions, $mountId, ConfigAdapter::class); } + #[\Override] public function getMountType() { return ($this->storageConfig->getAuthMechanism() instanceof SessionCredentials) ? 'external-session' : 'external'; } diff --git a/apps/files_external/lib/Config/UserPlaceholderHandler.php b/apps/files_external/lib/Config/UserPlaceholderHandler.php index a6365ca114c..7284bab00de 100644 --- a/apps/files_external/lib/Config/UserPlaceholderHandler.php +++ b/apps/files_external/lib/Config/UserPlaceholderHandler.php @@ -16,6 +16,7 @@ class UserPlaceholderHandler extends UserContext implements IConfigHandler { * @return mixed the same type as $optionValue * @since 16.0.0 */ + #[\Override] public function handle($optionValue) { $this->placeholder = 'user'; $uid = $this->getUserId(); diff --git a/apps/files_external/lib/ConfigLexicon.php b/apps/files_external/lib/ConfigLexicon.php index 154f76c1989..427bcdfcc6f 100644 --- a/apps/files_external/lib/ConfigLexicon.php +++ b/apps/files_external/lib/ConfigLexicon.php @@ -24,10 +24,12 @@ class ConfigLexicon implements ILexicon { public const ALLOW_USER_MOUNTING = 'allow_user_mounting'; public const USER_MOUNTING_BACKENDS = 'user_mounting_backends'; + #[\Override] public function getStrictness(): Strictness { return Strictness::NOTICE; } + #[\Override] public function getAppConfigs(): array { return [ new Entry(self::ALLOW_USER_MOUNTING, ValueType::BOOL, false, 'allow users to mount their own external filesystems', true), @@ -35,6 +37,7 @@ class ConfigLexicon implements ILexicon { ]; } + #[\Override] public function getUserConfigs(): array { return []; } diff --git a/apps/files_external/lib/Controller/GlobalStoragesController.php b/apps/files_external/lib/Controller/GlobalStoragesController.php index 287c00e179b..fa2fdfaa9a7 100644 --- a/apps/files_external/lib/Controller/GlobalStoragesController.php +++ b/apps/files_external/lib/Controller/GlobalStoragesController.php @@ -180,16 +180,19 @@ class GlobalStoragesController extends StoragesController { // PHP attributes are not inherited, so these methods override the parent // solely to attach #[AuthorizedAdminSetting] and expose them to delegated admins. + #[\Override] #[AuthorizedAdminSetting(settings: Admin::class)] public function index() { return parent::index(); } + #[\Override] #[AuthorizedAdminSetting(settings: Admin::class)] public function show(int $id, $testOnly = true) { return parent::show($id, $testOnly); } + #[\Override] #[AuthorizedAdminSetting(settings: Admin::class)] #[PasswordConfirmationRequired(strict: true)] public function destroy(int $id) { diff --git a/apps/files_external/lib/Controller/UserGlobalStoragesController.php b/apps/files_external/lib/Controller/UserGlobalStoragesController.php index 0fc7b53152a..5314dd57205 100644 --- a/apps/files_external/lib/Controller/UserGlobalStoragesController.php +++ b/apps/files_external/lib/Controller/UserGlobalStoragesController.php @@ -68,6 +68,7 @@ class UserGlobalStoragesController extends StoragesController { * * @return DataResponse */ + #[\Override] #[NoAdminRequired] public function index() { /** @var UserGlobalStoragesService */ @@ -84,6 +85,7 @@ class UserGlobalStoragesController extends StoragesController { ); } + #[\Override] protected function manipulateStorageConfig(StorageConfig $storage) { /** @var AuthMechanism */ $authMechanism = $storage->getAuthMechanism(); @@ -99,6 +101,7 @@ class UserGlobalStoragesController extends StoragesController { * @param int $id storage id * @return DataResponse */ + #[\Override] #[NoAdminRequired] public function show($id) { try { diff --git a/apps/files_external/lib/Controller/UserStoragesController.php b/apps/files_external/lib/Controller/UserStoragesController.php index a9d107589ca..fcedad3dfdb 100644 --- a/apps/files_external/lib/Controller/UserStoragesController.php +++ b/apps/files_external/lib/Controller/UserStoragesController.php @@ -53,6 +53,7 @@ class UserStoragesController extends StoragesController { ); } + #[\Override] protected function manipulateStorageConfig(StorageConfig $storage): void { /** @var AuthMechanism */ $authMechanism = $storage->getAuthMechanism(); diff --git a/apps/files_external/lib/Lib/Auth/AuthMechanism.php b/apps/files_external/lib/Lib/Auth/AuthMechanism.php index 71b138bacf2..ae11760708d 100644 --- a/apps/files_external/lib/Lib/Auth/AuthMechanism.php +++ b/apps/files_external/lib/Lib/Auth/AuthMechanism.php @@ -77,6 +77,7 @@ class AuthMechanism implements \JsonSerializable, IIdentifier, IFrontendDefiniti /** * Serialize into JSON for client-side JS */ + #[\Override] public function jsonSerialize(): array { $data = $this->jsonSerializeDefinition(); $data += $this->jsonSerializeIdentifier(); diff --git a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php index 916b496b506..c6b7f233aeb 100644 --- a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php +++ b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php @@ -62,6 +62,7 @@ class GlobalAuth extends AuthMechanism { /** * @return void */ + #[\Override] public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) { if ($storage->getType() === StorageConfig::MOUNT_TYPE_ADMIN) { $uid = ''; diff --git a/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php b/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php index ec849895698..fb00bbb0aaf 100644 --- a/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php +++ b/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php @@ -75,6 +75,7 @@ class LoginCredentials extends AuthMechanism { /** * @return void */ + #[\Override] public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) { if (!isset($user)) { throw new InsufficientDataForMeaningfulAnswerException('No login credentials saved'); diff --git a/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php b/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php index 71d277bd72d..a5cf3710074 100644 --- a/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php +++ b/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php @@ -44,6 +44,7 @@ class SessionCredentials extends AuthMechanism { /** * @return void */ + #[\Override] public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) { try { $credentials = $this->credentialsStore->getLoginCredentials(); @@ -63,6 +64,7 @@ class SessionCredentials extends AuthMechanism { $storage->setBackendOption('password', $credentials->getPassword()); } + #[\Override] public function wrapStorage(IStorage $storage): IStorage { return new SessionStorageWrapper(['storage' => $storage]); } diff --git a/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php b/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php index cb7165261ac..d24106f8589 100644 --- a/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php +++ b/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php @@ -57,6 +57,7 @@ class UserGlobalAuth extends AuthMechanism { /** * @return void */ + #[\Override] public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) { if ($user === null) { throw new InsufficientDataForMeaningfulAnswerException('No credentials saved'); diff --git a/apps/files_external/lib/Lib/Auth/Password/UserProvided.php b/apps/files_external/lib/Lib/Auth/Password/UserProvided.php index b158392f6eb..4542c591dc2 100644 --- a/apps/files_external/lib/Lib/Auth/Password/UserProvided.php +++ b/apps/files_external/lib/Lib/Auth/Password/UserProvided.php @@ -45,6 +45,7 @@ class UserProvided extends AuthMechanism implements IUserProvided { return self::CREDENTIALS_IDENTIFIER_PREFIX . $storageId; } + #[\Override] public function saveBackendOptions(IUser $user, $mountId, array $options) { if ($options['password'] === DefinitionParameter::UNMODIFIED_PLACEHOLDER) { $oldCredentials = $this->credentialsManager->retrieve($user->getUID(), $this->getCredentialsIdentifier($mountId)); @@ -60,6 +61,7 @@ class UserProvided extends AuthMechanism implements IUserProvided { /** * @return void */ + #[\Override] public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) { if (!isset($user)) { throw new InsufficientDataForMeaningfulAnswerException('No credentials saved'); diff --git a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php index 381f0e9cf5b..3235759713c 100644 --- a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php +++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php @@ -42,6 +42,7 @@ class RSA extends AuthMechanism { /** * @return void */ + #[\Override] public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) { $auth = new RSACrypt(); $auth->setPassword($this->config->getSystemValue('secret', '')); diff --git a/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php b/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php index 8f58b71d5ac..5fc56697d12 100644 --- a/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php +++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php @@ -39,6 +39,7 @@ class RSAPrivateKey extends AuthMechanism { /** * @return void */ + #[\Override] public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) { $auth = new RSACrypt(); $auth->setPassword($this->config->getSystemValue('secret', '')); diff --git a/apps/files_external/lib/Lib/Backend/Backend.php b/apps/files_external/lib/Lib/Backend/Backend.php index f7500ee24a4..af6111d8822 100644 --- a/apps/files_external/lib/Lib/Backend/Backend.php +++ b/apps/files_external/lib/Lib/Backend/Backend.php @@ -122,6 +122,7 @@ class Backend implements \JsonSerializable, IIdentifier, IFrontendDefinition { /** * Serialize into JSON for client-side JS */ + #[\Override] public function jsonSerialize(): array { $data = $this->jsonSerializeDefinition(); $data += $this->jsonSerializeIdentifier(); diff --git a/apps/files_external/lib/Lib/Backend/InvalidBackend.php b/apps/files_external/lib/Lib/Backend/InvalidBackend.php index 48912c0e49e..ca4e3ddb4f7 100644 --- a/apps/files_external/lib/Lib/Backend/InvalidBackend.php +++ b/apps/files_external/lib/Lib/Backend/InvalidBackend.php @@ -44,6 +44,7 @@ class InvalidBackend extends Backend { /** * @return void */ + #[\Override] public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) { $storage->setBackendOption('exception', new \Exception('Unknown storage backend "' . $this->invalidId . '"', StorageNotAvailableException::STATUS_ERROR)); } diff --git a/apps/files_external/lib/Lib/Backend/LegacyBackend.php b/apps/files_external/lib/Lib/Backend/LegacyBackend.php index 9c7e5b01bc3..87e362ecf25 100644 --- a/apps/files_external/lib/Lib/Backend/LegacyBackend.php +++ b/apps/files_external/lib/Lib/Backend/LegacyBackend.php @@ -74,6 +74,7 @@ class LegacyBackend extends Backend { /** * @return MissingDependency[] */ + #[\Override] public function checkDependencies() { if ($this->hasDependencies) { return $this->doCheckDependencies(); diff --git a/apps/files_external/lib/Lib/Backend/Local.php b/apps/files_external/lib/Lib/Backend/Local.php index 59ab6c3ae68..7359d35eb4d 100644 --- a/apps/files_external/lib/Lib/Backend/Local.php +++ b/apps/files_external/lib/Lib/Backend/Local.php @@ -34,6 +34,7 @@ class Local extends Backend { ; } + #[\Override] public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null): void { $storage->setBackendOption('isExternal', true); } diff --git a/apps/files_external/lib/Lib/Backend/SMB.php b/apps/files_external/lib/Lib/Backend/SMB.php index e86ad98880c..d0883c9c486 100644 --- a/apps/files_external/lib/Lib/Backend/SMB.php +++ b/apps/files_external/lib/Lib/Backend/SMB.php @@ -60,6 +60,7 @@ class SMB extends Backend { ->setLegacyAuthMechanism($legacyAuth); } + #[\Override] public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null): void { $auth = $storage->getAuthMechanism(); if ($auth->getScheme() === AuthMechanism::SCHEME_PASSWORD) { @@ -122,6 +123,7 @@ class SMB extends Backend { $storage->setBackendOption('auth', $smbAuth); } + #[\Override] public function checkDependencies(): array { $system = \OCP\Server::get(SystemBridge::class); if (NativeServer::available($system)) { diff --git a/apps/files_external/lib/Lib/Backend/SMB_OC.php b/apps/files_external/lib/Lib/Backend/SMB_OC.php index 25e1b60254a..7d97e8833cc 100644 --- a/apps/files_external/lib/Lib/Backend/SMB_OC.php +++ b/apps/files_external/lib/Lib/Backend/SMB_OC.php @@ -48,6 +48,7 @@ class SMB_OC extends Backend { /** * @return void */ + #[\Override] public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) { $username_as_share = ($storage->getBackendOption('username_as_share') === true); diff --git a/apps/files_external/lib/Lib/DefinitionParameter.php b/apps/files_external/lib/Lib/DefinitionParameter.php index ce0cadc37fb..7dde725f529 100644 --- a/apps/files_external/lib/Lib/DefinitionParameter.php +++ b/apps/files_external/lib/Lib/DefinitionParameter.php @@ -167,6 +167,7 @@ class DefinitionParameter implements \JsonSerializable { /** * Serialize into JSON for client-side JS */ + #[\Override] public function jsonSerialize(): array { $result = [ 'value' => $this->getText(), diff --git a/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php b/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php index 39472a7f948..683c3d05151 100644 --- a/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php +++ b/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php @@ -42,6 +42,7 @@ class SMBNotifyHandler implements INotifyHandler { } } + #[\Override] public function listen(callable $callback) { $oldRenamePath = null; $this->shareNotifyHandler->listen(function (\Icewind\SMB\Change $shareChange) use ($callback) { @@ -59,6 +60,7 @@ class SMBNotifyHandler implements INotifyHandler { * * @return IChange[] */ + #[\Override] public function getChanges() { $shareChanges = $this->shareNotifyHandler->getChanges(); $changes = []; @@ -76,6 +78,7 @@ class SMBNotifyHandler implements INotifyHandler { * * Note that any pending changes will be discarded */ + #[\Override] public function stop() { $this->shareNotifyHandler->stop(); } diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index e65c44d22d5..a45019b98f9 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -184,6 +184,7 @@ class AmazonS3 extends Common { return false; } + #[\Override] protected function remove(string $path): bool { // remember fileType to reduce http calls $fileType = $this->filetype($path); @@ -196,6 +197,7 @@ class AmazonS3 extends Common { } } + #[\Override] public function mkdir(string $path): bool { $path = $this->normalizePath($path); @@ -224,11 +226,13 @@ class AmazonS3 extends Common { return true; } + #[\Override] public function file_exists(string $path): bool { return $this->filetype($path) !== false; } + #[\Override] public function rmdir(string $path): bool { $path = $this->normalizePath($path); @@ -292,6 +296,7 @@ class AmazonS3 extends Common { return true; } + #[\Override] public function opendir(string $path) { try { $content = iterator_to_array($this->getDirectoryContent($path)); @@ -303,6 +308,7 @@ class AmazonS3 extends Common { } } + #[\Override] public function stat(string $path): array|false { $path = $this->normalizePath($path); @@ -320,6 +326,7 @@ class AmazonS3 extends Common { return $stat; } + #[\Override] public function is_dir(string $path): bool { $path = $this->normalizePath($path); @@ -334,6 +341,7 @@ class AmazonS3 extends Common { } } + #[\Override] public function filetype(string $path): string|false { $path = $this->normalizePath($path); @@ -362,6 +370,7 @@ class AmazonS3 extends Common { return false; } + #[\Override] public function getPermissions(string $path): int { $type = $this->filetype($path); if (!$type) { @@ -370,6 +379,7 @@ class AmazonS3 extends Common { return $type === 'dir' ? Constants::PERMISSION_ALL : Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE; } + #[\Override] public function unlink(string $path): bool { $path = $this->normalizePath($path); @@ -391,6 +401,7 @@ class AmazonS3 extends Common { return true; } + #[\Override] public function fopen(string $path, string $mode) { $path = $this->normalizePath($path); @@ -449,6 +460,7 @@ class AmazonS3 extends Common { return false; } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { if (is_null($mtime)) { $mtime = time(); @@ -484,6 +496,7 @@ class AmazonS3 extends Common { return true; } + #[\Override] public function copy(string $source, string $target, ?bool $isFile = null): bool { $source = $this->normalizePath($source); $target = $this->normalizePath($target); @@ -527,6 +540,7 @@ class AmazonS3 extends Common { return true; } + #[\Override] public function rename(string $source, string $target): bool { $source = $this->normalizePath($source); $target = $this->normalizePath($target); @@ -554,6 +568,7 @@ class AmazonS3 extends Common { return true; } + #[\Override] public function test(): bool { $this->getConnection()->headBucket([ 'Bucket' => $this->bucket @@ -561,6 +576,7 @@ class AmazonS3 extends Common { return true; } + #[\Override] public function getId(): string { return $this->id; } @@ -589,6 +605,7 @@ class AmazonS3 extends Common { return true; } + #[\Override] public function getDirectoryContent(string $directory): \Traversable { $path = $this->normalizePath($directory); @@ -692,6 +709,7 @@ class AmazonS3 extends Common { } } + #[\Override] public function hasUpdated(string $path, int $time): bool { // for files we can get the proper mtime if ($path !== '' && $object = $this->headObject($path)) { @@ -705,11 +723,13 @@ class AmazonS3 extends Common { } } + #[\Override] public function needsPartFile(): bool { // handled natively by the S3 backend/client integration return false; } + #[\Override] public function writeStream(string $path, $stream, ?int $size = null): int { if ($size === null) { $size = 0; diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php index 36e8651e530..e7c818a6259 100644 --- a/apps/files_external/lib/Lib/Storage/FTP.php +++ b/apps/files_external/lib/Lib/Storage/FTP.php @@ -82,6 +82,7 @@ class FTP extends Common { return $this->connection; } + #[\Override] public function getId(): string { return 'ftp::' . $this->username . '@' . $this->host . '/' . $this->root; } @@ -98,6 +99,7 @@ class FTP extends Common { } } + #[\Override] public function filemtime(string $path): int|false { $result = $this->getConnection()->mdtm($this->buildPath($path)); @@ -130,6 +132,7 @@ class FTP extends Common { } } + #[\Override] public function filesize(string $path): false|int|float { $result = $this->getConnection()->size($this->buildPath($path)); if ($result === -1) { @@ -139,6 +142,7 @@ class FTP extends Common { } } + #[\Override] public function rmdir(string $path): bool { if ($this->is_dir($path)) { $result = $this->getConnection()->rmdir($this->buildPath($path)); @@ -170,6 +174,7 @@ class FTP extends Common { return $result; } + #[\Override] public function test(): bool { try { return $this->getConnection()->systype() !== false; @@ -178,6 +183,7 @@ class FTP extends Common { } } + #[\Override] public function stat(string $path): array|false { if (!$this->file_exists($path)) { return false; @@ -188,6 +194,7 @@ class FTP extends Common { ]; } + #[\Override] public function file_exists(string $path): bool { if ($path === '' || $path === '.' || $path === '/') { return true; @@ -195,6 +202,7 @@ class FTP extends Common { return $this->filetype($path) !== false; } + #[\Override] public function unlink(string $path): bool { switch ($this->filetype($path)) { case 'dir': @@ -206,11 +214,13 @@ class FTP extends Common { } } + #[\Override] public function opendir(string $path) { $files = $this->getConnection()->nlist($this->buildPath($path)); return IteratorDirectory::wrap($files); } + #[\Override] public function mkdir(string $path): bool { if ($this->is_dir($path)) { return false; @@ -218,6 +228,7 @@ class FTP extends Common { return $this->getConnection()->mkdir($this->buildPath($path)) !== false; } + #[\Override] public function is_dir(string $path): bool { if ($path === '') { return true; @@ -230,10 +241,12 @@ class FTP extends Common { } } + #[\Override] public function is_file(string $path): bool { return $this->filesize($path) !== false; } + #[\Override] public function filetype(string $path): string|false { if ($this->is_dir($path)) { return 'dir'; @@ -244,6 +257,7 @@ class FTP extends Common { } } + #[\Override] public function fopen(string $path, string $mode) { $useExisting = true; switch ($mode) { @@ -285,6 +299,7 @@ class FTP extends Common { return false; } + #[\Override] public function writeStream(string $path, $stream, ?int $size = null): int { if ($size === null) { $stream = CountWrapper::wrap($stream, function ($writtenSize) use (&$size): void { @@ -310,6 +325,7 @@ class FTP extends Common { return $stream; } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { if ($this->file_exists($path)) { return false; @@ -319,11 +335,13 @@ class FTP extends Common { } } + #[\Override] public function rename(string $source, string $target): bool { $this->unlink($target); return $this->getConnection()->rename($this->buildPath($source), $this->buildPath($target)); } + #[\Override] public function getDirectoryContent(string $directory): \Traversable { $files = $this->getConnection()->mlsd($this->buildPath($directory)); $mimeTypeDetector = Server::get(IMimeTypeDetector::class); diff --git a/apps/files_external/lib/Lib/Storage/OwnCloud.php b/apps/files_external/lib/Lib/Storage/OwnCloud.php index 12c305de750..1d3e05f60ff 100644 --- a/apps/files_external/lib/Lib/Storage/OwnCloud.php +++ b/apps/files_external/lib/Lib/Storage/OwnCloud.php @@ -57,6 +57,7 @@ class OwnCloud extends DAV implements IDisableEncryptionStorage { parent::__construct($parameters); } + #[\Override] public function needsPartFile(): bool { return false; } diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php index 4ac6b28b9fc..e9c0804c23a 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -142,6 +142,7 @@ class SFTP extends Common { return $this->client; } + #[\Override] public function test(): bool { if ( !isset($this->host) @@ -152,6 +153,7 @@ class SFTP extends Common { return $this->getConnection()->nlist() !== false; } + #[\Override] public function getId(): string { $id = 'sftp::' . $this->user . '@' . $this->host; if ($this->port !== 22) { @@ -234,6 +236,7 @@ class SFTP extends Common { return []; } + #[\Override] public function mkdir(string $path): bool { try { return $this->getConnection()->mkdir($this->absPath($path)); @@ -242,6 +245,7 @@ class SFTP extends Common { } } + #[\Override] public function rmdir(string $path): bool { try { $result = $this->getConnection()->delete($this->absPath($path), true); @@ -254,6 +258,7 @@ class SFTP extends Common { } } + #[\Override] public function opendir(string $path) { try { $list = $this->getConnection()->nlist($this->absPath($path)); @@ -274,6 +279,7 @@ class SFTP extends Common { } } + #[\Override] public function filetype(string $path): string|false { try { $stat = $this->getConnection()->stat($this->absPath($path)); @@ -292,6 +298,7 @@ class SFTP extends Common { return false; } + #[\Override] public function file_exists(string $path): bool { try { return $this->getConnection()->stat($this->absPath($path)) !== false; @@ -300,6 +307,7 @@ class SFTP extends Common { } } + #[\Override] public function unlink(string $path): bool { try { return $this->getConnection()->delete($this->absPath($path), true); @@ -308,6 +316,7 @@ class SFTP extends Common { } } + #[\Override] public function fopen(string $path, string $mode) { $path = $this->cleanPath($path); try { @@ -356,6 +365,7 @@ class SFTP extends Common { return false; } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { $result = $this->getConnection()->touch($this->absPath($path), $mtime, $mtime); @@ -377,6 +387,7 @@ class SFTP extends Common { $this->getConnection()->get($path, $target); } + #[\Override] public function rename(string $source, string $target): bool { try { if ($this->file_exists($target)) { @@ -394,6 +405,7 @@ class SFTP extends Common { /** * @return array{mtime: int, size: int, ctime: int}|false */ + #[\Override] public function stat(string $path): array|false { try { $path = $this->cleanPath($path); @@ -425,6 +437,7 @@ class SFTP extends Common { return $url; } + #[\Override] public function file_put_contents(string $path, mixed $data): int|float|false { /** @psalm-suppress InternalMethod */ $result = $this->getConnection()->put($this->absPath($path), $data); @@ -438,6 +451,7 @@ class SFTP extends Common { } } + #[\Override] public function writeStream(string $path, $stream, ?int $size = null): int { if ($size === null) { $stream = CountWrapper::wrap($stream, function (int $writtenSize) use (&$size): void { @@ -463,6 +477,7 @@ class SFTP extends Common { } } + #[\Override] public function copy(string $source, string $target): bool { if ($this->is_dir($source) || $this->is_dir($target)) { return parent::copy($source, $target); @@ -490,6 +505,7 @@ class SFTP extends Common { } } + #[\Override] public function getPermissions(string $path): int { $stat = $this->getConnection()->stat($this->absPath($path)); if (!$stat) { @@ -502,6 +518,7 @@ class SFTP extends Common { } } + #[\Override] public function getMetaData(string $path): ?array { $stat = $this->getConnection()->stat($this->absPath($path)); if (!$stat) { diff --git a/apps/files_external/lib/Lib/Storage/SFTPReadStream.php b/apps/files_external/lib/Lib/Storage/SFTPReadStream.php index d9a557ee4d0..e373dbdb433 100644 --- a/apps/files_external/lib/Lib/Storage/SFTPReadStream.php +++ b/apps/files_external/lib/Lib/Storage/SFTPReadStream.php @@ -64,6 +64,7 @@ class SFTPReadStream implements File { return $context; } + #[\Override] public function stream_open($path, $mode, $options, &$opened_path) { [, $path] = explode('://', $path); $path = '/' . ltrim($path); @@ -103,6 +104,7 @@ class SFTPReadStream implements File { return true; } + #[\Override] public function stream_seek($offset, $whence = SEEK_SET) { switch ($whence) { case SEEK_SET: @@ -125,10 +127,12 @@ class SFTPReadStream implements File { $this->request_chunk(256 * 1024); } + #[\Override] public function stream_tell() { return $this->readPosition; } + #[\Override] public function stream_read($count) { if (!$this->eof && strlen($this->buffer) < $count) { $chunk = $this->read_chunk(); @@ -176,34 +180,42 @@ class SFTPReadStream implements File { } } + #[\Override] public function stream_write($data) { return false; } + #[\Override] public function stream_set_option($option, $arg1, $arg2) { return false; } + #[\Override] public function stream_truncate($size) { return false; } + #[\Override] public function stream_stat() { return false; } + #[\Override] public function stream_lock($operation) { return false; } + #[\Override] public function stream_flush() { return false; } + #[\Override] public function stream_eof() { return $this->eof; } + #[\Override] public function stream_close() { // we still have a read request incoming that needs to be handled before we can close if ($this->pendingRead) { diff --git a/apps/files_external/lib/Lib/Storage/SFTPWriteStream.php b/apps/files_external/lib/Lib/Storage/SFTPWriteStream.php index f1dba8ec223..ececbf39bbf 100644 --- a/apps/files_external/lib/Lib/Storage/SFTPWriteStream.php +++ b/apps/files_external/lib/Lib/Storage/SFTPWriteStream.php @@ -61,6 +61,7 @@ class SFTPWriteStream implements File { return $context; } + #[\Override] public function stream_open($path, $mode, $options, &$opened_path) { [, $path] = explode('://', $path); $path = '/' . ltrim($path); @@ -100,18 +101,22 @@ class SFTPWriteStream implements File { return true; } + #[\Override] public function stream_seek($offset, $whence = SEEK_SET) { return false; } + #[\Override] public function stream_tell() { return $this->writePosition; } + #[\Override] public function stream_read($count) { return false; } + #[\Override] public function stream_write($data) { $written = strlen($data); $this->writePosition += $written; @@ -127,22 +132,27 @@ class SFTPWriteStream implements File { return $written; } + #[\Override] public function stream_set_option($option, $arg1, $arg2) { return false; } + #[\Override] public function stream_truncate($size) { return false; } + #[\Override] public function stream_stat() { return false; } + #[\Override] public function stream_lock($operation) { return false; } + #[\Override] public function stream_flush() { $size = strlen($this->buffer); $packet = pack('Na*N3a*', strlen($this->handle), $this->handle, $this->internalPosition / 4294967296, $this->internalPosition, $size, $this->buffer); @@ -155,10 +165,12 @@ class SFTPWriteStream implements File { return $this->sftp->_read_put_responses(1); } + #[\Override] public function stream_eof() { return $this->eof; } + #[\Override] public function stream_close() { $this->stream_flush(); if (!$this->sftp->_close_handle($this->handle)) { diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 679e3ad791c..9628335c804 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -133,6 +133,7 @@ class SMB extends Common implements INotifyStorage { return [null, $user]; } + #[\Override] public function getId(): string { // FIXME: double slash to keep compatible with the old storage ids, // failure to do so will lead to creation of a new storage id and @@ -294,6 +295,7 @@ class SMB extends Common implements INotifyStorage { * @param string $source the old name of the path * @param string $target the new name of the path */ + #[\Override] public function rename(string $source, string $target, bool $retry = true): bool { if ($this->isRootDir($source) || $this->isRootDir($target)) { return false; @@ -333,6 +335,7 @@ class SMB extends Common implements INotifyStorage { return $result; } + #[\Override] public function stat(string $path, bool $retry = true): array|false { try { $result = $this->formatInfo($this->getFileInfo($path)); @@ -387,6 +390,7 @@ class SMB extends Common implements INotifyStorage { return $this->share->getName() && (!$this->root || $this->root === '/'); } + #[\Override] public function unlink(string $path): bool { if ($this->isRootDir($path)) { return false; @@ -414,6 +418,7 @@ class SMB extends Common implements INotifyStorage { /** * check if a file or folder has been updated since $time */ + #[\Override] public function hasUpdated(string $path, int $time): bool { if (!$path && $this->root === '/') { // mtime doesn't work for shares, but giving the nature of the backend, @@ -428,6 +433,7 @@ class SMB extends Common implements INotifyStorage { /** * @return resource|false */ + #[\Override] public function fopen(string $path, string $mode) { $fullPath = $this->buildPath($path); try { @@ -498,6 +504,7 @@ class SMB extends Common implements INotifyStorage { } } + #[\Override] public function rmdir(string $path): bool { if ($this->isRootDir($path)) { return false; @@ -525,6 +532,7 @@ class SMB extends Common implements INotifyStorage { } } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { try { if (!$this->file_exists($path)) { @@ -541,6 +549,7 @@ class SMB extends Common implements INotifyStorage { } } + #[\Override] public function getMetaData(string $path): ?array { try { $fileInfo = $this->getFileInfo($path); @@ -586,6 +595,7 @@ class SMB extends Common implements INotifyStorage { return $data; } + #[\Override] public function opendir(string $path) { try { $files = $this->getFolderContents($path); @@ -601,6 +611,7 @@ class SMB extends Common implements INotifyStorage { return IteratorDirectory::wrap($names); } + #[\Override] public function getDirectoryContent(string $directory): \Traversable { try { $files = $this->getFolderContents($directory); @@ -614,6 +625,7 @@ class SMB extends Common implements INotifyStorage { } } + #[\Override] public function filetype(string $path): string|false { try { return $this->getFileInfo($path)->isDirectory() ? 'dir' : 'file'; @@ -624,6 +636,7 @@ class SMB extends Common implements INotifyStorage { } } + #[\Override] public function mkdir(string $path): bool { $path = $this->buildPath($path); try { @@ -637,6 +650,7 @@ class SMB extends Common implements INotifyStorage { } } + #[\Override] public function file_exists(string $path): bool { try { // Case sensitive filesystem doesn't matter for root directory @@ -661,6 +675,7 @@ class SMB extends Common implements INotifyStorage { } } + #[\Override] public function isReadable(string $path): bool { try { $info = $this->getFileInfo($path); @@ -672,6 +687,7 @@ class SMB extends Common implements INotifyStorage { } } + #[\Override] public function isUpdatable(string $path): bool { try { $info = $this->getFileInfo($path); @@ -685,6 +701,7 @@ class SMB extends Common implements INotifyStorage { } } + #[\Override] public function isDeletable(string $path): bool { try { $info = $this->getFileInfo($path); @@ -704,6 +721,7 @@ class SMB extends Common implements INotifyStorage { return Server::available($system) || NativeServer::available($system) ?: ['smbclient']; } + #[\Override] public function test(): bool { try { return parent::test(); @@ -727,6 +745,7 @@ class SMB extends Common implements INotifyStorage { }); } + #[\Override] public function notify(string $path): SMBNotifyHandler { $path = '/' . ltrim($path, '/'); $shareNotifyHandler = $this->share->notify($this->buildPath($path)); diff --git a/apps/files_external/lib/Lib/Storage/StreamWrapper.php b/apps/files_external/lib/Lib/Storage/StreamWrapper.php index 1272b9d4d8a..b5387d31d68 100644 --- a/apps/files_external/lib/Lib/Storage/StreamWrapper.php +++ b/apps/files_external/lib/Lib/Storage/StreamWrapper.php @@ -13,10 +13,12 @@ abstract class StreamWrapper extends Common { abstract public function constructUrl(string $path): ?string; + #[\Override] public function mkdir(string $path): bool { return mkdir($this->constructUrl($path)); } + #[\Override] public function rmdir(string $path): bool { if ($this->is_dir($path) && $this->isDeletable($path)) { $dh = $this->opendir($path); @@ -39,18 +41,22 @@ abstract class StreamWrapper extends Common { } } + #[\Override] public function opendir(string $path) { return opendir($this->constructUrl($path)); } + #[\Override] public function filetype(string $path): string|false { return @filetype($this->constructUrl($path)); } + #[\Override] public function file_exists(string $path): bool { return file_exists($this->constructUrl($path)); } + #[\Override] public function unlink(string $path): bool { $url = $this->constructUrl($path); $success = unlink($url); @@ -60,10 +66,12 @@ abstract class StreamWrapper extends Common { return $success; } + #[\Override] public function fopen(string $path, string $mode) { return fopen($this->constructUrl($path), $mode); } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { if ($this->file_exists($path)) { if (is_null($mtime)) { @@ -89,10 +97,12 @@ abstract class StreamWrapper extends Common { return copy($path, $this->constructUrl($target)); } + #[\Override] public function rename(string $source, string $target): bool { return rename($this->constructUrl($source), $this->constructUrl($target)); } + #[\Override] public function stat(string $path): array|false { return stat($this->constructUrl($path)); } diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php index 6232b87cbe4..291e8bf3898 100644 --- a/apps/files_external/lib/Lib/Storage/Swift.php +++ b/apps/files_external/lib/Lib/Storage/Swift.php @@ -175,6 +175,7 @@ class Swift extends Common { $this->mimeDetector = Server::get(IMimeTypeDetector::class); } + #[\Override] public function mkdir(string $path): bool { $path = $this->normalizePath($path); @@ -206,6 +207,7 @@ class Swift extends Common { return true; } + #[\Override] public function file_exists(string $path): bool { $path = $this->normalizePath($path); @@ -216,6 +218,7 @@ class Swift extends Common { return $this->doesObjectExist($path); } + #[\Override] public function rmdir(string $path): bool { $path = $this->normalizePath($path); @@ -250,6 +253,7 @@ class Swift extends Common { return true; } + #[\Override] public function opendir(string $path) { $path = $this->normalizePath($path); @@ -286,6 +290,7 @@ class Swift extends Common { } } + #[\Override] public function stat(string $path): array|false { $path = $this->normalizePath($path); if ($path === '.') { @@ -326,6 +331,7 @@ class Swift extends Common { ]; } + #[\Override] public function filetype(string $path) { $path = $this->normalizePath($path); @@ -342,6 +348,7 @@ class Swift extends Common { } } + #[\Override] public function unlink(string $path): bool { $path = $this->normalizePath($path); @@ -366,6 +373,7 @@ class Swift extends Common { return true; } + #[\Override] public function fopen(string $path, string $mode) { $path = $this->normalizePath($path); @@ -416,6 +424,7 @@ class Swift extends Common { } } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { $path = $this->normalizePath($path); if (is_null($mtime)) { @@ -446,6 +455,7 @@ class Swift extends Common { } } + #[\Override] public function copy(string $source, string $target): bool { $source = $this->normalizePath($source); $target = $this->normalizePath($target); @@ -507,6 +517,7 @@ class Swift extends Common { return true; } + #[\Override] public function rename(string $source, string $target): bool { $source = $this->normalizePath($source); $target = $this->normalizePath($target); @@ -532,6 +543,7 @@ class Swift extends Common { return false; } + #[\Override] public function getId(): string { return $this->id; } @@ -562,6 +574,7 @@ class Swift extends Common { unlink($tmpFile); } + #[\Override] public function hasUpdated(string $path, int $time): bool { if ($this->is_file($path)) { return parent::hasUpdated($path, $time); diff --git a/apps/files_external/lib/Lib/Storage/SystemBridge.php b/apps/files_external/lib/Lib/Storage/SystemBridge.php index 80449b2744b..c04c2d67235 100644 --- a/apps/files_external/lib/Lib/Storage/SystemBridge.php +++ b/apps/files_external/lib/Lib/Storage/SystemBridge.php @@ -20,6 +20,7 @@ class SystemBridge extends System { ) { } + #[\Override] protected function getBinaryPath(string $binary): ?string { $path = $this->binaryFinder->findBinaryPath($binary); return $path !== false ? $path : null; diff --git a/apps/files_external/lib/Lib/StorageConfig.php b/apps/files_external/lib/Lib/StorageConfig.php index ad752cfe1de..ee0f34406f4 100644 --- a/apps/files_external/lib/Lib/StorageConfig.php +++ b/apps/files_external/lib/Lib/StorageConfig.php @@ -382,6 +382,7 @@ class StorageConfig implements \JsonSerializable { * Serialize config to JSON * @return Files_ExternalStorageConfig */ + #[\Override] public function jsonSerialize(bool $obfuscate = false): array { $result = []; if (!is_null($this->id)) { diff --git a/apps/files_external/lib/Listener/GroupDeletedListener.php b/apps/files_external/lib/Listener/GroupDeletedListener.php index 244b3b2371f..79a81ac7eab 100644 --- a/apps/files_external/lib/Listener/GroupDeletedListener.php +++ b/apps/files_external/lib/Listener/GroupDeletedListener.php @@ -20,6 +20,7 @@ class GroupDeletedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof GroupDeletedEvent) { return; diff --git a/apps/files_external/lib/Listener/LoadAdditionalListener.php b/apps/files_external/lib/Listener/LoadAdditionalListener.php index 6ba917759c3..42d93ae6c1e 100644 --- a/apps/files_external/lib/Listener/LoadAdditionalListener.php +++ b/apps/files_external/lib/Listener/LoadAdditionalListener.php @@ -28,6 +28,7 @@ class LoadAdditionalListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoadAdditionalScriptsEvent)) { return; diff --git a/apps/files_external/lib/Listener/StorePasswordListener.php b/apps/files_external/lib/Listener/StorePasswordListener.php index 8580176b014..f8e964a1f19 100644 --- a/apps/files_external/lib/Listener/StorePasswordListener.php +++ b/apps/files_external/lib/Listener/StorePasswordListener.php @@ -22,6 +22,7 @@ class StorePasswordListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof UserLoggedInEvent && !$event instanceof PasswordUpdatedEvent) { return; diff --git a/apps/files_external/lib/Listener/UserDeletedListener.php b/apps/files_external/lib/Listener/UserDeletedListener.php index 337fd12f311..81f150c0848 100644 --- a/apps/files_external/lib/Listener/UserDeletedListener.php +++ b/apps/files_external/lib/Listener/UserDeletedListener.php @@ -20,6 +20,7 @@ class UserDeletedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof UserDeletedEvent) { return; diff --git a/apps/files_external/lib/Migration/DummyUserSession.php b/apps/files_external/lib/Migration/DummyUserSession.php index 1ebf0e1ec4f..19e070ef674 100644 --- a/apps/files_external/lib/Migration/DummyUserSession.php +++ b/apps/files_external/lib/Migration/DummyUserSession.php @@ -14,24 +14,30 @@ class DummyUserSession implements IUserSession { private ?IUser $user = null; + #[\Override] public function login($uid, $password) { } + #[\Override] public function logout() { } + #[\Override] public function setUser($user) { $this->user = $user; } + #[\Override] public function setVolatileActiveUser(?IUser $user): void { $this->user = $user; } + #[\Override] public function getUser() { return $this->user; } + #[\Override] public function isLoggedIn() { return !is_null($this->user); } @@ -42,6 +48,7 @@ class DummyUserSession implements IUserSession { * @return string|null * @since 17.0.0 */ + #[\Override] public function getImpersonatingUserID() : ?string { return null; } @@ -51,6 +58,7 @@ class DummyUserSession implements IUserSession { * * @since 17.0.0 */ + #[\Override] public function setImpersonatingUserID(bool $useCurrentUser = true): void { //no OP } diff --git a/apps/files_external/lib/Migration/Version1011Date20200630192246.php b/apps/files_external/lib/Migration/Version1011Date20200630192246.php index dffbd70aa58..81fef2002ae 100644 --- a/apps/files_external/lib/Migration/Version1011Date20200630192246.php +++ b/apps/files_external/lib/Migration/Version1011Date20200630192246.php @@ -21,6 +21,7 @@ class Version1011Date20200630192246 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/files_external/lib/Migration/Version1015Date20211104103506.php b/apps/files_external/lib/Migration/Version1015Date20211104103506.php index e24a306d8b1..6fb1fb92a9e 100644 --- a/apps/files_external/lib/Migration/Version1015Date20211104103506.php +++ b/apps/files_external/lib/Migration/Version1015Date20211104103506.php @@ -26,6 +26,7 @@ class Version1015Date20211104103506 extends SimpleMigrationStep { ) { } + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { $qb = $this->connection->getQueryBuilder(); $qb->update('storages') diff --git a/apps/files_external/lib/Migration/Version1016Date20220324154536.php b/apps/files_external/lib/Migration/Version1016Date20220324154536.php index fb2cccfdd80..fdf532a27aa 100644 --- a/apps/files_external/lib/Migration/Version1016Date20220324154536.php +++ b/apps/files_external/lib/Migration/Version1016Date20220324154536.php @@ -21,6 +21,7 @@ class Version1016Date20220324154536 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/apps/files_external/lib/Migration/Version22000Date20210216084416.php b/apps/files_external/lib/Migration/Version22000Date20210216084416.php index c4878e602c0..4e359a5b704 100644 --- a/apps/files_external/lib/Migration/Version22000Date20210216084416.php +++ b/apps/files_external/lib/Migration/Version22000Date20210216084416.php @@ -23,6 +23,7 @@ class Version22000Date20210216084416 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/apps/files_external/lib/Service/ImportLegacyStoragesService.php b/apps/files_external/lib/Service/ImportLegacyStoragesService.php index 426561adbfc..d143f2a4c43 100644 --- a/apps/files_external/lib/Service/ImportLegacyStoragesService.php +++ b/apps/files_external/lib/Service/ImportLegacyStoragesService.php @@ -27,6 +27,7 @@ class ImportLegacyStoragesService extends LegacyStoragesService { * * @return array list of mount configs */ + #[\Override] protected function readLegacyConfig() { return $this->data; } diff --git a/apps/files_external/lib/Service/MountCacheService.php b/apps/files_external/lib/Service/MountCacheService.php index 119b7b6f8b6..51244fa464f 100644 --- a/apps/files_external/lib/Service/MountCacheService.php +++ b/apps/files_external/lib/Service/MountCacheService.php @@ -46,6 +46,7 @@ class MountCacheService implements IEventListener { $this->storageRootCache = new CappedMemoryCache(); } + #[\Override] public function handle(Event $event): void { if ($event instanceof StorageCreatedEvent) { $this->handleAddedStorage($event->getNewConfig()); diff --git a/apps/files_external/lib/Service/UserGlobalStoragesService.php b/apps/files_external/lib/Service/UserGlobalStoragesService.php index c76862996ae..70fbd8f198e 100644 --- a/apps/files_external/lib/Service/UserGlobalStoragesService.php +++ b/apps/files_external/lib/Service/UserGlobalStoragesService.php @@ -115,6 +115,7 @@ class UserGlobalStoragesService extends GlobalStoragesService { return $applicableGroups ? 1 : 0; } + #[\Override] protected function isApplicable(StorageConfig $config): bool { $applicableUsers = $config->getApplicableUsers(); $applicableGroups = $config->getApplicableGroups(); diff --git a/apps/files_external/lib/Service/UserStoragesService.php b/apps/files_external/lib/Service/UserStoragesService.php index ccd064df797..39f306219ae 100644 --- a/apps/files_external/lib/Service/UserStoragesService.php +++ b/apps/files_external/lib/Service/UserStoragesService.php @@ -50,6 +50,7 @@ class UserStoragesService extends StoragesService { * @param StorageConfig $storage storage data * @param string $signal signal to trigger */ + #[\Override] protected function triggerHooks(StorageConfig $storage, string $signal): void { $user = $this->getUser()->getUID(); @@ -70,6 +71,7 @@ class UserStoragesService extends StoragesService { * @param StorageConfig $oldStorage old storage data * @param StorageConfig $newStorage new storage data */ + #[\Override] protected function triggerChangeHooks(StorageConfig $oldStorage, StorageConfig $newStorage): void { // if mount point changed, it's like a deletion + creation if ($oldStorage->getMountPoint() !== $newStorage->getMountPoint()) { diff --git a/apps/files_external/lib/Settings/Admin.php b/apps/files_external/lib/Settings/Admin.php index 4a44a03707f..d91487a67e7 100644 --- a/apps/files_external/lib/Settings/Admin.php +++ b/apps/files_external/lib/Settings/Admin.php @@ -35,6 +35,7 @@ class Admin implements IDelegatedSettings { /** * @return TemplateResponse */ + #[\Override] public function getForm() { $this->setInitialState(); @@ -53,6 +54,7 @@ class Admin implements IDelegatedSettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection() { return 'externalstorages'; } @@ -64,14 +66,17 @@ class Admin implements IDelegatedSettings { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 40; } + #[\Override] public function getName(): string { return $this->l10n->t('External storage'); } + #[\Override] public function getAuthorizedAppConfig(): array { // No app config keys require delegation for external storage. return []; diff --git a/apps/files_external/lib/Settings/Personal.php b/apps/files_external/lib/Settings/Personal.php index 569fbd858fd..d7ee76bba77 100644 --- a/apps/files_external/lib/Settings/Personal.php +++ b/apps/files_external/lib/Settings/Personal.php @@ -34,12 +34,14 @@ class Personal implements ISettings { /** * @return TemplateResponse */ + #[\Override] public function getForm() { $this->setInitialState(); $this->loadScriptsAndStyles(); return new TemplateResponse('files_external', 'settings', renderAs: ''); } + #[\Override] public function getSection() { if (!$this->backendService->isUserMountingAllowed()) { return null; @@ -55,6 +57,7 @@ class Personal implements ISettings { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 40; } diff --git a/apps/files_external/lib/Settings/Section.php b/apps/files_external/lib/Settings/Section.php index 2fca049d152..cd18e3c105c 100644 --- a/apps/files_external/lib/Settings/Section.php +++ b/apps/files_external/lib/Settings/Section.php @@ -29,6 +29,7 @@ class Section implements IIconSection { * * @returns string */ + #[\Override] public function getID() { return 'externalstorages'; } @@ -39,6 +40,7 @@ class Section implements IIconSection { * * @return string */ + #[\Override] public function getName() { return $this->l->t('External storage'); } @@ -50,6 +52,7 @@ class Section implements IIconSection { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 10; } @@ -57,6 +60,7 @@ class Section implements IIconSection { /** * {@inheritdoc} */ + #[\Override] public function getIcon() { return $this->url->imagePath('files_external', 'app-dark.svg'); } diff --git a/apps/files_reminders/lib/AppInfo/Application.php b/apps/files_reminders/lib/AppInfo/Application.php index 2776e9db0b1..1c002fac21a 100644 --- a/apps/files_reminders/lib/AppInfo/Application.php +++ b/apps/files_reminders/lib/AppInfo/Application.php @@ -31,9 +31,11 @@ class Application extends App implements IBootstrap { parent::__construct(static::APP_ID); } + #[\Override] public function boot(IBootContext $context): void { } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerNotifierService(Notifier::class); diff --git a/apps/files_reminders/lib/BackgroundJob/CleanUpReminders.php b/apps/files_reminders/lib/BackgroundJob/CleanUpReminders.php index 35b72b190e8..7d006a02800 100644 --- a/apps/files_reminders/lib/BackgroundJob/CleanUpReminders.php +++ b/apps/files_reminders/lib/BackgroundJob/CleanUpReminders.php @@ -27,6 +27,7 @@ class CleanUpReminders extends TimedJob { /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ + #[\Override] protected function run($argument) { $this->reminderService->cleanUp(500); } diff --git a/apps/files_reminders/lib/BackgroundJob/ScheduledNotifications.php b/apps/files_reminders/lib/BackgroundJob/ScheduledNotifications.php index ab8c762d674..8e615c3a6d6 100644 --- a/apps/files_reminders/lib/BackgroundJob/ScheduledNotifications.php +++ b/apps/files_reminders/lib/BackgroundJob/ScheduledNotifications.php @@ -31,6 +31,7 @@ class ScheduledNotifications extends TimedJob { /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ + #[\Override] public function run($argument) { $reminders = $this->reminderMapper->findOverdue(); foreach ($reminders as $reminder) { diff --git a/apps/files_reminders/lib/Command/ListCommand.php b/apps/files_reminders/lib/Command/ListCommand.php index 989b721db5f..7ad3acb8edd 100644 --- a/apps/files_reminders/lib/Command/ListCommand.php +++ b/apps/files_reminders/lib/Command/ListCommand.php @@ -28,6 +28,7 @@ class ListCommand extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('files:reminders') @@ -46,6 +47,7 @@ class ListCommand extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); diff --git a/apps/files_reminders/lib/Dav/PropFindPlugin.php b/apps/files_reminders/lib/Dav/PropFindPlugin.php index 7fa45a4b854..7be6205ac62 100644 --- a/apps/files_reminders/lib/Dav/PropFindPlugin.php +++ b/apps/files_reminders/lib/Dav/PropFindPlugin.php @@ -32,6 +32,7 @@ class PropFindPlugin extends ServerPlugin { ) { } + #[\Override] public function initialize(Server $server): void { $server->on('preloadCollection', $this->preloadCollection(...)); $server->on('propFind', [$this, 'propFind']); diff --git a/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php b/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php index a2953d617c0..5525fe41c41 100644 --- a/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php +++ b/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php @@ -25,6 +25,7 @@ class LoadAdditionalScriptsListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoadAdditionalScriptsEvent)) { return; diff --git a/apps/files_reminders/lib/Listener/NodeDeletedListener.php b/apps/files_reminders/lib/Listener/NodeDeletedListener.php index 06a4733e6cd..dbe88761f8c 100644 --- a/apps/files_reminders/lib/Listener/NodeDeletedListener.php +++ b/apps/files_reminders/lib/Listener/NodeDeletedListener.php @@ -21,6 +21,7 @@ class NodeDeletedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof NodeDeletedEvent)) { return; diff --git a/apps/files_reminders/lib/Listener/SabrePluginAddListener.php b/apps/files_reminders/lib/Listener/SabrePluginAddListener.php index b2c4501f9af..d24167b317b 100644 --- a/apps/files_reminders/lib/Listener/SabrePluginAddListener.php +++ b/apps/files_reminders/lib/Listener/SabrePluginAddListener.php @@ -22,6 +22,7 @@ class SabrePluginAddListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof SabrePluginAddEvent)) { return; diff --git a/apps/files_reminders/lib/Listener/UserDeletedListener.php b/apps/files_reminders/lib/Listener/UserDeletedListener.php index 366a5e60420..185af2f0c75 100644 --- a/apps/files_reminders/lib/Listener/UserDeletedListener.php +++ b/apps/files_reminders/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/apps/files_reminders/lib/Migration/Version10000Date20230725162149.php b/apps/files_reminders/lib/Migration/Version10000Date20230725162149.php index 74614c6515e..c3ddbc719ba 100644 --- a/apps/files_reminders/lib/Migration/Version10000Date20230725162149.php +++ b/apps/files_reminders/lib/Migration/Version10000Date20230725162149.php @@ -20,6 +20,7 @@ class Version10000Date20230725162149 extends SimpleMigrationStep { /** * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/files_reminders/lib/Model/RichReminder.php b/apps/files_reminders/lib/Model/RichReminder.php index 4f221252717..eb89831e4cd 100644 --- a/apps/files_reminders/lib/Model/RichReminder.php +++ b/apps/files_reminders/lib/Model/RichReminder.php @@ -35,14 +35,17 @@ class RichReminder extends Reminder implements JsonSerializable { return $node; } + #[\Override] protected function getter(string $name): mixed { return $this->reminder->getter($name); } + #[\Override] public function __call(string $methodName, array $args) { return $this->reminder->__call($methodName, $args); } + #[\Override] public function jsonSerialize(): array { return [ 'userId' => $this->getUserId(), diff --git a/apps/files_reminders/lib/Notification/Notifier.php b/apps/files_reminders/lib/Notification/Notifier.php index 337ef04c814..80022bf5314 100644 --- a/apps/files_reminders/lib/Notification/Notifier.php +++ b/apps/files_reminders/lib/Notification/Notifier.php @@ -28,10 +28,12 @@ class Notifier implements INotifier { ) { } + #[\Override] public function getID(): string { return Application::APP_ID; } + #[\Override] public function getName(): string { return $this->l10nFactory->get(Application::APP_ID)->t('File reminders'); } @@ -39,6 +41,7 @@ class Notifier implements INotifier { /** * @throws UnknownNotificationException */ + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { $l = $this->l10nFactory->get(Application::APP_ID, $languageCode); diff --git a/apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php b/apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php index e5890567181..0552ae93591 100644 --- a/apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php +++ b/apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php @@ -21,14 +21,17 @@ class NeedNotificationsApp implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Files reminder'); } + #[\Override] public function getCategory(): string { return 'system'; } + #[\Override] public function run(): SetupResult { if ($this->appManager->isEnabledForAnyone('notifications')) { return SetupResult::success($this->l10n->t('The "files_reminders" app can work properly.')); diff --git a/apps/files_sharing/lib/Activity/Filter.php b/apps/files_sharing/lib/Activity/Filter.php index 6e1110e6f29..cc2d50ec8b3 100644 --- a/apps/files_sharing/lib/Activity/Filter.php +++ b/apps/files_sharing/lib/Activity/Filter.php @@ -26,6 +26,7 @@ class Filter implements IFilter { * @return string Lowercase a-z only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'files_sharing'; } @@ -34,6 +35,7 @@ class Filter implements IFilter { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('File shares'); } @@ -42,6 +44,7 @@ class Filter implements IFilter { * @return int * @since 11.0.0 */ + #[\Override] public function getPriority() { return 31; } @@ -50,6 +53,7 @@ class Filter implements IFilter { * @return string Full URL to an icon, empty string when none is given * @since 11.0.0 */ + #[\Override] public function getIcon() { return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')); } @@ -59,6 +63,7 @@ class Filter implements IFilter { * @return string[] An array of allowed apps from which activities should be displayed * @since 11.0.0 */ + #[\Override] public function filterTypes(array $types) { return array_intersect([ self::TYPE_SHARED, @@ -71,6 +76,7 @@ class Filter implements IFilter { * @return string[] An array of allowed apps from which activities should be displayed * @since 11.0.0 */ + #[\Override] public function allowedApps() { return [ 'files_sharing', diff --git a/apps/files_sharing/lib/Activity/Providers/Base.php b/apps/files_sharing/lib/Activity/Providers/Base.php index b50e2ce5373..1a58739555a 100644 --- a/apps/files_sharing/lib/Activity/Providers/Base.php +++ b/apps/files_sharing/lib/Activity/Providers/Base.php @@ -44,6 +44,7 @@ abstract class Base implements IProvider { * @throws UnknownActivityException * @since 11.0.0 */ + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'files_sharing') { throw new UnknownActivityException(); diff --git a/apps/files_sharing/lib/Activity/Providers/Downloads.php b/apps/files_sharing/lib/Activity/Providers/Downloads.php index bddf2d30f73..e2d8703c3a1 100644 --- a/apps/files_sharing/lib/Activity/Providers/Downloads.php +++ b/apps/files_sharing/lib/Activity/Providers/Downloads.php @@ -21,6 +21,7 @@ class Downloads extends Base { * @throws \InvalidArgumentException * @since 11.0.0 */ + #[\Override] public function parseShortVersion(IEvent $event) { $parsedParameters = $this->getParsedParameters($event); @@ -51,6 +52,7 @@ class Downloads extends Base { * @throws \InvalidArgumentException * @since 11.0.0 */ + #[\Override] public function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null) { $parsedParameters = $this->getParsedParameters($event); diff --git a/apps/files_sharing/lib/Activity/Providers/Groups.php b/apps/files_sharing/lib/Activity/Providers/Groups.php index d0086c05ced..09c450683ef 100644 --- a/apps/files_sharing/lib/Activity/Providers/Groups.php +++ b/apps/files_sharing/lib/Activity/Providers/Groups.php @@ -48,6 +48,7 @@ class Groups extends Base { * @throws \InvalidArgumentException * @since 11.0.0 */ + #[\Override] public function parseShortVersion(IEvent $event) { $parsedParameters = $this->getParsedParameters($event); @@ -82,6 +83,7 @@ class Groups extends Base { * @throws \InvalidArgumentException * @since 11.0.0 */ + #[\Override] public function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null) { $parsedParameters = $this->getParsedParameters($event); diff --git a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php index 15ffaf2cdb0..fef5c61bd88 100644 --- a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php +++ b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php @@ -22,6 +22,7 @@ class PublicLinks extends Base { * @throws \InvalidArgumentException * @since 11.0.0 */ + #[\Override] public function parseShortVersion(IEvent $event) { $parsedParameters = $this->getParsedParameters($event); @@ -58,6 +59,7 @@ class PublicLinks extends Base { * @throws \InvalidArgumentException * @since 11.0.0 */ + #[\Override] public function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null) { $parsedParameters = $this->getParsedParameters($event); diff --git a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php index 750d0747b62..1c759f93483 100644 --- a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php +++ b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php @@ -37,6 +37,7 @@ class RemoteShares extends Base { * @throws \InvalidArgumentException * @since 11.0.0 */ + #[\Override] public function parseShortVersion(IEvent $event) { $parsedParameters = $this->getParsedParameters($event); @@ -65,6 +66,7 @@ class RemoteShares extends Base { * @throws \InvalidArgumentException * @since 11.0.0 */ + #[\Override] public function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null) { $parsedParameters = $this->getParsedParameters($event); diff --git a/apps/files_sharing/lib/Activity/Providers/Users.php b/apps/files_sharing/lib/Activity/Providers/Users.php index 5c833ffae93..30635d2c8f2 100644 --- a/apps/files_sharing/lib/Activity/Providers/Users.php +++ b/apps/files_sharing/lib/Activity/Providers/Users.php @@ -28,6 +28,7 @@ class Users extends Base { * @throws \InvalidArgumentException * @since 11.0.0 */ + #[\Override] public function parseShortVersion(IEvent $event) { $parsedParameters = $this->getParsedParameters($event); @@ -72,6 +73,7 @@ class Users extends Base { * @throws \InvalidArgumentException * @since 11.0.0 */ + #[\Override] public function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null) { $parsedParameters = $this->getParsedParameters($event); diff --git a/apps/files_sharing/lib/Activity/Settings/PublicLinks.php b/apps/files_sharing/lib/Activity/Settings/PublicLinks.php index 3e6d7224a88..f19bae4b8f3 100644 --- a/apps/files_sharing/lib/Activity/Settings/PublicLinks.php +++ b/apps/files_sharing/lib/Activity/Settings/PublicLinks.php @@ -13,6 +13,7 @@ class PublicLinks extends ShareActivitySettings { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'public_links'; } @@ -21,6 +22,7 @@ class PublicLinks extends ShareActivitySettings { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('A file or folder shared by mail or by public link was downloaded'); } @@ -31,6 +33,7 @@ class PublicLinks extends ShareActivitySettings { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 20; } @@ -39,6 +42,7 @@ class PublicLinks extends ShareActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function canChangeStream() { return true; } @@ -47,6 +51,7 @@ class PublicLinks extends ShareActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledStream() { return true; } @@ -55,6 +60,7 @@ class PublicLinks extends ShareActivitySettings { * @return bool True when the option can be changed for the mail * @since 11.0.0 */ + #[\Override] public function canChangeMail() { return true; } @@ -63,6 +69,7 @@ class PublicLinks extends ShareActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledMail() { return false; } diff --git a/apps/files_sharing/lib/Activity/Settings/PublicLinksUpload.php b/apps/files_sharing/lib/Activity/Settings/PublicLinksUpload.php index 1e75cb20102..1552fb496de 100644 --- a/apps/files_sharing/lib/Activity/Settings/PublicLinksUpload.php +++ b/apps/files_sharing/lib/Activity/Settings/PublicLinksUpload.php @@ -13,6 +13,7 @@ class PublicLinksUpload extends ShareActivitySettings { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'public_links_upload'; } @@ -21,6 +22,7 @@ class PublicLinksUpload extends ShareActivitySettings { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('Files have been uploaded to a folder shared by mail or by public link'); } @@ -31,6 +33,7 @@ class PublicLinksUpload extends ShareActivitySettings { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 20; } @@ -39,6 +42,7 @@ class PublicLinksUpload extends ShareActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function canChangeStream() { return true; } @@ -47,6 +51,7 @@ class PublicLinksUpload extends ShareActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledStream() { return true; } @@ -55,6 +60,7 @@ class PublicLinksUpload extends ShareActivitySettings { * @return bool True when the option can be changed for the mail * @since 11.0.0 */ + #[\Override] public function canChangeMail() { return true; } @@ -63,6 +69,7 @@ class PublicLinksUpload extends ShareActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledMail() { return false; } diff --git a/apps/files_sharing/lib/Activity/Settings/RemoteShare.php b/apps/files_sharing/lib/Activity/Settings/RemoteShare.php index c9666e3d7ea..b39b1d0b558 100644 --- a/apps/files_sharing/lib/Activity/Settings/RemoteShare.php +++ b/apps/files_sharing/lib/Activity/Settings/RemoteShare.php @@ -13,6 +13,7 @@ class RemoteShare extends ShareActivitySettings { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'remote_share'; } @@ -21,6 +22,7 @@ class RemoteShare extends ShareActivitySettings { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('A file or folder was shared from another server'); } @@ -31,6 +33,7 @@ class RemoteShare extends ShareActivitySettings { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 11; } @@ -39,6 +42,7 @@ class RemoteShare extends ShareActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function canChangeStream() { return true; } @@ -47,6 +51,7 @@ class RemoteShare extends ShareActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledStream() { return true; } @@ -55,6 +60,7 @@ class RemoteShare extends ShareActivitySettings { * @return bool True when the option can be changed for the mail * @since 11.0.0 */ + #[\Override] public function canChangeMail() { return true; } @@ -63,6 +69,7 @@ class RemoteShare extends ShareActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledMail() { return false; } diff --git a/apps/files_sharing/lib/Activity/Settings/ShareActivitySettings.php b/apps/files_sharing/lib/Activity/Settings/ShareActivitySettings.php index 4d8d8278433..34b0a19cedf 100644 --- a/apps/files_sharing/lib/Activity/Settings/ShareActivitySettings.php +++ b/apps/files_sharing/lib/Activity/Settings/ShareActivitySettings.php @@ -20,10 +20,12 @@ abstract class ShareActivitySettings extends ActivitySettings { ) { } + #[\Override] public function getGroupIdentifier() { return 'sharing'; } + #[\Override] public function getGroupName() { return $this->l->t('Sharing'); } diff --git a/apps/files_sharing/lib/Activity/Settings/Shared.php b/apps/files_sharing/lib/Activity/Settings/Shared.php index 60f837efd5c..f558289d312 100644 --- a/apps/files_sharing/lib/Activity/Settings/Shared.php +++ b/apps/files_sharing/lib/Activity/Settings/Shared.php @@ -13,6 +13,7 @@ class Shared extends ShareActivitySettings { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'shared'; } @@ -21,6 +22,7 @@ class Shared extends ShareActivitySettings { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('A file or folder has been shared'); } @@ -31,6 +33,7 @@ class Shared extends ShareActivitySettings { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 10; } @@ -39,6 +42,7 @@ class Shared extends ShareActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function canChangeStream() { return true; } @@ -47,6 +51,7 @@ class Shared extends ShareActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledStream() { return true; } @@ -55,6 +60,7 @@ class Shared extends ShareActivitySettings { * @return bool True when the option can be changed for the mail * @since 11.0.0 */ + #[\Override] public function canChangeMail() { return true; } @@ -63,6 +69,7 @@ class Shared extends ShareActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledMail() { return false; } diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index 8f5c4c4c461..824a7f8b640 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -72,6 +72,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID, $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerService(ExternalMountProvider::class, function (ContainerInterface $c) { return new ExternalMountProvider( @@ -132,6 +133,7 @@ class Application extends App implements IBootstrap { $context->registerConfigLexicon(ConfigLexicon::class); } + #[\Override] public function boot(IBootContext $context): void { $context->injectFn([$this, 'registerMountProviders']); $context->injectFn([$this, 'registerEventsScripts']); diff --git a/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php b/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php index 2ecb504a9ce..857052829d7 100644 --- a/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php +++ b/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php @@ -30,6 +30,7 @@ class FederatedSharesDiscoverJob extends TimedJob { $this->setTimeSensitivity(self::TIME_INSENSITIVE); } + #[\Override] public function run($argument) { $qb = $this->connection->getQueryBuilder(); diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index f9042fc0765..c2b5e08f1e4 100644 --- a/apps/files_sharing/lib/Cache.php +++ b/apps/files_sharing/lib/Cache.php @@ -52,6 +52,7 @@ class Cache extends CacheJail { ); } + #[\Override] protected function getRoot() { if ($this->root === '') { $absoluteRoot = $this->sourceRootInfo->getPath(); @@ -69,10 +70,12 @@ class Cache extends CacheJail { return $this->root; } + #[\Override] public function getGetUnjailedRoot(): string { return $this->sourceRootInfo->getPath(); } + #[\Override] public function getCache(): ICache { if (is_null($this->cache)) { $sourceStorage = $this->storage->getSourceStorage(); @@ -86,6 +89,7 @@ class Cache extends CacheJail { return $this->cache; } + #[\Override] public function getNumericStorageId() { if (isset($this->numericId)) { return $this->numericId; @@ -94,6 +98,7 @@ class Cache extends CacheJail { } } + #[\Override] public function get($file) { if ($this->rootUnchanged && ($file === '' || $file === $this->sourceRootInfo->getId())) { return $this->formatCacheEntry(clone $this->sourceRootInfo, ''); @@ -101,26 +106,31 @@ class Cache extends CacheJail { return parent::get($file); } + #[\Override] public function update($id, array $data) { $this->rootUnchanged = false; parent::update($id, $data); } + #[\Override] public function insert($file, array $data) { $this->rootUnchanged = false; return parent::insert($file, $data); } + #[\Override] public function remove($file) { $this->rootUnchanged = false; parent::remove($file); } + #[\Override] public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { $this->rootUnchanged = false; return parent::moveFromCache($sourceCache, $sourcePath, $targetPath); } + #[\Override] protected function formatCacheEntry($entry, $path = null) { if (is_null($path)) { $path = $entry['path'] ?? ''; @@ -163,10 +173,12 @@ class Cache extends CacheJail { /** * remove all entries for files that are stored on the storage from the cache */ + #[\Override] public function clear() { // Not a valid action for Shared Cache } + #[\Override] public function getQueryFilterForStorage(): ISearchOperator { $storageFilter = \OC\Files\Cache\Cache::getQueryFilterForStorage(); @@ -185,6 +197,7 @@ class Cache extends CacheJail { ); } + #[\Override] public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry { if ($rawEntry->getStorageId() === $this->getNumericStorageId()) { return parent::getCacheEntryFromSearchResult($rawEntry); diff --git a/apps/files_sharing/lib/Capabilities.php b/apps/files_sharing/lib/Capabilities.php index ca298204307..6d4cf0a5045 100644 --- a/apps/files_sharing/lib/Capabilities.php +++ b/apps/files_sharing/lib/Capabilities.php @@ -97,6 +97,7 @@ class Capabilities implements ICapability { * }, * } */ + #[\Override] public function getCapabilities() { $res = []; diff --git a/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php b/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php index 803dfd6325f..5ce4f7dde7c 100644 --- a/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php +++ b/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php @@ -21,10 +21,12 @@ class ShareRecipientSorter implements ISorter { ) { } + #[\Override] public function getId(): string { return 'share-recipients'; } + #[\Override] public function sort(array &$sortArray, array $context) { // let's be tolerant. Comments uses "files" by default, other usages are often singular if ($context['itemType'] !== 'files' && $context['itemType'] !== 'file') { diff --git a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php index 1200bfde5af..f3550fb6f09 100644 --- a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php +++ b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php @@ -28,6 +28,7 @@ class CleanupRemoteStorages extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('sharing:cleanup-remote-storages') @@ -40,6 +41,7 @@ class CleanupRemoteStorages extends Command { ); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $remoteStorages = $this->getRemoteStorages(); diff --git a/apps/files_sharing/lib/Command/DeleteOrphanShares.php b/apps/files_sharing/lib/Command/DeleteOrphanShares.php index cb0006b9194..e15581b4113 100644 --- a/apps/files_sharing/lib/Command/DeleteOrphanShares.php +++ b/apps/files_sharing/lib/Command/DeleteOrphanShares.php @@ -23,6 +23,7 @@ class DeleteOrphanShares extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('sharing:delete-orphan-shares') @@ -37,6 +38,7 @@ class DeleteOrphanShares extends Base { ->addOption('with', null, InputOption::VALUE_REQUIRED, 'Only check shares with a specific user'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $force = $input->getOption('force'); $owner = $input->getOption('owner') ?: null; diff --git a/apps/files_sharing/lib/Command/ExiprationNotification.php b/apps/files_sharing/lib/Command/ExiprationNotification.php index b7ea5c5f14e..4b409230e74 100644 --- a/apps/files_sharing/lib/Command/ExiprationNotification.php +++ b/apps/files_sharing/lib/Command/ExiprationNotification.php @@ -29,12 +29,14 @@ class ExiprationNotification extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('sharing:expiration-notification') ->setDescription('Notify share initiators when a share will expire the next day.'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { //Current time $minTime = $this->time->getDateTime(); diff --git a/apps/files_sharing/lib/Command/FixShareOwners.php b/apps/files_sharing/lib/Command/FixShareOwners.php index 1cf5f82f5a8..e8590635ca0 100644 --- a/apps/files_sharing/lib/Command/FixShareOwners.php +++ b/apps/files_sharing/lib/Command/FixShareOwners.php @@ -21,6 +21,7 @@ class FixShareOwners extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('sharing:fix-share-owners') @@ -33,6 +34,7 @@ class FixShareOwners extends Base { ); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $shares = $this->orphanHelper->getAllShares(); $dryRun = $input->getOption('dry-run'); diff --git a/apps/files_sharing/lib/Command/ListShares.php b/apps/files_sharing/lib/Command/ListShares.php index 2d5cdbf7812..4a13aa92fa5 100644 --- a/apps/files_sharing/lib/Command/ListShares.php +++ b/apps/files_sharing/lib/Command/ListShares.php @@ -41,6 +41,7 @@ class ListShares extends Base { parent::__construct(); } + #[\Override] protected function configure() { parent::configure(); $this @@ -56,6 +57,7 @@ class ListShares extends Base { ->addOption('status', null, InputOption::VALUE_REQUIRED, 'only show shares with a specific status'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { if ($input->getOption('recursive') && !$input->getOption('parent')) { $output->writeln("recursive option can't be used without parent option"); diff --git a/apps/files_sharing/lib/Config/ConfigLexicon.php b/apps/files_sharing/lib/Config/ConfigLexicon.php index e34010edf79..c0f57a932bb 100644 --- a/apps/files_sharing/lib/Config/ConfigLexicon.php +++ b/apps/files_sharing/lib/Config/ConfigLexicon.php @@ -27,10 +27,12 @@ class ConfigLexicon implements ILexicon { public const UPDATE_CUTOFF_TIME = 'update_cutoff_time'; public const USER_NEEDS_SHARE_REFRESH = 'user_needs_share_refresh'; + #[\Override] public function getStrictness(): Strictness { return Strictness::IGNORE; } + #[\Override] public function getAppConfigs(): array { return [ new Entry(self::SHOW_FEDERATED_AS_INTERNAL, ValueType::BOOL, false, 'shows federated shares as internal shares', true), @@ -41,6 +43,7 @@ class ConfigLexicon implements ILexicon { ]; } + #[\Override] public function getUserConfigs(): array { return [ new Entry(self::USER_NEEDS_SHARE_REFRESH, ValueType::BOOL, true, 'whether a user needs to have the receiving share data refreshed for possible changes'), diff --git a/apps/files_sharing/lib/Controller/PublicPreviewController.php b/apps/files_sharing/lib/Controller/PublicPreviewController.php index 9056161af84..01a08a0674a 100644 --- a/apps/files_sharing/lib/Controller/PublicPreviewController.php +++ b/apps/files_sharing/lib/Controller/PublicPreviewController.php @@ -42,10 +42,12 @@ class PublicPreviewController extends PublicShareController { parent::__construct($appName, $request, $session); } + #[\Override] protected function getPasswordHash(): ?string { return $this->share->getPassword(); } + #[\Override] public function isValidToken(): bool { try { $this->share = $this->shareManager->getShareByToken($this->getToken()); @@ -55,6 +57,7 @@ class PublicPreviewController extends PublicShareController { } } + #[\Override] protected function isPasswordProtected(): bool { return $this->share->getPassword() !== null; } diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index a2ca205fdaf..69db7337469 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -85,6 +85,7 @@ class ShareController extends AuthPublicShareController { * Show the authentication page * The form has to submit to the authenticate method route */ + #[\Override] #[PublicPage] #[NoCSRFRequired] public function showAuthenticate(): TemplateResponse { @@ -98,6 +99,7 @@ class ShareController extends AuthPublicShareController { /** * The template to show when authentication failed */ + #[\Override] protected function showAuthFailed(): TemplateResponse { $templateParameters = ['share' => $this->share, 'wrongpw' => true]; @@ -109,6 +111,7 @@ class ShareController extends AuthPublicShareController { /** * The template to show after user identification */ + #[\Override] protected function showIdentificationResult(bool $success = false): TemplateResponse { $templateParameters = ['share' => $this->share, 'identityOk' => $success]; @@ -123,6 +126,7 @@ class ShareController extends AuthPublicShareController { * @param ?string $identityToken * @return bool */ + #[\Override] protected function validateIdentity(?string $identityToken = null): bool { if ($this->share->getShareType() !== IShare::TYPE_EMAIL) { return false; @@ -138,6 +142,7 @@ class ShareController extends AuthPublicShareController { /** * Generates a password for the share, respecting any password policy defined */ + #[\Override] protected function generatePassword(): void { $event = new GenerateSecurePasswordEvent(PasswordContext::SHARING); $this->eventDispatcher->dispatchTyped($event); @@ -147,14 +152,17 @@ class ShareController extends AuthPublicShareController { $this->shareManager->updateShare($this->share); } + #[\Override] protected function verifyPassword(string $password): bool { return $this->shareManager->checkPassword($this->share, $password); } + #[\Override] protected function getPasswordHash(): ?string { return $this->share->getPassword(); } + #[\Override] public function isValidToken(): bool { try { $this->share = $this->shareManager->getShareByToken($this->getToken()); @@ -165,10 +173,12 @@ class ShareController extends AuthPublicShareController { return true; } + #[\Override] protected function isPasswordProtected(): bool { return $this->share->getPassword() !== null; } + #[\Override] protected function authSucceeded() { if ($this->share === null) { throw new NotFoundException(); @@ -183,6 +193,7 @@ class ShareController extends AuthPublicShareController { $this->session->set(PublicAuth::DAV_AUTHENTICATED, array_merge($allowedShareIds, [$this->share->getId()])); } + #[\Override] protected function authFailed() { $this->emitAccessShareHook($this->share, 403, 'Wrong password'); $this->emitShareAccessEvent($this->share, self::SHARE_AUTH, 403, 'Wrong password'); @@ -271,6 +282,7 @@ class ShareController extends AuthPublicShareController { * @throws NotFoundException * @throws \Exception */ + #[\Override] #[PublicPage] #[NoCSRFRequired] public function showShare($path = ''): TemplateResponse { diff --git a/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php b/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php index fe047ce9081..981a12625a4 100644 --- a/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php +++ b/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php @@ -56,10 +56,12 @@ class DefaultPublicShareTemplateProvider implements IPublicShareTemplateProvider ) { } + #[\Override] public function shouldRespond(IShare $share): bool { return true; } + #[\Override] public function renderPage(IShare $share, string $token, string $path): TemplateResponse { $shareNode = $share->getNode(); $ownerName = ''; diff --git a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php index 42b80d885cc..a212f4add28 100644 --- a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php +++ b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php @@ -46,6 +46,7 @@ class DeleteOrphanedSharesJob extends TimedJob { * * @param array $argument unused argument */ + #[\Override] public function run($argument) { if ($this->db->getShardDefinition('filecache')) { $this->shardingCleanup(); diff --git a/apps/files_sharing/lib/ExpireSharesJob.php b/apps/files_sharing/lib/ExpireSharesJob.php index c72048e0e1e..c262f9e72c1 100644 --- a/apps/files_sharing/lib/ExpireSharesJob.php +++ b/apps/files_sharing/lib/ExpireSharesJob.php @@ -38,6 +38,7 @@ class ExpireSharesJob extends TimedJob { * * @param array $argument unused argument */ + #[\Override] public function run($argument) { //Current time $now = new \DateTime(); diff --git a/apps/files_sharing/lib/External/Cache.php b/apps/files_sharing/lib/External/Cache.php index 865850fd537..e004ed84d8b 100644 --- a/apps/files_sharing/lib/External/Cache.php +++ b/apps/files_sharing/lib/External/Cache.php @@ -27,6 +27,7 @@ class Cache extends \OC\Files\Cache\Cache { parent::__construct($this->storage); } + #[\Override] public function get($file) { $result = parent::get($file); if (!$result) { @@ -41,6 +42,7 @@ class Cache extends \OC\Files\Cache\Cache { return $result; } + #[\Override] public function getFolderContentsById($fileId, ?string $mimeTypeFilter = null): array { $results = parent::getFolderContentsById($fileId, $mimeTypeFilter); foreach ($results as &$file) { diff --git a/apps/files_sharing/lib/External/ExternalShare.php b/apps/files_sharing/lib/External/ExternalShare.php index 07a9a119fa0..b452b8ce013 100644 --- a/apps/files_sharing/lib/External/ExternalShare.php +++ b/apps/files_sharing/lib/External/ExternalShare.php @@ -90,6 +90,7 @@ class ExternalShare extends SnowflakeAwareEntity implements \JsonSerializable { /** * @return Files_SharingRemoteShare */ + #[\Override] public function jsonSerialize(): array { $parent = $this->getParent(); return [ diff --git a/apps/files_sharing/lib/External/MountProvider.php b/apps/files_sharing/lib/External/MountProvider.php index 1f3620c5644..06191927e0c 100644 --- a/apps/files_sharing/lib/External/MountProvider.php +++ b/apps/files_sharing/lib/External/MountProvider.php @@ -57,6 +57,7 @@ class MountProvider implements IMountProvider, IPartialMountProvider { return new Mount(self::STORAGE, $mountPoint, $data, $manager, $storageFactory); } + #[\Override] public function getMountsForUser(IUser $user, IStorageFactory $loader): array { $qb = $this->connection->getQueryBuilder(); $qb->select('id', 'remote', 'share_token', 'password', 'mountpoint', 'owner') @@ -74,6 +75,7 @@ class MountProvider implements IMountProvider, IPartialMountProvider { return $mounts; } + #[\Override] public function getMountsForPath( string $setupPathHint, bool $forChildren, diff --git a/apps/files_sharing/lib/External/Scanner.php b/apps/files_sharing/lib/External/Scanner.php index e6f96a846d6..0ed7aea9c81 100644 --- a/apps/files_sharing/lib/External/Scanner.php +++ b/apps/files_sharing/lib/External/Scanner.php @@ -17,6 +17,7 @@ use OCP\Files\StorageNotAvailableException; * @property Storage $storage */ class Scanner extends \OC\Files\Cache\Scanner { + #[\Override] public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) { // Disable locking for federated shares parent::scan($path, $recursive, $reuse, false); @@ -36,6 +37,7 @@ class Scanner extends \OC\Files\Cache\Scanner { * @param array|null $data the metadata for the file, as returned by the storage * @return array|null an array of metadata of the scanned file */ + #[\Override] public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) { try { return parent::scanFile($file, $reuseExisting, $parentId, $cacheData, $lock, $data); diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php index 68c69e9e7c8..f074d86d54f 100644 --- a/apps/files_sharing/lib/External/Storage.php +++ b/apps/files_sharing/lib/External/Storage.php @@ -104,6 +104,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, ); } + #[\Override] public function getWatcher(string $path = '', ?IStorage $storage = null): IWatcher { if (!$storage) { $storage = $this; @@ -135,10 +136,12 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, return $this->password; } + #[\Override] public function getId(): string { return 'shared::' . md5($this->token . '@' . $this->getRemote()); } + #[\Override] public function getCache(string $path = '', ?IStorage $storage = null): ICache { if (is_null($this->cache)) { $this->cache = new Cache($this, $this->cloudId); @@ -146,6 +149,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, return $this->cache; } + #[\Override] public function getScanner(string $path = '', ?IStorage $storage = null): IScanner { if (!$storage) { $storage = $this; @@ -157,6 +161,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, return $this->scanner; } + #[\Override] public function hasUpdated(string $path, int $time): bool { // since for owncloud webdav servers we can rely on etag propagation we only need to check the root of the storage // because of that we only do one check for the entire storage per request @@ -177,6 +182,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, } } + #[\Override] public function test(): bool { try { return parent::test(); @@ -227,6 +233,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, } } + #[\Override] public function file_exists(string $path): bool { if ($path === '') { return true; @@ -331,10 +338,12 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, return json_decode($response->getBody(), true); } + #[\Override] public function getOwner(string $path): string|false { return $this->cloudId->getDisplayId(); } + #[\Override] public function isSharable(string $path): bool { if ($this->shareManager->sharingDisabledForUser(Server::get(IUserSession::class)->getUser()?->getUID()) || !$this->appConfig->getValueBool('core', 'shareapi_allow_resharing', true)) { @@ -343,6 +352,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE); } + #[\Override] public function getPermissions(string $path): int { $response = $this->propfind($path); if ($response === false) { @@ -368,6 +378,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, return $permissions; } + #[\Override] public function needsPartFile(): bool { return false; } @@ -418,6 +429,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, return $permissions; } + #[\Override] public function free_space(string $path): int|float|false { return parent::free_space(''); } diff --git a/apps/files_sharing/lib/External/Watcher.php b/apps/files_sharing/lib/External/Watcher.php index e8c8637905f..3c0d753ce8a 100644 --- a/apps/files_sharing/lib/External/Watcher.php +++ b/apps/files_sharing/lib/External/Watcher.php @@ -15,6 +15,7 @@ class Watcher extends \OC\Files\Cache\Watcher { * * @param string $path */ + #[\Override] public function cleanFolder($path) { // not needed, the scanner takes care of this } diff --git a/apps/files_sharing/lib/Listener/BeforeDirectFileDownloadListener.php b/apps/files_sharing/lib/Listener/BeforeDirectFileDownloadListener.php index 717edd4869e..99eacdd697f 100644 --- a/apps/files_sharing/lib/Listener/BeforeDirectFileDownloadListener.php +++ b/apps/files_sharing/lib/Listener/BeforeDirectFileDownloadListener.php @@ -27,6 +27,7 @@ class BeforeDirectFileDownloadListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof BeforeDirectFileDownloadEvent)) { return; diff --git a/apps/files_sharing/lib/Listener/BeforeNodeReadListener.php b/apps/files_sharing/lib/Listener/BeforeNodeReadListener.php index d19bc8dfae9..65ddb857e42 100644 --- a/apps/files_sharing/lib/Listener/BeforeNodeReadListener.php +++ b/apps/files_sharing/lib/Listener/BeforeNodeReadListener.php @@ -41,6 +41,7 @@ class BeforeNodeReadListener implements IEventListener { $this->cache = $cacheFactory->createDistributed('files_sharing_activity_events'); } + #[\Override] public function handle(Event $event): void { if ($event instanceof BeforeZipCreatedEvent) { $this->handleBeforeZipCreatedEvent($event); diff --git a/apps/files_sharing/lib/Listener/BeforeZipCreatedListener.php b/apps/files_sharing/lib/Listener/BeforeZipCreatedListener.php index e638a088fbe..ff70d909eca 100644 --- a/apps/files_sharing/lib/Listener/BeforeZipCreatedListener.php +++ b/apps/files_sharing/lib/Listener/BeforeZipCreatedListener.php @@ -27,6 +27,7 @@ class BeforeZipCreatedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof BeforeZipCreatedEvent)) { return; diff --git a/apps/files_sharing/lib/Listener/LoadAdditionalListener.php b/apps/files_sharing/lib/Listener/LoadAdditionalListener.php index b089c8309b7..4ba3a0266ef 100644 --- a/apps/files_sharing/lib/Listener/LoadAdditionalListener.php +++ b/apps/files_sharing/lib/Listener/LoadAdditionalListener.php @@ -18,6 +18,7 @@ use OCP\Util; /** @template-implements IEventListener */ class LoadAdditionalListener implements IEventListener { + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoadAdditionalScriptsEvent)) { return; diff --git a/apps/files_sharing/lib/Listener/LoadPublicFileRequestAuthListener.php b/apps/files_sharing/lib/Listener/LoadPublicFileRequestAuthListener.php index 6da2476194b..840cb021195 100644 --- a/apps/files_sharing/lib/Listener/LoadPublicFileRequestAuthListener.php +++ b/apps/files_sharing/lib/Listener/LoadPublicFileRequestAuthListener.php @@ -24,6 +24,7 @@ class LoadPublicFileRequestAuthListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof BeforeTemplateRenderedEvent) { return; diff --git a/apps/files_sharing/lib/Listener/LoadSidebarListener.php b/apps/files_sharing/lib/Listener/LoadSidebarListener.php index 935f88ae753..e6a30a56881 100644 --- a/apps/files_sharing/lib/Listener/LoadSidebarListener.php +++ b/apps/files_sharing/lib/Listener/LoadSidebarListener.php @@ -32,6 +32,7 @@ class LoadSidebarListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoadSidebar)) { return; diff --git a/apps/files_sharing/lib/Listener/ShareInteractionListener.php b/apps/files_sharing/lib/Listener/ShareInteractionListener.php index 7b11a472492..d57424fbd9f 100644 --- a/apps/files_sharing/lib/Listener/ShareInteractionListener.php +++ b/apps/files_sharing/lib/Listener/ShareInteractionListener.php @@ -33,6 +33,7 @@ class ShareInteractionListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof ShareCreatedEvent)) { // Unrelated diff --git a/apps/files_sharing/lib/Listener/SharesUpdatedListener.php b/apps/files_sharing/lib/Listener/SharesUpdatedListener.php index 9cb37406710..47d5daf7b3e 100644 --- a/apps/files_sharing/lib/Listener/SharesUpdatedListener.php +++ b/apps/files_sharing/lib/Listener/SharesUpdatedListener.php @@ -59,6 +59,7 @@ class SharesUpdatedListener implements IEventListener { $this->cutOffMarkTime = $appConfig->getValueFloat(Application::APP_ID, ConfigLexicon::UPDATE_CUTOFF_TIME, 3.0); } + #[\Override] public function handle(Event $event): void { // don't trigger the on-setup checks if this handler triggers an fs setup $oldState = $this->homeSetupListener->setDisabled(true); diff --git a/apps/files_sharing/lib/Listener/UserAddedToGroupListener.php b/apps/files_sharing/lib/Listener/UserAddedToGroupListener.php index 281c96ca5e7..25433b58ba6 100644 --- a/apps/files_sharing/lib/Listener/UserAddedToGroupListener.php +++ b/apps/files_sharing/lib/Listener/UserAddedToGroupListener.php @@ -25,6 +25,7 @@ class UserAddedToGroupListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof UserAddedEvent)) { return; diff --git a/apps/files_sharing/lib/Listener/UserHomeSetupListener.php b/apps/files_sharing/lib/Listener/UserHomeSetupListener.php index 7f95605b3b6..50ecd16ce21 100644 --- a/apps/files_sharing/lib/Listener/UserHomeSetupListener.php +++ b/apps/files_sharing/lib/Listener/UserHomeSetupListener.php @@ -35,6 +35,7 @@ class UserHomeSetupListener implements IEventListener { $this->disabled = $disabled; return $previous; } + #[\Override] public function handle(Event $event): void { if (!$event instanceof UserHomeSetupEvent) { return; diff --git a/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php b/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php index 0ac447436bd..0ff1767893a 100644 --- a/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php +++ b/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php @@ -27,6 +27,7 @@ class UserShareAcceptanceListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof ShareCreatedEvent)) { return; diff --git a/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php b/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php index 7f458b2b53b..2e3a936f159 100644 --- a/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php +++ b/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php @@ -29,6 +29,7 @@ class OCSShareAPIMiddleware extends Middleware { * * @throws OCSNotFoundException */ + #[\Override] public function beforeController($controller, $methodName) { if ($controller instanceof ShareAPIController) { if (!$this->shareManager->shareApiEnabled()) { @@ -43,6 +44,7 @@ class OCSShareAPIMiddleware extends Middleware { * @param Response $response * @return Response */ + #[\Override] public function afterController($controller, $methodName, Response $response) { if ($controller instanceof ShareAPIController) { /** @var ShareAPIController $controller */ diff --git a/apps/files_sharing/lib/Middleware/ShareInfoMiddleware.php b/apps/files_sharing/lib/Middleware/ShareInfoMiddleware.php index e4ba2c88b17..a05e9990476 100644 --- a/apps/files_sharing/lib/Middleware/ShareInfoMiddleware.php +++ b/apps/files_sharing/lib/Middleware/ShareInfoMiddleware.php @@ -28,6 +28,7 @@ class ShareInfoMiddleware extends Middleware { * @param string $methodName * @throws S2SException */ + #[\Override] public function beforeController($controller, $methodName) { if (!($controller instanceof ShareInfoController)) { return; @@ -45,6 +46,7 @@ class ShareInfoMiddleware extends Middleware { * @throws \Exception * @return Response */ + #[\Override] public function afterException($controller, $methodName, \Exception $exception) { if (!($controller instanceof ShareInfoController)) { throw $exception; @@ -63,6 +65,7 @@ class ShareInfoMiddleware extends Middleware { * @param Response $response * @return Response */ + #[\Override] public function afterController($controller, $methodName, Response $response) { if (!($controller instanceof ShareInfoController)) { return $response; diff --git a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php index 8ea2eb59d73..69339601ea7 100644 --- a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php +++ b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php @@ -47,6 +47,7 @@ class SharingCheckMiddleware extends Middleware { * @throws NotFoundException * @throws S2SException */ + #[\Override] public function beforeController($controller, $methodName): void { if (!$this->isSharingEnabled()) { throw new NotFoundException('Sharing is disabled.'); @@ -67,6 +68,7 @@ class SharingCheckMiddleware extends Middleware { * @return Response * @throws \Exception */ + #[\Override] public function afterException($controller, $methodName, \Exception $exception): Response { if (is_a($exception, NotFoundException::class)) { return new NotFoundResponse(); diff --git a/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php b/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php index 7675bc886be..cf68a41935f 100644 --- a/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php +++ b/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php @@ -31,6 +31,7 @@ class OwncloudGuestShareType implements IRepairStep { * @return string * @since 9.1.0 */ + #[\Override] public function getName() { return 'Fix the share type of guest shares when migrating from ownCloud'; } @@ -38,6 +39,7 @@ class OwncloudGuestShareType implements IRepairStep { /** * @param IOutput $output */ + #[\Override] public function run(IOutput $output) { if (!$this->shouldRun()) { return; diff --git a/apps/files_sharing/lib/Migration/SetAcceptedStatus.php b/apps/files_sharing/lib/Migration/SetAcceptedStatus.php index 4da6aad4b33..a51570e15fb 100644 --- a/apps/files_sharing/lib/Migration/SetAcceptedStatus.php +++ b/apps/files_sharing/lib/Migration/SetAcceptedStatus.php @@ -29,6 +29,7 @@ class SetAcceptedStatus implements IRepairStep { * @return string * @since 9.1.0 */ + #[\Override] public function getName(): string { return 'Set existing shares as accepted'; } @@ -36,6 +37,7 @@ class SetAcceptedStatus implements IRepairStep { /** * @param IOutput $output */ + #[\Override] public function run(IOutput $output): void { if (!$this->shouldRun()) { return; diff --git a/apps/files_sharing/lib/Migration/SetPasswordColumn.php b/apps/files_sharing/lib/Migration/SetPasswordColumn.php index 5a2fbaeca93..3e466c225ba 100644 --- a/apps/files_sharing/lib/Migration/SetPasswordColumn.php +++ b/apps/files_sharing/lib/Migration/SetPasswordColumn.php @@ -31,6 +31,7 @@ class SetPasswordColumn implements IRepairStep { * @return string * @since 9.1.0 */ + #[\Override] public function getName() { return 'Copy the share password into the dedicated column'; } @@ -38,6 +39,7 @@ class SetPasswordColumn implements IRepairStep { /** * @param IOutput $output */ + #[\Override] public function run(IOutput $output) { if (!$this->shouldRun()) { return; diff --git a/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php b/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php index e97f198a193..29b7f423d81 100644 --- a/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php +++ b/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php @@ -23,6 +23,7 @@ class Version11300Date20201120141438 extends SimpleMigrationStep { ) { } + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -115,6 +116,7 @@ class Version11300Date20201120141438 extends SimpleMigrationStep { return $schema; } + #[\Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { $qb = $this->connection->getQueryBuilder(); $qb->update('share_external') diff --git a/apps/files_sharing/lib/Migration/Version21000Date20201223143245.php b/apps/files_sharing/lib/Migration/Version21000Date20201223143245.php index 9bd07a19802..f5a0ae2dd45 100644 --- a/apps/files_sharing/lib/Migration/Version21000Date20201223143245.php +++ b/apps/files_sharing/lib/Migration/Version21000Date20201223143245.php @@ -15,6 +15,7 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version21000Date20201223143245 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/files_sharing/lib/Migration/Version22000Date20210216084241.php b/apps/files_sharing/lib/Migration/Version22000Date20210216084241.php index e82fb4a72d5..38f504c9d2f 100644 --- a/apps/files_sharing/lib/Migration/Version22000Date20210216084241.php +++ b/apps/files_sharing/lib/Migration/Version22000Date20210216084241.php @@ -23,6 +23,7 @@ class Version22000Date20210216084241 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/apps/files_sharing/lib/Migration/Version24000Date20220208195521.php b/apps/files_sharing/lib/Migration/Version24000Date20220208195521.php index 75da1de1d83..4886fceb2b8 100644 --- a/apps/files_sharing/lib/Migration/Version24000Date20220208195521.php +++ b/apps/files_sharing/lib/Migration/Version24000Date20220208195521.php @@ -22,6 +22,7 @@ class Version24000Date20220208195521 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { $schema = $schemaClosure(); $table = $schema->getTable('share'); diff --git a/apps/files_sharing/lib/Migration/Version24000Date20220404142216.php b/apps/files_sharing/lib/Migration/Version24000Date20220404142216.php index 03985bd50c7..63df2e83734 100644 --- a/apps/files_sharing/lib/Migration/Version24000Date20220404142216.php +++ b/apps/files_sharing/lib/Migration/Version24000Date20220404142216.php @@ -24,6 +24,7 @@ class Version24000Date20220404142216 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/apps/files_sharing/lib/Notification/Notifier.php b/apps/files_sharing/lib/Notification/Notifier.php index e4434ef0b37..d43af278180 100644 --- a/apps/files_sharing/lib/Notification/Notifier.php +++ b/apps/files_sharing/lib/Notification/Notifier.php @@ -44,6 +44,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getID(): string { return 'files_sharing'; } @@ -54,6 +55,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getName(): string { return $this->l10nFactory->get('files_sharing')->t('File sharing'); } @@ -66,6 +68,7 @@ class Notifier implements INotifier { * @throws AlreadyProcessedException When the notification is not needed anymore and should be deleted * @since 9.0.0 */ + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'files_sharing' || ($notification->getSubject() !== 'expiresTomorrow' diff --git a/apps/files_sharing/lib/Scanner.php b/apps/files_sharing/lib/Scanner.php index c15a5ea0311..38275b1f6f0 100644 --- a/apps/files_sharing/lib/Scanner.php +++ b/apps/files_sharing/lib/Scanner.php @@ -27,6 +27,7 @@ class Scanner extends \OC\Files\Cache\Scanner { * * @return array|null an array of metadata of the file */ + #[\Override] public function getData($path) { $data = parent::getData($path); if ($data === null) { @@ -51,6 +52,7 @@ class Scanner extends \OC\Files\Cache\Scanner { } } + #[\Override] public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) { $sourceScanner = $this->getSourceScanner(); if ($sourceScanner instanceof ObjectStoreScanner) { diff --git a/apps/files_sharing/lib/Settings/Personal.php b/apps/files_sharing/lib/Settings/Personal.php index 171131b1819..b31118746d4 100644 --- a/apps/files_sharing/lib/Settings/Personal.php +++ b/apps/files_sharing/lib/Settings/Personal.php @@ -24,6 +24,7 @@ class Personal implements ISettings { ) { } + #[\Override] public function getForm(): TemplateResponse { $defaultAcceptSystemConfig = $this->config->getSystemValueBool('sharing.enable_share_accept', false) ? 'no' : 'yes'; $defaultShareFolder = $this->config->getSystemValue('share_folder', '/'); @@ -41,10 +42,12 @@ class Personal implements ISettings { return new TemplateResponse('files_sharing', 'Settings/personal'); } + #[\Override] public function getSection(): string { return 'sharing'; } + #[\Override] public function getPriority(): int { return 90; } diff --git a/apps/files_sharing/lib/SharedMount.php b/apps/files_sharing/lib/SharedMount.php index 0d6fe7e83e0..915a92e81f9 100644 --- a/apps/files_sharing/lib/SharedMount.php +++ b/apps/files_sharing/lib/SharedMount.php @@ -148,6 +148,7 @@ class SharedMount extends MountPoint implements IMovableMount, ISharedMountPoint * * @return int */ + #[\Override] public function getStorageRootId() { return $this->getShare()->getNodeId(); } @@ -155,6 +156,7 @@ class SharedMount extends MountPoint implements IMovableMount, ISharedMountPoint /** * @return int */ + #[\Override] public function getNumericStorageId() { if (!is_null($this->getShare()->getNodeCacheEntry())) { return $this->getShare()->getNodeCacheEntry()->getStorageId(); diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php index 9d6ca56a11d..c1e8faeae33 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -210,6 +210,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage self::$initDepth--; } + #[\Override] public function instanceOfStorage(string $class): bool { if ($class === '\OC\Files\Storage\Common' || $class == Common::class) { return true; @@ -238,10 +239,12 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage return $this->getSourceRootInfo() && ($this->getSourceRootInfo()->getPermissions() & Constants::PERMISSION_SHARE) === Constants::PERMISSION_SHARE; } + #[\Override] public function getId(): string { return 'shared::' . $this->getMountPoint(); } + #[\Override] public function getPermissions(string $path = ''): int { if (!$this->isValid()) { return 0; @@ -260,10 +263,12 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage return $permissions; } + #[\Override] public function isCreatable(string $path): bool { return (bool)($this->getPermissions($path) & Constants::PERMISSION_CREATE); } + #[\Override] public function isReadable(string $path): bool { if (!$this->isValid()) { return false; @@ -277,14 +282,17 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage return $storage->isReadable($internalPath); } + #[\Override] public function isUpdatable(string $path): bool { return (bool)($this->getPermissions($path) & Constants::PERMISSION_UPDATE); } + #[\Override] public function isDeletable(string $path): bool { return (bool)($this->getPermissions($path) & Constants::PERMISSION_DELETE); } + #[\Override] public function isSharable(string $path): bool { if ($this->shareManager->sharingDisabledForUser(Server::get(IUserSession::class)->getUser()?->getUID()) || !$this->appConfig->getValueBool('core', 'shareapi_allow_resharing', true)) { @@ -293,6 +301,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE); } + #[\Override] public function fopen(string $path, string $mode) { $source = $this->getUnjailedPath($path); switch ($mode) { @@ -345,6 +354,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage return $this->nonMaskedStorage->fopen($this->getUnjailedPath($path), $mode); } + #[\Override] public function rename(string $source, string $target): bool { $this->init(); $isPartFile = pathinfo($source, PATHINFO_EXTENSION) === 'part'; @@ -390,6 +400,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage return $this->superShare->getShareOwner(); } + #[\Override] public function getShare(): IShare { return $this->superShare; } @@ -403,6 +414,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage return $this->superShare->getNodeType(); } + #[\Override] public function getCache(string $path = '', ?IStorage $storage = null): ICache { if ($this->cache) { return $this->cache; @@ -424,6 +436,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage return $this->cache; } + #[\Override] public function getScanner(string $path = '', ?IStorage $storage = null): IScanner { if (!$storage) { $storage = $this; @@ -431,10 +444,12 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage return new Scanner($storage); } + #[\Override] public function getOwner(string $path): string|false { return $this->superShare->getShareOwner(); } + #[\Override] public function getWatcher(string $path = '', ?IStorage $storage = null): IWatcher { if ($this->watcher) { return $this->watcher; @@ -473,6 +488,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage return true; } + #[\Override] public function acquireLock(string $path, int $type, ILockingProvider $provider): void { /** @var ILockingStorage $targetStorage */ [$targetStorage, $targetInternalPath] = $this->resolvePath($path); @@ -484,6 +500,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage } } + #[\Override] public function releaseLock(string $path, int $type, ILockingProvider $provider): void { /** @var ILockingStorage $targetStorage */ [$targetStorage, $targetInternalPath] = $this->resolvePath($path); @@ -495,12 +512,14 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage } } + #[\Override] public function changeLock(string $path, int $type, ILockingProvider $provider): void { /** @var ILockingStorage $targetStorage */ [$targetStorage, $targetInternalPath] = $this->resolvePath($path); $targetStorage->changeLock($targetInternalPath, $type, $provider); } + #[\Override] public function getAvailability(): array { // shares do not participate in availability logic return [ @@ -509,6 +528,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage ]; } + #[\Override] public function setAvailability(bool $isAvailable): void { // shares do not participate in availability logic } @@ -518,6 +538,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage return $this->nonMaskedStorage; } + #[\Override] public function getWrapperStorage(): Storage { $this->init(); @@ -533,6 +554,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage return $this->storage; } + #[\Override] public function file_get_contents(string $path): string|false { $info = [ 'target' => $this->getMountPoint() . '/' . $path, @@ -542,6 +564,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage return parent::file_get_contents($path); } + #[\Override] public function file_put_contents(string $path, mixed $data): int|float|false { $info = [ 'target' => $this->getMountPoint() . '/' . $path, @@ -556,6 +579,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage $this->mountOptions = $options; } + #[\Override] public function getUnjailedPath(string $path): string { $this->init(); return parent::getUnjailedPath($path); diff --git a/apps/files_sharing/lib/SharesReminderJob.php b/apps/files_sharing/lib/SharesReminderJob.php index dcf65b84823..8cbf9351e02 100644 --- a/apps/files_sharing/lib/SharesReminderJob.php +++ b/apps/files_sharing/lib/SharesReminderJob.php @@ -61,6 +61,7 @@ class SharesReminderJob extends TimedJob { * @param array $argument unused argument * @throws Exception if a database error occurs */ + #[\Override] public function run(mixed $argument): void { foreach ($this->getShares() as $share) { $reminderInfo = $this->prepareReminder($share); diff --git a/apps/files_trashbin/lib/AppInfo/Application.php b/apps/files_trashbin/lib/AppInfo/Application.php index 76d566f4286..f63015548d5 100644 --- a/apps/files_trashbin/lib/AppInfo/Application.php +++ b/apps/files_trashbin/lib/AppInfo/Application.php @@ -40,6 +40,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID, $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerCapability(Capabilities::class); @@ -70,6 +71,7 @@ class Application extends App implements IBootstrap { $context->registerEventListener(BeforeNodeDeletedEvent::class, Trashbin::class); } + #[\Override] public function boot(IBootContext $context): void { $context->injectFn([$this, 'registerTrashBackends']); } diff --git a/apps/files_trashbin/lib/Capabilities.php b/apps/files_trashbin/lib/Capabilities.php index 2f55017fac8..35d84dced1c 100644 --- a/apps/files_trashbin/lib/Capabilities.php +++ b/apps/files_trashbin/lib/Capabilities.php @@ -29,6 +29,7 @@ class Capabilities implements ICapability { * } * } */ + #[\Override] public function getCapabilities() { return [ 'files' => [ diff --git a/apps/files_trashbin/lib/Command/CleanUp.php b/apps/files_trashbin/lib/Command/CleanUp.php index 4eaafd274a9..33e2c81eea8 100644 --- a/apps/files_trashbin/lib/Command/CleanUp.php +++ b/apps/files_trashbin/lib/Command/CleanUp.php @@ -35,6 +35,7 @@ class CleanUp extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -53,6 +54,7 @@ class CleanUp extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $userIds = $input->getArgument('user_id'); $verbose = $input->getOption('verbose'); diff --git a/apps/files_trashbin/lib/Command/ExpireTrash.php b/apps/files_trashbin/lib/Command/ExpireTrash.php index fdc8e058cbf..b4aa0a9e0a9 100644 --- a/apps/files_trashbin/lib/Command/ExpireTrash.php +++ b/apps/files_trashbin/lib/Command/ExpireTrash.php @@ -31,6 +31,7 @@ class ExpireTrash extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -43,6 +44,7 @@ class ExpireTrash extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $minAge = $this->expiration->getMinAgeAsTimestamp(); $maxAge = $this->expiration->getMaxAgeAsTimestamp(); diff --git a/apps/files_trashbin/lib/Command/RestoreAllFiles.php b/apps/files_trashbin/lib/Command/RestoreAllFiles.php index 938a98b36bf..05c327cb5cc 100644 --- a/apps/files_trashbin/lib/Command/RestoreAllFiles.php +++ b/apps/files_trashbin/lib/Command/RestoreAllFiles.php @@ -58,6 +58,7 @@ class RestoreAllFiles extends Base { $this->l10n = $l10nFactory->get('files_trashbin'); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -101,6 +102,7 @@ class RestoreAllFiles extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { /** @var string[] $users */ $users = $input->getArgument('user_id'); diff --git a/apps/files_trashbin/lib/Listener/EventListener.php b/apps/files_trashbin/lib/Listener/EventListener.php index 06f8f48e7bb..81f238bd632 100644 --- a/apps/files_trashbin/lib/Listener/EventListener.php +++ b/apps/files_trashbin/lib/Listener/EventListener.php @@ -31,6 +31,7 @@ class EventListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof NodeWrittenEvent) { // Resize trash diff --git a/apps/files_trashbin/lib/Listeners/BeforeTemplateRendered.php b/apps/files_trashbin/lib/Listeners/BeforeTemplateRendered.php index d62618583f7..ca0456b5b10 100644 --- a/apps/files_trashbin/lib/Listeners/BeforeTemplateRendered.php +++ b/apps/files_trashbin/lib/Listeners/BeforeTemplateRendered.php @@ -22,6 +22,7 @@ class BeforeTemplateRendered implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof BeforeTemplateRenderedEvent)) { return; diff --git a/apps/files_trashbin/lib/Listeners/LoadAdditionalScripts.php b/apps/files_trashbin/lib/Listeners/LoadAdditionalScripts.php index 7940b934ace..652cd5226f3 100644 --- a/apps/files_trashbin/lib/Listeners/LoadAdditionalScripts.php +++ b/apps/files_trashbin/lib/Listeners/LoadAdditionalScripts.php @@ -23,6 +23,7 @@ class LoadAdditionalScripts implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoadAdditionalScriptsEvent)) { return; diff --git a/apps/files_trashbin/lib/Listeners/SyncLivePhotosListener.php b/apps/files_trashbin/lib/Listeners/SyncLivePhotosListener.php index decd34fbdd5..6a09a6b8aae 100644 --- a/apps/files_trashbin/lib/Listeners/SyncLivePhotosListener.php +++ b/apps/files_trashbin/lib/Listeners/SyncLivePhotosListener.php @@ -33,6 +33,7 @@ class SyncLivePhotosListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($this->userSession === null) { return; diff --git a/apps/files_trashbin/lib/Migration/Version1010Date20200630192639.php b/apps/files_trashbin/lib/Migration/Version1010Date20200630192639.php index 3de908e2d78..8ca09036c8b 100644 --- a/apps/files_trashbin/lib/Migration/Version1010Date20200630192639.php +++ b/apps/files_trashbin/lib/Migration/Version1010Date20200630192639.php @@ -21,6 +21,7 @@ class Version1010Date20200630192639 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/files_trashbin/lib/Sabre/AbstractTrash.php b/apps/files_trashbin/lib/Sabre/AbstractTrash.php index f032395437b..acc872b34c7 100644 --- a/apps/files_trashbin/lib/Sabre/AbstractTrash.php +++ b/apps/files_trashbin/lib/Sabre/AbstractTrash.php @@ -22,18 +22,22 @@ abstract class AbstractTrash implements ITrash { ) { } + #[\Override] public function getFilename(): string { return $this->data->getName(); } + #[\Override] public function getDeletionTime(): int { return $this->data->getDeletedTime(); } + #[\Override] public function getFileId(): int { return $this->data->getId(); } + #[\Override] public function getFileInfo(): FileInfo { return $this->data; } @@ -42,6 +46,7 @@ abstract class AbstractTrash implements ITrash { * @psalm-suppress ImplementedReturnTypeMismatch \Sabre\DAV\IFile::getSize signature does not support 32bit * @return int|float */ + #[\Override] public function getSize(): int|float { return $this->data->getSize(); } @@ -62,14 +67,17 @@ abstract class AbstractTrash implements ITrash { return $this->data->getName(); } + #[\Override] public function getOriginalLocation(): string { return $this->data->getOriginalLocation(); } + #[\Override] public function getTitle(): string { return $this->data->getTitle(); } + #[\Override] public function getDeletedBy(): ?IUser { return $this->data->getDeletedBy(); } @@ -82,6 +90,7 @@ abstract class AbstractTrash implements ITrash { $this->trashManager->removeItem($this->data); } + #[\Override] public function restore(): bool { $this->trashManager->restoreItem($this->data); return true; diff --git a/apps/files_trashbin/lib/Sabre/AbstractTrashFile.php b/apps/files_trashbin/lib/Sabre/AbstractTrashFile.php index 03014d23669..28749502e5c 100644 --- a/apps/files_trashbin/lib/Sabre/AbstractTrashFile.php +++ b/apps/files_trashbin/lib/Sabre/AbstractTrashFile.php @@ -12,10 +12,12 @@ use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\IFile; abstract class AbstractTrashFile extends AbstractTrash implements IFile, ITrash { + #[\Override] public function put($data) { throw new Forbidden(); } + #[\Override] public function setName($name) { throw new Forbidden(); } diff --git a/apps/files_trashbin/lib/Sabre/AbstractTrashFolder.php b/apps/files_trashbin/lib/Sabre/AbstractTrashFolder.php index 9e8f67f4db6..49f74f4cf57 100644 --- a/apps/files_trashbin/lib/Sabre/AbstractTrashFolder.php +++ b/apps/files_trashbin/lib/Sabre/AbstractTrashFolder.php @@ -15,6 +15,7 @@ use Sabre\DAV\Exception\NotFound; use Sabre\DAV\ICollection; abstract class AbstractTrashFolder extends AbstractTrash implements ICollection, ITrash { + #[\Override] public function getChildren(): array { $entries = $this->trashManager->listTrashFolder($this->data); @@ -28,6 +29,7 @@ abstract class AbstractTrashFolder extends AbstractTrash implements ICollection, return $children; } + #[\Override] public function getChild($name): ITrash { $entries = $this->getChildren(); @@ -40,6 +42,7 @@ abstract class AbstractTrashFolder extends AbstractTrash implements ICollection, throw new NotFound(); } + #[\Override] public function childExists($name): bool { try { $this->getChild($name); @@ -49,14 +52,17 @@ abstract class AbstractTrashFolder extends AbstractTrash implements ICollection, } } + #[\Override] public function setName($name) { throw new Forbidden(); } + #[\Override] public function createFile($name, $data = null) { throw new Forbidden(); } + #[\Override] public function createDirectory($name) { throw new Forbidden(); } diff --git a/apps/files_trashbin/lib/Sabre/RestoreFolder.php b/apps/files_trashbin/lib/Sabre/RestoreFolder.php index 781a28bbc25..766809d3f2b 100644 --- a/apps/files_trashbin/lib/Sabre/RestoreFolder.php +++ b/apps/files_trashbin/lib/Sabre/RestoreFolder.php @@ -14,42 +14,52 @@ use Sabre\DAV\IMoveTarget; use Sabre\DAV\INode; class RestoreFolder implements ICollection, IMoveTarget { + #[\Override] public function createFile($name, $data = null) { throw new Forbidden(); } + #[\Override] public function createDirectory($name) { throw new Forbidden(); } + #[\Override] public function getChild($name) { return null; } + #[\Override] public function delete() { throw new Forbidden(); } + #[\Override] public function getName() { return 'restore'; } + #[\Override] public function setName($name) { throw new Forbidden(); } + #[\Override] public function getLastModified(): int { return 0; } + #[\Override] public function getChildren(): array { return []; } + #[\Override] public function childExists($name): bool { return false; } + #[\Override] public function moveInto($targetName, $sourcePath, INode $sourceNode): bool { if (!($sourceNode instanceof ITrash)) { return false; diff --git a/apps/files_trashbin/lib/Sabre/RootCollection.php b/apps/files_trashbin/lib/Sabre/RootCollection.php index 8886dae0895..2e1e87134f8 100644 --- a/apps/files_trashbin/lib/Sabre/RootCollection.php +++ b/apps/files_trashbin/lib/Sabre/RootCollection.php @@ -36,6 +36,7 @@ class RootCollection extends AbstractPrincipalCollection { * @param array $principalInfo * @return INode */ + #[\Override] public function getChildForPrincipal(array $principalInfo): TrashHome { [, $name] = \Sabre\Uri\split($principalInfo['uri']); $user = Server::get(IUserSession::class)->getUser(); @@ -45,6 +46,7 @@ class RootCollection extends AbstractPrincipalCollection { return new TrashHome($principalInfo, $this->trashManager, $user); } + #[\Override] public function getName(): string { return 'trashbin'; } diff --git a/apps/files_trashbin/lib/Sabre/TrashFile.php b/apps/files_trashbin/lib/Sabre/TrashFile.php index 4b495daf133..fec435b2e15 100644 --- a/apps/files_trashbin/lib/Sabre/TrashFile.php +++ b/apps/files_trashbin/lib/Sabre/TrashFile.php @@ -13,6 +13,7 @@ use OCP\Files\ForbiddenException; use Sabre\DAV\Exception\Forbidden; class TrashFile extends AbstractTrashFile { + #[\Override] public function get() { try { return $this->data->getStorage()->fopen(Trashbin::getTrashFilename($this->data->getInternalPath(), $this->getDeletionTime()), 'rb'); @@ -21,6 +22,7 @@ class TrashFile extends AbstractTrashFile { } } + #[\Override] public function getName(): string { return Trashbin::getTrashFilename($this->data->getName(), $this->getDeletionTime()); } diff --git a/apps/files_trashbin/lib/Sabre/TrashFolder.php b/apps/files_trashbin/lib/Sabre/TrashFolder.php index e1c495bf08e..7906efb9ff1 100644 --- a/apps/files_trashbin/lib/Sabre/TrashFolder.php +++ b/apps/files_trashbin/lib/Sabre/TrashFolder.php @@ -11,6 +11,7 @@ namespace OCA\Files_Trashbin\Sabre; use OCA\Files_Trashbin\Trashbin; class TrashFolder extends AbstractTrashFolder { + #[\Override] public function getName(): string { return Trashbin::getTrashFilename($this->data->getName(), $this->getDeletionTime()); } diff --git a/apps/files_trashbin/lib/Sabre/TrashFolderFile.php b/apps/files_trashbin/lib/Sabre/TrashFolderFile.php index 37e70b717ae..b984e8a35b2 100644 --- a/apps/files_trashbin/lib/Sabre/TrashFolderFile.php +++ b/apps/files_trashbin/lib/Sabre/TrashFolderFile.php @@ -9,6 +9,7 @@ declare(strict_types=1); namespace OCA\Files_Trashbin\Sabre; class TrashFolderFile extends AbstractTrashFile { + #[\Override] public function get() { return $this->data->getStorage()->fopen($this->data->getInternalPath(), 'rb'); } diff --git a/apps/files_trashbin/lib/Sabre/TrashHome.php b/apps/files_trashbin/lib/Sabre/TrashHome.php index fc291c76f17..174807541f9 100644 --- a/apps/files_trashbin/lib/Sabre/TrashHome.php +++ b/apps/files_trashbin/lib/Sabre/TrashHome.php @@ -22,27 +22,33 @@ class TrashHome implements ICollection { ) { } + #[\Override] public function delete() { throw new Forbidden(); } + #[\Override] public function getName(): string { [, $name] = \Sabre\Uri\split($this->principalInfo['uri']); return $name; } + #[\Override] public function setName($name) { throw new Forbidden('Permission denied to rename this trashbin'); } + #[\Override] public function createFile($name, $data = null) { throw new Forbidden('Not allowed to create files in the trashbin'); } + #[\Override] public function createDirectory($name) { throw new Forbidden('Not allowed to create folders in the trashbin'); } + #[\Override] public function getChild($name) { if ($name === 'restore') { return new RestoreFolder(); @@ -54,6 +60,7 @@ class TrashHome implements ICollection { throw new NotFound(); } + #[\Override] public function getChildren(): array { return [ new RestoreFolder(), @@ -61,10 +68,12 @@ class TrashHome implements ICollection { ]; } + #[\Override] public function childExists($name): bool { return $name === 'restore' || $name === 'trash'; } + #[\Override] public function getLastModified(): int { return 0; } diff --git a/apps/files_trashbin/lib/Sabre/TrashRoot.php b/apps/files_trashbin/lib/Sabre/TrashRoot.php index dd89583d9a1..7a009afe62f 100644 --- a/apps/files_trashbin/lib/Sabre/TrashRoot.php +++ b/apps/files_trashbin/lib/Sabre/TrashRoot.php @@ -26,6 +26,7 @@ class TrashRoot implements ICollection { ) { } + #[\Override] public function delete() { if (!ConfigService::getDeleteFromTrashEnabled()) { throw new Forbidden('Not allowed to delete items from the trash bin'); @@ -37,22 +38,27 @@ class TrashRoot implements ICollection { } } + #[\Override] public function getName(): string { return 'trash'; } + #[\Override] public function setName($name) { throw new Forbidden('Permission denied to rename this trashbin'); } + #[\Override] public function createFile($name, $data = null) { throw new Forbidden('Not allowed to create files in the trashbin'); } + #[\Override] public function createDirectory($name) { throw new Forbidden('Not allowed to create folders in the trashbin'); } + #[\Override] public function getChildren(): array { $entries = $this->trashManager->listTrashRoot($this->user); @@ -66,6 +72,7 @@ class TrashRoot implements ICollection { return $children; } + #[\Override] public function getChild($name): ITrash { $entries = $this->getChildren(); @@ -78,6 +85,7 @@ class TrashRoot implements ICollection { throw new NotFound(); } + #[\Override] public function childExists($name): bool { try { $this->getChild($name); @@ -87,6 +95,7 @@ class TrashRoot implements ICollection { } } + #[\Override] public function getLastModified(): int { return 0; } diff --git a/apps/files_trashbin/lib/Sabre/TrashbinPlugin.php b/apps/files_trashbin/lib/Sabre/TrashbinPlugin.php index 9afa5092e09..6b722971beb 100644 --- a/apps/files_trashbin/lib/Sabre/TrashbinPlugin.php +++ b/apps/files_trashbin/lib/Sabre/TrashbinPlugin.php @@ -46,6 +46,7 @@ class TrashbinPlugin extends ServerPlugin { ) { } + #[\Override] public function initialize(Server $server): void { $this->server = $server; diff --git a/apps/files_trashbin/lib/Storage.php b/apps/files_trashbin/lib/Storage.php index c0035374824..39cd4f1c60b 100644 --- a/apps/files_trashbin/lib/Storage.php +++ b/apps/files_trashbin/lib/Storage.php @@ -43,6 +43,7 @@ class Storage extends Wrapper { parent::__construct($parameters); } + #[\Override] public function unlink(string $path): bool { if ($this->trashEnabled) { try { @@ -60,6 +61,7 @@ class Storage extends Wrapper { } } + #[\Override] public function rmdir(string $path): bool { if ($this->trashEnabled) { return $this->doDelete($path, 'rmdir'); @@ -175,6 +177,7 @@ class Storage extends Wrapper { return $this->mountPoint; } + #[\Override] public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { $sourceIsTrashbin = $sourceStorage->instanceOfStorage(Storage::class); try { diff --git a/apps/files_trashbin/lib/Trash/ITrashManager.php b/apps/files_trashbin/lib/Trash/ITrashManager.php index 26877f6697c..af174bf45f3 100644 --- a/apps/files_trashbin/lib/Trash/ITrashManager.php +++ b/apps/files_trashbin/lib/Trash/ITrashManager.php @@ -27,6 +27,7 @@ interface ITrashManager extends ITrashBackend { * @return ITrashItem[] * @since 15.0.0 */ + #[\Override] public function listTrashRoot(IUser $user): array; /** diff --git a/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php b/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php index 204defde35c..488dc79f541 100644 --- a/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php +++ b/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php @@ -58,21 +58,25 @@ class LegacyTrashBackend implements ITrashBackend { }, $items); } + #[\Override] public function listTrashRoot(IUser $user): array { $entries = Helper::getTrashFiles('/', $user->getUID()); return $this->mapTrashItems($entries, $user); } + #[\Override] public function listTrashFolder(ITrashItem $folder): array { $user = $folder->getUser(); $entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID()); return $this->mapTrashItems($entries, $user, $folder); } + #[\Override] public function restoreItem(ITrashItem $item) { Trashbin::restore($item->getTrashPath(), $item->getName(), $item->isRootItem() ? $item->getDeletedTime() : null); } + #[\Override] public function removeItem(ITrashItem $item) { $user = $item->getUser(); if ($item->isRootItem()) { @@ -83,6 +87,7 @@ class LegacyTrashBackend implements ITrashBackend { } } + #[\Override] public function moveToTrash(IStorage $storage, string $internalPath): bool { if (!$storage instanceof Storage) { return false; @@ -105,6 +110,7 @@ class LegacyTrashBackend implements ITrashBackend { return $result; } + #[\Override] public function getTrashNodeById(IUser $user, int $fileId) { try { $userFolder = $this->rootFolder->getUserFolder($user->getUID()); diff --git a/apps/files_trashbin/lib/Trash/TrashItem.php b/apps/files_trashbin/lib/Trash/TrashItem.php index 47fc5e9d735..9e1a28a5ee7 100644 --- a/apps/files_trashbin/lib/Trash/TrashItem.php +++ b/apps/files_trashbin/lib/Trash/TrashItem.php @@ -23,146 +23,182 @@ class TrashItem implements ITrashItem { ) { } + #[\Override] public function getTrashBackend(): ITrashBackend { return $this->backend; } + #[\Override] public function getOriginalLocation(): string { return $this->originalLocation; } + #[\Override] public function getDeletedTime(): int { return $this->deletedTime; } + #[\Override] public function getTrashPath(): string { return $this->trashPath; } + #[\Override] public function isRootItem(): bool { return substr_count($this->getTrashPath(), '/') === 1; } + #[\Override] public function getUser(): IUser { return $this->user; } + #[\Override] public function getEtag() { return $this->fileInfo->getEtag(); } + #[\Override] public function getSize($includeMounts = true) { return $this->fileInfo->getSize($includeMounts); } + #[\Override] public function getMtime() { return $this->fileInfo->getMtime(); } + #[\Override] public function getName() { return $this->fileInfo->getName(); } + #[\Override] public function getInternalPath() { return $this->fileInfo->getInternalPath(); } + #[\Override] public function getPath() { return $this->fileInfo->getPath(); } + #[\Override] public function getMimetype(): string { return $this->fileInfo->getMimetype(); } + #[\Override] public function getMimePart() { return $this->fileInfo->getMimePart(); } + #[\Override] public function getStorage() { return $this->fileInfo->getStorage(); } + #[\Override] public function getId() { return $this->fileInfo->getId(); } + #[\Override] public function isEncrypted() { return $this->fileInfo->isEncrypted(); } + #[\Override] public function getPermissions() { return $this->fileInfo->getPermissions(); } + #[\Override] public function getType() { return $this->fileInfo->getType(); } + #[\Override] public function isReadable() { return $this->fileInfo->isReadable(); } + #[\Override] public function isUpdateable() { return $this->fileInfo->isUpdateable(); } + #[\Override] public function isCreatable() { return $this->fileInfo->isCreatable(); } + #[\Override] public function isDeletable() { return $this->fileInfo->isDeletable(); } + #[\Override] public function isShareable() { return $this->fileInfo->isShareable(); } + #[\Override] public function isShared() { return $this->fileInfo->isShared(); } + #[\Override] public function isMounted() { return $this->fileInfo->isMounted(); } + #[\Override] public function getMountPoint() { return $this->fileInfo->getMountPoint(); } + #[\Override] public function getOwner() { return $this->fileInfo->getOwner(); } + #[\Override] public function getChecksum() { return $this->fileInfo->getChecksum(); } + #[\Override] public function getExtension(): string { return $this->fileInfo->getExtension(); } + #[\Override] public function getTitle(): string { return $this->getOriginalLocation(); } + #[\Override] public function getCreationTime(): int { return $this->fileInfo->getCreationTime(); } + #[\Override] public function getUploadTime(): int { return $this->fileInfo->getUploadTime(); } + #[\Override] public function getLastActivity(): int { return $this->fileInfo->getLastActivity(); } + #[\Override] public function getParentId(): int { return $this->fileInfo->getParentId(); } + #[\Override] public function getDeletedBy(): ?IUser { return $this->deletedBy; } @@ -171,10 +207,12 @@ class TrashItem implements ITrashItem { * @inheritDoc * @return array */ + #[\Override] public function getMetadata(): array { return $this->fileInfo->getMetadata(); } + #[\Override] public function getData(): ICacheEntry { return $this->fileInfo->getData(); } diff --git a/apps/files_trashbin/lib/Trash/TrashManager.php b/apps/files_trashbin/lib/Trash/TrashManager.php index 521a576c00a..b82fbbc6da9 100644 --- a/apps/files_trashbin/lib/Trash/TrashManager.php +++ b/apps/files_trashbin/lib/Trash/TrashManager.php @@ -15,6 +15,7 @@ class TrashManager implements ITrashManager { private $trashPaused = false; + #[\Override] public function registerBackend(string $storageType, ITrashBackend $backend) { $this->backends[$storageType] = $backend; } @@ -26,6 +27,7 @@ class TrashManager implements ITrashManager { return $this->backends; } + #[\Override] public function listTrashRoot(IUser $user): array { $items = array_reduce($this->getBackends(), function (array $items, ITrashBackend $backend) use ($user) { return array_merge($items, $backend->listTrashRoot($user)); @@ -40,14 +42,17 @@ class TrashManager implements ITrashManager { return $item->getTrashBackend(); } + #[\Override] public function listTrashFolder(ITrashItem $folder): array { return $this->getBackendForItem($folder)->listTrashFolder($folder); } + #[\Override] public function restoreItem(ITrashItem $item) { return $this->getBackendForItem($item)->restoreItem($item); } + #[\Override] public function removeItem(ITrashItem $item) { $this->getBackendForItem($item)->removeItem($item); } @@ -76,6 +81,7 @@ class TrashManager implements ITrashManager { } } + #[\Override] public function moveToTrash(IStorage $storage, string $internalPath): bool { if ($this->trashPaused) { return false; @@ -91,6 +97,7 @@ class TrashManager implements ITrashManager { } } + #[\Override] public function getTrashNodeById(IUser $user, int $fileId) { foreach ($this->backends as $backend) { $item = $backend->getTrashNodeById($user, $fileId); @@ -101,10 +108,12 @@ class TrashManager implements ITrashManager { return null; } + #[\Override] public function pauseTrash() { $this->trashPaused = true; } + #[\Override] public function resumeTrash() { $this->trashPaused = false; } diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 7aa40528961..e66045f03cb 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -1268,6 +1268,7 @@ class Trashbin implements IEventListener { return $user; } + #[\Override] public function handle(Event $event): void { if ($event instanceof BeforeNodeDeletedEvent) { self::ensureFileScannedHook($event->getNode()); diff --git a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php index baff1ef6032..d230bc52d4b 100644 --- a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php +++ b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php @@ -42,6 +42,7 @@ class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getEstimatedExportSize(IUser $user): int|float { $uid = $user->getUID(); @@ -59,6 +60,7 @@ class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function export(IUser $user, IExportDestination $exportDestination, OutputInterface $output): void { $output->writeln('Exporting trashbin into ' . Application::APP_ID . '…'); @@ -91,6 +93,7 @@ class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function import(IUser $user, IImportSource $importSource, OutputInterface $output): void { if ($importSource->getMigratorVersion($this->getId()) === null) { $output->writeln('No version for ' . static::class . ', skipping import…'); @@ -144,6 +147,7 @@ class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getId(): string { return 'trashbin'; } @@ -151,6 +155,7 @@ class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getDisplayName(): string { return $this->l10n->t('Deleted files'); } @@ -158,6 +163,7 @@ class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getDescription(): string { return $this->l10n->t('Deleted files and folders in the trash bin (may expire during export if you are low on storage space)'); } diff --git a/apps/files_versions/lib/AppInfo/Application.php b/apps/files_versions/lib/AppInfo/Application.php index 29158276415..4301880b527 100644 --- a/apps/files_versions/lib/AppInfo/Application.php +++ b/apps/files_versions/lib/AppInfo/Application.php @@ -57,6 +57,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID, $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { /** * Register capabilities @@ -114,6 +115,7 @@ class Application extends App implements IBootstrap { $context->registerEventListener(VersionRestoredEvent::class, LegacyRollbackListener::class); } + #[\Override] public function boot(IBootContext $context): void { $context->injectFn(\Closure::fromCallable([$this, 'registerVersionBackends'])); } diff --git a/apps/files_versions/lib/BackgroundJob/ExpireVersions.php b/apps/files_versions/lib/BackgroundJob/ExpireVersions.php index 794cbc5b882..2d9d985b4b8 100644 --- a/apps/files_versions/lib/BackgroundJob/ExpireVersions.php +++ b/apps/files_versions/lib/BackgroundJob/ExpireVersions.php @@ -30,6 +30,7 @@ class ExpireVersions extends TimedJob { $this->setInterval(60 * 30); } + #[\Override] public function run($argument) { $backgroundJob = $this->config->getAppValue('files_versions', 'background_job_expire_versions', 'yes'); if ($backgroundJob === 'no') { diff --git a/apps/files_versions/lib/Capabilities.php b/apps/files_versions/lib/Capabilities.php index 248231c69be..88255f5e170 100644 --- a/apps/files_versions/lib/Capabilities.php +++ b/apps/files_versions/lib/Capabilities.php @@ -25,6 +25,7 @@ class Capabilities implements ICapability { * * @return array{files: array{versioning: bool, version_labeling: bool, version_deletion: bool}} */ + #[\Override] public function getCapabilities() { return [ 'files' => [ diff --git a/apps/files_versions/lib/Command/CleanUp.php b/apps/files_versions/lib/Command/CleanUp.php index e8c46afef16..f3a71d3dbb2 100644 --- a/apps/files_versions/lib/Command/CleanUp.php +++ b/apps/files_versions/lib/Command/CleanUp.php @@ -26,6 +26,7 @@ class CleanUp extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('versions:cleanup') @@ -44,6 +45,7 @@ class CleanUp extends Command { } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $users = $input->getArgument('user_id'); diff --git a/apps/files_versions/lib/Command/Expire.php b/apps/files_versions/lib/Command/Expire.php index a30e623c347..19960ecdb1b 100644 --- a/apps/files_versions/lib/Command/Expire.php +++ b/apps/files_versions/lib/Command/Expire.php @@ -24,6 +24,7 @@ class Expire implements ICommand { ) { } + #[\Override] public function handle(): void { /** @var IUserManager $userManager */ $userManager = Server::get(IUserManager::class); diff --git a/apps/files_versions/lib/Command/ExpireVersions.php b/apps/files_versions/lib/Command/ExpireVersions.php index d3f341a21d2..5413f897d2c 100644 --- a/apps/files_versions/lib/Command/ExpireVersions.php +++ b/apps/files_versions/lib/Command/ExpireVersions.php @@ -26,6 +26,7 @@ class ExpireVersions extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('versions:expire') @@ -37,6 +38,7 @@ class ExpireVersions extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $maxAge = $this->expiration->getMaxAgeAsTimestamp(); if (!$maxAge) { diff --git a/apps/files_versions/lib/Db/VersionEntity.php b/apps/files_versions/lib/Db/VersionEntity.php index 20102e67602..530e6effedf 100644 --- a/apps/files_versions/lib/Db/VersionEntity.php +++ b/apps/files_versions/lib/Db/VersionEntity.php @@ -42,6 +42,7 @@ class VersionEntity extends Entity implements JsonSerializable { $this->addType('metadata', Types::JSON); } + #[\Override] public function jsonSerialize(): array { return [ 'id' => $this->getId(), diff --git a/apps/files_versions/lib/Listener/FileEventsListener.php b/apps/files_versions/lib/Listener/FileEventsListener.php index 5431d3bfa3d..fc27e97eeaf 100644 --- a/apps/files_versions/lib/Listener/FileEventsListener.php +++ b/apps/files_versions/lib/Listener/FileEventsListener.php @@ -65,6 +65,7 @@ class FileEventsListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof NodeCreatedEvent) { $this->created($event->getNode()); diff --git a/apps/files_versions/lib/Listener/LegacyRollbackListener.php b/apps/files_versions/lib/Listener/LegacyRollbackListener.php index 072c1511caa..9970279553b 100644 --- a/apps/files_versions/lib/Listener/LegacyRollbackListener.php +++ b/apps/files_versions/lib/Listener/LegacyRollbackListener.php @@ -21,6 +21,7 @@ use OCP\EventDispatcher\IEventListener; * @template-implements IEventListener */ class LegacyRollbackListener implements IEventListener { + #[\Override] public function handle(Event $event): void { if (!($event instanceof VersionRestoredEvent)) { return; diff --git a/apps/files_versions/lib/Listener/LoadAdditionalListener.php b/apps/files_versions/lib/Listener/LoadAdditionalListener.php index 7453c83ac6b..92b6c9c692a 100644 --- a/apps/files_versions/lib/Listener/LoadAdditionalListener.php +++ b/apps/files_versions/lib/Listener/LoadAdditionalListener.php @@ -16,6 +16,7 @@ use OCP\Util; /** @template-implements IEventListener */ class LoadAdditionalListener implements IEventListener { + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoadAdditionalScriptsEvent)) { return; diff --git a/apps/files_versions/lib/Listener/LoadSidebarListener.php b/apps/files_versions/lib/Listener/LoadSidebarListener.php index 651a20f9778..249c11ca488 100644 --- a/apps/files_versions/lib/Listener/LoadSidebarListener.php +++ b/apps/files_versions/lib/Listener/LoadSidebarListener.php @@ -16,6 +16,7 @@ use OCP\Util; /** @template-implements IEventListener */ class LoadSidebarListener implements IEventListener { + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoadSidebar)) { return; diff --git a/apps/files_versions/lib/Listener/VersionAuthorListener.php b/apps/files_versions/lib/Listener/VersionAuthorListener.php index 9b93b1f888b..32189608fc1 100644 --- a/apps/files_versions/lib/Listener/VersionAuthorListener.php +++ b/apps/files_versions/lib/Listener/VersionAuthorListener.php @@ -30,6 +30,7 @@ class VersionAuthorListener implements IEventListener { * @abstract handles events from a nodes version being changed * @param Event $event the event that triggered this listener to activate */ + #[\Override] public function handle(Event $event): void { if ($event instanceof NodeWrittenEvent) { $this->post_write_hook($event->getNode()); diff --git a/apps/files_versions/lib/Listener/VersionStorageMoveListener.php b/apps/files_versions/lib/Listener/VersionStorageMoveListener.php index d7c078733ad..8c50d5226b4 100644 --- a/apps/files_versions/lib/Listener/VersionStorageMoveListener.php +++ b/apps/files_versions/lib/Listener/VersionStorageMoveListener.php @@ -45,6 +45,7 @@ class VersionStorageMoveListener implements IEventListener { * @abstract Moves version across storages if necessary. * @throws Exception No user in session */ + #[\Override] public function handle(Event $event): void { if (!($event instanceof AbstractNodesEvent)) { return; diff --git a/apps/files_versions/lib/Migration/Version1020Date20221114144058.php b/apps/files_versions/lib/Migration/Version1020Date20221114144058.php index 77c8c2201f3..4167c4ecdf1 100644 --- a/apps/files_versions/lib/Migration/Version1020Date20221114144058.php +++ b/apps/files_versions/lib/Migration/Version1020Date20221114144058.php @@ -25,6 +25,7 @@ class Version1020Date20221114144058 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/apps/files_versions/lib/Sabre/Plugin.php b/apps/files_versions/lib/Sabre/Plugin.php index 76b7633076b..37755aab6b3 100644 --- a/apps/files_versions/lib/Sabre/Plugin.php +++ b/apps/files_versions/lib/Sabre/Plugin.php @@ -45,6 +45,7 @@ class Plugin extends ServerPlugin { ) { } + #[\Override] public function initialize(Server $server): void { $this->server = $server; diff --git a/apps/files_versions/lib/Sabre/RestoreFolder.php b/apps/files_versions/lib/Sabre/RestoreFolder.php index 7904b098a4f..0c340b0ca02 100644 --- a/apps/files_versions/lib/Sabre/RestoreFolder.php +++ b/apps/files_versions/lib/Sabre/RestoreFolder.php @@ -14,42 +14,52 @@ use Sabre\DAV\IMoveTarget; use Sabre\DAV\INode; class RestoreFolder implements ICollection, IMoveTarget { + #[\Override] public function createFile($name, $data = null) { throw new Forbidden(); } + #[\Override] public function createDirectory($name) { throw new Forbidden(); } + #[\Override] public function getChild($name) { return null; } + #[\Override] public function delete() { throw new Forbidden(); } + #[\Override] public function getName() { return 'restore'; } + #[\Override] public function setName($name) { throw new Forbidden(); } + #[\Override] public function getLastModified(): int { return 0; } + #[\Override] public function getChildren(): array { return []; } + #[\Override] public function childExists($name): bool { return false; } + #[\Override] public function moveInto($targetName, $sourcePath, INode $sourceNode): bool { if (!($sourceNode instanceof VersionFile)) { return false; diff --git a/apps/files_versions/lib/Sabre/RootCollection.php b/apps/files_versions/lib/Sabre/RootCollection.php index 1e7129f23da..0e97b346626 100644 --- a/apps/files_versions/lib/Sabre/RootCollection.php +++ b/apps/files_versions/lib/Sabre/RootCollection.php @@ -40,6 +40,7 @@ class RootCollection extends AbstractPrincipalCollection { * @param array $principalInfo * @return INode */ + #[\Override] public function getChildForPrincipal(array $principalInfo) { [, $name] = \Sabre\Uri\split($principalInfo['uri']); $user = $this->userSession->getUser(); @@ -49,6 +50,7 @@ class RootCollection extends AbstractPrincipalCollection { return new VersionHome($principalInfo, $this->rootFolder, $this->userManager, $this->versionManager); } + #[\Override] public function getName() { return 'versions'; } diff --git a/apps/files_versions/lib/Sabre/VersionCollection.php b/apps/files_versions/lib/Sabre/VersionCollection.php index 375d5cf99f2..cc2d7f1b983 100644 --- a/apps/files_versions/lib/Sabre/VersionCollection.php +++ b/apps/files_versions/lib/Sabre/VersionCollection.php @@ -25,14 +25,17 @@ class VersionCollection implements ICollection { ) { } + #[\Override] public function createFile($name, $data = null) { throw new Forbidden(); } + #[\Override] public function createDirectory($name) { throw new Forbidden(); } + #[\Override] public function getChild($name) { /** @var VersionFile[] $versions */ $versions = $this->getChildren(); @@ -46,6 +49,7 @@ class VersionCollection implements ICollection { throw new NotFound(); } + #[\Override] public function getChildren(): array { $versions = $this->versionManager->getVersionsForFile($this->user, $this->file); @@ -54,6 +58,7 @@ class VersionCollection implements ICollection { }, $versions); } + #[\Override] public function childExists($name): bool { try { $this->getChild($name); @@ -63,18 +68,22 @@ class VersionCollection implements ICollection { } } + #[\Override] public function delete() { throw new Forbidden(); } + #[\Override] public function getName(): string { return (string)$this->file->getId(); } + #[\Override] public function setName($name) { throw new Forbidden(); } + #[\Override] public function getLastModified(): int { return 0; } diff --git a/apps/files_versions/lib/Sabre/VersionFile.php b/apps/files_versions/lib/Sabre/VersionFile.php index faa03473648..e75b3031bad 100644 --- a/apps/files_versions/lib/Sabre/VersionFile.php +++ b/apps/files_versions/lib/Sabre/VersionFile.php @@ -27,10 +27,12 @@ class VersionFile implements IFile { ) { } + #[\Override] public function put($data) { throw new Forbidden(); } + #[\Override] public function get() { try { return $this->versionManager->read($this->version); @@ -39,10 +41,12 @@ class VersionFile implements IFile { } } + #[\Override] public function getContentType(): string { return $this->version->getMimeType(); } + #[\Override] public function getETag(): string { return (string)$this->version->getRevisionId(); } @@ -51,10 +55,12 @@ class VersionFile implements IFile { * @psalm-suppress ImplementedReturnTypeMismatch \Sabre\DAV\IFile::getSize signature does not support 32bit * @return int|float */ + #[\Override] public function getSize(): int|float { return $this->version->getSize(); } + #[\Override] public function delete() { if ($this->versionManager instanceof IDeletableVersionBackend) { $this->versionManager->deleteVersion($this->version); @@ -63,10 +69,12 @@ class VersionFile implements IFile { } } + #[\Override] public function getName(): string { return (string)$this->version->getRevisionId(); } + #[\Override] public function setName($name) { throw new Forbidden(); } @@ -94,6 +102,7 @@ class VersionFile implements IFile { return null; } + #[\Override] public function getLastModified(): int { return $this->version->getTimestamp(); } diff --git a/apps/files_versions/lib/Sabre/VersionHome.php b/apps/files_versions/lib/Sabre/VersionHome.php index 07ac491f2a1..4c2f256ad32 100644 --- a/apps/files_versions/lib/Sabre/VersionHome.php +++ b/apps/files_versions/lib/Sabre/VersionHome.php @@ -32,26 +32,32 @@ class VersionHome implements ICollection { return $user; } + #[\Override] public function delete() { throw new Forbidden(); } + #[\Override] public function getName(): string { return $this->getUser()->getUID(); } + #[\Override] public function setName($name) { throw new Forbidden(); } + #[\Override] public function createFile($name, $data = null) { throw new Forbidden(); } + #[\Override] public function createDirectory($name) { throw new Forbidden(); } + #[\Override] public function getChild($name) { $user = $this->getUser(); @@ -63,6 +69,7 @@ class VersionHome implements ICollection { } } + #[\Override] public function getChildren() { $user = $this->getUser(); @@ -72,10 +79,12 @@ class VersionHome implements ICollection { ]; } + #[\Override] public function childExists($name) { return $name === 'versions' || $name === 'restore'; } + #[\Override] public function getLastModified() { return 0; } diff --git a/apps/files_versions/lib/Sabre/VersionRoot.php b/apps/files_versions/lib/Sabre/VersionRoot.php index 7f7014fbee3..665ff3cc197 100644 --- a/apps/files_versions/lib/Sabre/VersionRoot.php +++ b/apps/files_versions/lib/Sabre/VersionRoot.php @@ -25,26 +25,32 @@ class VersionRoot implements ICollection { ) { } + #[\Override] public function delete() { throw new Forbidden(); } + #[\Override] public function getName(): string { return 'versions'; } + #[\Override] public function setName($name) { throw new Forbidden(); } + #[\Override] public function createFile($name, $data = null) { throw new Forbidden(); } + #[\Override] public function createDirectory($name) { throw new Forbidden(); } + #[\Override] public function getChild($name) { $userFolder = $this->rootFolder->getUserFolder($this->user->getUID()); @@ -62,10 +68,12 @@ class VersionRoot implements ICollection { return new VersionCollection($node, $this->user, $this->versionManager); } + #[\Override] public function getChildren(): array { return []; } + #[\Override] public function childExists($name): bool { try { $this->getChild($name); @@ -75,6 +83,7 @@ class VersionRoot implements ICollection { } } + #[\Override] public function getLastModified(): int { return 0; } diff --git a/apps/files_versions/lib/Versions/LegacyVersionsBackend.php b/apps/files_versions/lib/Versions/LegacyVersionsBackend.php index c2d57ae96f2..c3ae5d2742d 100644 --- a/apps/files_versions/lib/Versions/LegacyVersionsBackend.php +++ b/apps/files_versions/lib/Versions/LegacyVersionsBackend.php @@ -41,10 +41,12 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend ) { } + #[\Override] public function useBackendForStorage(IStorage $storage): bool { return true; } + #[\Override] public function getVersionsForFile(IUser $user, FileInfo $file): array { $storage = $file->getStorage(); @@ -147,6 +149,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend return $davVersions; } + #[\Override] public function createVersion(IUser $user, FileInfo $file) { $userFolder = $this->rootFolder->getUserFolder($user->getUID()); $relativePath = $userFolder->getRelativePath($file->getPath()); @@ -162,6 +165,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend $userView->getFileInfo('files_versions/' . $relativePath . '.v' . $file->getMtime()); } + #[\Override] public function rollback(IVersion $version) { if (!$this->currentUserHasPermissions($version->getSourceFile(), Constants::PERMISSION_UPDATE)) { throw new Forbidden('You cannot restore this version because you do not have update permissions on the source file.'); @@ -182,6 +186,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend } } + #[\Override] public function read(IVersion $version) { $versions = $this->getVersionFolder($version->getUser()); /** @var File $file */ @@ -189,6 +194,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend return $file->fopen('r'); } + #[\Override] public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): File { $userFolder = $this->rootFolder->getUserFolder($user->getUID()); $owner = $sourceFile->getOwner(); @@ -212,10 +218,12 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend return $file; } + #[\Override] public function getRevision(Node $node): int { return $node->getMTime(); } + #[\Override] public function deleteVersion(IVersion $version): void { if (!$this->currentUserHasPermissions($version->getSourceFile(), Constants::PERMISSION_DELETE)) { throw new Forbidden('You cannot delete this version because you do not have delete permissions on the source file.'); @@ -229,6 +237,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend $this->versionsMapper->delete($versionEntity); } + #[\Override] public function createVersionEntity(File $file): ?VersionEntity { $versionEntity = new VersionEntity(); $versionEntity->setFileId($file->getId()); @@ -260,6 +269,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend return null; } + #[\Override] public function updateVersionEntity(File $sourceFile, int $revision, array $properties): void { $versionEntity = $this->versionsMapper->findVersionForFileId($sourceFile->getId(), $revision); @@ -278,6 +288,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend $this->versionsMapper->update($versionEntity); } + #[\Override] public function deleteVersionsEntity(File $file): void { $this->versionsMapper->deleteAllVersionsForFileId($file->getId()); } @@ -308,6 +319,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend return false; } + #[\Override] public function setMetadataValue(Node $node, int $revision, string $key, string $value): void { if (!$this->currentUserHasPermissions($node, Constants::PERMISSION_UPDATE)) { throw new Forbidden('You cannot update the version\'s metadata because you do not have update permissions on the source file.'); @@ -323,6 +335,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend /** * @inheritdoc */ + #[\Override] public function importVersionsForFile(IUser $user, Node $source, Node $target, array $versions): void { $userFolder = $this->rootFolder->getUserFolder($user->getUID()); $relativePath = $userFolder->getRelativePath($target->getPath()); @@ -371,6 +384,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend /** * @inheritdoc */ + #[\Override] public function clearVersionsForFile(IUser $user, Node $source, Node $target): void { $userId = $user->getUID(); $userFolder = $this->rootFolder->getUserFolder($userId); diff --git a/apps/files_versions/lib/Versions/Version.php b/apps/files_versions/lib/Versions/Version.php index e202a69b7d7..2d05e97af57 100644 --- a/apps/files_versions/lib/Versions/Version.php +++ b/apps/files_versions/lib/Versions/Version.php @@ -26,46 +26,57 @@ class Version implements IVersion, IMetadataVersion { ) { } + #[\Override] public function getBackend(): IVersionBackend { return $this->backend; } + #[\Override] public function getSourceFile(): FileInfo { return $this->sourceFileInfo; } + #[\Override] public function getRevisionId() { return $this->revisionId; } + #[\Override] public function getTimestamp(): int { return $this->timestamp; } + #[\Override] public function getSize(): int|float { return $this->size; } + #[\Override] public function getSourceFileName(): string { return $this->name; } + #[\Override] public function getMimeType(): string { return $this->mimetype; } + #[\Override] public function getVersionPath(): string { return $this->path; } + #[\Override] public function getUser(): IUser { return $this->user; } + #[\Override] public function getMetadata(): array { return $this->metadata; } + #[\Override] public function getMetadataValue(string $key): ?string { return $this->metadata[$key] ?? null; } diff --git a/apps/files_versions/lib/Versions/VersionManager.php b/apps/files_versions/lib/Versions/VersionManager.php index 9acea8c6513..a676268fda5 100644 --- a/apps/files_versions/lib/Versions/VersionManager.php +++ b/apps/files_versions/lib/Versions/VersionManager.php @@ -34,6 +34,7 @@ class VersionManager implements IVersionManager, IDeletableVersionBackend, INeed ) { } + #[\Override] public function registerBackend(string $storageType, IVersionBackend $backend) { if (!isset($this->backends[$storageType])) { $this->backends[$storageType] = []; @@ -53,6 +54,7 @@ class VersionManager implements IVersionManager, IDeletableVersionBackend, INeed * @return IVersionBackend * @throws BackendNotFoundException */ + #[\Override] public function getBackendForStorage(IStorage $storage): IVersionBackend { $fullType = get_class($storage); $backends = $this->getBackends(); @@ -82,16 +84,19 @@ class VersionManager implements IVersionManager, IDeletableVersionBackend, INeed } } + #[\Override] public function getVersionsForFile(IUser $user, FileInfo $file): array { $backend = $this->getBackendForStorage($file->getStorage()); return $backend->getVersionsForFile($user, $file); } + #[\Override] public function createVersion(IUser $user, FileInfo $file) { $backend = $this->getBackendForStorage($file->getStorage()); $backend->createVersion($user, $file); } + #[\Override] public function rollback(IVersion $version) { $backend = $version->getBackend(); $result = self::handleAppLocks(fn (): ?bool => $backend->rollback($version)); @@ -102,25 +107,30 @@ class VersionManager implements IVersionManager, IDeletableVersionBackend, INeed return $result; } + #[\Override] public function read(IVersion $version) { $backend = $version->getBackend(); return $backend->read($version); } + #[\Override] public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): File { $backend = $this->getBackendForStorage($sourceFile->getStorage()); return $backend->getVersionFile($user, $sourceFile, $revision); } + #[\Override] public function getRevision(Node $node): int { $backend = $this->getBackendForStorage($node->getStorage()); return $backend->getRevision($node); } + #[\Override] public function useBackendForStorage(IStorage $storage): bool { return false; } + #[\Override] public function deleteVersion(IVersion $version): void { $backend = $version->getBackend(); if ($backend instanceof IDeletableVersionBackend) { @@ -128,6 +138,7 @@ class VersionManager implements IVersionManager, IDeletableVersionBackend, INeed } } + #[\Override] public function createVersionEntity(File $file): void { $backend = $this->getBackendForStorage($file->getStorage()); if ($backend instanceof INeedSyncVersionBackend) { @@ -144,6 +155,7 @@ class VersionManager implements IVersionManager, IDeletableVersionBackend, INeed } } + #[\Override] public function updateVersionEntity(File $sourceFile, int $revision, array $properties): void { $backend = $this->getBackendForStorage($sourceFile->getStorage()); if ($backend instanceof INeedSyncVersionBackend) { @@ -151,6 +163,7 @@ class VersionManager implements IVersionManager, IDeletableVersionBackend, INeed } } + #[\Override] public function deleteVersionsEntity(File $file): void { $backend = $this->getBackendForStorage($file->getStorage()); if ($backend instanceof INeedSyncVersionBackend) { @@ -158,6 +171,7 @@ class VersionManager implements IVersionManager, IDeletableVersionBackend, INeed } } + #[\Override] public function setMetadataValue(Node $node, int $revision, string $key, string $value): void { $backend = $this->getBackendForStorage($node->getStorage()); if ($backend instanceof IMetadataVersionBackend) { diff --git a/apps/lookup_server_connector/lib/AppInfo/Application.php b/apps/lookup_server_connector/lib/AppInfo/Application.php index 4a43e925970..d09b36a70c4 100644 --- a/apps/lookup_server_connector/lib/AppInfo/Application.php +++ b/apps/lookup_server_connector/lib/AppInfo/Application.php @@ -25,9 +25,11 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID); } + #[\Override] public function register(IRegistrationContext $context): void { } + #[\Override] public function boot(IBootContext $context): void { $context->injectFn(Closure::fromCallable([$this, 'registerEventListeners'])); } diff --git a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php index 411c02685fc..981a58c1e94 100644 --- a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php +++ b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php @@ -51,6 +51,7 @@ class RetryJob extends Job { /** * Run the job, then remove it from the jobList */ + #[\Override] public function start(IJobList $jobList): void { if (!isset($this->argument['userId'])) { // Old background job without user id, just drop it. @@ -95,6 +96,7 @@ class RetryJob extends Job { return ($this->time->getTime() - $this->lastRun) > $delay; } + #[\Override] protected function run($argument): void { $user = $this->userManager->get($this->argument['userId']); if (!$user instanceof IUser) { diff --git a/apps/oauth2/lib/BackgroundJob/CleanupExpiredAuthorizationCode.php b/apps/oauth2/lib/BackgroundJob/CleanupExpiredAuthorizationCode.php index b819a45ace2..876cbc36514 100644 --- a/apps/oauth2/lib/BackgroundJob/CleanupExpiredAuthorizationCode.php +++ b/apps/oauth2/lib/BackgroundJob/CleanupExpiredAuthorizationCode.php @@ -33,6 +33,7 @@ class CleanupExpiredAuthorizationCode extends TimedJob { * @param mixed $argument * @inheritDoc */ + #[\Override] protected function run($argument): void { try { $this->accessTokenMapper->cleanupExpiredAuthorizationCode(); diff --git a/apps/oauth2/lib/Command/ImportLegacyOcClient.php b/apps/oauth2/lib/Command/ImportLegacyOcClient.php index acdc57cf991..6a2303ac545 100644 --- a/apps/oauth2/lib/Command/ImportLegacyOcClient.php +++ b/apps/oauth2/lib/Command/ImportLegacyOcClient.php @@ -30,6 +30,7 @@ class ImportLegacyOcClient extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this->setName('oauth2:import-legacy-oc-client'); $this->setDescription('This command is only required to be run on instances which were migrated from ownCloud without the oauth2.enable_oc_clients system config! Import a legacy Oauth2 client from an ownCloud instance and migrate it. The data is expected to be straight out of the database table oc_oauth2_clients.'); @@ -45,10 +46,12 @@ class ImportLegacyOcClient extends Command { ); } + #[\Override] public function isEnabled(): bool { return $this->config->getSystemValueBool('oauth2.enable_oc_clients', false); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { /** @var string $clientId */ $clientId = $input->getArgument(self::ARGUMENT_CLIENT_ID); diff --git a/apps/oauth2/lib/Migration/SetTokenExpiration.php b/apps/oauth2/lib/Migration/SetTokenExpiration.php index 428153b51bc..eb852c3ec42 100644 --- a/apps/oauth2/lib/Migration/SetTokenExpiration.php +++ b/apps/oauth2/lib/Migration/SetTokenExpiration.php @@ -25,10 +25,12 @@ class SetTokenExpiration implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Update OAuth token expiration times'; } + #[\Override] public function run(IOutput $output) { $qb = $this->connection->getQueryBuilder(); $qb->select('*') diff --git a/apps/oauth2/lib/Migration/Version010401Date20181207190718.php b/apps/oauth2/lib/Migration/Version010401Date20181207190718.php index 8648826d53c..eeecbd6001b 100644 --- a/apps/oauth2/lib/Migration/Version010401Date20181207190718.php +++ b/apps/oauth2/lib/Migration/Version010401Date20181207190718.php @@ -21,6 +21,7 @@ class Version010401Date20181207190718 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/oauth2/lib/Migration/Version010402Date20190107124745.php b/apps/oauth2/lib/Migration/Version010402Date20190107124745.php index 08099c625f7..a6d3849020f 100644 --- a/apps/oauth2/lib/Migration/Version010402Date20190107124745.php +++ b/apps/oauth2/lib/Migration/Version010402Date20190107124745.php @@ -21,6 +21,7 @@ class Version010402Date20190107124745 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/oauth2/lib/Migration/Version011601Date20230522143227.php b/apps/oauth2/lib/Migration/Version011601Date20230522143227.php index d206915f861..465f72c352b 100644 --- a/apps/oauth2/lib/Migration/Version011601Date20230522143227.php +++ b/apps/oauth2/lib/Migration/Version011601Date20230522143227.php @@ -24,6 +24,7 @@ class Version011601Date20230522143227 extends SimpleMigrationStep { ) { } + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -40,6 +41,7 @@ class Version011601Date20230522143227 extends SimpleMigrationStep { return null; } + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { $qbUpdate = $this->connection->getQueryBuilder(); $qbUpdate->update('oauth2_clients') diff --git a/apps/oauth2/lib/Migration/Version011602Date20230613160650.php b/apps/oauth2/lib/Migration/Version011602Date20230613160650.php index 06efce324b2..48492d79dd0 100644 --- a/apps/oauth2/lib/Migration/Version011602Date20230613160650.php +++ b/apps/oauth2/lib/Migration/Version011602Date20230613160650.php @@ -19,6 +19,7 @@ class Version011602Date20230613160650 extends SimpleMigrationStep { ) { } + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/oauth2/lib/Migration/Version011603Date20230620111039.php b/apps/oauth2/lib/Migration/Version011603Date20230620111039.php index 853eacd2873..02c166ddac6 100644 --- a/apps/oauth2/lib/Migration/Version011603Date20230620111039.php +++ b/apps/oauth2/lib/Migration/Version011603Date20230620111039.php @@ -23,6 +23,7 @@ class Version011603Date20230620111039 extends SimpleMigrationStep { ) { } + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -58,6 +59,7 @@ class Version011603Date20230620111039 extends SimpleMigrationStep { return null; } + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { // we consider that existing access_tokens have already produced at least one oauth token // which prevents cleaning them up diff --git a/apps/oauth2/lib/Migration/Version011901Date20240829164356.php b/apps/oauth2/lib/Migration/Version011901Date20240829164356.php index 3e97b29fdd1..1f5ce908a60 100644 --- a/apps/oauth2/lib/Migration/Version011901Date20240829164356.php +++ b/apps/oauth2/lib/Migration/Version011901Date20240829164356.php @@ -23,6 +23,7 @@ class Version011901Date20240829164356 extends SimpleMigrationStep { ) { } + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $qbUpdate = $this->connection->getQueryBuilder(); $qbUpdate->update('oauth2_clients') diff --git a/apps/oauth2/lib/Settings/Admin.php b/apps/oauth2/lib/Settings/Admin.php index b843b31af17..ac2f2418a66 100644 --- a/apps/oauth2/lib/Settings/Admin.php +++ b/apps/oauth2/lib/Settings/Admin.php @@ -26,6 +26,7 @@ class Admin implements ISettings { ) { } + #[\Override] public function getForm(): TemplateResponse { $clients = $this->clientMapper->getClients(); $result = []; @@ -56,10 +57,12 @@ class Admin implements ISettings { ); } + #[\Override] public function getSection(): string { return 'security'; } + #[\Override] public function getPriority(): int { return 100; } diff --git a/apps/profile/lib/AppInfo/Application.php b/apps/profile/lib/AppInfo/Application.php index d10a8dffe5d..ff2d3f86016 100644 --- a/apps/profile/lib/AppInfo/Application.php +++ b/apps/profile/lib/AppInfo/Application.php @@ -24,11 +24,13 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID, $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerReferenceProvider(ProfilePickerReferenceProvider::class); $context->registerEventListener(RenderReferenceEvent::class, ProfilePickerReferenceListener::class); } + #[\Override] public function boot(IBootContext $context): void { } } diff --git a/apps/profile/lib/Listener/ProfilePickerReferenceListener.php b/apps/profile/lib/Listener/ProfilePickerReferenceListener.php index 124d10e035c..c43b9fe9d55 100644 --- a/apps/profile/lib/Listener/ProfilePickerReferenceListener.php +++ b/apps/profile/lib/Listener/ProfilePickerReferenceListener.php @@ -27,6 +27,7 @@ class ProfilePickerReferenceListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof RenderReferenceEvent) { return; diff --git a/apps/profile/lib/Reference/ProfilePickerReferenceProvider.php b/apps/profile/lib/Reference/ProfilePickerReferenceProvider.php index 9b748a42d6d..dbc34a28973 100644 --- a/apps/profile/lib/Reference/ProfilePickerReferenceProvider.php +++ b/apps/profile/lib/Reference/ProfilePickerReferenceProvider.php @@ -46,6 +46,7 @@ class ProfilePickerReferenceProvider extends ADiscoverableReferenceProvider { /** * @inheritDoc */ + #[\Override] public function getId(): string { return 'profile_picker'; } @@ -53,6 +54,7 @@ class ProfilePickerReferenceProvider extends ADiscoverableReferenceProvider { /** * @inheritDoc */ + #[\Override] public function getTitle(): string { return $this->l10n->t('Profile picker'); } @@ -60,6 +62,7 @@ class ProfilePickerReferenceProvider extends ADiscoverableReferenceProvider { /** * @inheritDoc */ + #[\Override] public function getOrder(): int { return 10; } @@ -67,6 +70,7 @@ class ProfilePickerReferenceProvider extends ADiscoverableReferenceProvider { /** * @inheritDoc */ + #[\Override] public function getIconUrl(): string { return $this->urlGenerator->imagePath(Application::APP_ID, 'app-dark.svg'); } @@ -74,6 +78,7 @@ class ProfilePickerReferenceProvider extends ADiscoverableReferenceProvider { /** * @inheritDoc */ + #[\Override] public function matchReference(string $referenceText): bool { if (!$this->enabled) { return false; @@ -84,6 +89,7 @@ class ProfilePickerReferenceProvider extends ADiscoverableReferenceProvider { /** * @inheritDoc */ + #[\Override] public function resolveReference(string $referenceText): ?IReference { if (!$this->matchReference($referenceText)) { return null; @@ -176,6 +182,7 @@ class ProfilePickerReferenceProvider extends ADiscoverableReferenceProvider { /** * @inheritDoc */ + #[\Override] public function getCachePrefix(string $referenceId): string { return $this->userId ?? ''; } @@ -183,6 +190,7 @@ class ProfilePickerReferenceProvider extends ADiscoverableReferenceProvider { /** * @inheritDoc */ + #[\Override] public function getCacheKey(string $referenceId): ?string { $objectId = $this->getObjectId($referenceId); if ($objectId !== null) { diff --git a/apps/provisioning_api/lib/AppInfo/Application.php b/apps/provisioning_api/lib/AppInfo/Application.php index 9595dd4a606..deef1738c45 100644 --- a/apps/provisioning_api/lib/AppInfo/Application.php +++ b/apps/provisioning_api/lib/AppInfo/Application.php @@ -36,6 +36,7 @@ class Application extends App implements IBootstrap { parent::__construct('provisioning_api', $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); @@ -74,6 +75,7 @@ class Application extends App implements IBootstrap { $context->registerCapability(Capabilities::class); } + #[\Override] public function boot(IBootContext $context): void { } } diff --git a/apps/provisioning_api/lib/Capabilities.php b/apps/provisioning_api/lib/Capabilities.php index 5becf6f611f..1297fcd2754 100644 --- a/apps/provisioning_api/lib/Capabilities.php +++ b/apps/provisioning_api/lib/Capabilities.php @@ -30,6 +30,7 @@ class Capabilities implements ICapability { * }, * } */ + #[\Override] public function getCapabilities() { $federatedScopeEnabled = $this->appManager->isEnabledForUser('federation'); diff --git a/apps/provisioning_api/lib/Listener/UserDeletedListener.php b/apps/provisioning_api/lib/Listener/UserDeletedListener.php index 5a2dce249fb..2300ac19a60 100644 --- a/apps/provisioning_api/lib/Listener/UserDeletedListener.php +++ b/apps/provisioning_api/lib/Listener/UserDeletedListener.php @@ -21,6 +21,7 @@ class UserDeletedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof UserDeletedEvent)) { // Unrelated diff --git a/apps/provisioning_api/lib/Middleware/ProvisioningApiMiddleware.php b/apps/provisioning_api/lib/Middleware/ProvisioningApiMiddleware.php index 2e4e6a3bf2c..937590cde8e 100644 --- a/apps/provisioning_api/lib/Middleware/ProvisioningApiMiddleware.php +++ b/apps/provisioning_api/lib/Middleware/ProvisioningApiMiddleware.php @@ -39,6 +39,7 @@ class ProvisioningApiMiddleware extends Middleware { * * @throws NotSubAdminException */ + #[\Override] public function beforeController($controller, $methodName) { // If AuthorizedAdminSetting, the check will be done in the SecurityMiddleware if (!$this->isAdmin && !$this->reflector->hasAnnotation('NoSubAdminRequired') && !$this->isSubAdmin && !$this->reflector->hasAnnotationOrAttribute('AuthorizedAdminSetting', AuthorizedAdminSetting::class)) { @@ -53,6 +54,7 @@ class ProvisioningApiMiddleware extends Middleware { * @throws \Exception * @return Response */ + #[\Override] public function afterException($controller, $methodName, \Exception $exception) { if ($exception instanceof NotSubAdminException) { throw new OCSException($exception->getMessage(), Http::STATUS_FORBIDDEN); diff --git a/apps/settings/lib/Activity/GroupProvider.php b/apps/settings/lib/Activity/GroupProvider.php index 2d492265cf4..8abaeaa0834 100644 --- a/apps/settings/lib/Activity/GroupProvider.php +++ b/apps/settings/lib/Activity/GroupProvider.php @@ -33,6 +33,7 @@ class GroupProvider implements IProvider { ) { } + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getType() !== 'group_settings') { throw new UnknownActivityException(); diff --git a/apps/settings/lib/Activity/GroupSetting.php b/apps/settings/lib/Activity/GroupSetting.php index a97c233e6d9..98b672f3f55 100644 --- a/apps/settings/lib/Activity/GroupSetting.php +++ b/apps/settings/lib/Activity/GroupSetting.php @@ -25,6 +25,7 @@ class GroupSetting implements ISetting { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier(): string { return 'group_settings'; } @@ -33,6 +34,7 @@ class GroupSetting implements ISetting { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Your group memberships were modified'); } @@ -43,6 +45,7 @@ class GroupSetting implements ISetting { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority(): int { return 0; } @@ -51,6 +54,7 @@ class GroupSetting implements ISetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function canChangeStream(): bool { return false; } @@ -59,6 +63,7 @@ class GroupSetting implements ISetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledStream(): bool { return true; } @@ -67,6 +72,7 @@ class GroupSetting implements ISetting { * @return bool True when the option can be changed for the mail * @since 11.0.0 */ + #[\Override] public function canChangeMail(): bool { return true; } @@ -75,6 +81,7 @@ class GroupSetting implements ISetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledMail(): bool { return true; } diff --git a/apps/settings/lib/Activity/Provider.php b/apps/settings/lib/Activity/Provider.php index c31a900abd5..52c9f90d449 100644 --- a/apps/settings/lib/Activity/Provider.php +++ b/apps/settings/lib/Activity/Provider.php @@ -50,6 +50,7 @@ class Provider implements IProvider { * @throws UnknownActivityException * @since 11.0.0 */ + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== 'settings') { throw new UnknownActivityException('Unknown app'); diff --git a/apps/settings/lib/Activity/SecurityFilter.php b/apps/settings/lib/Activity/SecurityFilter.php index 283b0862ae6..8bb40a170f2 100644 --- a/apps/settings/lib/Activity/SecurityFilter.php +++ b/apps/settings/lib/Activity/SecurityFilter.php @@ -20,26 +20,32 @@ class SecurityFilter implements IFilter { ) { } + #[\Override] public function allowedApps() { return []; } + #[\Override] public function filterTypes(array $types) { return array_intersect(['security'], $types); } + #[\Override] public function getIcon() { return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')); } + #[\Override] public function getIdentifier() { return 'security'; } + #[\Override] public function getName() { return $this->l10n->t('Security'); } + #[\Override] public function getPriority() { return 30; } diff --git a/apps/settings/lib/Activity/SecurityProvider.php b/apps/settings/lib/Activity/SecurityProvider.php index 658e2e7b949..3b6c121439e 100644 --- a/apps/settings/lib/Activity/SecurityProvider.php +++ b/apps/settings/lib/Activity/SecurityProvider.php @@ -24,6 +24,7 @@ class SecurityProvider implements IProvider { ) { } + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getType() !== 'security') { throw new UnknownActivityException(); diff --git a/apps/settings/lib/Activity/SecuritySetting.php b/apps/settings/lib/Activity/SecuritySetting.php index 5a42db555f2..a3ada47b47d 100644 --- a/apps/settings/lib/Activity/SecuritySetting.php +++ b/apps/settings/lib/Activity/SecuritySetting.php @@ -18,30 +18,37 @@ class SecuritySetting implements ISetting { ) { } + #[\Override] public function canChangeMail() { return false; } + #[\Override] public function canChangeStream() { return false; } + #[\Override] public function getIdentifier() { return 'security'; } + #[\Override] public function getName() { return $this->l10n->t('Security'); } + #[\Override] public function getPriority() { return 30; } + #[\Override] public function isDefaultEnabledMail() { return true; } + #[\Override] public function isDefaultEnabledStream() { return true; } diff --git a/apps/settings/lib/Activity/Setting.php b/apps/settings/lib/Activity/Setting.php index dcc308e2950..85a4efe3971 100644 --- a/apps/settings/lib/Activity/Setting.php +++ b/apps/settings/lib/Activity/Setting.php @@ -25,6 +25,7 @@ class Setting implements ISetting { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'personal_settings'; } @@ -33,6 +34,7 @@ class Setting implements ISetting { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('Your password or email was modified'); } @@ -43,6 +45,7 @@ class Setting implements ISetting { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 0; } @@ -51,6 +54,7 @@ class Setting implements ISetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function canChangeStream() { return false; } @@ -59,6 +63,7 @@ class Setting implements ISetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledStream() { return true; } @@ -67,6 +72,7 @@ class Setting implements ISetting { * @return bool True when the option can be changed for the mail * @since 11.0.0 */ + #[\Override] public function canChangeMail() { return false; } @@ -75,6 +81,7 @@ class Setting implements ISetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledMail() { return false; } diff --git a/apps/settings/lib/AppInfo/Application.php b/apps/settings/lib/AppInfo/Application.php index ebdcf144717..3231924dcef 100644 --- a/apps/settings/lib/AppInfo/Application.php +++ b/apps/settings/lib/AppInfo/Application.php @@ -111,6 +111,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID, $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { // Register Middleware $context->registerServiceAlias('SubadminMiddleware', SubadminMiddleware::class); @@ -221,6 +222,7 @@ class Application extends App implements IBootstrap { $context->registerUserMigrator(AccountMigrator::class); } + #[\Override] public function boot(IBootContext $context): void { } } diff --git a/apps/settings/lib/BackgroundJobs/VerifyUserData.php b/apps/settings/lib/BackgroundJobs/VerifyUserData.php index eb66644ad91..f4eb595aabf 100644 --- a/apps/settings/lib/BackgroundJobs/VerifyUserData.php +++ b/apps/settings/lib/BackgroundJobs/VerifyUserData.php @@ -44,6 +44,7 @@ class VerifyUserData extends Job { $this->lookupServerUrl = rtrim($lookupServerUrl, '/'); } + #[\Override] public function start(IJobList $jobList): void { if ($this->shouldRun($this->argument)) { parent::start($jobList); @@ -56,6 +57,7 @@ class VerifyUserData extends Job { } } + #[\Override] protected function run($argument) { $try = (int)$argument['try'] + 1; diff --git a/apps/settings/lib/Command/AdminDelegation/Add.php b/apps/settings/lib/Command/AdminDelegation/Add.php index 6064176724d..25fc8abcf8e 100644 --- a/apps/settings/lib/Command/AdminDelegation/Add.php +++ b/apps/settings/lib/Command/AdminDelegation/Add.php @@ -27,6 +27,7 @@ class Add extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('admin-delegation:add') @@ -37,6 +38,7 @@ class Add extends Base { ; } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $settingClass = $input->getArgument('settingClass'); diff --git a/apps/settings/lib/Command/AdminDelegation/Remove.php b/apps/settings/lib/Command/AdminDelegation/Remove.php index 6b5347ce89f..c04d25744e7 100644 --- a/apps/settings/lib/Command/AdminDelegation/Remove.php +++ b/apps/settings/lib/Command/AdminDelegation/Remove.php @@ -25,6 +25,7 @@ class Remove extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('admin-delegation:remove') @@ -35,6 +36,7 @@ class Remove extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $settingClass = $input->getArgument('settingClass'); diff --git a/apps/settings/lib/Command/AdminDelegation/Show.php b/apps/settings/lib/Command/AdminDelegation/Show.php index 6095964c5ee..633888c5b6e 100644 --- a/apps/settings/lib/Command/AdminDelegation/Show.php +++ b/apps/settings/lib/Command/AdminDelegation/Show.php @@ -25,6 +25,7 @@ class Show extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -33,6 +34,7 @@ class Show extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $outputFormat = $input->getOption('output'); diff --git a/apps/settings/lib/ConfigLexicon.php b/apps/settings/lib/ConfigLexicon.php index 6897f4759b0..a47f7cb45d1 100644 --- a/apps/settings/lib/ConfigLexicon.php +++ b/apps/settings/lib/ConfigLexicon.php @@ -29,16 +29,19 @@ class ConfigLexicon implements ILexicon { public const USER_LIST_SHOW_NEW_USER_FORM = 'user_list_show_new_user_form'; public const USER_LIST_SHOW_LANGUAGES = 'user_list_show_languages'; + #[\Override] public function getStrictness(): Strictness { return Strictness::IGNORE; } + #[\Override] public function getAppConfigs(): array { return [ new Entry(key: self::LOGIN_QRCODE_ONETIME, type: ValueType::BOOL, defaultRaw: true, definition: 'Use onetime QR codes for app passwords', note: 'Limits compatibility for mobile apps to versions released in 2026 or later'), ]; } + #[\Override] public function getUserConfigs(): array { return [ new Entry( diff --git a/apps/settings/lib/Hooks.php b/apps/settings/lib/Hooks.php index 3ff3a8b1190..510eed6dd43 100644 --- a/apps/settings/lib/Hooks.php +++ b/apps/settings/lib/Hooks.php @@ -42,6 +42,7 @@ class Hooks implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof PasswordUpdatedEvent) { $this->onChangePassword($event); diff --git a/apps/settings/lib/Listener/AppPasswordCreatedActivityListener.php b/apps/settings/lib/Listener/AppPasswordCreatedActivityListener.php index 92258b35d36..138cfeeb8c6 100644 --- a/apps/settings/lib/Listener/AppPasswordCreatedActivityListener.php +++ b/apps/settings/lib/Listener/AppPasswordCreatedActivityListener.php @@ -28,6 +28,7 @@ class AppPasswordCreatedActivityListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof AppPasswordCreatedEvent)) { return; diff --git a/apps/settings/lib/Listener/GroupRemovedListener.php b/apps/settings/lib/Listener/GroupRemovedListener.php index ae739446607..1a46e14d5bb 100644 --- a/apps/settings/lib/Listener/GroupRemovedListener.php +++ b/apps/settings/lib/Listener/GroupRemovedListener.php @@ -24,6 +24,7 @@ class GroupRemovedListener implements IEventListener { /** * @inheritDoc */ + #[\Override] public function handle(Event $event): void { if (!($event instanceof GroupDeletedEvent)) { return; diff --git a/apps/settings/lib/Listener/MailProviderListener.php b/apps/settings/lib/Listener/MailProviderListener.php index 61446f1e6cb..c0925b6a3d8 100644 --- a/apps/settings/lib/Listener/MailProviderListener.php +++ b/apps/settings/lib/Listener/MailProviderListener.php @@ -22,6 +22,7 @@ class MailProviderListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { /** @var DeclarativeSettingsGetValueEvent|DeclarativeSettingsSetValueEvent $event */ diff --git a/apps/settings/lib/Listener/UserAddedToGroupActivityListener.php b/apps/settings/lib/Listener/UserAddedToGroupActivityListener.php index 87cd66efdbc..4e76478b897 100644 --- a/apps/settings/lib/Listener/UserAddedToGroupActivityListener.php +++ b/apps/settings/lib/Listener/UserAddedToGroupActivityListener.php @@ -27,6 +27,7 @@ class UserAddedToGroupActivityListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof UserAddedEvent)) { return; diff --git a/apps/settings/lib/Listener/UserRemovedFromGroupActivityListener.php b/apps/settings/lib/Listener/UserRemovedFromGroupActivityListener.php index 803d86d555d..b8fedc0975c 100644 --- a/apps/settings/lib/Listener/UserRemovedFromGroupActivityListener.php +++ b/apps/settings/lib/Listener/UserRemovedFromGroupActivityListener.php @@ -27,6 +27,7 @@ class UserRemovedFromGroupActivityListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof UserRemovedEvent)) { return; diff --git a/apps/settings/lib/Search/AppSearch.php b/apps/settings/lib/Search/AppSearch.php index 19c2bce5451..a359f7ea9ea 100644 --- a/apps/settings/lib/Search/AppSearch.php +++ b/apps/settings/lib/Search/AppSearch.php @@ -23,18 +23,22 @@ class AppSearch implements IProvider { ) { } + #[\Override] public function getId(): string { return 'settings_apps'; } + #[\Override] public function getName(): string { return $this->l->t('Apps'); } + #[\Override] public function getOrder(string $route, array $routeParameters): int { return $route === 'settings.AppSettings.viewApps' ? -50 : 100; } + #[\Override] public function search(IUser $user, ISearchQuery $query): SearchResult { $entries = $this->navigationManager->getAll('all'); diff --git a/apps/settings/lib/Search/SectionSearch.php b/apps/settings/lib/Search/SectionSearch.php index 52f0c9b08db..b68768a2bac 100644 --- a/apps/settings/lib/Search/SectionSearch.php +++ b/apps/settings/lib/Search/SectionSearch.php @@ -32,6 +32,7 @@ class SectionSearch implements IProvider { /** * @inheritDoc */ + #[\Override] public function getId(): string { return 'settings'; } @@ -39,6 +40,7 @@ class SectionSearch implements IProvider { /** * @inheritDoc */ + #[\Override] public function getName(): string { return $this->l->t('Settings'); } @@ -46,6 +48,7 @@ class SectionSearch implements IProvider { /** * @inheritDoc */ + #[\Override] public function getOrder(string $route, array $routeParameters): int { if ($route === 'settings.PersonalSettings.index' || $route === 'settings.AdminSettings.index') { return -1; @@ -57,6 +60,7 @@ class SectionSearch implements IProvider { /** * @inheritDoc */ + #[\Override] public function search(IUser $user, ISearchQuery $query): SearchResult { $isAdmin = $this->groupManager->isAdmin($user->getUID()); diff --git a/apps/settings/lib/Search/UserSearch.php b/apps/settings/lib/Search/UserSearch.php index 5326f4cefff..79c8a6c1990 100644 --- a/apps/settings/lib/Search/UserSearch.php +++ b/apps/settings/lib/Search/UserSearch.php @@ -20,20 +20,24 @@ class UserSearch implements IProvider { ) { } + #[\Override] public function getId(): string { return 'users'; } + #[\Override] public function getName(): string { return $this->l->t('Users'); } + #[\Override] public function getOrder(string $route, array $routeParameters): ?int { return str_starts_with($route, 'settings.Users.usersList') ? 300 : null; } + #[\Override] public function search(IUser $user, ISearchQuery $query): SearchResult { return SearchResult::complete($this->l->t('Users'), []); } diff --git a/apps/settings/lib/Sections/Admin/Additional.php b/apps/settings/lib/Sections/Admin/Additional.php index 0d83a98bbe5..392e0695269 100644 --- a/apps/settings/lib/Sections/Admin/Additional.php +++ b/apps/settings/lib/Sections/Admin/Additional.php @@ -20,18 +20,22 @@ class Additional implements IIconSection { ) { } + #[\Override] public function getIcon(): string { return $this->urlGenerator->imagePath('core', 'actions/settings-dark.svg'); } + #[\Override] public function getID(): string { return 'additional'; } + #[\Override] public function getName(): string { return $this->l->t('Additional settings'); } + #[\Override] public function getPriority(): int { return 98; } diff --git a/apps/settings/lib/Sections/Admin/ArtificialIntelligence.php b/apps/settings/lib/Sections/Admin/ArtificialIntelligence.php index 2a300c260c0..3d819a86090 100644 --- a/apps/settings/lib/Sections/Admin/ArtificialIntelligence.php +++ b/apps/settings/lib/Sections/Admin/ArtificialIntelligence.php @@ -20,18 +20,22 @@ class ArtificialIntelligence implements IIconSection { ) { } + #[\Override] public function getIcon(): string { return $this->urlGenerator->imagePath('settings', 'ai.svg'); } + #[\Override] public function getID(): string { return 'ai'; } + #[\Override] public function getName(): string { return $this->l->t('Assistant'); } + #[\Override] public function getPriority(): int { return 40; } diff --git a/apps/settings/lib/Sections/Admin/Delegation.php b/apps/settings/lib/Sections/Admin/Delegation.php index 24bb555eae8..146058c3f9b 100644 --- a/apps/settings/lib/Sections/Admin/Delegation.php +++ b/apps/settings/lib/Sections/Admin/Delegation.php @@ -27,6 +27,7 @@ class Delegation implements IIconSection { * {@inheritdoc} * @return string */ + #[\Override] public function getID() { return 'admindelegation'; } @@ -35,6 +36,7 @@ class Delegation implements IIconSection { * {@inheritdoc} * @return string */ + #[\Override] public function getName() { return $this->l->t('Administration privileges'); } @@ -43,6 +45,7 @@ class Delegation implements IIconSection { * {@inheritdoc} * @return int */ + #[\Override] public function getPriority() { return 54; } @@ -51,6 +54,7 @@ class Delegation implements IIconSection { * {@inheritdoc} * @return string */ + #[\Override] public function getIcon() { return $this->url->imagePath('core', 'actions/user-admin.svg'); } diff --git a/apps/settings/lib/Sections/Admin/Groupware.php b/apps/settings/lib/Sections/Admin/Groupware.php index 57d92b9cc72..8bc6ed81b8e 100644 --- a/apps/settings/lib/Sections/Admin/Groupware.php +++ b/apps/settings/lib/Sections/Admin/Groupware.php @@ -20,18 +20,22 @@ class Groupware implements IIconSection { ) { } + #[\Override] public function getIcon(): string { return $this->urlGenerator->imagePath('core', 'places/contacts.svg'); } + #[\Override] public function getID(): string { return 'groupware'; } + #[\Override] public function getName(): string { return $this->l->t('Groupware'); } + #[\Override] public function getPriority(): int { return 50; } diff --git a/apps/settings/lib/Sections/Admin/Overview.php b/apps/settings/lib/Sections/Admin/Overview.php index 0145a2eca93..5926f178519 100644 --- a/apps/settings/lib/Sections/Admin/Overview.php +++ b/apps/settings/lib/Sections/Admin/Overview.php @@ -20,18 +20,22 @@ class Overview implements IIconSection { ) { } + #[\Override] public function getIcon(): string { return $this->urlGenerator->imagePath('settings', 'admin.svg'); } + #[\Override] public function getID(): string { return 'overview'; } + #[\Override] public function getName(): string { return $this->l->t('Overview'); } + #[\Override] public function getPriority(): int { return 0; } diff --git a/apps/settings/lib/Sections/Admin/Presets.php b/apps/settings/lib/Sections/Admin/Presets.php index 85c858de4e1..479f87de078 100644 --- a/apps/settings/lib/Sections/Admin/Presets.php +++ b/apps/settings/lib/Sections/Admin/Presets.php @@ -20,18 +20,22 @@ class Presets implements IIconSection { ) { } + #[\Override] public function getIcon(): string { return $this->urlGenerator->imagePath('settings', 'library_add_check.svg'); } + #[\Override] public function getID(): string { return 'presets'; } + #[\Override] public function getName(): string { return $this->l->t('Quick presets'); } + #[\Override] public function getPriority(): int { return 0; } diff --git a/apps/settings/lib/Sections/Admin/Security.php b/apps/settings/lib/Sections/Admin/Security.php index 10027be32fb..687fa1ae446 100644 --- a/apps/settings/lib/Sections/Admin/Security.php +++ b/apps/settings/lib/Sections/Admin/Security.php @@ -20,18 +20,22 @@ class Security implements IIconSection { ) { } + #[\Override] public function getIcon(): string { return $this->urlGenerator->imagePath('core', 'actions/password.svg'); } + #[\Override] public function getID(): string { return 'security'; } + #[\Override] public function getName(): string { return $this->l->t('Security'); } + #[\Override] public function getPriority(): int { return 10; } diff --git a/apps/settings/lib/Sections/Admin/Server.php b/apps/settings/lib/Sections/Admin/Server.php index c6a02efa4e3..fcf1b7bd873 100644 --- a/apps/settings/lib/Sections/Admin/Server.php +++ b/apps/settings/lib/Sections/Admin/Server.php @@ -20,18 +20,22 @@ class Server implements IIconSection { ) { } + #[\Override] public function getIcon(): string { return $this->urlGenerator->imagePath('core', 'actions/settings-dark.svg'); } + #[\Override] public function getID(): string { return 'server'; } + #[\Override] public function getName(): string { return $this->l->t('Basic settings'); } + #[\Override] public function getPriority(): int { return 1; } diff --git a/apps/settings/lib/Sections/Admin/Sharing.php b/apps/settings/lib/Sections/Admin/Sharing.php index c7598bb1157..1c8aa624ada 100644 --- a/apps/settings/lib/Sections/Admin/Sharing.php +++ b/apps/settings/lib/Sections/Admin/Sharing.php @@ -20,18 +20,22 @@ class Sharing implements IIconSection { ) { } + #[\Override] public function getIcon(): string { return $this->urlGenerator->imagePath('core', 'actions/share.svg'); } + #[\Override] public function getID(): string { return 'sharing'; } + #[\Override] public function getName(): string { return $this->l->t('Sharing'); } + #[\Override] public function getPriority(): int { return 5; } diff --git a/apps/settings/lib/Sections/Admin/Users.php b/apps/settings/lib/Sections/Admin/Users.php index d5e080331e8..0cc1f1421d4 100644 --- a/apps/settings/lib/Sections/Admin/Users.php +++ b/apps/settings/lib/Sections/Admin/Users.php @@ -18,18 +18,22 @@ class Users implements IIconSection { ) { } + #[\Override] public function getID(): string { return 'usersdelegation'; } + #[\Override] public function getName(): string { return $this->l->t('Users'); } + #[\Override] public function getPriority(): int { return 55; } + #[\Override] public function getIcon(): string { return ''; } diff --git a/apps/settings/lib/Sections/Personal/Availability.php b/apps/settings/lib/Sections/Personal/Availability.php index e12e41ea800..6ddb2fd26a8 100644 --- a/apps/settings/lib/Sections/Personal/Availability.php +++ b/apps/settings/lib/Sections/Personal/Availability.php @@ -21,18 +21,22 @@ class Availability implements IIconSection { ) { } + #[\Override] public function getIcon(): string { return $this->urlGenerator->imagePath('dav', 'schedule.svg'); } + #[\Override] public function getID(): string { return 'availability'; } + #[\Override] public function getName(): string { return $this->l->t('Availability'); } + #[\Override] public function getPriority(): int { return 50; } diff --git a/apps/settings/lib/Sections/Personal/Calendar.php b/apps/settings/lib/Sections/Personal/Calendar.php index 602b7598f15..dedf6053886 100644 --- a/apps/settings/lib/Sections/Personal/Calendar.php +++ b/apps/settings/lib/Sections/Personal/Calendar.php @@ -21,18 +21,22 @@ class Calendar implements IIconSection { ) { } + #[\Override] public function getIcon(): string { return $this->urlGenerator->imagePath('dav', 'calendar.svg'); } + #[\Override] public function getID(): string { return 'calendar'; } + #[\Override] public function getName(): string { return $this->l->t('Calendar'); } + #[\Override] public function getPriority(): int { return 50; } diff --git a/apps/settings/lib/Sections/Personal/PersonalInfo.php b/apps/settings/lib/Sections/Personal/PersonalInfo.php index 35c3e6d2926..15c101e82d1 100644 --- a/apps/settings/lib/Sections/Personal/PersonalInfo.php +++ b/apps/settings/lib/Sections/Personal/PersonalInfo.php @@ -20,18 +20,22 @@ class PersonalInfo implements IIconSection { ) { } + #[\Override] public function getIcon() { return $this->urlGenerator->imagePath('core', 'actions/user.svg'); } + #[\Override] public function getID(): string { return 'personal-info'; } + #[\Override] public function getName(): string { return $this->l->t('Personal info'); } + #[\Override] public function getPriority(): int { return 0; } diff --git a/apps/settings/lib/Sections/Personal/Security.php b/apps/settings/lib/Sections/Personal/Security.php index d7eb65724ec..fa32c1a9cbf 100644 --- a/apps/settings/lib/Sections/Personal/Security.php +++ b/apps/settings/lib/Sections/Personal/Security.php @@ -20,18 +20,22 @@ class Security implements IIconSection { ) { } + #[\Override] public function getIcon() { return $this->urlGenerator->imagePath('settings', 'password.svg'); } + #[\Override] public function getID(): string { return 'security'; } + #[\Override] public function getName(): string { return $this->l->t('Security'); } + #[\Override] public function getPriority(): int { return 5; } diff --git a/apps/settings/lib/Sections/Personal/SyncClients.php b/apps/settings/lib/Sections/Personal/SyncClients.php index 3f221956f0c..349358c2a26 100644 --- a/apps/settings/lib/Sections/Personal/SyncClients.php +++ b/apps/settings/lib/Sections/Personal/SyncClients.php @@ -20,18 +20,22 @@ class SyncClients implements IIconSection { ) { } + #[\Override] public function getIcon() { return $this->urlGenerator->imagePath('core', 'clients/phone.svg'); } + #[\Override] public function getID(): string { return 'sync-clients'; } + #[\Override] public function getName(): string { return $this->l->t('Mobile & desktop'); } + #[\Override] public function getPriority(): int { return 15; } diff --git a/apps/settings/lib/Service/AuthorizedGroupService.php b/apps/settings/lib/Service/AuthorizedGroupService.php index 223bf8ee19e..51eae61670e 100644 --- a/apps/settings/lib/Service/AuthorizedGroupService.php +++ b/apps/settings/lib/Service/AuthorizedGroupService.php @@ -17,6 +17,9 @@ use OCP\DB\Exception; use OCP\IGroup; use Throwable; +/** + * @psalm-api - we cannot use final as this will break unit tests + */ readonly class AuthorizedGroupService { public function __construct( private AuthorizedGroupMapper $mapper, diff --git a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php index aaec0049b20..702dcb4a620 100644 --- a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php +++ b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php @@ -44,6 +44,7 @@ class ArtificialIntelligence implements IDelegatedSettings { /** * @return TemplateResponse */ + #[\Override] public function getForm() { $translationProviders = []; $translationPreferences = []; @@ -191,6 +192,7 @@ class ArtificialIntelligence implements IDelegatedSettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection() { return 'ai'; } @@ -202,14 +204,17 @@ class ArtificialIntelligence implements IDelegatedSettings { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 10; } + #[\Override] public function getName(): ?string { return $this->l->t('Artificial Intelligence'); } + #[\Override] public function getAuthorizedAppConfig(): array { return [ 'core' => ['/ai..*/'], diff --git a/apps/settings/lib/Settings/Admin/Delegation.php b/apps/settings/lib/Settings/Admin/Delegation.php index 06ff2af9447..19efa169267 100644 --- a/apps/settings/lib/Settings/Admin/Delegation.php +++ b/apps/settings/lib/Settings/Admin/Delegation.php @@ -82,6 +82,7 @@ class Delegation implements ISettings { $this->initialStateService->provideInitialState('authorized-groups', $this->authorizedGroupService->findAll()); } + #[\Override] public function getForm(): TemplateResponse { $this->initSettingState(); $this->initAvailableGroupState(); @@ -94,6 +95,7 @@ class Delegation implements ISettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection() { return 'admindelegation'; } @@ -101,6 +103,7 @@ class Delegation implements ISettings { /* * @inheritdoc */ + #[\Override] public function getPriority() { return 75; } diff --git a/apps/settings/lib/Settings/Admin/Mail.php b/apps/settings/lib/Settings/Admin/Mail.php index e76ca9b8214..353abb95377 100644 --- a/apps/settings/lib/Settings/Admin/Mail.php +++ b/apps/settings/lib/Settings/Admin/Mail.php @@ -29,6 +29,7 @@ class Mail implements IDelegatedSettings { /** * @return TemplateResponse */ + #[\Override] public function getForm() { $finder = Server::get(IBinaryFinder::class); @@ -90,6 +91,7 @@ class Mail implements IDelegatedSettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection() { return 'server'; } @@ -101,14 +103,17 @@ class Mail implements IDelegatedSettings { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 10; } + #[\Override] public function getName(): ?string { return $this->l->t('Email server'); } + #[\Override] public function getAuthorizedAppConfig(): array { return []; } diff --git a/apps/settings/lib/Settings/Admin/MailProvider.php b/apps/settings/lib/Settings/Admin/MailProvider.php index c1e72378d20..a1badb5d5b9 100644 --- a/apps/settings/lib/Settings/Admin/MailProvider.php +++ b/apps/settings/lib/Settings/Admin/MailProvider.php @@ -18,6 +18,7 @@ class MailProvider implements IDeclarativeSettingsForm { ) { } + #[\Override] public function getSchema(): array { return [ 'id' => 'mail-provider-support', diff --git a/apps/settings/lib/Settings/Admin/Overview.php b/apps/settings/lib/Settings/Admin/Overview.php index 8e35605429f..7cc37537de4 100644 --- a/apps/settings/lib/Settings/Admin/Overview.php +++ b/apps/settings/lib/Settings/Admin/Overview.php @@ -30,6 +30,7 @@ class Overview implements IDelegatedSettings { /** * @return TemplateResponse */ + #[\Override] public function getForm() { Util::addScript('settings', 'vue-settings-admin-overview'); $this->initialState->provideInitialState('setup-checks-section', [ @@ -49,6 +50,7 @@ class Overview implements IDelegatedSettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection() { return 'overview'; } @@ -60,14 +62,17 @@ class Overview implements IDelegatedSettings { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 10; } + #[\Override] public function getName(): ?string { return $this->l->t('Security & setup checks'); } + #[\Override] public function getAuthorizedAppConfig(): array { return []; } diff --git a/apps/settings/lib/Settings/Admin/Presets.php b/apps/settings/lib/Settings/Admin/Presets.php index 51df463f610..f629beca447 100644 --- a/apps/settings/lib/Settings/Admin/Presets.php +++ b/apps/settings/lib/Settings/Admin/Presets.php @@ -24,6 +24,7 @@ class Presets implements ISettings { ) { } + #[\Override] public function getForm() { $presets = $this->presetManager->retrieveLexiconPreset(); $selectedPreset = $this->presetManager->getLexiconPreset(); @@ -36,10 +37,12 @@ class Presets implements ISettings { return new TemplateResponse('settings', 'settings/admin/presets', [], ''); } + #[\Override] public function getSection() { return 'presets'; } + #[\Override] public function getPriority() { return 0; } diff --git a/apps/settings/lib/Settings/Admin/Security.php b/apps/settings/lib/Settings/Admin/Security.php index b21b9cd2512..9cd375972d9 100644 --- a/apps/settings/lib/Settings/Admin/Security.php +++ b/apps/settings/lib/Settings/Admin/Security.php @@ -27,6 +27,7 @@ class Security implements ISettings { /** * @return TemplateResponse */ + #[\Override] public function getForm(): TemplateResponse { $encryptionModules = $this->manager->getEncryptionModules(); $defaultEncryptionModuleId = $this->manager->getDefaultEncryptionModuleId(); @@ -53,6 +54,7 @@ class Security implements ISettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection(): string { return 'security'; } @@ -64,6 +66,7 @@ class Security implements ISettings { * * E.g.: 70 */ + #[\Override] public function getPriority(): int { return 10; } diff --git a/apps/settings/lib/Settings/Admin/Server.php b/apps/settings/lib/Settings/Admin/Server.php index 32328da5b1a..b38234361a4 100644 --- a/apps/settings/lib/Settings/Admin/Server.php +++ b/apps/settings/lib/Settings/Admin/Server.php @@ -36,6 +36,7 @@ class Server implements IDelegatedSettings { /** * @return TemplateResponse */ + #[\Override] public function getForm() { $ownerConfigFile = fileowner(\OC::$configDir . 'config.php'); $cliBasedCronPossible = function_exists('posix_getpwuid') && $ownerConfigFile !== false; @@ -84,6 +85,7 @@ class Server implements IDelegatedSettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection(): string { return 'server'; } @@ -95,14 +97,17 @@ class Server implements IDelegatedSettings { * * E.g.: 70 */ + #[\Override] public function getPriority(): int { return 0; } + #[\Override] public function getName(): ?string { return $this->l->t('Background jobs'); } + #[\Override] public function getAuthorizedAppConfig(): array { return [ 'core' => [ diff --git a/apps/settings/lib/Settings/Admin/Sharing.php b/apps/settings/lib/Settings/Admin/Sharing.php index 468e64793fc..ffc40790a0f 100644 --- a/apps/settings/lib/Settings/Admin/Sharing.php +++ b/apps/settings/lib/Settings/Admin/Sharing.php @@ -35,6 +35,7 @@ class Sharing implements IDelegatedSettings { /** * @return TemplateResponse */ + #[\Override] public function getForm() { $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', ''); $linksExcludedGroups = $this->config->getAppValue('core', 'shareapi_allow_links_exclude_groups', ''); @@ -99,6 +100,7 @@ class Sharing implements IDelegatedSettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection() { return 'sharing'; } @@ -110,16 +112,19 @@ class Sharing implements IDelegatedSettings { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 0; } + #[\Override] public function getAuthorizedAppConfig(): array { return [ 'core' => ['/shareapi_.*/'], ]; } + #[\Override] public function getName(): ?string { return null; } diff --git a/apps/settings/lib/Settings/Admin/Users.php b/apps/settings/lib/Settings/Admin/Users.php index 8e45216b9c4..b6ae3817313 100644 --- a/apps/settings/lib/Settings/Admin/Users.php +++ b/apps/settings/lib/Settings/Admin/Users.php @@ -16,23 +16,28 @@ use OCP\Settings\IDelegatedSettings; * Empty settings class, used only for admin delegation. */ class Users implements IDelegatedSettings { + #[\Override] public function getForm(): TemplateResponse { throw new \Exception('Admin delegation settings should never be rendered'); } + #[\Override] public function getSection(): ?string { return 'usersdelegation'; } + #[\Override] public function getPriority(): int { return 0; } + #[\Override] public function getName(): ?string { /* Use section name alone */ return null; } + #[\Override] public function getAuthorizedAppConfig(): array { return []; } diff --git a/apps/settings/lib/Settings/Personal/Additional.php b/apps/settings/lib/Settings/Personal/Additional.php index 52b2a33a05d..d4be223d4f5 100644 --- a/apps/settings/lib/Settings/Personal/Additional.php +++ b/apps/settings/lib/Settings/Personal/Additional.php @@ -17,6 +17,7 @@ class Additional implements ISettings { * @return TemplateResponse returns the instance with all parameters set, ready to be rendered * @since 9.1 */ + #[\Override] public function getForm(): TemplateResponse { return new TemplateResponse('settings', 'settings/empty'); } @@ -25,6 +26,7 @@ class Additional implements ISettings { * @return string the section ID, e.g. 'sharing' * @since 9.1 */ + #[\Override] public function getSection(): string { return 'additional'; } @@ -37,6 +39,7 @@ class Additional implements ISettings { * E.g.: 70 * @since 9.1 */ + #[\Override] public function getPriority(): int { return 5; } diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php index 4f51b3a3283..0aa70be16ab 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -50,6 +50,7 @@ class PersonalInfo implements ISettings { ) { } + #[\Override] public function getForm(): TemplateResponse { $federationEnabled = $this->appManager->isEnabledForUser('federation'); $federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing'); @@ -161,6 +162,7 @@ class PersonalInfo implements ISettings { * returns the section ID string, e.g. 'sharing' * @since 9.1 */ + #[\Override] public function getSection(): string { return 'personal-info'; } @@ -173,6 +175,7 @@ class PersonalInfo implements ISettings { * E.g.: 70 * @since 9.1 */ + #[\Override] public function getPriority(): int { return 10; } diff --git a/apps/settings/lib/Settings/Personal/Security/Authtokens.php b/apps/settings/lib/Settings/Personal/Security/Authtokens.php index d5a58ca5026..7503637e669 100644 --- a/apps/settings/lib/Settings/Personal/Security/Authtokens.php +++ b/apps/settings/lib/Settings/Personal/Security/Authtokens.php @@ -33,6 +33,7 @@ class Authtokens implements ISettings { ) { } + #[\Override] public function getForm(): TemplateResponse { $this->initialState->provideInitialState( 'app_tokens', @@ -48,10 +49,12 @@ class Authtokens implements ISettings { return new TemplateResponse('settings', 'settings/personal/security/authtokens'); } + #[\Override] public function getSection(): string { return 'security'; } + #[\Override] public function getPriority(): int { return 100; } diff --git a/apps/settings/lib/Settings/Personal/Security/Password.php b/apps/settings/lib/Settings/Personal/Security/Password.php index 8184dae9560..599eb203f76 100644 --- a/apps/settings/lib/Settings/Personal/Security/Password.php +++ b/apps/settings/lib/Settings/Personal/Security/Password.php @@ -20,6 +20,7 @@ class Password implements ISettings { ) { } + #[\Override] public function getForm(): TemplateResponse { $user = $this->userManager->get($this->userId); $passwordChangeSupported = false; @@ -32,10 +33,12 @@ class Password implements ISettings { ]); } + #[\Override] public function getSection(): string { return 'security'; } + #[\Override] public function getPriority(): int { return 10; } diff --git a/apps/settings/lib/Settings/Personal/Security/TwoFactor.php b/apps/settings/lib/Settings/Personal/Security/TwoFactor.php index 04bb003dba5..06883d762d9 100644 --- a/apps/settings/lib/Settings/Personal/Security/TwoFactor.php +++ b/apps/settings/lib/Settings/Personal/Security/TwoFactor.php @@ -33,12 +33,14 @@ class TwoFactor implements ISettings { ) { } + #[\Override] public function getForm(): TemplateResponse { return new TemplateResponse('settings', 'settings/personal/security/twofactor', [ 'twoFactorProviderData' => $this->getTwoFactorProviderData(), ]); } + #[\Override] public function getSection(): ?string { if (!$this->shouldShow()) { return null; @@ -46,6 +48,7 @@ class TwoFactor implements ISettings { return 'security'; } + #[\Override] public function getPriority(): int { return 15; } diff --git a/apps/settings/lib/Settings/Personal/Security/WebAuthn.php b/apps/settings/lib/Settings/Personal/Security/WebAuthn.php index 10e5ee76263..8ead56dc83a 100644 --- a/apps/settings/lib/Settings/Personal/Security/WebAuthn.php +++ b/apps/settings/lib/Settings/Personal/Security/WebAuthn.php @@ -25,6 +25,7 @@ class WebAuthn implements ISettings { ) { } + #[\Override] public function getForm() { $this->initialStateService->provideInitialState( Application::APP_ID, @@ -35,6 +36,7 @@ class WebAuthn implements ISettings { return new TemplateResponse('settings', 'settings/personal/security/webauthn'); } + #[\Override] public function getSection(): ?string { if (!$this->manager->isWebAuthnAvailable()) { return null; @@ -43,6 +45,7 @@ class WebAuthn implements ISettings { return 'security'; } + #[\Override] public function getPriority(): int { return 20; } diff --git a/apps/settings/lib/Settings/Personal/ServerDevNotice.php b/apps/settings/lib/Settings/Personal/ServerDevNotice.php index c9993484abd..be4137b5593 100644 --- a/apps/settings/lib/Settings/Personal/ServerDevNotice.php +++ b/apps/settings/lib/Settings/Personal/ServerDevNotice.php @@ -32,6 +32,7 @@ class ServerDevNotice implements ISettings { /** * @return TemplateResponse */ + #[\Override] public function getForm(): TemplateResponse { $userFolder = $this->rootFolder->getUserFolder($this->userSession->getUser()->getUID()); @@ -58,6 +59,7 @@ class ServerDevNotice implements ISettings { /** * @return string|null the section ID, e.g. 'sharing' */ + #[\Override] public function getSection(): ?string { if ($this->registry->delegateHasValidSubscription()) { return null; @@ -73,6 +75,7 @@ class ServerDevNotice implements ISettings { * * E.g.: 70 */ + #[\Override] public function getPriority(): int { return 1000; } diff --git a/apps/settings/lib/SetupChecks/AllowedAdminRanges.php b/apps/settings/lib/SetupChecks/AllowedAdminRanges.php index 5116676dd43..46e6e1bfdf0 100644 --- a/apps/settings/lib/SetupChecks/AllowedAdminRanges.php +++ b/apps/settings/lib/SetupChecks/AllowedAdminRanges.php @@ -22,14 +22,17 @@ class AllowedAdminRanges implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'system'; } + #[\Override] public function getName(): string { return $this->l10n->t('Allowed admin IP ranges'); } + #[\Override] public function run(): SetupResult { $allowedAdminRanges = $this->config->getSystemValue(RemoteAddress::SETTING_NAME, false); if ( diff --git a/apps/settings/lib/SetupChecks/AppDirsWithDifferentOwner.php b/apps/settings/lib/SetupChecks/AppDirsWithDifferentOwner.php index 0d18037c3b5..cedbd6a6205 100644 --- a/apps/settings/lib/SetupChecks/AppDirsWithDifferentOwner.php +++ b/apps/settings/lib/SetupChecks/AppDirsWithDifferentOwner.php @@ -18,10 +18,12 @@ class AppDirsWithDifferentOwner implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('App directories owner'); } + #[\Override] public function getCategory(): string { return 'security'; } @@ -72,6 +74,7 @@ class AppDirsWithDifferentOwner implements ISetupCheck { return $appDirsWithDifferentOwner; } + #[\Override] public function run(): SetupResult { $currentUser = posix_getuid(); $currentUserInfos = posix_getpwuid($currentUser) ?: []; diff --git a/apps/settings/lib/SetupChecks/BruteForceThrottler.php b/apps/settings/lib/SetupChecks/BruteForceThrottler.php index e97e363944f..53dbbc809a7 100644 --- a/apps/settings/lib/SetupChecks/BruteForceThrottler.php +++ b/apps/settings/lib/SetupChecks/BruteForceThrottler.php @@ -25,14 +25,17 @@ class BruteForceThrottler implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'system'; } + #[\Override] public function getName(): string { return $this->l10n->t('Brute-force Throttle'); } + #[\Override] public function run(): SetupResult { $address = $this->request->getRemoteAddress(); if ($address === '') { diff --git a/apps/settings/lib/SetupChecks/CheckUserCertificates.php b/apps/settings/lib/SetupChecks/CheckUserCertificates.php index d1e3551c085..34c5348dabd 100644 --- a/apps/settings/lib/SetupChecks/CheckUserCertificates.php +++ b/apps/settings/lib/SetupChecks/CheckUserCertificates.php @@ -23,14 +23,17 @@ class CheckUserCertificates implements ISetupCheck { $this->configValue = $config->getAppValue('files_external', 'user_certificate_scan', ''); } + #[\Override] public function getCategory(): string { return 'security'; } + #[\Override] public function getName(): string { return $this->l10n->t('Old administration imported certificates'); } + #[\Override] public function run(): SetupResult { // all fine if neither "not-run-yet" nor a result if ($this->configValue === '') { diff --git a/apps/settings/lib/SetupChecks/CodeIntegrity.php b/apps/settings/lib/SetupChecks/CodeIntegrity.php index 3556f591360..89251f15a26 100644 --- a/apps/settings/lib/SetupChecks/CodeIntegrity.php +++ b/apps/settings/lib/SetupChecks/CodeIntegrity.php @@ -22,14 +22,17 @@ class CodeIntegrity implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Code integrity'); } + #[\Override] public function getCategory(): string { return 'security'; } + #[\Override] public function run(): SetupResult { if (!$this->checker->isCodeCheckEnforced()) { return SetupResult::info($this->l10n->t('Integrity checker has been disabled. Integrity cannot be verified.')); diff --git a/apps/settings/lib/SetupChecks/CronErrors.php b/apps/settings/lib/SetupChecks/CronErrors.php index dc625b04477..7a858ddae38 100644 --- a/apps/settings/lib/SetupChecks/CronErrors.php +++ b/apps/settings/lib/SetupChecks/CronErrors.php @@ -21,14 +21,17 @@ class CronErrors implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'system'; } + #[\Override] public function getName(): string { return $this->l10n->t('Cron errors'); } + #[\Override] public function run(): SetupResult { $errors = json_decode($this->config->getAppValue('core', 'cronErrors', ''), true); if (is_array($errors) && count($errors) > 0) { diff --git a/apps/settings/lib/SetupChecks/CronInfo.php b/apps/settings/lib/SetupChecks/CronInfo.php index f18148c9d14..dfd4d5c1396 100644 --- a/apps/settings/lib/SetupChecks/CronInfo.php +++ b/apps/settings/lib/SetupChecks/CronInfo.php @@ -27,14 +27,17 @@ class CronInfo implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'system'; } + #[\Override] public function getName(): string { return $this->l10n->t('Cron last run'); } + #[\Override] public function run(): SetupResult { $lastCronRun = $this->appConfig->getValueInt('core', 'lastcron', 0); $relativeTime = $this->dateTimeFormatter->formatTimeSpan($lastCronRun); diff --git a/apps/settings/lib/SetupChecks/DataDirectoryProtected.php b/apps/settings/lib/SetupChecks/DataDirectoryProtected.php index e572c345079..a49fdef4b84 100644 --- a/apps/settings/lib/SetupChecks/DataDirectoryProtected.php +++ b/apps/settings/lib/SetupChecks/DataDirectoryProtected.php @@ -32,14 +32,17 @@ class DataDirectoryProtected implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'network'; } + #[\Override] public function getName(): string { return $this->l10n->t('Data directory protected'); } + #[\Override] public function run(): SetupResult { $dataDir = str_replace(\OC::$SERVERROOT . '/', '', $this->config->getSystemValueString('datadirectory', '')); $dataUrl = $this->urlGenerator->linkTo('', $dataDir . '/.ncdata'); diff --git a/apps/settings/lib/SetupChecks/DatabaseHasMissingColumns.php b/apps/settings/lib/SetupChecks/DatabaseHasMissingColumns.php index ec004f73021..83d1fa4ad33 100644 --- a/apps/settings/lib/SetupChecks/DatabaseHasMissingColumns.php +++ b/apps/settings/lib/SetupChecks/DatabaseHasMissingColumns.php @@ -25,10 +25,12 @@ class DatabaseHasMissingColumns implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'database'; } + #[\Override] public function getName(): string { return $this->l10n->t('Database missing columns'); } @@ -55,6 +57,7 @@ class DatabaseHasMissingColumns implements ISetupCheck { return $columnInfo->getListOfMissingColumns(); } + #[\Override] public function run(): SetupResult { $missingColumns = $this->getMissingColumns(); if (empty($missingColumns)) { diff --git a/apps/settings/lib/SetupChecks/DatabaseHasMissingIndices.php b/apps/settings/lib/SetupChecks/DatabaseHasMissingIndices.php index 97e80c2aaa9..df0ff70aa0f 100644 --- a/apps/settings/lib/SetupChecks/DatabaseHasMissingIndices.php +++ b/apps/settings/lib/SetupChecks/DatabaseHasMissingIndices.php @@ -27,10 +27,12 @@ class DatabaseHasMissingIndices implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'database'; } + #[\Override] public function getName(): string { return $this->l10n->t('Database missing indices'); } @@ -70,6 +72,7 @@ class DatabaseHasMissingIndices implements ISetupCheck { return $indexInfo->getListOfMissingIndices(); } + #[\Override] public function run(): SetupResult { $missingIndices = $this->getMissingIndices(); if (empty($missingIndices)) { diff --git a/apps/settings/lib/SetupChecks/DatabaseHasMissingPrimaryKeys.php b/apps/settings/lib/SetupChecks/DatabaseHasMissingPrimaryKeys.php index 03810ca8faf..4a5a342c096 100644 --- a/apps/settings/lib/SetupChecks/DatabaseHasMissingPrimaryKeys.php +++ b/apps/settings/lib/SetupChecks/DatabaseHasMissingPrimaryKeys.php @@ -25,10 +25,12 @@ class DatabaseHasMissingPrimaryKeys implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'database'; } + #[\Override] public function getName(): string { return $this->l10n->t('Database missing primary keys'); } @@ -55,6 +57,7 @@ class DatabaseHasMissingPrimaryKeys implements ISetupCheck { return $primaryKeyInfo->getListOfMissingPrimaryKeys(); } + #[\Override] public function run(): SetupResult { $missingPrimaryKeys = $this->getMissingPrimaryKeys(); if (empty($missingPrimaryKeys)) { diff --git a/apps/settings/lib/SetupChecks/DatabasePendingBigIntConversions.php b/apps/settings/lib/SetupChecks/DatabasePendingBigIntConversions.php index bb9794c1e03..4635d76d838 100644 --- a/apps/settings/lib/SetupChecks/DatabasePendingBigIntConversions.php +++ b/apps/settings/lib/SetupChecks/DatabasePendingBigIntConversions.php @@ -29,10 +29,12 @@ class DatabasePendingBigIntConversions implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'database'; } + #[\Override] public function getName(): string { return $this->l10n->t('Database pending bigint migrations'); } @@ -63,6 +65,7 @@ class DatabasePendingBigIntConversions implements ISetupCheck { return $pendingColumns; } + #[\Override] public function run(): SetupResult { $pendingColumns = $this->getBigIntConversionPendingColumns(); if (empty($pendingColumns)) { diff --git a/apps/settings/lib/SetupChecks/DebugMode.php b/apps/settings/lib/SetupChecks/DebugMode.php index 8841ecc607d..2f916b2a35f 100644 --- a/apps/settings/lib/SetupChecks/DebugMode.php +++ b/apps/settings/lib/SetupChecks/DebugMode.php @@ -20,14 +20,17 @@ class DebugMode implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Debug mode'); } + #[\Override] public function getCategory(): string { return 'system'; } + #[\Override] public function run(): SetupResult { if ($this->config->getSystemValueBool('debug', false)) { return SetupResult::warning($this->l10n->t('This instance is running in debug mode. Only enable this for local development and not in production environments.')); diff --git a/apps/settings/lib/SetupChecks/DefaultPhoneRegionSet.php b/apps/settings/lib/SetupChecks/DefaultPhoneRegionSet.php index fa94cd9d059..70c3fc8361e 100644 --- a/apps/settings/lib/SetupChecks/DefaultPhoneRegionSet.php +++ b/apps/settings/lib/SetupChecks/DefaultPhoneRegionSet.php @@ -20,14 +20,17 @@ class DefaultPhoneRegionSet implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Default phone region'); } + #[\Override] public function getCategory(): string { return 'config'; } + #[\Override] public function run(): SetupResult { if ($this->config->getSystemValueString('default_phone_region', '') !== '') { return SetupResult::success($this->config->getSystemValueString('default_phone_region', '')); diff --git a/apps/settings/lib/SetupChecks/EmailTestSuccessful.php b/apps/settings/lib/SetupChecks/EmailTestSuccessful.php index 8cad8e82156..4c5d0a889ee 100644 --- a/apps/settings/lib/SetupChecks/EmailTestSuccessful.php +++ b/apps/settings/lib/SetupChecks/EmailTestSuccessful.php @@ -23,10 +23,12 @@ class EmailTestSuccessful implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Email test'); } + #[\Override] public function getCategory(): string { return 'config'; } @@ -45,6 +47,7 @@ class EmailTestSuccessful implements ISetupCheck { return true; } + #[\Override] public function run(): SetupResult { if ($this->config->getSystemValueString('mail_smtpmode', 'smtp') === 'null') { return SetupResult::success($this->l10n->t('Mail delivery is disabled by instance config "%s".', ['mail_smtpmode'])); diff --git a/apps/settings/lib/SetupChecks/FileLocking.php b/apps/settings/lib/SetupChecks/FileLocking.php index f683ee05f03..ae4387edccd 100644 --- a/apps/settings/lib/SetupChecks/FileLocking.php +++ b/apps/settings/lib/SetupChecks/FileLocking.php @@ -25,10 +25,12 @@ class FileLocking implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Transactional File Locking'); } + #[\Override] public function getCategory(): string { return 'system'; } @@ -41,6 +43,7 @@ class FileLocking implements ISetupCheck { return ($this->lockingProvider instanceof DBLockingProvider); } + #[\Override] public function run(): SetupResult { if (!$this->hasWorkingFileLocking()) { return SetupResult::error( diff --git a/apps/settings/lib/SetupChecks/ForwardedForHeaders.php b/apps/settings/lib/SetupChecks/ForwardedForHeaders.php index 8238ce07554..e383128dcad 100644 --- a/apps/settings/lib/SetupChecks/ForwardedForHeaders.php +++ b/apps/settings/lib/SetupChecks/ForwardedForHeaders.php @@ -25,14 +25,17 @@ class ForwardedForHeaders implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'security'; } + #[\Override] public function getName(): string { return $this->l10n->t('Forwarded for headers'); } + #[\Override] public function run(): SetupResult { $trustedProxies = $this->config->getSystemValue('trusted_proxies', []); $remoteAddress = $this->request->getHeader('REMOTE_ADDR'); diff --git a/apps/settings/lib/SetupChecks/HttpsUrlGeneration.php b/apps/settings/lib/SetupChecks/HttpsUrlGeneration.php index 7f76297748b..33a6d0edccb 100644 --- a/apps/settings/lib/SetupChecks/HttpsUrlGeneration.php +++ b/apps/settings/lib/SetupChecks/HttpsUrlGeneration.php @@ -23,14 +23,17 @@ class HttpsUrlGeneration implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'security'; } + #[\Override] public function getName(): string { return $this->l10n->t('HTTPS access and URLs'); } + #[\Override] public function run(): SetupResult { if (!\OC::$CLI && $this->request->getServerProtocol() !== 'https') { if (!preg_match('/(?:^(?:localhost|127\.0\.0\.1|::1)|\.onion)$/', $this->request->getInsecureServerHost())) { diff --git a/apps/settings/lib/SetupChecks/InternetConnectivity.php b/apps/settings/lib/SetupChecks/InternetConnectivity.php index b4a229977bd..432a388c4ca 100644 --- a/apps/settings/lib/SetupChecks/InternetConnectivity.php +++ b/apps/settings/lib/SetupChecks/InternetConnectivity.php @@ -27,14 +27,17 @@ class InternetConnectivity implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'network'; } + #[\Override] public function getName(): string { return $this->l10n->t('Internet connectivity'); } + #[\Override] public function run(): SetupResult { if ($this->config->getSystemValue('has_internet_connection', true) === false) { return SetupResult::success($this->l10n->t('Internet connectivity is disabled in configuration file.')); diff --git a/apps/settings/lib/SetupChecks/JavaScriptModules.php b/apps/settings/lib/SetupChecks/JavaScriptModules.php index 72f58405811..de3cf231fc7 100644 --- a/apps/settings/lib/SetupChecks/JavaScriptModules.php +++ b/apps/settings/lib/SetupChecks/JavaScriptModules.php @@ -32,14 +32,17 @@ class JavaScriptModules implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'network'; } + #[\Override] public function getName(): string { return $this->l10n->t('JavaScript modules support'); } + #[\Override] public function run(): SetupResult { $testFile = $this->urlGenerator->linkTo('settings', 'js/esm-test.mjs'); diff --git a/apps/settings/lib/SetupChecks/JavaScriptSourceMaps.php b/apps/settings/lib/SetupChecks/JavaScriptSourceMaps.php index dcfc40192b9..a1b4d0d89de 100644 --- a/apps/settings/lib/SetupChecks/JavaScriptSourceMaps.php +++ b/apps/settings/lib/SetupChecks/JavaScriptSourceMaps.php @@ -32,14 +32,17 @@ class JavaScriptSourceMaps implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'network'; } + #[\Override] public function getName(): string { return $this->l10n->t('JavaScript source map support'); } + #[\Override] public function run(): SetupResult { $testFile = $this->urlGenerator->linkTo('settings', 'js/map-test.js.map'); diff --git a/apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php b/apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php index 47594e201cb..cb752f01385 100644 --- a/apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php +++ b/apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php @@ -22,14 +22,17 @@ class LegacySSEKeyFormat implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'security'; } + #[\Override] public function getName(): string { return $this->l10n->t('Old server-side-encryption'); } + #[\Override] public function run(): SetupResult { if ($this->config->getSystemValueBool('encryption.legacy_format_support', false) === false) { return SetupResult::success($this->l10n->t('Disabled')); diff --git a/apps/settings/lib/SetupChecks/LoggingLevel.php b/apps/settings/lib/SetupChecks/LoggingLevel.php index b9e1dbe700d..e0b8809ea62 100644 --- a/apps/settings/lib/SetupChecks/LoggingLevel.php +++ b/apps/settings/lib/SetupChecks/LoggingLevel.php @@ -23,14 +23,17 @@ class LoggingLevel implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Logging level'); } + #[\Override] public function getCategory(): string { return 'system'; } + #[\Override] public function run(): SetupResult { $configLogLevel = $this->config->getSystemValue('loglevel', ILogger::WARN); if (!is_int($configLogLevel) diff --git a/apps/settings/lib/SetupChecks/MaintenanceWindowStart.php b/apps/settings/lib/SetupChecks/MaintenanceWindowStart.php index ca8df039b1e..fc1bf53ffa0 100644 --- a/apps/settings/lib/SetupChecks/MaintenanceWindowStart.php +++ b/apps/settings/lib/SetupChecks/MaintenanceWindowStart.php @@ -23,14 +23,17 @@ class MaintenanceWindowStart implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'system'; } + #[\Override] public function getName(): string { return $this->l10n->t('Maintenance window start'); } + #[\Override] public function run(): SetupResult { $configValue = $this->config->getSystemValue('maintenance_window_start', null); if ($configValue === null) { diff --git a/apps/settings/lib/SetupChecks/MemcacheConfigured.php b/apps/settings/lib/SetupChecks/MemcacheConfigured.php index e3601d428bb..2016a4f1345 100644 --- a/apps/settings/lib/SetupChecks/MemcacheConfigured.php +++ b/apps/settings/lib/SetupChecks/MemcacheConfigured.php @@ -25,14 +25,17 @@ class MemcacheConfigured implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Memcache'); } + #[\Override] public function getCategory(): string { return 'system'; } + #[\Override] public function run(): SetupResult { $memcacheDistributedClass = $this->config->getSystemValue('memcache.distributed', null); $memcacheLockingClass = $this->config->getSystemValue('memcache.locking', null); diff --git a/apps/settings/lib/SetupChecks/MimeTypeMigrationAvailable.php b/apps/settings/lib/SetupChecks/MimeTypeMigrationAvailable.php index cf237f68670..2b5ad98d5fc 100644 --- a/apps/settings/lib/SetupChecks/MimeTypeMigrationAvailable.php +++ b/apps/settings/lib/SetupChecks/MimeTypeMigrationAvailable.php @@ -21,14 +21,17 @@ class MimeTypeMigrationAvailable implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'system'; } + #[\Override] public function getName(): string { return $this->l10n->t('Mimetype migrations available'); } + #[\Override] public function run(): SetupResult { if ($this->repairMimeTypes->migrationsAvailable()) { return SetupResult::warning( diff --git a/apps/settings/lib/SetupChecks/MysqlRowFormat.php b/apps/settings/lib/SetupChecks/MysqlRowFormat.php index b99cacdbc72..7eaee90afe9 100644 --- a/apps/settings/lib/SetupChecks/MysqlRowFormat.php +++ b/apps/settings/lib/SetupChecks/MysqlRowFormat.php @@ -25,14 +25,17 @@ class MysqlRowFormat implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('MySQL row format'); } + #[\Override] public function getCategory(): string { return 'database'; } + #[\Override] public function run(): SetupResult { $provider = $this->connection->getDatabaseProvider(); if (!in_array($provider, [IDBConnection::PLATFORM_MYSQL, IDBConnection::PLATFORM_MARIADB], true)) { diff --git a/apps/settings/lib/SetupChecks/MysqlUnicodeSupport.php b/apps/settings/lib/SetupChecks/MysqlUnicodeSupport.php index ba2fa93e094..86bee1f30ce 100644 --- a/apps/settings/lib/SetupChecks/MysqlUnicodeSupport.php +++ b/apps/settings/lib/SetupChecks/MysqlUnicodeSupport.php @@ -22,14 +22,17 @@ class MysqlUnicodeSupport implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('MySQL Unicode support'); } + #[\Override] public function getCategory(): string { return 'database'; } + #[\Override] public function run(): SetupResult { if ($this->config->getSystemValueString('dbtype') !== 'mysql') { return SetupResult::success($this->l10n->t('You are not using MySQL')); diff --git a/apps/settings/lib/SetupChecks/OcxProviders.php b/apps/settings/lib/SetupChecks/OcxProviders.php index c53e8087bd9..f839585a345 100644 --- a/apps/settings/lib/SetupChecks/OcxProviders.php +++ b/apps/settings/lib/SetupChecks/OcxProviders.php @@ -32,14 +32,17 @@ class OcxProviders implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'network'; } + #[\Override] public function getName(): string { return $this->l10n->t('OCS provider resolving'); } + #[\Override] public function run(): SetupResult { // List of providers that work $workingProviders = []; diff --git a/apps/settings/lib/SetupChecks/OverwriteCliUrl.php b/apps/settings/lib/SetupChecks/OverwriteCliUrl.php index 6fe0a1260cc..7202cd7c1a2 100644 --- a/apps/settings/lib/SetupChecks/OverwriteCliUrl.php +++ b/apps/settings/lib/SetupChecks/OverwriteCliUrl.php @@ -23,14 +23,17 @@ class OverwriteCliUrl implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'config'; } + #[\Override] public function getName(): string { return $this->l10n->t('Overwrite CLI URL'); } + #[\Override] public function run(): SetupResult { $currentOverwriteCliUrl = $this->config->getSystemValue('overwrite.cli.url', ''); $suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT; diff --git a/apps/settings/lib/SetupChecks/PhpApcuConfig.php b/apps/settings/lib/SetupChecks/PhpApcuConfig.php index c91a8cefec1..fa0c4ba8740 100644 --- a/apps/settings/lib/SetupChecks/PhpApcuConfig.php +++ b/apps/settings/lib/SetupChecks/PhpApcuConfig.php @@ -25,14 +25,17 @@ class PhpApcuConfig implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'php'; } + #[\Override] public function getName(): string { return $this->l10n->t('PHP APCu configuration'); } + #[\Override] public function run(): SetupResult { $localIsApcu = ltrim($this->config->getSystemValueString('memcache.local'), '\\') === APCu::class; $distributedIsApcu = ltrim($this->config->getSystemValueString('memcache.distributed'), '\\') === APCu::class; diff --git a/apps/settings/lib/SetupChecks/PhpDefaultCharset.php b/apps/settings/lib/SetupChecks/PhpDefaultCharset.php index 580db8cbd02..140ab627bee 100644 --- a/apps/settings/lib/SetupChecks/PhpDefaultCharset.php +++ b/apps/settings/lib/SetupChecks/PhpDefaultCharset.php @@ -18,14 +18,17 @@ class PhpDefaultCharset implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('PHP default charset'); } + #[\Override] public function getCategory(): string { return 'php'; } + #[\Override] public function run(): SetupResult { if (strtoupper(trim(ini_get('default_charset'))) === 'UTF-8') { return SetupResult::success('UTF-8'); diff --git a/apps/settings/lib/SetupChecks/PhpDisabledFunctions.php b/apps/settings/lib/SetupChecks/PhpDisabledFunctions.php index b82b5921989..f18a145b10b 100644 --- a/apps/settings/lib/SetupChecks/PhpDisabledFunctions.php +++ b/apps/settings/lib/SetupChecks/PhpDisabledFunctions.php @@ -19,14 +19,17 @@ class PhpDisabledFunctions implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('PHP set_time_limit'); } + #[\Override] public function getCategory(): string { return 'php'; } + #[\Override] public function run(): SetupResult { if (function_exists('set_time_limit') && !str_contains(ini_get('disable_functions'), 'set_time_limit')) { return SetupResult::success($this->l10n->t('The function is available.')); diff --git a/apps/settings/lib/SetupChecks/PhpFreetypeSupport.php b/apps/settings/lib/SetupChecks/PhpFreetypeSupport.php index ec5d6c7e146..eb84a2f699c 100644 --- a/apps/settings/lib/SetupChecks/PhpFreetypeSupport.php +++ b/apps/settings/lib/SetupChecks/PhpFreetypeSupport.php @@ -19,10 +19,12 @@ class PhpFreetypeSupport implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Freetype'); } + #[\Override] public function getCategory(): string { return 'php'; } @@ -34,6 +36,7 @@ class PhpFreetypeSupport implements ISetupCheck { return function_exists('imagettfbbox') && function_exists('imagettftext'); } + #[\Override] public function run(): SetupResult { if ($this->hasFreeTypeSupport()) { return SetupResult::success($this->l10n->t('Supported')); diff --git a/apps/settings/lib/SetupChecks/PhpGetEnv.php b/apps/settings/lib/SetupChecks/PhpGetEnv.php index 279a23a9691..33458ff96bd 100644 --- a/apps/settings/lib/SetupChecks/PhpGetEnv.php +++ b/apps/settings/lib/SetupChecks/PhpGetEnv.php @@ -20,14 +20,17 @@ class PhpGetEnv implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('PHP getenv'); } + #[\Override] public function getCategory(): string { return 'php'; } + #[\Override] public function run(): SetupResult { if (!empty(getenv('PATH'))) { return SetupResult::success(); diff --git a/apps/settings/lib/SetupChecks/PhpMaxFileSize.php b/apps/settings/lib/SetupChecks/PhpMaxFileSize.php index d81cbe6d45c..5d5f56f5529 100644 --- a/apps/settings/lib/SetupChecks/PhpMaxFileSize.php +++ b/apps/settings/lib/SetupChecks/PhpMaxFileSize.php @@ -24,14 +24,17 @@ class PhpMaxFileSize implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'php'; } + #[\Override] public function getName(): string { return $this->l10n->t('PHP file size upload limit'); } + #[\Override] public function run(): SetupResult { $upload_max_filesize = (string)$this->iniGetWrapper->getString('upload_max_filesize'); $post_max_size = (string)$this->iniGetWrapper->getString('post_max_size'); diff --git a/apps/settings/lib/SetupChecks/PhpMemoryLimit.php b/apps/settings/lib/SetupChecks/PhpMemoryLimit.php index 7b693169f10..16c189b6732 100644 --- a/apps/settings/lib/SetupChecks/PhpMemoryLimit.php +++ b/apps/settings/lib/SetupChecks/PhpMemoryLimit.php @@ -22,14 +22,17 @@ class PhpMemoryLimit implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'php'; } + #[\Override] public function getName(): string { return $this->l10n->t('PHP memory limit'); } + #[\Override] public function run(): SetupResult { if ($this->memoryInfo->isMemoryLimitSufficient()) { return SetupResult::success(Util::humanFileSize($this->memoryInfo->getMemoryLimit())); diff --git a/apps/settings/lib/SetupChecks/PhpModules.php b/apps/settings/lib/SetupChecks/PhpModules.php index 49bf6b2ff93..64fa6e15c0a 100644 --- a/apps/settings/lib/SetupChecks/PhpModules.php +++ b/apps/settings/lib/SetupChecks/PhpModules.php @@ -45,10 +45,12 @@ class PhpModules implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('PHP modules'); } + #[\Override] public function getCategory(): string { return 'php'; } @@ -63,6 +65,7 @@ class PhpModules implements ISetupCheck { }; } + #[\Override] public function run(): SetupResult { $missingRecommendedModules = $this->getMissingModules(self::RECOMMENDED_MODULES); $missingRequiredModules = $this->getMissingModules(self::REQUIRED_MODULES); diff --git a/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php b/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php index 83b7be1c390..b1ee390b9cf 100644 --- a/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php +++ b/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php @@ -22,10 +22,12 @@ class PhpOpcacheSetup implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('PHP opcache'); } + #[\Override] public function getCategory(): string { return 'php'; } @@ -111,6 +113,7 @@ class PhpOpcacheSetup implements ISetupCheck { return [$level, $recommendations]; } + #[\Override] public function run(): SetupResult { // Skip OPcache checks if running from CLI if (\OC::$CLI && !$this->iniGetWrapper->getBool('opcache.enable_cli')) { diff --git a/apps/settings/lib/SetupChecks/PhpOutdated.php b/apps/settings/lib/SetupChecks/PhpOutdated.php index 0ac36c1e273..287b937070f 100644 --- a/apps/settings/lib/SetupChecks/PhpOutdated.php +++ b/apps/settings/lib/SetupChecks/PhpOutdated.php @@ -24,14 +24,17 @@ class PhpOutdated implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'security'; } + #[\Override] public function getName(): string { return $this->l10n->t('PHP version'); } + #[\Override] public function run(): SetupResult { if (PHP_VERSION_ID < 80300) { return SetupResult::warning($this->l10n->t('You are currently running PHP %1$s. PHP %2$s is deprecated since Nextcloud %3$s. Nextcloud %4$s may require at least PHP %5$s. Please upgrade to one of the officially supported PHP versions provided by the PHP Group as soon as possible.', [ diff --git a/apps/settings/lib/SetupChecks/PhpOutputBuffering.php b/apps/settings/lib/SetupChecks/PhpOutputBuffering.php index be8154fbb1b..f594d14b4c2 100644 --- a/apps/settings/lib/SetupChecks/PhpOutputBuffering.php +++ b/apps/settings/lib/SetupChecks/PhpOutputBuffering.php @@ -18,14 +18,17 @@ class PhpOutputBuffering implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'php'; } + #[\Override] public function getName(): string { return $this->l10n->t('PHP "output_buffering" option'); } + #[\Override] public function run(): SetupResult { $value = trim(ini_get('output_buffering')); if ($value === '' || $value === '0') { diff --git a/apps/settings/lib/SetupChecks/PushService.php b/apps/settings/lib/SetupChecks/PushService.php index 1f03404d80e..6f66bce7a57 100644 --- a/apps/settings/lib/SetupChecks/PushService.php +++ b/apps/settings/lib/SetupChecks/PushService.php @@ -26,10 +26,12 @@ class PushService implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Push service'); } + #[\Override] public function getCategory(): string { return 'system'; } @@ -46,6 +48,7 @@ class PushService implements ISetupCheck { return $this->notificationsManager->isFairUseOfFreePushService(); } + #[\Override] public function run(): SetupResult { if ($this->subscriptionRegistry->delegateHasValidSubscription()) { return SetupResult::success($this->l10n->t('Valid enterprise license')); diff --git a/apps/settings/lib/SetupChecks/RandomnessSecure.php b/apps/settings/lib/SetupChecks/RandomnessSecure.php index 045ddde0b9d..5280d7fe9d9 100644 --- a/apps/settings/lib/SetupChecks/RandomnessSecure.php +++ b/apps/settings/lib/SetupChecks/RandomnessSecure.php @@ -24,14 +24,17 @@ class RandomnessSecure implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Random generator'); } + #[\Override] public function getCategory(): string { return 'security'; } + #[\Override] public function run(): SetupResult { try { $this->secureRandom->generate(1); diff --git a/apps/settings/lib/SetupChecks/ReadOnlyConfig.php b/apps/settings/lib/SetupChecks/ReadOnlyConfig.php index b616f8a7155..86efabff060 100644 --- a/apps/settings/lib/SetupChecks/ReadOnlyConfig.php +++ b/apps/settings/lib/SetupChecks/ReadOnlyConfig.php @@ -20,14 +20,17 @@ class ReadOnlyConfig implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Configuration file access rights'); } + #[\Override] public function getCategory(): string { return 'config'; } + #[\Override] public function run(): SetupResult { if ($this->config->getSystemValueBool('config_is_read_only', false)) { return SetupResult::info($this->l10n->t('The read-only config has been enabled. This prevents setting some configurations via the web-interface. Furthermore, the file needs to be made writable manually for every update.')); diff --git a/apps/settings/lib/SetupChecks/SchedulingTableSize.php b/apps/settings/lib/SetupChecks/SchedulingTableSize.php index b23972ca7dc..237143bbc39 100644 --- a/apps/settings/lib/SetupChecks/SchedulingTableSize.php +++ b/apps/settings/lib/SetupChecks/SchedulingTableSize.php @@ -22,14 +22,17 @@ class SchedulingTableSize implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Scheduling objects table size'); } + #[\Override] public function getCategory(): string { return 'database'; } + #[\Override] public function run(): SetupResult { $qb = $this->connection->getQueryBuilder(); $qb->select($qb->func()->count('id')) diff --git a/apps/settings/lib/SetupChecks/SecurityHeaders.php b/apps/settings/lib/SetupChecks/SecurityHeaders.php index 9cc6856a170..2fee92d160d 100644 --- a/apps/settings/lib/SetupChecks/SecurityHeaders.php +++ b/apps/settings/lib/SetupChecks/SecurityHeaders.php @@ -31,14 +31,17 @@ class SecurityHeaders implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'security'; } + #[\Override] public function getName(): string { return $this->l10n->t('HTTP headers'); } + #[\Override] public function run(): SetupResult { $urls = [ ['get', $this->urlGenerator->linkToRoute('heartbeat'), [200]], diff --git a/apps/settings/lib/SetupChecks/SupportedDatabase.php b/apps/settings/lib/SetupChecks/SupportedDatabase.php index c6ae9760bcf..bf017aaec58 100644 --- a/apps/settings/lib/SetupChecks/SupportedDatabase.php +++ b/apps/settings/lib/SetupChecks/SupportedDatabase.php @@ -32,14 +32,17 @@ class SupportedDatabase implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'database'; } + #[\Override] public function getName(): string { return $this->l10n->t('Database version'); } + #[\Override] public function run(): SetupResult { $databasePlatform = $this->connection->getDatabaseProvider(); if ($databasePlatform === IDBConnection::PLATFORM_MYSQL || $databasePlatform === IDBConnection::PLATFORM_MARIADB) { diff --git a/apps/settings/lib/SetupChecks/SystemIs64bit.php b/apps/settings/lib/SetupChecks/SystemIs64bit.php index 308011c218e..550fcb8dba2 100644 --- a/apps/settings/lib/SetupChecks/SystemIs64bit.php +++ b/apps/settings/lib/SetupChecks/SystemIs64bit.php @@ -21,10 +21,12 @@ class SystemIs64bit implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Architecture'); } + #[\Override] public function getCategory(): string { return 'system'; } @@ -37,6 +39,7 @@ class SystemIs64bit implements ISetupCheck { } } + #[\Override] public function run(): SetupResult { if ($this->is64bit()) { return SetupResult::success($this->l10n->t('64-bit')); diff --git a/apps/settings/lib/SetupChecks/TaskProcessingPickupSpeed.php b/apps/settings/lib/SetupChecks/TaskProcessingPickupSpeed.php index 4897d0cf2de..17496f3d56f 100644 --- a/apps/settings/lib/SetupChecks/TaskProcessingPickupSpeed.php +++ b/apps/settings/lib/SetupChecks/TaskProcessingPickupSpeed.php @@ -27,14 +27,17 @@ class TaskProcessingPickupSpeed implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'ai'; } + #[\Override] public function getName(): string { return $this->l10n->t('Task Processing pickup speed'); } + #[\Override] public function run(): SetupResult { $taskCount = 0; $lastNDays = 1; diff --git a/apps/settings/lib/SetupChecks/TaskProcessingSuccessRate.php b/apps/settings/lib/SetupChecks/TaskProcessingSuccessRate.php index 4fc801ad8b7..b5e6819b7b6 100644 --- a/apps/settings/lib/SetupChecks/TaskProcessingSuccessRate.php +++ b/apps/settings/lib/SetupChecks/TaskProcessingSuccessRate.php @@ -28,14 +28,17 @@ class TaskProcessingSuccessRate implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'ai'; } + #[\Override] public function getName(): string { return $this->l10n->t('Task Processing pickup speed'); } + #[\Override] public function run(): SetupResult { $taskCount = 0; $lastNDays = 0; diff --git a/apps/settings/lib/SetupChecks/TempSpaceAvailable.php b/apps/settings/lib/SetupChecks/TempSpaceAvailable.php index 49dc0d377e7..d4aa3db94b0 100644 --- a/apps/settings/lib/SetupChecks/TempSpaceAvailable.php +++ b/apps/settings/lib/SetupChecks/TempSpaceAvailable.php @@ -24,10 +24,12 @@ class TempSpaceAvailable implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Temporary space available'); } + #[\Override] public function getCategory(): string { return 'system'; } @@ -51,6 +53,7 @@ class TempSpaceAvailable implements ISetupCheck { return true; } + #[\Override] public function run(): SetupResult { $phpTempPath = sys_get_temp_dir(); $nextcloudTempPath = ''; diff --git a/apps/settings/lib/SetupChecks/TransactionIsolation.php b/apps/settings/lib/SetupChecks/TransactionIsolation.php index 892c0ecbda6..798f95acb9a 100644 --- a/apps/settings/lib/SetupChecks/TransactionIsolation.php +++ b/apps/settings/lib/SetupChecks/TransactionIsolation.php @@ -27,14 +27,17 @@ class TransactionIsolation implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Database transaction isolation level'); } + #[\Override] public function getCategory(): string { return 'database'; } + #[\Override] public function run(): SetupResult { try { if ($this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_SQLITE) { diff --git a/apps/settings/lib/SetupChecks/TwoFactorConfiguration.php b/apps/settings/lib/SetupChecks/TwoFactorConfiguration.php index 584191401ca..a0abf937906 100644 --- a/apps/settings/lib/SetupChecks/TwoFactorConfiguration.php +++ b/apps/settings/lib/SetupChecks/TwoFactorConfiguration.php @@ -24,14 +24,17 @@ class TwoFactorConfiguration implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('Second factor configuration'); } + #[\Override] public function getCategory(): string { return 'security'; } + #[\Override] public function run(): SetupResult { $providers = $this->providerLoader->getProviders(); $providerSet = new ProviderSet($providers, false); diff --git a/apps/settings/lib/SetupChecks/WellKnownUrls.php b/apps/settings/lib/SetupChecks/WellKnownUrls.php index 4eeaff8f3c4..e1599376efa 100644 --- a/apps/settings/lib/SetupChecks/WellKnownUrls.php +++ b/apps/settings/lib/SetupChecks/WellKnownUrls.php @@ -31,14 +31,17 @@ class WellKnownUrls implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'network'; } + #[\Override] public function getName(): string { return $this->l10n->t('.well-known URLs'); } + #[\Override] public function run(): SetupResult { if (!$this->config->getSystemValueBool('check_for_working_wellknown_setup', true)) { return SetupResult::info($this->l10n->t('`check_for_working_wellknown_setup` is set to false in your configuration, so this check was skipped.')); diff --git a/apps/settings/lib/SetupChecks/Woff2Loading.php b/apps/settings/lib/SetupChecks/Woff2Loading.php index 27aff4ea999..ce2e32d2a74 100644 --- a/apps/settings/lib/SetupChecks/Woff2Loading.php +++ b/apps/settings/lib/SetupChecks/Woff2Loading.php @@ -32,14 +32,17 @@ class Woff2Loading implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'network'; } + #[\Override] public function getName(): string { return $this->l10n->t('Font file loading'); } + #[\Override] public function run(): SetupResult { $result = $this->checkFont('otf', $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Regular.otf')); if ($result->getSeverity() !== SetupResult::SUCCESS) { diff --git a/apps/settings/lib/UserMigration/AccountMigrator.php b/apps/settings/lib/UserMigration/AccountMigrator.php index 2670974c52b..993d770fe6e 100644 --- a/apps/settings/lib/UserMigration/AccountMigrator.php +++ b/apps/settings/lib/UserMigration/AccountMigrator.php @@ -53,6 +53,7 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getEstimatedExportSize(IUser $user): int|float { $size = 100; // 100KiB for account JSON @@ -72,6 +73,7 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function export(IUser $user, IExportDestination $exportDestination, OutputInterface $output): void { $output->writeln('Exporting account information in ' . AccountMigrator::PATH_ACCOUNT_FILE . '…'); @@ -107,6 +109,7 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function import(IUser $user, IImportSource $importSource, OutputInterface $output): void { if ($importSource->getMigratorVersion($this->getId()) === null) { $output->writeln('No version for ' . static::class . ', skipping import…'); @@ -172,6 +175,7 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getId(): string { return 'account'; } @@ -179,6 +183,7 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getDisplayName(): string { return $this->l10n->t('Profile information'); } @@ -186,6 +191,7 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator { /** * {@inheritDoc} */ + #[\Override] public function getDescription(): string { return $this->l10n->t('Profile picture, full name, email, phone number, address, website, Twitter, organisation, role, headline, biography, and whether your profile is enabled'); } diff --git a/apps/settings/lib/WellKnown/ChangePasswordHandler.php b/apps/settings/lib/WellKnown/ChangePasswordHandler.php index 9609579ef0a..bae40ab7e10 100644 --- a/apps/settings/lib/WellKnown/ChangePasswordHandler.php +++ b/apps/settings/lib/WellKnown/ChangePasswordHandler.php @@ -23,6 +23,7 @@ class ChangePasswordHandler implements IHandler { ) { } + #[\Override] public function handle(string $service, IRequestContext $context, ?IResponse $previousResponse): ?IResponse { if ($service !== 'change-password') { return $previousResponse; diff --git a/apps/settings/lib/WellKnown/SecurityTxtHandler.php b/apps/settings/lib/WellKnown/SecurityTxtHandler.php index e3f1c274366..00985cac18e 100644 --- a/apps/settings/lib/WellKnown/SecurityTxtHandler.php +++ b/apps/settings/lib/WellKnown/SecurityTxtHandler.php @@ -16,6 +16,7 @@ use OCP\Http\WellKnown\IRequestContext; use OCP\Http\WellKnown\IResponse; class SecurityTxtHandler implements IHandler { + #[\Override] public function handle(string $service, IRequestContext $context, ?IResponse $previousResponse): ?IResponse { if ($service !== 'security.txt') { return $previousResponse; diff --git a/apps/sharebymail/lib/Activity.php b/apps/sharebymail/lib/Activity.php index 5eecf83bedf..65a2b3088b8 100644 --- a/apps/sharebymail/lib/Activity.php +++ b/apps/sharebymail/lib/Activity.php @@ -43,6 +43,7 @@ class Activity implements IProvider { * @throws UnknownActivityException * @since 11.0.0 */ + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== 'sharebymail') { throw new UnknownActivityException(); diff --git a/apps/sharebymail/lib/AppInfo/Application.php b/apps/sharebymail/lib/AppInfo/Application.php index 792f7f31664..6f0edfe95be 100644 --- a/apps/sharebymail/lib/AppInfo/Application.php +++ b/apps/sharebymail/lib/AppInfo/Application.php @@ -21,10 +21,12 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerCapability(Capabilities::class); } + #[\Override] public function boot(IBootContext $context): void { } } diff --git a/apps/sharebymail/lib/Capabilities.php b/apps/sharebymail/lib/Capabilities.php index 425a695ff36..afc0bd70482 100644 --- a/apps/sharebymail/lib/Capabilities.php +++ b/apps/sharebymail/lib/Capabilities.php @@ -43,6 +43,7 @@ class Capabilities implements ICapability { * } * } */ + #[\Override] public function getCapabilities(): array { if (!$this->appManager->isEnabledForUser('files_sharing')) { return []; diff --git a/apps/sharebymail/lib/Settings/Admin.php b/apps/sharebymail/lib/Settings/Admin.php index ff7aff90312..99849ae323b 100644 --- a/apps/sharebymail/lib/Settings/Admin.php +++ b/apps/sharebymail/lib/Settings/Admin.php @@ -25,6 +25,7 @@ class Admin implements IDelegatedSettings { /** * @return TemplateResponse */ + #[\Override] public function getForm() { $this->initialState->provideInitialState('sendPasswordMail', $this->settingsManager->sendPasswordByMail()); $this->initialState->provideInitialState('replyToInitiator', $this->settingsManager->replyToInitiator()); @@ -37,6 +38,7 @@ class Admin implements IDelegatedSettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection() { return 'sharing'; } @@ -48,14 +50,17 @@ class Admin implements IDelegatedSettings { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 40; } + #[\Override] public function getName(): ?string { return $this->l->t('Share by mail'); } + #[\Override] public function getAuthorizedAppConfig(): array { return [ 'sharebymail' => ['s/(sendpasswordmail|replyToInitiator)/'], diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index c2cd1a2f033..10cf9ae2863 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -51,6 +51,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider * * @return string Containing only [a-zA-Z0-9] */ + #[\Override] public function identifier(): string { return 'ocMailShare'; } @@ -81,6 +82,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider * @throws ShareNotFound * @throws \Exception */ + #[\Override] public function create(IShare $share): IShare { $shareWith = $share->getSharedWith(); // Check if file is not already shared with the given email, @@ -246,6 +248,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider /** * @inheritDoc */ + #[\Override] public function sendMailNotification(IShare $share): bool { $shareId = $share->getId(); @@ -642,6 +645,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider return $token; } + #[\Override] public function getChildren(IShare $parent): array { $children = []; @@ -717,6 +721,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider /** * Update a share */ + #[\Override] public function update(IShare $share, ?string $plainTextPassword = null): IShare { $originalShare = $this->getShareById($share->getId()); @@ -768,6 +773,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider /** * @inheritdoc */ + #[\Override] public function move(IShare $share, $recipient): IShare { /** * nothing to do here, mail shares are only outgoing shares @@ -780,6 +786,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider * * @param IShare $share */ + #[\Override] public function delete(IShare $share): void { try { $this->createShareActivity($share, 'unshare'); @@ -792,10 +799,12 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider /** * @inheritdoc */ + #[\Override] public function deleteFromSelf(IShare $share, $recipient): void { // nothing to do here, mail shares are only outgoing shares } + #[\Override] public function restore(IShare $share, string $recipient): IShare { throw new GenericShareException('not implemented'); } @@ -803,6 +812,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider /** * @inheritdoc */ + #[\Override] public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset): array { $qb = $this->dbConnection->getQueryBuilder(); $qb->select('*') @@ -859,6 +869,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider /** * @inheritdoc */ + #[\Override] public function getShareById($id, $recipientId = null): IShare { $qb = $this->dbConnection->getQueryBuilder(); @@ -891,6 +902,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider * * @return IShare[] */ + #[\Override] public function getSharesByPath(Node $path): array { $qb = $this->dbConnection->getQueryBuilder(); @@ -913,6 +925,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider /** * @inheritdoc */ + #[\Override] public function getSharedWith($userId, $shareType, $node, $limit, $offset): array { /** @var IShare[] $shares */ $shares = []; @@ -955,6 +968,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider * * @throws ShareNotFound */ + #[\Override] public function getShareByToken($token): IShare { $qb = $this->dbConnection->getQueryBuilder(); @@ -1073,6 +1087,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider * A user is deleted from the system * So clean up the relevant shares. */ + #[\Override] public function userDeleted($uid, $shareType): void { $qb = $this->dbConnection->getQueryBuilder(); @@ -1085,12 +1100,14 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider /** * This provider does not support group shares */ + #[\Override] public function groupDeleted($gid): void { } /** * This provider does not support group shares */ + #[\Override] public function userDeletedFromGroup($uid, $gid): void { } @@ -1117,10 +1134,12 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider return $data; } + #[\Override] public function getSharesInFolder($userId, Folder $node, $reshares, $shallow = true): array { return $this->getSharesInFolderInternal($userId, $node, $reshares); } + #[\Override] public function getAllSharesInFolder(Folder $node): array { return $this->getSharesInFolderInternal(null, $node, null); } @@ -1172,6 +1191,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider /** * @inheritdoc */ + #[\Override] public function getAccessList($nodes, $currentAccess): array { $ids = []; foreach ($nodes as $node) { @@ -1204,6 +1224,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider return ['public' => $public, 'mail' => $mail]; } + #[\Override] public function getAllShares(): iterable { $qb = $this->dbConnection->getQueryBuilder(); diff --git a/apps/systemtags/lib/Activity/Provider.php b/apps/systemtags/lib/Activity/Provider.php index 5849ab173e3..605c3b7c282 100644 --- a/apps/systemtags/lib/Activity/Provider.php +++ b/apps/systemtags/lib/Activity/Provider.php @@ -48,6 +48,7 @@ class Provider implements IProvider { * @throws UnknownActivityException * @since 11.0.0 */ + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'systemtags') { throw new UnknownActivityException(); diff --git a/apps/systemtags/lib/Activity/Setting.php b/apps/systemtags/lib/Activity/Setting.php index 84e5bc0f66a..b3a3e6b4477 100644 --- a/apps/systemtags/lib/Activity/Setting.php +++ b/apps/systemtags/lib/Activity/Setting.php @@ -21,6 +21,7 @@ class Setting extends ActivitySettings { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ + #[\Override] public function getIdentifier() { return 'systemtags'; } @@ -29,6 +30,7 @@ class Setting extends ActivitySettings { * @return string A translated string * @since 11.0.0 */ + #[\Override] public function getName() { return $this->l->t('System tags for a file have been modified'); } @@ -37,6 +39,7 @@ class Setting extends ActivitySettings { * @return string Lowercase a-z and underscore only group identifier * @since 20.0.0 */ + #[\Override] public function getGroupIdentifier() { return 'files'; } @@ -45,6 +48,7 @@ class Setting extends ActivitySettings { * @return string A translated string for the settings group * @since 20.0.0 */ + #[\Override] public function getGroupName() { return $this->l->t('Files'); } @@ -55,6 +59,7 @@ class Setting extends ActivitySettings { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ + #[\Override] public function getPriority() { return 50; } @@ -63,6 +68,7 @@ class Setting extends ActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function canChangeStream() { return true; } @@ -71,6 +77,7 @@ class Setting extends ActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledStream() { return true; } @@ -79,6 +86,7 @@ class Setting extends ActivitySettings { * @return bool True when the option can be changed for the mail * @since 11.0.0 */ + #[\Override] public function canChangeMail() { return true; } @@ -87,6 +95,7 @@ class Setting extends ActivitySettings { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ + #[\Override] public function isDefaultEnabledMail() { return false; } diff --git a/apps/systemtags/lib/AppInfo/Application.php b/apps/systemtags/lib/AppInfo/Application.php index e0cb0a56d77..442a14ac662 100644 --- a/apps/systemtags/lib/AppInfo/Application.php +++ b/apps/systemtags/lib/AppInfo/Application.php @@ -32,6 +32,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerSearchProvider(TagSearchProvider::class); $context->registerCapability(Capabilities::class); @@ -40,6 +41,7 @@ class Application extends App implements IBootstrap { $context->registerEventListener(BeforeSabrePubliclyLoadedEvent::class, BeforeSabrePubliclyLoadedListener::class); } + #[\Override] public function boot(IBootContext $context): void { $context->injectFn(function (IEventDispatcher $dispatcher) use ($context): void { $managerListener = function (ManagerEvent $event) use ($context): void { diff --git a/apps/systemtags/lib/Capabilities.php b/apps/systemtags/lib/Capabilities.php index a3168ccf1ae..092a74ae635 100644 --- a/apps/systemtags/lib/Capabilities.php +++ b/apps/systemtags/lib/Capabilities.php @@ -14,6 +14,7 @@ class Capabilities implements ICapability { /** * @return array{systemtags: array{enabled: true}} */ + #[\Override] public function getCapabilities() { $capabilities = [ 'systemtags' => [ diff --git a/apps/systemtags/lib/Command/Files/Add.php b/apps/systemtags/lib/Command/Files/Add.php index 237feb748a4..97d60b40891 100644 --- a/apps/systemtags/lib/Command/Files/Add.php +++ b/apps/systemtags/lib/Command/Files/Add.php @@ -28,6 +28,7 @@ class Add extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this->setName('tag:files:add') ->setDescription('Add a system-tag to a file or folder') @@ -36,6 +37,7 @@ class Add extends Command { ->addArgument('access', InputArgument::REQUIRED, 'access level of the tag (public, restricted or invisible)'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $targetInput = $input->getArgument('target'); $tagsInput = $input->getArgument('tags'); diff --git a/apps/systemtags/lib/Command/Files/Delete.php b/apps/systemtags/lib/Command/Files/Delete.php index b24135664d7..62946cefc4c 100644 --- a/apps/systemtags/lib/Command/Files/Delete.php +++ b/apps/systemtags/lib/Command/Files/Delete.php @@ -28,6 +28,7 @@ class Delete extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this->setName('tag:files:delete') ->setDescription('Delete a system-tag from a file or folder') @@ -36,6 +37,7 @@ class Delete extends Command { ->addArgument('access', InputArgument::REQUIRED, 'access level of the tag (public, restricted or invisible)'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $targetInput = $input->getArgument('target'); $tagsInput = $input->getArgument('tags'); diff --git a/apps/systemtags/lib/Command/Files/DeleteAll.php b/apps/systemtags/lib/Command/Files/DeleteAll.php index f60be49cbe3..e04f9437199 100644 --- a/apps/systemtags/lib/Command/Files/DeleteAll.php +++ b/apps/systemtags/lib/Command/Files/DeleteAll.php @@ -25,12 +25,14 @@ class DeleteAll extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this->setName('tag:files:delete-all') ->setDescription('Delete all system-tags from a file or folder') ->addArgument('target', InputArgument::REQUIRED, 'file id or path'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $targetInput = $input->getArgument('target'); $targetNode = $this->fileUtils->getNode($targetInput); diff --git a/apps/systemtags/lib/Listeners/BeforeSabrePubliclyLoadedListener.php b/apps/systemtags/lib/Listeners/BeforeSabrePubliclyLoadedListener.php index e89ed47a104..7491b1bdc49 100644 --- a/apps/systemtags/lib/Listeners/BeforeSabrePubliclyLoadedListener.php +++ b/apps/systemtags/lib/Listeners/BeforeSabrePubliclyLoadedListener.php @@ -17,6 +17,7 @@ use OCP\Server; * @template-implements IEventListener */ class BeforeSabrePubliclyLoadedListener implements IEventListener { + #[\Override] public function handle(Event $event): void { if (!$event instanceof BeforeSabrePubliclyLoadedEvent) { return; diff --git a/apps/systemtags/lib/Listeners/BeforeTemplateRenderedListener.php b/apps/systemtags/lib/Listeners/BeforeTemplateRenderedListener.php index afb85dc6d6b..e868b206544 100644 --- a/apps/systemtags/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/apps/systemtags/lib/Listeners/BeforeTemplateRenderedListener.php @@ -25,6 +25,7 @@ class BeforeTemplateRenderedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof BeforeTemplateRenderedEvent) { return; diff --git a/apps/systemtags/lib/Listeners/LoadAdditionalScriptsListener.php b/apps/systemtags/lib/Listeners/LoadAdditionalScriptsListener.php index 6ed1adc0834..196e01cf58d 100644 --- a/apps/systemtags/lib/Listeners/LoadAdditionalScriptsListener.php +++ b/apps/systemtags/lib/Listeners/LoadAdditionalScriptsListener.php @@ -25,6 +25,7 @@ class LoadAdditionalScriptsListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof LoadAdditionalScriptsEvent) { return; diff --git a/apps/systemtags/lib/Migration/Version31000Date20241018063111.php b/apps/systemtags/lib/Migration/Version31000Date20241018063111.php index 8006d7f3969..25788f385dd 100644 --- a/apps/systemtags/lib/Migration/Version31000Date20241018063111.php +++ b/apps/systemtags/lib/Migration/Version31000Date20241018063111.php @@ -23,6 +23,7 @@ use OCP\Migration\SimpleMigrationStep; #[AddColumn(table: 'systemtag', name: 'etag', type: ColumnType::STRING, description: 'Adding etag for systemtag table to prevent conflicts')] class Version31000Date20241018063111 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/systemtags/lib/Migration/Version31000Date20241114171300.php b/apps/systemtags/lib/Migration/Version31000Date20241114171300.php index 22e1bd1e485..6c82f2b5832 100644 --- a/apps/systemtags/lib/Migration/Version31000Date20241114171300.php +++ b/apps/systemtags/lib/Migration/Version31000Date20241114171300.php @@ -23,6 +23,7 @@ use OCP\Migration\SimpleMigrationStep; #[AddColumn(table: 'systemtag', name: 'color', type: ColumnType::STRING, description: 'Adding color for systemtag table')] class Version31000Date20241114171300 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/systemtags/lib/Search/TagSearchProvider.php b/apps/systemtags/lib/Search/TagSearchProvider.php index 0dc1f130131..6be6d959148 100644 --- a/apps/systemtags/lib/Search/TagSearchProvider.php +++ b/apps/systemtags/lib/Search/TagSearchProvider.php @@ -45,6 +45,7 @@ class TagSearchProvider implements IProvider { /** * @inheritDoc */ + #[\Override] public function getId(): string { return 'systemtags'; } @@ -52,6 +53,7 @@ class TagSearchProvider implements IProvider { /** * @inheritDoc */ + #[\Override] public function getName(): string { return $this->l10n->t('Tags'); } @@ -59,6 +61,7 @@ class TagSearchProvider implements IProvider { /** * @inheritDoc */ + #[\Override] public function getOrder(string $route, array $routeParameters): int { if ($route === 'files.View.index') { return -4; @@ -69,6 +72,7 @@ class TagSearchProvider implements IProvider { /** * @inheritDoc */ + #[\Override] public function search(IUser $user, ISearchQuery $query): SearchResult { $matchingTags = $this->tagManager->getAllTags(true, $query->getTerm()); if (count($matchingTags) === 0) { diff --git a/apps/systemtags/lib/Settings/Admin.php b/apps/systemtags/lib/Settings/Admin.php index 27f492e1a22..e994eef6fa7 100644 --- a/apps/systemtags/lib/Settings/Admin.php +++ b/apps/systemtags/lib/Settings/Admin.php @@ -26,6 +26,7 @@ class Admin implements ISettings { /** * @return TemplateResponse */ + #[\Override] public function getForm() { $restrictSystemTagsCreationToAdmin = $this->appConfig->getValueBool(Application::APP_ID, 'restrict_creation_to_admin', false); $this->initialStateService->provideInitialState('restrictSystemTagsCreationToAdmin', $restrictSystemTagsCreationToAdmin); @@ -38,6 +39,7 @@ class Admin implements ISettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection() { return 'server'; } @@ -49,6 +51,7 @@ class Admin implements ISettings { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 70; } diff --git a/apps/testing/lib/AlternativeHomeUserBackend.php b/apps/testing/lib/AlternativeHomeUserBackend.php index 0524ebe110d..3590c3fcb9a 100644 --- a/apps/testing/lib/AlternativeHomeUserBackend.php +++ b/apps/testing/lib/AlternativeHomeUserBackend.php @@ -31,6 +31,7 @@ class AlternativeHomeUserBackend extends Database { * @param string $uid the username * @return string|false */ + #[\Override] public function getHome($uid) { if ($this->userExists($uid)) { // workaround to avoid killing the admin diff --git a/apps/testing/lib/AppInfo/Application.php b/apps/testing/lib/AppInfo/Application.php index 2035dbbf6fc..756adba4cde 100644 --- a/apps/testing/lib/AppInfo/Application.php +++ b/apps/testing/lib/AppInfo/Application.php @@ -44,6 +44,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID, $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerTranslationProvider(FakeTranslationProvider::class); $context->registerTextProcessingProvider(FakeTextProcessingProvider::class); @@ -67,6 +68,7 @@ class Application extends App implements IBootstrap { $context->registerEventListener(DeclarativeSettingsSetValueEvent::class, SetDeclarativeSettingsValueListener::class); } + #[\Override] public function boot(IBootContext $context): void { $server = $context->getServerContainer(); $config = $server->get(IAppConfig::class); diff --git a/apps/testing/lib/Conversion/ConversionProvider.php b/apps/testing/lib/Conversion/ConversionProvider.php index b8d93428694..1ee014e2ca5 100644 --- a/apps/testing/lib/Conversion/ConversionProvider.php +++ b/apps/testing/lib/Conversion/ConversionProvider.php @@ -20,6 +20,7 @@ class ConversionProvider implements IConversionProvider { ) { } + #[\Override] public function getSupportedMimeTypes(): array { return [ new ConversionMimeProvider('image/jpeg', 'image/png', 'png', $this->l10n->t('Image (.png)')), @@ -27,6 +28,7 @@ class ConversionProvider implements IConversionProvider { ]; } + #[\Override] public function convertFile(File $file, string $targetMimeType): mixed { $image = imagecreatefromstring($file->getContent()); imagepalettetotruecolor($image); diff --git a/apps/testing/lib/HiddenGroupBackend.php b/apps/testing/lib/HiddenGroupBackend.php index 96ead46c06e..41c60b1c846 100644 --- a/apps/testing/lib/HiddenGroupBackend.php +++ b/apps/testing/lib/HiddenGroupBackend.php @@ -18,26 +18,32 @@ class HiddenGroupBackend extends ABackend implements IHideFromCollaborationBacke ) { } + #[\Override] public function inGroup($uid, $gid): bool { return false; } + #[\Override] public function getUserGroups($uid): array { return []; } + #[\Override] public function getGroups($search = '', $limit = -1, $offset = 0): array { return $offset === 0 ? [$this->groupName] : []; } + #[\Override] public function groupExists($gid): bool { return $gid === $this->groupName; } + #[\Override] public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0): array { return []; } + #[\Override] public function hideGroup(string $groupId): bool { return true; } diff --git a/apps/testing/lib/Listener/GetDeclarativeSettingsValueListener.php b/apps/testing/lib/Listener/GetDeclarativeSettingsValueListener.php index 0df58168007..145e58a5617 100644 --- a/apps/testing/lib/Listener/GetDeclarativeSettingsValueListener.php +++ b/apps/testing/lib/Listener/GetDeclarativeSettingsValueListener.php @@ -22,6 +22,7 @@ class GetDeclarativeSettingsValueListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof DeclarativeSettingsGetValueEvent) { return; diff --git a/apps/testing/lib/Listener/RegisterDeclarativeSettingsListener.php b/apps/testing/lib/Listener/RegisterDeclarativeSettingsListener.php index aab39b78d76..dc08335bcb5 100644 --- a/apps/testing/lib/Listener/RegisterDeclarativeSettingsListener.php +++ b/apps/testing/lib/Listener/RegisterDeclarativeSettingsListener.php @@ -20,6 +20,7 @@ class RegisterDeclarativeSettingsListener implements IEventListener { public function __construct() { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof DeclarativeSettingsRegisterFormEvent)) { // Unrelated diff --git a/apps/testing/lib/Listener/SetDeclarativeSettingsValueListener.php b/apps/testing/lib/Listener/SetDeclarativeSettingsValueListener.php index 0058e7df43e..554bda6f436 100644 --- a/apps/testing/lib/Listener/SetDeclarativeSettingsValueListener.php +++ b/apps/testing/lib/Listener/SetDeclarativeSettingsValueListener.php @@ -22,6 +22,7 @@ class SetDeclarativeSettingsValueListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof DeclarativeSettingsSetValueEvent) { return; diff --git a/apps/testing/lib/Migration/Version30000Date20240102030405.php b/apps/testing/lib/Migration/Version30000Date20240102030405.php index e7b6bdcd618..7c56b1005c2 100644 --- a/apps/testing/lib/Migration/Version30000Date20240102030405.php +++ b/apps/testing/lib/Migration/Version30000Date20240102030405.php @@ -35,6 +35,7 @@ use OCP\Migration\SimpleMigrationStep; #[ModifyColumn(table: 'other_table', name: 'this_field')] #[ModifyColumn(table: 'other_table', name: 'this_field', type: ColumnType::BIGINT)] class Version30000Date20240102030405 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { return null; } diff --git a/apps/testing/lib/Provider/FakeText2ImageProvider.php b/apps/testing/lib/Provider/FakeText2ImageProvider.php index 6b607f23347..190cb5cd631 100644 --- a/apps/testing/lib/Provider/FakeText2ImageProvider.php +++ b/apps/testing/lib/Provider/FakeText2ImageProvider.php @@ -11,10 +11,12 @@ use OCP\TextToImage\IProvider; class FakeText2ImageProvider implements IProvider { + #[\Override] public function getName(): string { return 'Fake Text2Image provider'; } + #[\Override] public function generate(string $prompt, array $resources): void { foreach ($resources as $resource) { $read = fopen(__DIR__ . '/../../img/logo.png', 'r'); @@ -23,10 +25,12 @@ class FakeText2ImageProvider implements IProvider { } } + #[\Override] public function getExpectedRuntime(): int { return 1; } + #[\Override] public function getId(): string { return 'testing-fake-text2image-provider'; } diff --git a/apps/testing/lib/Provider/FakeTextProcessingProvider.php b/apps/testing/lib/Provider/FakeTextProcessingProvider.php index 991d0c605c8..08529bd0803 100644 --- a/apps/testing/lib/Provider/FakeTextProcessingProvider.php +++ b/apps/testing/lib/Provider/FakeTextProcessingProvider.php @@ -15,14 +15,17 @@ use OCP\TextProcessing\ITaskType; /** @template-implements IProvider */ class FakeTextProcessingProvider implements IProvider { + #[\Override] public function getName(): string { return 'Fake text processing provider (asynchronous)'; } + #[\Override] public function process(string $prompt): string { return $this->mb_strrev($prompt) . ' (done with FakeTextProcessingProvider)'; } + #[\Override] public function getTaskType(): string { return FreePromptTaskType::class; } diff --git a/apps/testing/lib/Provider/FakeTextProcessingProviderSync.php b/apps/testing/lib/Provider/FakeTextProcessingProviderSync.php index 01fc200be52..0585a15bc45 100644 --- a/apps/testing/lib/Provider/FakeTextProcessingProviderSync.php +++ b/apps/testing/lib/Provider/FakeTextProcessingProviderSync.php @@ -17,18 +17,22 @@ use OCP\TextProcessing\ITaskType; */ class FakeTextProcessingProviderSync implements IProviderWithExpectedRuntime { + #[\Override] public function getName(): string { return 'Fake text processing provider (synchronous)'; } + #[\Override] public function process(string $prompt): string { return $this->mb_strrev($prompt) . ' (done with FakeTextProcessingProviderSync)'; } + #[\Override] public function getTaskType(): string { return FreePromptTaskType::class; } + #[\Override] public function getExpectedRuntime(): int { return 1; } diff --git a/apps/testing/lib/Provider/FakeTranslationProvider.php b/apps/testing/lib/Provider/FakeTranslationProvider.php index 2e19eceae59..6455710fc6d 100644 --- a/apps/testing/lib/Provider/FakeTranslationProvider.php +++ b/apps/testing/lib/Provider/FakeTranslationProvider.php @@ -13,10 +13,12 @@ use OCP\Translation\LanguageTuple; class FakeTranslationProvider implements ITranslationProvider { + #[\Override] public function getName(): string { return 'Fake translation'; } + #[\Override] public function getAvailableLanguages(): array { return [ new LanguageTuple('de', 'German', 'en', 'English'), @@ -24,6 +26,7 @@ class FakeTranslationProvider implements ITranslationProvider { ]; } + #[\Override] public function translate(?string $fromLanguage, string $toLanguage, string $text): string { return $this->mb_strrev($text); } diff --git a/apps/testing/lib/Settings/DeclarativeSettingsForm.php b/apps/testing/lib/Settings/DeclarativeSettingsForm.php index 55e44cbcbea..9a5a094d456 100644 --- a/apps/testing/lib/Settings/DeclarativeSettingsForm.php +++ b/apps/testing/lib/Settings/DeclarativeSettingsForm.php @@ -11,6 +11,7 @@ use OCP\Settings\DeclarativeSettingsTypes; use OCP\Settings\IDeclarativeSettingsForm; class DeclarativeSettingsForm implements IDeclarativeSettingsForm { + #[\Override] public function getSchema(): array { return [ 'id' => 'test_declarative_form', diff --git a/apps/testing/lib/TaskProcessing/FakeContextWriteProvider.php b/apps/testing/lib/TaskProcessing/FakeContextWriteProvider.php index 9a5574f5147..b61b1f5fc9a 100644 --- a/apps/testing/lib/TaskProcessing/FakeContextWriteProvider.php +++ b/apps/testing/lib/TaskProcessing/FakeContextWriteProvider.php @@ -26,30 +26,37 @@ class FakeContextWriteProvider implements ISynchronousProvider { ) { } + #[\Override] public function getId(): string { return Application::APP_ID . '-contextwrite'; } + #[\Override] public function getName(): string { return 'Fake context write task processing provider'; } + #[\Override] public function getTaskTypeId(): string { return ContextWrite::ID; } + #[\Override] public function getExpectedRuntime(): int { return 1; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShape(): array { return [ 'max_tokens' => new ShapeDescriptor( @@ -65,6 +72,7 @@ class FakeContextWriteProvider implements ISynchronousProvider { ]; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return [ 'model' => [ @@ -75,6 +83,7 @@ class FakeContextWriteProvider implements ISynchronousProvider { ]; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return [ 'max_tokens' => 4321, @@ -82,18 +91,22 @@ class FakeContextWriteProvider implements ISynchronousProvider { ]; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) { throw new ProcessingException('Failing as set by AppConfig'); diff --git a/apps/testing/lib/TaskProcessing/FakeOcrProvider.php b/apps/testing/lib/TaskProcessing/FakeOcrProvider.php index 15cc237d458..bb255c0c17f 100644 --- a/apps/testing/lib/TaskProcessing/FakeOcrProvider.php +++ b/apps/testing/lib/TaskProcessing/FakeOcrProvider.php @@ -24,54 +24,67 @@ class FakeOcrProvider implements ISynchronousProvider { ) { } + #[\Override] public function getId(): string { return Application::APP_ID . '-image2text-ocr'; } + #[\Override] public function getName(): string { return 'Fake OCR task processing provider'; } + #[\Override] public function getTaskTypeId(): string { return ImageToTextOpticalCharacterRecognition::ID; } + #[\Override] public function getExpectedRuntime(): int { return 1; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShape(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) { throw new ProcessingException('Failing as set by AppConfig'); diff --git a/apps/testing/lib/TaskProcessing/FakeTextToImageProvider.php b/apps/testing/lib/TaskProcessing/FakeTextToImageProvider.php index 455d6c0b518..b100d3aa79d 100644 --- a/apps/testing/lib/TaskProcessing/FakeTextToImageProvider.php +++ b/apps/testing/lib/TaskProcessing/FakeTextToImageProvider.php @@ -25,32 +25,39 @@ class FakeTextToImageProvider implements ISynchronousProvider { ) { } + #[\Override] public function getId(): string { return Application::APP_ID . '-text2image'; } + #[\Override] public function getName(): string { return 'Fake text2image task processing provider'; } + #[\Override] public function getTaskTypeId(): string { return TextToImage::ID; } + #[\Override] public function getExpectedRuntime(): int { return 1; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return [ 'numberOfImages' => 1, ]; } + #[\Override] public function getOptionalInputShape(): array { return [ 'size' => new ShapeDescriptor( @@ -61,26 +68,32 @@ class FakeTextToImageProvider implements ISynchronousProvider { ]; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) { throw new ProcessingException('Failing as set by AppConfig'); diff --git a/apps/testing/lib/TaskProcessing/FakeTextToTextChatProvider.php b/apps/testing/lib/TaskProcessing/FakeTextToTextChatProvider.php index 8f75490dd6c..414332547e6 100644 --- a/apps/testing/lib/TaskProcessing/FakeTextToTextChatProvider.php +++ b/apps/testing/lib/TaskProcessing/FakeTextToTextChatProvider.php @@ -23,54 +23,67 @@ class FakeTextToTextChatProvider implements ISynchronousProvider { ) { } + #[\Override] public function getId(): string { return Application::APP_ID . '-text2textchat'; } + #[\Override] public function getName(): string { return 'Fake text2text chat task processing provider'; } + #[\Override] public function getTaskTypeId(): string { return TextToTextChat::ID; } + #[\Override] public function getExpectedRuntime(): int { return 1; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShape(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) { throw new ProcessingException('Failing as set by AppConfig'); diff --git a/apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php b/apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php index 5012823024e..b87143dae25 100644 --- a/apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php +++ b/apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php @@ -26,30 +26,37 @@ class FakeTextToTextProvider implements ISynchronousProvider { ) { } + #[\Override] public function getId(): string { return Application::APP_ID . '-text2text'; } + #[\Override] public function getName(): string { return 'Fake text2text task processing provider'; } + #[\Override] public function getTaskTypeId(): string { return TextToText::ID; } + #[\Override] public function getExpectedRuntime(): int { return 1; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShape(): array { return [ 'max_tokens' => new ShapeDescriptor( @@ -65,6 +72,7 @@ class FakeTextToTextProvider implements ISynchronousProvider { ]; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return [ 'model' => [ @@ -75,6 +83,7 @@ class FakeTextToTextProvider implements ISynchronousProvider { ]; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return [ 'max_tokens' => 1234, @@ -82,18 +91,22 @@ class FakeTextToTextProvider implements ISynchronousProvider { ]; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) { throw new ProcessingException('Failing as set by AppConfig'); diff --git a/apps/testing/lib/TaskProcessing/FakeTextToTextSummaryProvider.php b/apps/testing/lib/TaskProcessing/FakeTextToTextSummaryProvider.php index 58816d8a0df..359c84580e6 100644 --- a/apps/testing/lib/TaskProcessing/FakeTextToTextSummaryProvider.php +++ b/apps/testing/lib/TaskProcessing/FakeTextToTextSummaryProvider.php @@ -26,30 +26,37 @@ class FakeTextToTextSummaryProvider implements ISynchronousProvider { ) { } + #[\Override] public function getId(): string { return Application::APP_ID . '-text2text-summary'; } + #[\Override] public function getName(): string { return 'Fake text2text summary task processing provider'; } + #[\Override] public function getTaskTypeId(): string { return TextToTextSummary::ID; } + #[\Override] public function getExpectedRuntime(): int { return 1; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShape(): array { return [ 'max_tokens' => new ShapeDescriptor( @@ -65,6 +72,7 @@ class FakeTextToTextSummaryProvider implements ISynchronousProvider { ]; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return [ 'model' => [ @@ -75,6 +83,7 @@ class FakeTextToTextSummaryProvider implements ISynchronousProvider { ]; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return [ 'max_tokens' => 1234, @@ -82,18 +91,22 @@ class FakeTextToTextSummaryProvider implements ISynchronousProvider { ]; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) { throw new ProcessingException('Failing as set by AppConfig'); diff --git a/apps/testing/lib/TaskProcessing/FakeTranscribeProvider.php b/apps/testing/lib/TaskProcessing/FakeTranscribeProvider.php index 4827a07037a..3d39d5c1964 100644 --- a/apps/testing/lib/TaskProcessing/FakeTranscribeProvider.php +++ b/apps/testing/lib/TaskProcessing/FakeTranscribeProvider.php @@ -24,54 +24,67 @@ class FakeTranscribeProvider implements ISynchronousProvider { ) { } + #[\Override] public function getId(): string { return Application::APP_ID . '-audio2text'; } + #[\Override] public function getName(): string { return 'Fake audio2text task processing provider'; } + #[\Override] public function getTaskTypeId(): string { return AudioToText::ID; } + #[\Override] public function getExpectedRuntime(): int { return 1; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShape(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { if (!isset($input['input']) || !$input['input'] instanceof File || !$input['input']->isReadable()) { throw new RuntimeException('Invalid input file'); diff --git a/apps/testing/lib/TaskProcessing/FakeTranslateProvider.php b/apps/testing/lib/TaskProcessing/FakeTranslateProvider.php index 22be8e83049..a2a5056fe44 100644 --- a/apps/testing/lib/TaskProcessing/FakeTranslateProvider.php +++ b/apps/testing/lib/TaskProcessing/FakeTranslateProvider.php @@ -28,22 +28,27 @@ class FakeTranslateProvider implements ISynchronousProvider { ) { } + #[\Override] public function getId(): string { return Application::APP_ID . '-translate'; } + #[\Override] public function getName(): string { return 'Fake translate task processing provider'; } + #[\Override] public function getTaskTypeId(): string { return TextToTextTranslate::ID; } + #[\Override] public function getExpectedRuntime(): int { return 1; } + #[\Override] public function getInputShapeEnumValues(): array { $coreL = $this->l10nFactory->getLanguages(); $languages = array_merge($coreL['commonLanguages'], $coreL['otherLanguages']); @@ -57,12 +62,14 @@ class FakeTranslateProvider implements ISynchronousProvider { ]; } + #[\Override] public function getInputShapeDefaults(): array { return [ 'origin_language' => 'detect_language', ]; } + #[\Override] public function getOptionalInputShape(): array { return [ 'max_tokens' => new ShapeDescriptor( @@ -78,6 +85,7 @@ class FakeTranslateProvider implements ISynchronousProvider { ]; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return [ 'model' => [ @@ -88,6 +96,7 @@ class FakeTranslateProvider implements ISynchronousProvider { ]; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return [ 'max_tokens' => 200, @@ -95,14 +104,17 @@ class FakeTranslateProvider implements ISynchronousProvider { ]; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } @@ -116,6 +128,7 @@ class FakeTranslateProvider implements ISynchronousProvider { return $coreLanguages; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) { throw new ProcessingException('Failing as set by AppConfig'); diff --git a/apps/theming/lib/AppInfo/Application.php b/apps/theming/lib/AppInfo/Application.php index c0a69e5189a..f7d792e099b 100644 --- a/apps/theming/lib/AppInfo/Application.php +++ b/apps/theming/lib/AppInfo/Application.php @@ -28,6 +28,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerCapability(Capabilities::class); $context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); @@ -37,6 +38,7 @@ class Application extends App implements IBootstrap { $context->registerSetupCheck(PhpImagickModule::class); } + #[\Override] public function boot(IBootContext $context): void { } } diff --git a/apps/theming/lib/Capabilities.php b/apps/theming/lib/Capabilities.php index 9a9166c1628..c99b4ff87ca 100644 --- a/apps/theming/lib/Capabilities.php +++ b/apps/theming/lib/Capabilities.php @@ -67,6 +67,7 @@ class Capabilities implements IPublicCapability { * }, * } */ + #[\Override] public function getCapabilities() { $color = $this->theming->getDefaultColorPrimary(); $colorText = $this->util->invertTextColor($color) ? '#000000' : '#ffffff'; diff --git a/apps/theming/lib/Command/UpdateConfig.php b/apps/theming/lib/Command/UpdateConfig.php index d0b72ebbc37..efdb738988d 100644 --- a/apps/theming/lib/Command/UpdateConfig.php +++ b/apps/theming/lib/Command/UpdateConfig.php @@ -30,6 +30,7 @@ class UpdateConfig extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('theming:config') @@ -54,6 +55,7 @@ class UpdateConfig extends Command { } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $key = $input->getArgument('key'); $value = $input->getArgument('value'); diff --git a/apps/theming/lib/ConfigLexicon.php b/apps/theming/lib/ConfigLexicon.php index e71d80f6801..6c91d7dfad3 100644 --- a/apps/theming/lib/ConfigLexicon.php +++ b/apps/theming/lib/ConfigLexicon.php @@ -42,10 +42,12 @@ class ConfigLexicon implements ILexicon { /** Base URL for documentation */ public const DOC_BASE_URL = 'docBaseUrl'; + #[\Override] public function getStrictness(): Strictness { return Strictness::NOTICE; } + #[\Override] public function getAppConfigs(): array { return [ // internals @@ -110,6 +112,7 @@ class ConfigLexicon implements ILexicon { ]; } + #[\Override] public function getUserConfigs(): array { return []; } diff --git a/apps/theming/lib/Jobs/MigrateBackgroundImages.php b/apps/theming/lib/Jobs/MigrateBackgroundImages.php index 685e7c9cc8c..ea1533dab72 100644 --- a/apps/theming/lib/Jobs/MigrateBackgroundImages.php +++ b/apps/theming/lib/Jobs/MigrateBackgroundImages.php @@ -41,6 +41,7 @@ class MigrateBackgroundImages extends QueuedJob { parent::__construct($time); } + #[\Override] protected function run(mixed $argument): void { if (!is_array($argument) || !isset($argument['stage'])) { throw new \Exception('Job ' . self::class . ' called with wrong argument'); diff --git a/apps/theming/lib/Jobs/RestoreBackgroundImageColor.php b/apps/theming/lib/Jobs/RestoreBackgroundImageColor.php index a2b2778cc7d..c2bd381966d 100644 --- a/apps/theming/lib/Jobs/RestoreBackgroundImageColor.php +++ b/apps/theming/lib/Jobs/RestoreBackgroundImageColor.php @@ -40,6 +40,7 @@ class RestoreBackgroundImageColor extends QueuedJob { parent::__construct($time); } + #[\Override] protected function run(mixed $argument): void { if (!is_array($argument) || !isset($argument['stage'])) { throw new \Exception('Job ' . self::class . ' called with wrong argument'); diff --git a/apps/theming/lib/Listener/BeforePreferenceListener.php b/apps/theming/lib/Listener/BeforePreferenceListener.php index 048deae50ce..8beebda0a6d 100644 --- a/apps/theming/lib/Listener/BeforePreferenceListener.php +++ b/apps/theming/lib/Listener/BeforePreferenceListener.php @@ -28,6 +28,7 @@ class BeforePreferenceListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof BeforePreferenceSetEvent && !$event instanceof BeforePreferenceDeletedEvent) { diff --git a/apps/theming/lib/Listener/BeforeTemplateRenderedListener.php b/apps/theming/lib/Listener/BeforeTemplateRenderedListener.php index 18ab9392b97..1a0f857130e 100644 --- a/apps/theming/lib/Listener/BeforeTemplateRenderedListener.php +++ b/apps/theming/lib/Listener/BeforeTemplateRenderedListener.php @@ -34,6 +34,7 @@ class BeforeTemplateRenderedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { $this->initialState->provideLazyInitialState( 'data', diff --git a/apps/theming/lib/Migration/InitBackgroundImagesMigration.php b/apps/theming/lib/Migration/InitBackgroundImagesMigration.php index dea1bb3aa83..92bb8cdc252 100644 --- a/apps/theming/lib/Migration/InitBackgroundImagesMigration.php +++ b/apps/theming/lib/Migration/InitBackgroundImagesMigration.php @@ -21,10 +21,12 @@ class InitBackgroundImagesMigration implements IRepairStep { ) { } + #[\Override] public function getName() { return 'Initialize migration of background images from dashboard to theming app'; } + #[\Override] public function run(IOutput $output) { $this->jobList->add(MigrateBackgroundImages::class, ['stage' => MigrateBackgroundImages::STAGE_PREPARE]); } diff --git a/apps/theming/lib/Migration/Version2006Date20240905111627.php b/apps/theming/lib/Migration/Version2006Date20240905111627.php index 8f4130cba46..ae6872f14be 100644 --- a/apps/theming/lib/Migration/Version2006Date20240905111627.php +++ b/apps/theming/lib/Migration/Version2006Date20240905111627.php @@ -29,18 +29,22 @@ class Version2006Date20240905111627 implements IMigrationStep { ) { } + #[\Override] public function name(): string { return 'Restore custom primary color'; } + #[\Override] public function description(): string { return 'Restore custom primary color after separating primary color from background color'; } + #[\Override] public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { // nop } + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { $this->restoreSystemColors($output); @@ -52,6 +56,7 @@ class Version2006Date20240905111627 implements IMigrationStep { return null; } + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $output->info('Initialize restoring of background colors for custom background images'); // This is done in a background job as this can take a lot of time for large instances diff --git a/apps/theming/lib/Service/JSDataService.php b/apps/theming/lib/Service/JSDataService.php index 72bc7ab6be3..12cb5b4ef7e 100644 --- a/apps/theming/lib/Service/JSDataService.php +++ b/apps/theming/lib/Service/JSDataService.php @@ -26,6 +26,7 @@ class JSDataService implements \JsonSerializable { $this->themesService = $themesService; } + #[\Override] public function jsonSerialize(): array { return [ 'name' => $this->themingDefaults->getName(), diff --git a/apps/theming/lib/Settings/Admin.php b/apps/theming/lib/Settings/Admin.php index ed1f4361215..80184b988e1 100644 --- a/apps/theming/lib/Settings/Admin.php +++ b/apps/theming/lib/Settings/Admin.php @@ -38,6 +38,7 @@ class Admin implements IDelegatedSettings { /** * @return TemplateResponse */ + #[\Override] public function getForm(): TemplateResponse { $themeable = true; $errorMessage = ''; @@ -88,6 +89,7 @@ class Admin implements IDelegatedSettings { /** * @return string the section ID, e.g. 'sharing' */ + #[\Override] public function getSection(): string { return Application::APP_ID; } @@ -99,14 +101,17 @@ class Admin implements IDelegatedSettings { * * E.g.: 70 */ + #[\Override] public function getPriority(): int { return 5; } + #[\Override] public function getName(): ?string { return null; // Only one setting in this section } + #[\Override] public function getAuthorizedAppConfig(): array { return [ Application::APP_ID => '/.*/', diff --git a/apps/theming/lib/Settings/AdminSection.php b/apps/theming/lib/Settings/AdminSection.php index 007b3e904de..6a60fcd8816 100644 --- a/apps/theming/lib/Settings/AdminSection.php +++ b/apps/theming/lib/Settings/AdminSection.php @@ -26,6 +26,7 @@ class AdminSection implements IIconSection { * * @returns string */ + #[\Override] public function getID() { return $this->appName; } @@ -36,6 +37,7 @@ class AdminSection implements IIconSection { * * @return string */ + #[\Override] public function getName() { return $this->l->t('Theming'); } @@ -47,6 +49,7 @@ class AdminSection implements IIconSection { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 30; } @@ -54,6 +57,7 @@ class AdminSection implements IIconSection { /** * {@inheritdoc} */ + #[\Override] public function getIcon() { return $this->url->imagePath($this->appName, 'app-dark.svg'); } diff --git a/apps/theming/lib/Settings/Personal.php b/apps/theming/lib/Settings/Personal.php index fbe67531b36..875d2ed7ea6 100644 --- a/apps/theming/lib/Settings/Personal.php +++ b/apps/theming/lib/Settings/Personal.php @@ -30,6 +30,7 @@ class Personal implements ISettings { ) { } + #[\Override] public function getForm(): TemplateResponse { $enforcedTheme = $this->config->getSystemValueString('enforce_theme', ''); @@ -91,6 +92,7 @@ class Personal implements ISettings { * @return string the section ID, e.g. 'sharing' * @since 9.1 */ + #[\Override] public function getSection(): string { return Application::APP_ID; } @@ -103,6 +105,7 @@ class Personal implements ISettings { * E.g.: 70 * @since 9.1 */ + #[\Override] public function getPriority(): int { return 40; } diff --git a/apps/theming/lib/Settings/PersonalSection.php b/apps/theming/lib/Settings/PersonalSection.php index ce636f50764..4a24420dfc8 100644 --- a/apps/theming/lib/Settings/PersonalSection.php +++ b/apps/theming/lib/Settings/PersonalSection.php @@ -35,6 +35,7 @@ class PersonalSection implements IIconSection { * @returns string * @since 13.0.0 */ + #[\Override] public function getIcon() { return $this->urlGenerator->imagePath(Application::APP_ID, 'accessibility-dark.svg'); } @@ -46,6 +47,7 @@ class PersonalSection implements IIconSection { * @returns string * @since 9.1 */ + #[\Override] public function getID() { return Application::APP_ID; } @@ -57,6 +59,7 @@ class PersonalSection implements IIconSection { * @return string * @since 9.1 */ + #[\Override] public function getName() { return $this->l->t('Appearance and accessibility'); } @@ -69,6 +72,7 @@ class PersonalSection implements IIconSection { * E.g.: 70 * @since 9.1 */ + #[\Override] public function getPriority() { return 15; } diff --git a/apps/theming/lib/SetupChecks/PhpImagickModule.php b/apps/theming/lib/SetupChecks/PhpImagickModule.php index cf9e51eee33..31f5a033e2d 100644 --- a/apps/theming/lib/SetupChecks/PhpImagickModule.php +++ b/apps/theming/lib/SetupChecks/PhpImagickModule.php @@ -20,14 +20,17 @@ class PhpImagickModule implements ISetupCheck { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('PHP Imagick module'); } + #[\Override] public function getCategory(): string { return 'php'; } + #[\Override] public function run(): SetupResult { if (!extension_loaded('imagick')) { return SetupResult::info( diff --git a/apps/theming/lib/Themes/DarkHighContrastTheme.php b/apps/theming/lib/Themes/DarkHighContrastTheme.php index cd88a0a98fc..70801936f38 100644 --- a/apps/theming/lib/Themes/DarkHighContrastTheme.php +++ b/apps/theming/lib/Themes/DarkHighContrastTheme.php @@ -11,22 +11,27 @@ use OCA\Theming\ITheme; class DarkHighContrastTheme extends DarkTheme implements ITheme { + #[\Override] public function getId(): string { return 'dark-highcontrast'; } + #[\Override] public function getTitle(): string { return $this->l->t('Dark theme with high contrast mode'); } + #[\Override] public function getEnableLabel(): string { return $this->l->t('Enable dark high contrast mode'); } + #[\Override] public function getDescription(): string { return $this->l->t('Similar to the high contrast mode, but with dark colours.'); } + #[\Override] public function getMediaQuery(): string { return '(prefers-color-scheme: dark) and (prefers-contrast: more)'; } @@ -34,6 +39,7 @@ class DarkHighContrastTheme extends DarkTheme implements ITheme { /** * Keep this consistent with other HighContrast Themes */ + #[\Override] public function getCSSVariables(): array { $defaultVariables = parent::getCSSVariables(); @@ -116,6 +122,7 @@ class DarkHighContrastTheme extends DarkTheme implements ITheme { ); } + #[\Override] public function getCustomCss(): string { return " [class^='icon-'], [class*=' icon-'], diff --git a/apps/theming/lib/Themes/DarkTheme.php b/apps/theming/lib/Themes/DarkTheme.php index 8305f4e48bd..1c2d746dabd 100644 --- a/apps/theming/lib/Themes/DarkTheme.php +++ b/apps/theming/lib/Themes/DarkTheme.php @@ -13,26 +13,32 @@ class DarkTheme extends DefaultTheme implements ITheme { protected bool $isDarkVariant = true; + #[\Override] public function getId(): string { return 'dark'; } + #[\Override] public function getTitle(): string { return $this->l->t('Dark theme'); } + #[\Override] public function getEnableLabel(): string { return $this->l->t('Enable dark theme'); } + #[\Override] public function getDescription(): string { return $this->l->t('A dark theme to ease your eyes by reducing the overall luminosity and brightness.'); } + #[\Override] public function getMediaQuery(): string { return '(prefers-color-scheme: dark)'; } + #[\Override] public function getMeta(): array { // https://html.spec.whatwg.org/multipage/semantics.html#meta-color-scheme return [[ @@ -41,6 +47,7 @@ class DarkTheme extends DefaultTheme implements ITheme { ]]; } + #[\Override] public function getCSSVariables(): array { $defaultVariables = parent::getCSSVariables(); diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php index 02ab6475e1b..38b20a14e98 100644 --- a/apps/theming/lib/Themes/DefaultTheme.php +++ b/apps/theming/lib/Themes/DefaultTheme.php @@ -40,34 +40,42 @@ class DefaultTheme implements ITheme { $this->primaryColor = $this->themingDefaults->getColorPrimary(); } + #[\Override] public function getId(): string { return 'default'; } + #[\Override] public function getType(): int { return ITheme::TYPE_THEME; } + #[\Override] public function getTitle(): string { return $this->l->t('System default theme'); } + #[\Override] public function getEnableLabel(): string { return $this->l->t('Enable the system default'); } + #[\Override] public function getDescription(): string { return $this->l->t('Using the default system appearance.'); } + #[\Override] public function getMediaQuery(): string { return ''; } + #[\Override] public function getMeta(): array { return []; } + #[\Override] public function getCSSVariables(): array { $colorMainText = '#222222'; // Color that still provides enough contrast for text, so we need a ratio of 4.5:1 on main background AND hover @@ -260,6 +268,7 @@ class DefaultTheme implements ITheme { return $variables; } + #[\Override] public function getCustomCss(): string { return ''; } diff --git a/apps/theming/lib/Themes/DyslexiaFont.php b/apps/theming/lib/Themes/DyslexiaFont.php index 2448de7b3c8..0900a62511d 100644 --- a/apps/theming/lib/Themes/DyslexiaFont.php +++ b/apps/theming/lib/Themes/DyslexiaFont.php @@ -11,26 +11,32 @@ use OCA\Theming\ITheme; class DyslexiaFont extends DefaultTheme implements ITheme { + #[\Override] public function getId(): string { return 'opendyslexic'; } + #[\Override] public function getType(): int { return ITheme::TYPE_FONT; } + #[\Override] public function getTitle(): string { return $this->l->t('Dyslexia font'); } + #[\Override] public function getEnableLabel(): string { return $this->l->t('Enable dyslexia font'); } + #[\Override] public function getDescription(): string { return $this->l->t('OpenDyslexic is a free typeface/font designed to mitigate some of the common reading errors caused by dyslexia.'); } + #[\Override] public function getCSSVariables(): array { $variables = parent::getCSSVariables(); $originalFontFace = $variables['--font-face']; @@ -42,6 +48,7 @@ class DyslexiaFont extends DefaultTheme implements ITheme { return $variables; } + #[\Override] public function getCustomCss(): string { $fontPathOtf = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Regular.otf'); $boldFontPathOtf = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Bold.otf'); diff --git a/apps/theming/lib/Themes/HighContrastTheme.php b/apps/theming/lib/Themes/HighContrastTheme.php index 6d3b1af72c2..ed60a9e6519 100644 --- a/apps/theming/lib/Themes/HighContrastTheme.php +++ b/apps/theming/lib/Themes/HighContrastTheme.php @@ -11,22 +11,27 @@ use OCA\Theming\ITheme; class HighContrastTheme extends DefaultTheme implements ITheme { + #[\Override] public function getId(): string { return 'light-highcontrast'; } + #[\Override] public function getTitle(): string { return $this->l->t('High contrast mode'); } + #[\Override] public function getEnableLabel(): string { return $this->l->t('Enable high contrast mode'); } + #[\Override] public function getDescription(): string { return $this->l->t('A high contrast mode to ease your navigation. Visual quality will be reduced but clarity will be increased.'); } + #[\Override] public function getMediaQuery(): string { return '(prefers-contrast: more)'; } @@ -34,6 +39,7 @@ class HighContrastTheme extends DefaultTheme implements ITheme { /** * Keep this consistent with other HighContrast Themes */ + #[\Override] public function getCSSVariables(): array { $defaultVariables = parent::getCSSVariables(); @@ -122,6 +128,7 @@ class HighContrastTheme extends DefaultTheme implements ITheme { ); } + #[\Override] public function getCustomCss(): string { return " [class^='icon-'], [class*=' icon-'], diff --git a/apps/theming/lib/Themes/LightTheme.php b/apps/theming/lib/Themes/LightTheme.php index 714156d4721..484668fa0fd 100644 --- a/apps/theming/lib/Themes/LightTheme.php +++ b/apps/theming/lib/Themes/LightTheme.php @@ -11,26 +11,32 @@ use OCA\Theming\ITheme; class LightTheme extends DefaultTheme implements ITheme { + #[\Override] public function getId(): string { return 'light'; } + #[\Override] public function getTitle(): string { return $this->l->t('Light theme'); } + #[\Override] public function getEnableLabel(): string { return $this->l->t('Enable the default light theme'); } + #[\Override] public function getDescription(): string { return $this->l->t('The default light appearance.'); } + #[\Override] public function getMediaQuery(): string { return '(prefers-color-scheme: light)'; } + #[\Override] public function getMeta(): array { // https://html.spec.whatwg.org/multipage/semantics.html#meta-color-scheme return [[ diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index b48adf0f38d..2cf5ddc9dc9 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -68,26 +68,32 @@ class ThemingDefaults extends \OC_Defaults { $this->docBaseUrl = parent::getDocBaseUrl(); } + #[\Override] public function getName() { return strip_tags($this->appConfig->getAppValueString(ConfigLexicon::INSTANCE_NAME, $this->name)); } + #[\Override] public function getHTMLName() { return $this->appConfig->getAppValueString(ConfigLexicon::INSTANCE_NAME, $this->name); } + #[\Override] public function getTitle() { return strip_tags($this->appConfig->getAppValueString(ConfigLexicon::INSTANCE_NAME, $this->title)); } + #[\Override] public function getEntity() { return strip_tags($this->appConfig->getAppValueString(ConfigLexicon::INSTANCE_NAME, $this->entity)); } + #[\Override] public function getProductName(): string { return strip_tags($this->appConfig->getAppValueString(ConfigLexicon::PRODUCT_NAME, $this->productName)); } + #[\Override] public function getBaseUrl() { return $this->appConfig->getAppValueString(ConfigLexicon::BASE_URL, $this->url); } @@ -97,6 +103,7 @@ class ThemingDefaults extends \OC_Defaults { * @psalm-suppress InvalidReturnStatement * @psalm-suppress InvalidReturnType */ + #[\Override] public function getSlogan(?string $lang = null): string { return \OCP\Util::sanitizeHTML($this->appConfig->getAppValueString(ConfigLexicon::INSTANCE_SLOGAN, parent::getSlogan($lang))); } @@ -109,10 +116,12 @@ class ThemingDefaults extends \OC_Defaults { return $this->appConfig->getAppValueString(ConfigLexicon::INSTANCE_PRIVACY_URL, ''); } + #[\Override] public function getDocBaseUrl(): string { return $this->appConfig->getAppValueString(ConfigLexicon::DOC_BASE_URL, $this->docBaseUrl); } + #[\Override] public function getShortFooter() { $slogan = $this->getSlogan(); $baseUrl = $this->getBaseUrl(); @@ -171,6 +180,7 @@ class ThemingDefaults extends \OC_Defaults { * Color that is used for highlighting elements like important buttons * If user theming is enabled then the user defined value is returned */ + #[\Override] public function getColorPrimary(): string { $user = $this->userSession->getUser(); @@ -197,6 +207,7 @@ class ThemingDefaults extends \OC_Defaults { * Color that is used for the page background (e.g. the header) * If user theming is enabled then the user defined value is returned */ + #[\Override] public function getColorBackground(): string { $user = $this->userSession->getUser(); @@ -251,6 +262,7 @@ class ThemingDefaults extends \OC_Defaults { * @param bool $useSvg Whether to point to the SVG image or a fallback * @return string */ + #[\Override] public function getLogo($useSvg = true): string { $logo = $this->appConfig->getAppValueString('logoMime', ''); @@ -296,6 +308,7 @@ class ThemingDefaults extends \OC_Defaults { /** * @return string */ + #[\Override] public function getiTunesAppId() { return $this->appConfig->getAppValueString('iTunesAppId', $this->iTunesAppId); } @@ -303,6 +316,7 @@ class ThemingDefaults extends \OC_Defaults { /** * @return string */ + #[\Override] public function getiOSClientUrl() { return $this->appConfig->getAppValueString('iOSClientUrl', $this->iOSClientUrl); } @@ -310,6 +324,7 @@ class ThemingDefaults extends \OC_Defaults { /** * @return string */ + #[\Override] public function getAndroidClientUrl() { return $this->appConfig->getAppValueString('AndroidClientUrl', $this->AndroidClientUrl); } @@ -317,6 +332,7 @@ class ThemingDefaults extends \OC_Defaults { /** * @return string */ + #[\Override] public function getFDroidClientUrl() { return $this->appConfig->getAppValueString('FDroidClientUrl', $this->FDroidClientUrl); } @@ -325,6 +341,7 @@ class ThemingDefaults extends \OC_Defaults { * @return array scss variables to overwrite * @deprecated since Nextcloud 22 - https://github.com/nextcloud/server/issues/9940 */ + #[\Override] public function getScssVariables() { $cacheBuster = $this->appConfig->getAppValueInt(ConfigLexicon::CACHE_BUSTER); $cache = $this->cacheFactory->createDistributed('theming-' . (string)$cacheBuster . '-' . $this->urlGenerator->getBaseUrl()); @@ -515,6 +532,7 @@ class ThemingDefaults extends \OC_Defaults { * * @return string */ + #[\Override] public function getTextColorPrimary() { return $this->util->invertTextColor($this->getColorPrimary()) ? '#000000' : '#ffffff'; } diff --git a/apps/twofactor_backupcodes/lib/Activity/Provider.php b/apps/twofactor_backupcodes/lib/Activity/Provider.php index eba38147bd7..5d9899cb602 100644 --- a/apps/twofactor_backupcodes/lib/Activity/Provider.php +++ b/apps/twofactor_backupcodes/lib/Activity/Provider.php @@ -29,6 +29,7 @@ class Provider implements IProvider { ) { } + #[\Override] public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== 'twofactor_backupcodes') { throw new UnknownActivityException(); diff --git a/apps/twofactor_backupcodes/lib/AppInfo/Application.php b/apps/twofactor_backupcodes/lib/AppInfo/Application.php index e9a1ec1c72c..4898f89f1d7 100644 --- a/apps/twofactor_backupcodes/lib/AppInfo/Application.php +++ b/apps/twofactor_backupcodes/lib/AppInfo/Application.php @@ -32,6 +32,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerNotifierService(Notifier::class); @@ -46,6 +47,7 @@ class Application extends App implements IBootstrap { $context->registerTwoFactorProvider(BackupCodesProvider::class); } + #[\Override] public function boot(IBootContext $context): void { } } diff --git a/apps/twofactor_backupcodes/lib/BackgroundJob/CheckBackupCodes.php b/apps/twofactor_backupcodes/lib/BackgroundJob/CheckBackupCodes.php index af80847451a..871fa16098d 100644 --- a/apps/twofactor_backupcodes/lib/BackgroundJob/CheckBackupCodes.php +++ b/apps/twofactor_backupcodes/lib/BackgroundJob/CheckBackupCodes.php @@ -28,6 +28,7 @@ class CheckBackupCodes extends QueuedJob { parent::__construct($timeFactory); } + #[\Override] protected function run($argument) { $this->userManager->callForSeenUsers(function (IUser $user): void { if (!$user->isEnabled()) { diff --git a/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php b/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php index 5e853479f0a..ea7dec2878b 100644 --- a/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php +++ b/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php @@ -31,6 +31,7 @@ class RememberBackupCodesJob extends TimedJob { $this->setTimeSensitivity(self::TIME_INSENSITIVE); } + #[\Override] protected function run($argument) { $uid = $argument['uid']; $user = $this->userManager->get($uid); diff --git a/apps/twofactor_backupcodes/lib/Listener/ActivityPublisher.php b/apps/twofactor_backupcodes/lib/Listener/ActivityPublisher.php index b52f1f2c098..1bbef159651 100644 --- a/apps/twofactor_backupcodes/lib/Listener/ActivityPublisher.php +++ b/apps/twofactor_backupcodes/lib/Listener/ActivityPublisher.php @@ -26,6 +26,7 @@ class ActivityPublisher implements IEventListener { /** * Push an event to the user's activity stream */ + #[\Override] public function handle(Event $event): void { if ($event instanceof CodesGenerated) { $activity = $this->activityManager->generateEvent(); diff --git a/apps/twofactor_backupcodes/lib/Listener/ClearNotifications.php b/apps/twofactor_backupcodes/lib/Listener/ClearNotifications.php index 46bb1583004..5b666dd83fa 100644 --- a/apps/twofactor_backupcodes/lib/Listener/ClearNotifications.php +++ b/apps/twofactor_backupcodes/lib/Listener/ClearNotifications.php @@ -21,6 +21,7 @@ class ClearNotifications implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof CodesGenerated)) { return; diff --git a/apps/twofactor_backupcodes/lib/Listener/ProviderDisabled.php b/apps/twofactor_backupcodes/lib/Listener/ProviderDisabled.php index a8d51e55c1b..6c221130129 100644 --- a/apps/twofactor_backupcodes/lib/Listener/ProviderDisabled.php +++ b/apps/twofactor_backupcodes/lib/Listener/ProviderDisabled.php @@ -24,6 +24,7 @@ class ProviderDisabled implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof TwoFactorProviderForUserUnregistered)) { return; diff --git a/apps/twofactor_backupcodes/lib/Listener/ProviderEnabled.php b/apps/twofactor_backupcodes/lib/Listener/ProviderEnabled.php index 4ec510e7194..cc1780a987b 100644 --- a/apps/twofactor_backupcodes/lib/Listener/ProviderEnabled.php +++ b/apps/twofactor_backupcodes/lib/Listener/ProviderEnabled.php @@ -24,6 +24,7 @@ class ProviderEnabled implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof TwoFactorProviderForUserRegistered)) { return; diff --git a/apps/twofactor_backupcodes/lib/Listener/RegistryUpdater.php b/apps/twofactor_backupcodes/lib/Listener/RegistryUpdater.php index 1cb07bd9805..1cdc8cb9f10 100644 --- a/apps/twofactor_backupcodes/lib/Listener/RegistryUpdater.php +++ b/apps/twofactor_backupcodes/lib/Listener/RegistryUpdater.php @@ -23,6 +23,7 @@ class RegistryUpdater implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof CodesGenerated) { $this->registry->enableProviderFor($this->provider, $event->getUser()); diff --git a/apps/twofactor_backupcodes/lib/Listener/UserDeleted.php b/apps/twofactor_backupcodes/lib/Listener/UserDeleted.php index 72fd504b338..1b5c3bbb995 100644 --- a/apps/twofactor_backupcodes/lib/Listener/UserDeleted.php +++ b/apps/twofactor_backupcodes/lib/Listener/UserDeleted.php @@ -21,6 +21,7 @@ class UserDeleted implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof UserDeletedEvent)) { return; diff --git a/apps/twofactor_backupcodes/lib/Migration/CheckBackupCodes.php b/apps/twofactor_backupcodes/lib/Migration/CheckBackupCodes.php index 9c0c676134b..ca0fca2ac63 100644 --- a/apps/twofactor_backupcodes/lib/Migration/CheckBackupCodes.php +++ b/apps/twofactor_backupcodes/lib/Migration/CheckBackupCodes.php @@ -19,10 +19,12 @@ class CheckBackupCodes implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Add background job to check for backup codes'; } + #[\Override] public function run(IOutput $output) { $this->jobList->add(\OCA\TwoFactorBackupCodes\BackgroundJob\CheckBackupCodes::class); } diff --git a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607104347.php b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607104347.php index ce752541bac..da6c560419d 100644 --- a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607104347.php +++ b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607104347.php @@ -21,6 +21,7 @@ class Version1002Date20170607104347 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607113030.php b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607113030.php index ad277d3b15b..df53f32b8d7 100644 --- a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607113030.php +++ b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607113030.php @@ -30,6 +30,7 @@ class Version1002Date20170607113030 extends SimpleMigrationStep { * @param array $options * @since 13.0.0 */ + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -75,6 +76,7 @@ class Version1002Date20170607113030 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170919123342.php b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170919123342.php index 2ca390e6edd..befe9061af4 100644 --- a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170919123342.php +++ b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170919123342.php @@ -23,6 +23,7 @@ class Version1002Date20170919123342 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170926101419.php b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170926101419.php index d19fda49182..96baef3adc8 100644 --- a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170926101419.php +++ b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170926101419.php @@ -20,6 +20,7 @@ class Version1002Date20170926101419 extends BigIntMigration { * ['table1' => ['column1', 'column2'], ...] * @since 13.0.0 */ + #[\Override] protected function getColumnsByTable() { return [ 'twofactor_backupcodes' => ['id'], diff --git a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20180821043638.php b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20180821043638.php index 04d6d58c783..5934b1521cc 100644 --- a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20180821043638.php +++ b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20180821043638.php @@ -22,6 +22,7 @@ class Version1002Date20180821043638 extends SimpleMigrationStep { * * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/twofactor_backupcodes/lib/Notifications/Notifier.php b/apps/twofactor_backupcodes/lib/Notifications/Notifier.php index e8144f52a56..5b99c77b60b 100644 --- a/apps/twofactor_backupcodes/lib/Notifications/Notifier.php +++ b/apps/twofactor_backupcodes/lib/Notifications/Notifier.php @@ -28,6 +28,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getID(): string { return 'twofactor_backupcodes'; } @@ -38,10 +39,12 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getName(): string { return $this->factory->get('twofactor_backupcodes')->t('Second-factor backup codes'); } + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'twofactor_backupcodes') { // Not my app => throw diff --git a/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php b/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php index c521329e203..385b4927e78 100644 --- a/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php +++ b/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php @@ -36,6 +36,7 @@ class BackupCodesProvider implements IDeactivatableByAdmin, IProvidesPersonalSet * * @return string */ + #[\Override] public function getId(): string { return 'backup_codes'; } @@ -45,6 +46,7 @@ class BackupCodesProvider implements IDeactivatableByAdmin, IProvidesPersonalSet * * @return string */ + #[\Override] public function getDisplayName(): string { return $this->l10n->t('Backup code'); } @@ -54,6 +56,7 @@ class BackupCodesProvider implements IDeactivatableByAdmin, IProvidesPersonalSet * * @return string */ + #[\Override] public function getDescription(): string { return $this->l10n->t('Use backup code'); } @@ -64,6 +67,7 @@ class BackupCodesProvider implements IDeactivatableByAdmin, IProvidesPersonalSet * @param IUser $user * @return ITemplate */ + #[\Override] public function getTemplate(IUser $user): ITemplate { return $this->templateManager->getTemplate('twofactor_backupcodes', 'challenge'); } @@ -75,6 +79,7 @@ class BackupCodesProvider implements IDeactivatableByAdmin, IProvidesPersonalSet * @param string $challenge * @return bool */ + #[\Override] public function verifyChallenge(IUser $user, string $challenge): bool { return $this->storage->validateCode($user, $challenge); } @@ -85,6 +90,7 @@ class BackupCodesProvider implements IDeactivatableByAdmin, IProvidesPersonalSet * @param IUser $user * @return boolean */ + #[\Override] public function isTwoFactorAuthEnabledForUser(IUser $user): bool { return $this->storage->hasBackupCodes($user); } @@ -118,12 +124,14 @@ class BackupCodesProvider implements IDeactivatableByAdmin, IProvidesPersonalSet * * @return IPersonalProviderSettings */ + #[\Override] public function getPersonalSettings(IUser $user): IPersonalProviderSettings { $state = $this->storage->getBackupCodesState($user); $this->initialState->provideInitialState('state', $state); return new Personal(); } + #[\Override] public function disableFor(IUser $user): void { $this->storage->deleteCodes($user); } diff --git a/apps/twofactor_backupcodes/lib/Settings/Personal.php b/apps/twofactor_backupcodes/lib/Settings/Personal.php index 77b3b447b48..b28be2fe4a1 100644 --- a/apps/twofactor_backupcodes/lib/Settings/Personal.php +++ b/apps/twofactor_backupcodes/lib/Settings/Personal.php @@ -17,6 +17,7 @@ use OCP\Template\ITemplateManager; use OCP\Util; class Personal implements IPersonalProviderSettings { + #[\Override] public function getBody(): ITemplate { Util::addScript(Application::APP_ID, 'settings-personal'); Util::addStyle(Application::APP_ID, 'settings-personal'); diff --git a/apps/updatenotification/lib/AppInfo/Application.php b/apps/updatenotification/lib/AppInfo/Application.php index 2a1678da5db..e8b9476884d 100644 --- a/apps/updatenotification/lib/AppInfo/Application.php +++ b/apps/updatenotification/lib/AppInfo/Application.php @@ -36,6 +36,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_NAME, []); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerNotifierService(Notifier::class); $context->registerNotifierService(AppUpdateNotifier::class); @@ -44,6 +45,7 @@ class Application extends App implements IBootstrap { $context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedEventListener::class); } + #[\Override] public function boot(IBootContext $context): void { $context->injectFn(function (IConfig $config, IUserSession $userSession, diff --git a/apps/updatenotification/lib/BackgroundJob/AppUpdatedNotifications.php b/apps/updatenotification/lib/BackgroundJob/AppUpdatedNotifications.php index 049390546ed..5a3b39aa076 100644 --- a/apps/updatenotification/lib/BackgroundJob/AppUpdatedNotifications.php +++ b/apps/updatenotification/lib/BackgroundJob/AppUpdatedNotifications.php @@ -38,6 +38,7 @@ class AppUpdatedNotifications extends QueuedJob { /** * @param array{appId: string, timestamp: int} $argument */ + #[\Override] protected function run(mixed $argument): void { $appId = $argument['appId']; $timestamp = $argument['timestamp']; diff --git a/apps/updatenotification/lib/BackgroundJob/ResetToken.php b/apps/updatenotification/lib/BackgroundJob/ResetToken.php index f0fc992546b..c3d401a7075 100644 --- a/apps/updatenotification/lib/BackgroundJob/ResetToken.php +++ b/apps/updatenotification/lib/BackgroundJob/ResetToken.php @@ -37,6 +37,7 @@ class ResetToken extends TimedJob { /** * @param $argument */ + #[\Override] protected function run($argument) { if ($this->config->getSystemValueBool('config_is_read_only')) { $this->logger->debug('Skipping `updater.secret` reset since config_is_read_only is set', ['app' => 'updatenotification']); diff --git a/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php b/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php index 8879bb0c223..ab114e8971e 100644 --- a/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php +++ b/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php @@ -49,6 +49,7 @@ class UpdateAvailableNotifications extends TimedJob { $this->setTimeSensitivity(self::TIME_INSENSITIVE); } + #[\Override] protected function run($argument) { // Do not check for updates if not connected to the internet if (!$this->config->getSystemValueBool('has_internet_connection', true)) { diff --git a/apps/updatenotification/lib/Command/Check.php b/apps/updatenotification/lib/Command/Check.php index d93e4935012..61fdc8c48d4 100644 --- a/apps/updatenotification/lib/Command/Check.php +++ b/apps/updatenotification/lib/Command/Check.php @@ -25,6 +25,7 @@ class Check extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('update:check') @@ -32,6 +33,7 @@ class Check extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $updatesAvailableCount = 0; diff --git a/apps/updatenotification/lib/Listener/AppUpdateEventListener.php b/apps/updatenotification/lib/Listener/AppUpdateEventListener.php index 49a2506d913..4142aceda85 100644 --- a/apps/updatenotification/lib/Listener/AppUpdateEventListener.php +++ b/apps/updatenotification/lib/Listener/AppUpdateEventListener.php @@ -30,6 +30,7 @@ class AppUpdateEventListener implements IEventListener { /** * @param AppUpdateEvent $event */ + #[\Override] public function handle(Event $event): void { if (!($event instanceof AppUpdateEvent)) { return; diff --git a/apps/updatenotification/lib/Listener/BeforeTemplateRenderedEventListener.php b/apps/updatenotification/lib/Listener/BeforeTemplateRenderedEventListener.php index 974734a76f4..625d0fac296 100644 --- a/apps/updatenotification/lib/Listener/BeforeTemplateRenderedEventListener.php +++ b/apps/updatenotification/lib/Listener/BeforeTemplateRenderedEventListener.php @@ -30,6 +30,7 @@ class BeforeTemplateRenderedEventListener implements IEventListener { /** * @param BeforeTemplateRenderedEvent $event */ + #[\Override] public function handle(Event $event): void { if (!($event instanceof BeforeTemplateRenderedEvent)) { return; diff --git a/apps/updatenotification/lib/Notification/AppUpdateNotifier.php b/apps/updatenotification/lib/Notification/AppUpdateNotifier.php index 353ca883aba..4f4ae6bc98c 100644 --- a/apps/updatenotification/lib/Notification/AppUpdateNotifier.php +++ b/apps/updatenotification/lib/Notification/AppUpdateNotifier.php @@ -33,6 +33,7 @@ class AppUpdateNotifier implements INotifier { ) { } + #[\Override] public function getID(): string { return 'updatenotification_app_updated'; } @@ -40,6 +41,7 @@ class AppUpdateNotifier implements INotifier { /** * Human readable name describing the notifier */ + #[\Override] public function getName(): string { return $this->l10nFactory->get(Application::APP_NAME)->t('App updated'); } @@ -51,6 +53,7 @@ class AppUpdateNotifier implements INotifier { * @throws UnknownNotificationException When the notification was not prepared by a notifier * @throws AlreadyProcessedException When the app is no longer known */ + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== Application::APP_NAME) { throw new UnknownNotificationException('Unknown app'); diff --git a/apps/updatenotification/lib/Notification/Notifier.php b/apps/updatenotification/lib/Notification/Notifier.php index 787675bd98d..d27dcea024f 100644 --- a/apps/updatenotification/lib/Notification/Notifier.php +++ b/apps/updatenotification/lib/Notification/Notifier.php @@ -49,6 +49,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getID(): string { return Application::APP_NAME; } @@ -59,6 +60,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getName(): string { return $this->l10NFactory->get(Application::APP_NAME)->t('Update notifications'); } @@ -71,6 +73,7 @@ class Notifier implements INotifier { * @throws AlreadyProcessedException When the notification is not needed anymore and should be deleted * @since 9.0.0 */ + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== Application::APP_NAME) { throw new UnknownNotificationException('Unknown app id'); diff --git a/apps/updatenotification/lib/Settings/Admin.php b/apps/updatenotification/lib/Settings/Admin.php index 22228f1bccc..c2fceababc0 100644 --- a/apps/updatenotification/lib/Settings/Admin.php +++ b/apps/updatenotification/lib/Settings/Admin.php @@ -39,6 +39,7 @@ class Admin implements ISettings { ) { } + #[\Override] public function getForm(): TemplateResponse { $lastUpdateCheckTimestamp = $this->appConfig->getValueInt('core', 'lastupdatedat'); $lastUpdateCheck = $this->dateTimeFormatter->formatDateTime($lastUpdateCheckTimestamp); @@ -132,6 +133,7 @@ class Admin implements ISettings { return $result; } + #[\Override] public function getSection(): ?string { if (!$this->config->getSystemValueBool('updatechecker', true)) { // update checker is disabled so we do not show the section at all @@ -141,6 +143,7 @@ class Admin implements ISettings { return 'overview'; } + #[\Override] public function getPriority(): int { return 11; } diff --git a/apps/user_ldap/lib/AppInfo/Application.php b/apps/user_ldap/lib/AppInfo/Application.php index 220a11715fa..f1bf6a6ccba 100644 --- a/apps/user_ldap/lib/AppInfo/Application.php +++ b/apps/user_ldap/lib/AppInfo/Application.php @@ -52,6 +52,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerServiceAlias(ILDAPWrapper::class, LDAP::class); @@ -80,6 +81,7 @@ class Application extends App implements IBootstrap { $context->registerSetupCheck(LdapConnection::class); } + #[\Override] public function boot(IBootContext $context): void { $context->injectFn(function ( INotificationManager $notificationManager, diff --git a/apps/user_ldap/lib/Command/CheckGroup.php b/apps/user_ldap/lib/Command/CheckGroup.php index 9c7ccb9d3b3..99b7166e406 100644 --- a/apps/user_ldap/lib/Command/CheckGroup.php +++ b/apps/user_ldap/lib/Command/CheckGroup.php @@ -34,6 +34,7 @@ class CheckGroup extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:check-group') @@ -58,6 +59,7 @@ class CheckGroup extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $this->dispatcher->addListener(GroupCreatedEvent::class, fn ($event) => $this->onGroupCreatedEvent($event, $output)); $this->dispatcher->addListener(UserAddedEvent::class, fn ($event) => $this->onUserAddedEvent($event, $output)); diff --git a/apps/user_ldap/lib/Command/CheckUser.php b/apps/user_ldap/lib/Command/CheckUser.php index 8bb26ce3d0e..75c13f71b7d 100644 --- a/apps/user_ldap/lib/Command/CheckUser.php +++ b/apps/user_ldap/lib/Command/CheckUser.php @@ -27,6 +27,7 @@ class CheckUser extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:check-user') @@ -51,6 +52,7 @@ class CheckUser extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { try { $this->assertAllowed($input->getOption('force')); diff --git a/apps/user_ldap/lib/Command/CreateEmptyConfig.php b/apps/user_ldap/lib/Command/CreateEmptyConfig.php index 7c381cf431f..f51e1f9f891 100644 --- a/apps/user_ldap/lib/Command/CreateEmptyConfig.php +++ b/apps/user_ldap/lib/Command/CreateEmptyConfig.php @@ -21,6 +21,7 @@ class CreateEmptyConfig extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:create-empty-config') @@ -34,6 +35,7 @@ class CreateEmptyConfig extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $configPrefix = $this->helper->getNextServerConfigurationPrefix(); $configHolder = new Configuration($configPrefix); diff --git a/apps/user_ldap/lib/Command/DeleteConfig.php b/apps/user_ldap/lib/Command/DeleteConfig.php index 7604e229bed..08c8fa3f0fe 100644 --- a/apps/user_ldap/lib/Command/DeleteConfig.php +++ b/apps/user_ldap/lib/Command/DeleteConfig.php @@ -20,6 +20,7 @@ class DeleteConfig extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:delete-config') @@ -32,6 +33,7 @@ class DeleteConfig extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $configPrefix = $input->getArgument('configID'); diff --git a/apps/user_ldap/lib/Command/PromoteGroup.php b/apps/user_ldap/lib/Command/PromoteGroup.php index b203a910b14..f6ba058e03d 100644 --- a/apps/user_ldap/lib/Command/PromoteGroup.php +++ b/apps/user_ldap/lib/Command/PromoteGroup.php @@ -27,6 +27,7 @@ class PromoteGroup extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:promote-group') @@ -82,6 +83,7 @@ class PromoteGroup extends Command { } } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $groupInput = (string)$input->getArgument('group'); $group = $this->groupManager->get($groupInput); diff --git a/apps/user_ldap/lib/Command/ResetGroup.php b/apps/user_ldap/lib/Command/ResetGroup.php index 5833ca980f2..20218324179 100644 --- a/apps/user_ldap/lib/Command/ResetGroup.php +++ b/apps/user_ldap/lib/Command/ResetGroup.php @@ -27,6 +27,7 @@ class ResetGroup extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:reset-group') @@ -44,6 +45,7 @@ class ResetGroup extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { try { $gid = $input->getArgument('gid'); diff --git a/apps/user_ldap/lib/Command/ResetUser.php b/apps/user_ldap/lib/Command/ResetUser.php index 1409806e4ac..1c46af5b029 100644 --- a/apps/user_ldap/lib/Command/ResetUser.php +++ b/apps/user_ldap/lib/Command/ResetUser.php @@ -28,6 +28,7 @@ class ResetUser extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:reset-user') @@ -45,6 +46,7 @@ class ResetUser extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { try { $uid = $input->getArgument('uid'); diff --git a/apps/user_ldap/lib/Command/Search.php b/apps/user_ldap/lib/Command/Search.php index a2a8effb770..4aab2502562 100644 --- a/apps/user_ldap/lib/Command/Search.php +++ b/apps/user_ldap/lib/Command/Search.php @@ -26,6 +26,7 @@ class Search extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:search') @@ -78,6 +79,7 @@ class Search extends Command { } } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $offset = (int)$input->getOption('offset'); $limit = (int)$input->getOption('limit'); diff --git a/apps/user_ldap/lib/Command/SetConfig.php b/apps/user_ldap/lib/Command/SetConfig.php index f4aa2041b39..1fa298087d0 100644 --- a/apps/user_ldap/lib/Command/SetConfig.php +++ b/apps/user_ldap/lib/Command/SetConfig.php @@ -23,6 +23,7 @@ class SetConfig extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:set-config') @@ -45,6 +46,7 @@ class SetConfig extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $availableConfigs = $this->helper->getServerConfigurationPrefixes(); $configID = $input->getArgument('configID'); diff --git a/apps/user_ldap/lib/Command/ShowConfig.php b/apps/user_ldap/lib/Command/ShowConfig.php index ce92a05c45f..9084d24f7bb 100644 --- a/apps/user_ldap/lib/Command/ShowConfig.php +++ b/apps/user_ldap/lib/Command/ShowConfig.php @@ -23,6 +23,7 @@ class ShowConfig extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:show-config') @@ -48,6 +49,7 @@ class ShowConfig extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $availableConfigs = $this->helper->getServerConfigurationPrefixes(); $configID = $input->getArgument('configID'); diff --git a/apps/user_ldap/lib/Command/ShowRemnants.php b/apps/user_ldap/lib/Command/ShowRemnants.php index d255aac1368..381e346cc40 100644 --- a/apps/user_ldap/lib/Command/ShowRemnants.php +++ b/apps/user_ldap/lib/Command/ShowRemnants.php @@ -24,6 +24,7 @@ class ShowRemnants extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:show-remnants') @@ -47,6 +48,7 @@ class ShowRemnants extends Command { * * {@inheritdoc} */ + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { /** @var \Symfony\Component\Console\Helper\Table $table */ $table = new Table($output); diff --git a/apps/user_ldap/lib/Command/TestConfig.php b/apps/user_ldap/lib/Command/TestConfig.php index 77eaac91d85..ee6417982b4 100644 --- a/apps/user_ldap/lib/Command/TestConfig.php +++ b/apps/user_ldap/lib/Command/TestConfig.php @@ -30,6 +30,7 @@ class TestConfig extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:test-config') @@ -42,6 +43,7 @@ class TestConfig extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $availableConfigs = $this->helper->getServerConfigurationPrefixes(); $configID = $input->getArgument('configID'); diff --git a/apps/user_ldap/lib/Command/TestUserSettings.php b/apps/user_ldap/lib/Command/TestUserSettings.php index 12690158f98..98399125f04 100644 --- a/apps/user_ldap/lib/Command/TestUserSettings.php +++ b/apps/user_ldap/lib/Command/TestUserSettings.php @@ -31,6 +31,7 @@ class TestUserSettings extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:test-user-settings') @@ -55,6 +56,7 @@ class TestUserSettings extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { try { $uid = $input->getArgument('user'); diff --git a/apps/user_ldap/lib/Command/UpdateUUID.php b/apps/user_ldap/lib/Command/UpdateUUID.php index 93dcc37bada..07f0a4a95dc 100644 --- a/apps/user_ldap/lib/Command/UpdateUUID.php +++ b/apps/user_ldap/lib/Command/UpdateUUID.php @@ -64,6 +64,7 @@ class UpdateUUID extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('ldap:update-uuid') @@ -101,6 +102,7 @@ class UpdateUUID extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $this->dryRun = $input->getOption('dry-run'); $entriesToUpdate = $this->estimateNumberOfUpdates($input); diff --git a/apps/user_ldap/lib/DataCollector/LdapDataCollector.php b/apps/user_ldap/lib/DataCollector/LdapDataCollector.php index 2f74a628a32..35638088b85 100644 --- a/apps/user_ldap/lib/DataCollector/LdapDataCollector.php +++ b/apps/user_ldap/lib/DataCollector/LdapDataCollector.php @@ -27,10 +27,12 @@ class LdapDataCollector extends AbstractDataCollector { $this->data[count($this->data) - 1]['end'] = microtime(true); } + #[\Override] public function getName(): string { return 'ldap'; } + #[\Override] public function collect(Request $request, Response $response, ?\Throwable $exception = null): void { } } diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index 301793c1362..3ca30890306 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -64,6 +64,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis * @throws Exception * @throws ServerNotAvailableException */ + #[\Override] public function inGroup($uid, $gid): bool { if (!$this->enabled) { return false; @@ -658,6 +659,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis * @throws Exception * @throws ServerNotAvailableException */ + #[\Override] public function getUserGroups($uid): array { if (!$this->enabled) { return []; @@ -862,6 +864,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis * @throws Exception * @throws ServerNotAvailableException */ + #[\Override] public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { if (!$this->enabled) { return []; @@ -1082,6 +1085,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis * (active directory has a limit of 1000 by default) * @throws Exception */ + #[\Override] public function getGroups($search = '', $limit = -1, $offset = 0) { if (!$this->enabled) { return []; @@ -1121,6 +1125,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis * @return bool * @throws ServerNotAvailableException */ + #[\Override] public function groupExists($gid) { return $this->groupExistsOnLDAP($gid, false); } @@ -1197,6 +1202,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis * Returns the supported actions as int to be * compared with GroupInterface::CREATE_GROUP etc. */ + #[\Override] public function implementsActions($actions): bool { return (bool)((GroupInterface::COUNT_USERS | GroupInterface::DELETE_GROUP @@ -1209,6 +1215,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis * * @return Access instance of Access for LDAP interaction */ + #[\Override] public function getLDAPAccess($gid) { return $this->access; } @@ -1248,6 +1255,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis * @param string $gid gid of the group to delete * @throws Exception */ + #[\Override] public function deleteGroup(string $gid): bool { if ($this->groupPluginManager->canDeleteGroup()) { if ($ret = $this->groupPluginManager->deleteGroup($gid)) { @@ -1335,6 +1343,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis * @return \LDAP\Connection The LDAP connection * @throws ServerNotAvailableException */ + #[\Override] public function getNewLDAPConnection($gid): \LDAP\Connection { $connection = clone $this->access->getConnection(); return $connection->getConnectionResource(); @@ -1343,6 +1352,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis /** * @throws ServerNotAvailableException */ + #[\Override] public function getDisplayName(string $gid): string { if ($this->groupPluginManager instanceof IGetDisplayNameBackend) { return $this->groupPluginManager->getDisplayName($gid); @@ -1408,6 +1418,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis /** * @throws ServerNotAvailableException */ + #[\Override] public function isAdmin(string $uid): bool { if (!$this->enabled) { return false; diff --git a/apps/user_ldap/lib/Group_Proxy.php b/apps/user_ldap/lib/Group_Proxy.php index c08fe7117bf..5449930e846 100644 --- a/apps/user_ldap/lib/Group_Proxy.php +++ b/apps/user_ldap/lib/Group_Proxy.php @@ -34,6 +34,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl } + #[\Override] protected function newInstance(string $configPrefix): Group_LDAP { return new Group_LDAP($this->getAccess($configPrefix), $this->groupPluginManager, $this->userConfig, $this->ncUserManager); } @@ -46,6 +47,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl * @param array $parameters an array of parameters to be passed * @return mixed the result of the method or false */ + #[\Override] protected function walkBackends($id, $method, $parameters) { $this->setup(); @@ -71,6 +73,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl * @param mixed $passOnWhen the result matches this variable * @return mixed the result of the method or false */ + #[\Override] protected function callOnLastSeenOn($id, $method, $parameters, $passOnWhen) { $this->setup(); @@ -98,6 +101,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl return false; } + #[\Override] protected function activeBackends(): int { $this->setup(); return count($this->backends); @@ -112,6 +116,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl * * Checks whether the user is member of a group or not. */ + #[\Override] public function inGroup($uid, $gid) { return $this->handleRequest($gid, 'inGroup', [$uid, $gid]); } @@ -125,6 +130,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl * This function fetches all groups a user belongs to. It does not check * if the user exists at all. */ + #[\Override] public function getUserGroups($uid) { $this->setup(); @@ -142,6 +148,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl * * @return array user ids */ + #[\Override] public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { $this->setup(); @@ -168,6 +175,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl /** * delete a group */ + #[\Override] public function deleteGroup(string $gid): bool { return $this->handleRequest( $gid, 'deleteGroup', [$gid]); @@ -227,6 +235,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl /** * {@inheritdoc} */ + #[\Override] public function getGroupsDetails(array $gids): array { if (!($this instanceof IGroupDetailsBackend || $this->implementsActions(GroupInterface::GROUP_DETAILS))) { throw new \Exception('Should not have been called'); @@ -246,6 +255,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl * * Returns a list with all groups */ + #[\Override] public function getGroups($search = '', $limit = -1, $offset = 0) { $this->setup(); @@ -266,6 +276,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl * @param string $gid * @return bool */ + #[\Override] public function groupExists($gid) { return $this->handleRequest($gid, 'groupExists', [$gid]); } @@ -290,6 +301,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl /** * {@inheritdoc} */ + #[\Override] public function groupsExists(array $gids): array { return array_values(array_filter( $gids, @@ -306,6 +318,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl * Returns the supported actions as int to be * compared with \OCP\GroupInterface::CREATE_GROUP etc. */ + #[\Override] public function implementsActions($actions) { $this->setup(); //it's the same across all our user backends obviously @@ -318,6 +331,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl * @param string $gid * @return Access instance of Access for LDAP interaction */ + #[\Override] public function getLDAPAccess($gid) { return $this->handleRequest($gid, 'getLDAPAccess', [$gid]); } @@ -329,10 +343,12 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl * @param string $gid * @return \LDAP\Connection The LDAP connection */ + #[\Override] public function getNewLDAPConnection($gid): \LDAP\Connection { return $this->handleRequest($gid, 'getNewLDAPConnection', [$gid]); } + #[\Override] public function getDisplayName(string $gid): string { return $this->handleRequest($gid, 'getDisplayName', [$gid]); } @@ -342,6 +358,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl * @return string the name of the backend to be shown * @since 22.0.0 */ + #[\Override] public function getBackendName(): string { return 'LDAP'; } @@ -354,6 +371,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl $this->handleRequest($gid, 'addRelationshipToCaches', [$uid, $dnUser, $gid]); } + #[\Override] public function isAdmin(string $uid): bool { return $this->handleRequest($uid, 'isAdmin', [$uid]); } diff --git a/apps/user_ldap/lib/Handler/ExtStorageConfigHandler.php b/apps/user_ldap/lib/Handler/ExtStorageConfigHandler.php index 8b63d54aa66..a91f76fbd0f 100644 --- a/apps/user_ldap/lib/Handler/ExtStorageConfigHandler.php +++ b/apps/user_ldap/lib/Handler/ExtStorageConfigHandler.php @@ -20,6 +20,7 @@ class ExtStorageConfigHandler extends UserContext implements IConfigHandler { * @since 16.0.0 * @throws \Exception */ + #[\Override] public function handle($optionValue) { $this->placeholder = 'home'; $user = $this->getUser(); diff --git a/apps/user_ldap/lib/Jobs/CleanUp.php b/apps/user_ldap/lib/Jobs/CleanUp.php index 76277b43c0b..f3bdb19f3d3 100644 --- a/apps/user_ldap/lib/Jobs/CleanUp.php +++ b/apps/user_ldap/lib/Jobs/CleanUp.php @@ -101,6 +101,7 @@ class CleanUp extends TimedJob { * makes the background job do its work * @param array $argument */ + #[\Override] public function run($argument): void { $this->setArguments($argument); diff --git a/apps/user_ldap/lib/Jobs/Sync.php b/apps/user_ldap/lib/Jobs/Sync.php index 36738de20e7..755c172c355 100644 --- a/apps/user_ldap/lib/Jobs/Sync.php +++ b/apps/user_ldap/lib/Jobs/Sync.php @@ -80,6 +80,7 @@ class Sync extends TimedJob { /** * @param array $argument */ + #[\Override] public function run($argument) { $isBackgroundJobModeAjax = $this->globalAppConfig ->getValueString('core', 'backgroundjobs_mode', 'ajax') === 'ajax'; diff --git a/apps/user_ldap/lib/Jobs/UpdateGroups.php b/apps/user_ldap/lib/Jobs/UpdateGroups.php index 2ed4c8c74b4..ab58205b735 100644 --- a/apps/user_ldap/lib/Jobs/UpdateGroups.php +++ b/apps/user_ldap/lib/Jobs/UpdateGroups.php @@ -31,6 +31,7 @@ class UpdateGroups extends TimedJob { * @param mixed $argument * @throws Exception */ + #[\Override] public function run($argument): void { $this->logger->debug('Run background job "updateGroups"'); $this->service->updateGroups(); diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php index 21b5b519157..6ed24c03eaf 100644 --- a/apps/user_ldap/lib/LDAP.php +++ b/apps/user_ldap/lib/LDAP.php @@ -38,6 +38,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function bind($link, $dn, $password) { return $this->invokeLDAPMethod('bind', $link, $dn, $password); } @@ -45,6 +46,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function connect($host, $port) { $pos = strpos($host, '://'); if ($pos === false) { @@ -61,6 +63,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function controlPagedResultResponse($link, $result, &$cookie): bool { $errorCode = 0; $errorMsg = ''; @@ -91,6 +94,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function countEntries($link, $result) { return $this->invokeLDAPMethod('count_entries', $link, $result); } @@ -98,6 +102,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function errno($link) { return $this->invokeLDAPMethod('errno', $link); } @@ -105,6 +110,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function error($link) { return $this->invokeLDAPMethod('error', $link); } @@ -116,6 +122,7 @@ class LDAP implements ILDAPWrapper { * @return array|false * @link https://www.php.net/manual/en/function.ldap-explode-dn.php */ + #[\Override] public function explodeDN($dn, $withAttrib) { return $this->invokeLDAPMethod('explode_dn', $dn, $withAttrib); } @@ -123,6 +130,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function firstEntry($link, $result) { return $this->invokeLDAPMethod('first_entry', $link, $result); } @@ -130,6 +138,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function getAttributes($link, $result) { return $this->invokeLDAPMethod('get_attributes', $link, $result); } @@ -137,6 +146,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function getDN($link, $result) { return $this->invokeLDAPMethod('get_dn', $link, $result); } @@ -144,6 +154,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function getEntries($link, $result) { return $this->invokeLDAPMethod('get_entries', $link, $result); } @@ -151,6 +162,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function nextEntry($link, $result) { return $this->invokeLDAPMethod('next_entry', $link, $result); } @@ -158,6 +170,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function read($link, $baseDN, $filter, $attr) { return $this->invokeLDAPMethod('read', $link, $baseDN, $filter, $attr, 0, -1); } @@ -165,6 +178,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0, int $pageSize = 0, string $cookie = '') { if ($pageSize > 0 || $cookie !== '') { $serverControls = [[ @@ -201,6 +215,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function modReplace($link, $userDN, $password) { return $this->invokeLDAPMethod('mod_replace', $link, $userDN, ['userPassword' => $password]); } @@ -208,6 +223,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function exopPasswd($link, string $userDN, string $oldPassword, string $password) { return $this->invokeLDAPMethod('exop_passwd', $link, $userDN, $oldPassword, $password); } @@ -215,6 +231,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function setOption($link, $option, $value) { return $this->invokeLDAPMethod('set_option', $link, $option, $value); } @@ -222,6 +239,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function startTls($link) { return $this->invokeLDAPMethod('start_tls', $link); } @@ -229,6 +247,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function unbind($link) { return $this->invokeLDAPMethod('unbind', $link); } @@ -237,6 +256,7 @@ class LDAP implements ILDAPWrapper { * Checks whether the server supports LDAP * @return boolean if it the case, false otherwise * */ + #[\Override] public function areLDAPFunctionsAvailable() { return function_exists('ldap_connect'); } @@ -244,6 +264,7 @@ class LDAP implements ILDAPWrapper { /** * {@inheritDoc} */ + #[\Override] public function isResource($resource) { return is_resource($resource) || is_object($resource); } diff --git a/apps/user_ldap/lib/LDAPProvider.php b/apps/user_ldap/lib/LDAPProvider.php index 31a40fa89e2..a99c1ccf506 100644 --- a/apps/user_ldap/lib/LDAPProvider.php +++ b/apps/user_ldap/lib/LDAPProvider.php @@ -65,6 +65,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * @return string with the LDAP DN * @throws \Exception if translation was unsuccessful */ + #[\Override] public function getUserDN(string $uid): string { if (!$this->userBackend->userExists($uid)) { throw new \Exception('User id not found in LDAP'); @@ -80,6 +81,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * Translate a group id to LDAP DN. * @throws \Exception */ + #[\Override] public function getGroupDN(string $gid): string { if (!$this->groupBackend->groupExists($gid)) { throw new \Exception('Group id not found in LDAP'); @@ -97,6 +99,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * @return string the internal user name * @throws \Exception if translation was unsuccessful */ + #[\Override] public function getUserName(string $dn): string { $result = $this->userBackend->dn2UserName($dn); if (!$result) { @@ -108,6 +111,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { /** * Convert a stored DN so it can be used as base parameter for LDAP queries. */ + #[\Override] public function DNasBaseParameter(string $dn): string { return $this->helper->DNasBaseParameter($dn); } @@ -115,6 +119,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { /** * Sanitize a DN received from the LDAP server. */ + #[\Override] public function sanitizeDN(array|string $dn): array|string { return $this->helper->sanitizeDN($dn); } @@ -124,6 +129,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * The connection must be closed manually. * @throws \Exception if user id was not found in LDAP */ + #[\Override] public function getLDAPConnection(string $uid): Connection { if (!$this->userBackend->userExists($uid)) { throw new \Exception('User id not found in LDAP'); @@ -136,6 +142,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * The connection must be closed manually. * @throws \Exception if group id was not found in LDAP */ + #[\Override] public function getGroupLDAPConnection(string $gid): Connection { if (!$this->groupBackend->groupExists($gid)) { throw new \Exception('Group id not found in LDAP'); @@ -147,6 +154,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * Get the LDAP base for users. * @throws \Exception if user id was not found in LDAP */ + #[\Override] public function getLDAPBaseUsers(string $uid): string { if (!$this->userBackend->userExists($uid)) { throw new \Exception('User id not found in LDAP'); @@ -175,6 +183,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * Get the LDAP base for groups. * @throws \Exception if user id was not found in LDAP */ + #[\Override] public function getLDAPBaseGroups(string $uid): string { if (!$this->userBackend->userExists($uid)) { throw new \Exception('User id not found in LDAP'); @@ -187,6 +196,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * Clear the cache if a cache is used, otherwise do nothing. * @throws \Exception if user id was not found in LDAP */ + #[\Override] public function clearCache(string $uid): void { if (!$this->userBackend->userExists($uid)) { throw new \Exception('User id not found in LDAP'); @@ -199,6 +209,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * Acts on the LDAP connection of a group * @throws \Exception if user id was not found in LDAP */ + #[\Override] public function clearGroupCache(string $gid): void { if (!$this->groupBackend->groupExists($gid)) { throw new \Exception('Group id not found in LDAP'); @@ -209,6 +220,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { /** * Check whether a LDAP DN exists */ + #[\Override] public function dnExists(string $dn): bool { $result = $this->userBackend->dn2UserName($dn); return !$result ? false : true; @@ -217,6 +229,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { /** * Flag record for deletion. */ + #[\Override] public function flagRecord(string $uid): void { $this->deletedUsersIndex->markUser($uid); } @@ -224,6 +237,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { /** * Unflag record for deletion. */ + #[\Override] public function unflagRecord(string $uid): void { //do nothing } @@ -232,6 +246,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * Get the LDAP attribute name for the user's display name * @throws \Exception if user id was not found in LDAP */ + #[\Override] public function getLDAPDisplayNameField(string $uid): string { if (!$this->userBackend->userExists($uid)) { throw new \Exception('User id not found in LDAP'); @@ -243,6 +258,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * Get the LDAP attribute name for the email * @throws \Exception if user id was not found in LDAP */ + #[\Override] public function getLDAPEmailField(string $uid): string { if (!$this->userBackend->userExists($uid)) { throw new \Exception('User id not found in LDAP'); @@ -254,6 +270,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * Get the LDAP type of association between users and groups * @throws \Exception if group id was not found in LDAP */ + #[\Override] public function getLDAPGroupMemberAssoc(string $gid): string { if (!$this->groupBackend->groupExists($gid)) { throw new \Exception('Group id not found in LDAP'); @@ -266,6 +283,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * * @throws \Exception if user id was not found in LDAP */ + #[\Override] public function getUserAttribute(string $uid, string $attribute): ?string { $values = $this->getMultiValueUserAttribute($uid, $attribute); if (count($values) === 0) { @@ -279,6 +297,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { * * @throws \Exception if user id was not found in LDAP */ + #[\Override] public function getMultiValueUserAttribute(string $uid, string $attribute): array { if (!$this->userBackend->userExists($uid)) { throw new \Exception('User id not found in LDAP'); diff --git a/apps/user_ldap/lib/LDAPProviderFactory.php b/apps/user_ldap/lib/LDAPProviderFactory.php index b91f92f2519..369a32d2710 100644 --- a/apps/user_ldap/lib/LDAPProviderFactory.php +++ b/apps/user_ldap/lib/LDAPProviderFactory.php @@ -20,10 +20,12 @@ class LDAPProviderFactory implements ILDAPProviderFactory { ) { } + #[\Override] public function getLDAPProvider(): ILDAPProvider { return $this->serverContainer->get(LDAPProvider::class); } + #[\Override] public function isAvailable(): bool { return true; } diff --git a/apps/user_ldap/lib/LoginListener.php b/apps/user_ldap/lib/LoginListener.php index f397f4694d2..eb8a29d3ee6 100644 --- a/apps/user_ldap/lib/LoginListener.php +++ b/apps/user_ldap/lib/LoginListener.php @@ -34,6 +34,7 @@ class LoginListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof PostLoginEvent) { $this->onPostLogin($event->getUser()); diff --git a/apps/user_ldap/lib/Mapping/GroupMapping.php b/apps/user_ldap/lib/Mapping/GroupMapping.php index bd8ed8d64fd..ab474c3fe04 100644 --- a/apps/user_ldap/lib/Mapping/GroupMapping.php +++ b/apps/user_ldap/lib/Mapping/GroupMapping.php @@ -19,6 +19,7 @@ class GroupMapping extends AbstractMapping { * returns the DB table name which holds the mappings * @return string */ + #[\Override] protected function getTableName(bool $includePrefix = true) { $p = $includePrefix ? '*PREFIX*' : ''; return $p . 'ldap_group_mapping'; diff --git a/apps/user_ldap/lib/Mapping/UserMapping.php b/apps/user_ldap/lib/Mapping/UserMapping.php index f48d76f722b..9b9964b36ac 100644 --- a/apps/user_ldap/lib/Mapping/UserMapping.php +++ b/apps/user_ldap/lib/Mapping/UserMapping.php @@ -40,6 +40,7 @@ class UserMapping extends AbstractMapping { /** * @throws HintException */ + #[\Override] public function map($fdn, $name, $uuid): bool { try { $this->assertion->createUserIsLegit(); @@ -59,6 +60,7 @@ class UserMapping extends AbstractMapping { * returns the DB table name which holds the mappings * @return string */ + #[\Override] protected function getTableName(bool $includePrefix = true) { $p = $includePrefix ? '*PREFIX*' : ''; return $p . 'ldap_user_mapping'; diff --git a/apps/user_ldap/lib/Migration/RemoveRefreshTime.php b/apps/user_ldap/lib/Migration/RemoveRefreshTime.php index 88ac56ccb84..cb41ed59f71 100644 --- a/apps/user_ldap/lib/Migration/RemoveRefreshTime.php +++ b/apps/user_ldap/lib/Migration/RemoveRefreshTime.php @@ -28,10 +28,12 @@ class RemoveRefreshTime implements IRepairStep { ) { } + #[\Override] public function getName() { return 'Remove deprecated refresh time markers for LDAP user records'; } + #[\Override] public function run(IOutput $output) { $this->config->deleteAppValue('user_ldap', 'updateAttributesInterval'); diff --git a/apps/user_ldap/lib/Migration/SetDefaultProvider.php b/apps/user_ldap/lib/Migration/SetDefaultProvider.php index 0bb04438a1d..3fa476ddeca 100644 --- a/apps/user_ldap/lib/Migration/SetDefaultProvider.php +++ b/apps/user_ldap/lib/Migration/SetDefaultProvider.php @@ -22,10 +22,12 @@ class SetDefaultProvider implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Set default LDAP provider'; } + #[\Override] public function run(IOutput $output): void { $current = $this->config->getSystemValue('ldapProviderFactory', null); if ($current === null) { diff --git a/apps/user_ldap/lib/Migration/UUIDFix.php b/apps/user_ldap/lib/Migration/UUIDFix.php index e853f3bba66..dff3c5f5c7e 100644 --- a/apps/user_ldap/lib/Migration/UUIDFix.php +++ b/apps/user_ldap/lib/Migration/UUIDFix.php @@ -15,6 +15,7 @@ abstract class UUIDFix extends QueuedJob { protected AbstractMapping $mapper; protected Proxy $proxy; + #[\Override] public function run($argument) { $isUser = $this->proxy instanceof User_Proxy; foreach ($argument['records'] as $record) { diff --git a/apps/user_ldap/lib/Migration/UUIDFixInsert.php b/apps/user_ldap/lib/Migration/UUIDFixInsert.php index 88c9859b809..b88d8f41a97 100644 --- a/apps/user_ldap/lib/Migration/UUIDFixInsert.php +++ b/apps/user_ldap/lib/Migration/UUIDFixInsert.php @@ -23,10 +23,12 @@ class UUIDFixInsert implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Insert UUIDFix background job for user and group in batches'; } + #[\Override] public function run(IOutput $output): void { $installedVersion = $this->appConfig->getAppValueString('installed_version', '1.2.1'); if (version_compare($installedVersion, '1.2.1') !== -1) { diff --git a/apps/user_ldap/lib/Migration/UnsetDefaultProvider.php b/apps/user_ldap/lib/Migration/UnsetDefaultProvider.php index 025415cf712..0947f266ab7 100644 --- a/apps/user_ldap/lib/Migration/UnsetDefaultProvider.php +++ b/apps/user_ldap/lib/Migration/UnsetDefaultProvider.php @@ -20,10 +20,12 @@ class UnsetDefaultProvider implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Unset default LDAP provider'; } + #[\Override] public function run(IOutput $output): void { $current = $this->config->getSystemValue('ldapProviderFactory', null); if ($current === LDAPProviderFactory::class) { diff --git a/apps/user_ldap/lib/Migration/Version1010Date20200630192842.php b/apps/user_ldap/lib/Migration/Version1010Date20200630192842.php index 1464e50e359..ef85fa66ba3 100644 --- a/apps/user_ldap/lib/Migration/Version1010Date20200630192842.php +++ b/apps/user_ldap/lib/Migration/Version1010Date20200630192842.php @@ -21,6 +21,7 @@ class Version1010Date20200630192842 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php b/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php index a6e071811e0..a92f61bad60 100644 --- a/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php +++ b/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php @@ -38,6 +38,7 @@ class Version1120Date20210917155206 extends SimpleMigrationStep { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { // ensure that there is no user or group id longer than 64char in LDAP table $this->handleIDs('ldap_group_mapping', false); @@ -50,6 +51,7 @@ class Version1120Date20210917155206 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/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php index 406c1633fc8..9b84b6fc27a 100644 --- a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php +++ b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php @@ -35,6 +35,7 @@ class Version1130Date20211102154716 extends SimpleMigrationStep { return 'Adjust LDAP user and group ldap_dn column lengths and add ldap_dn_hash columns'; } + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { foreach (['ldap_user_mapping', 'ldap_group_mapping'] as $tableName) { $this->processDuplicateUUIDs($tableName); @@ -58,6 +59,7 @@ class Version1130Date20211102154716 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -127,6 +129,7 @@ class Version1130Date20211102154716 extends SimpleMigrationStep { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { $this->handleDNHashes('ldap_group_mapping'); $this->handleDNHashes('ldap_user_mapping'); diff --git a/apps/user_ldap/lib/Migration/Version1130Date20220110154717.php b/apps/user_ldap/lib/Migration/Version1130Date20220110154717.php index 80960373edf..9276e9f4696 100644 --- a/apps/user_ldap/lib/Migration/Version1130Date20220110154717.php +++ b/apps/user_ldap/lib/Migration/Version1130Date20220110154717.php @@ -24,6 +24,7 @@ class Version1130Date20220110154717 extends GroupMappingMigration { * @param array $options * @since 13.0.0 */ + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -44,6 +45,7 @@ class Version1130Date20220110154717 extends GroupMappingMigration { * @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/apps/user_ldap/lib/Migration/Version1130Date20220110154718.php b/apps/user_ldap/lib/Migration/Version1130Date20220110154718.php index f67b791daad..c7b9feb4b4e 100644 --- a/apps/user_ldap/lib/Migration/Version1130Date20220110154718.php +++ b/apps/user_ldap/lib/Migration/Version1130Date20220110154718.php @@ -25,6 +25,7 @@ class Version1130Date20220110154718 extends GroupMappingMigration { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -66,6 +67,7 @@ class Version1130Date20220110154718 extends GroupMappingMigration { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/user_ldap/lib/Migration/Version1130Date20220110154719.php b/apps/user_ldap/lib/Migration/Version1130Date20220110154719.php index c34ee5357f5..be9558ca2ff 100644 --- a/apps/user_ldap/lib/Migration/Version1130Date20220110154719.php +++ b/apps/user_ldap/lib/Migration/Version1130Date20220110154719.php @@ -25,6 +25,7 @@ class Version1130Date20220110154719 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/apps/user_ldap/lib/Migration/Version1141Date20220323143801.php b/apps/user_ldap/lib/Migration/Version1141Date20220323143801.php index ecedbf1de20..b70a3dd9062 100644 --- a/apps/user_ldap/lib/Migration/Version1141Date20220323143801.php +++ b/apps/user_ldap/lib/Migration/Version1141Date20220323143801.php @@ -28,6 +28,7 @@ class Version1141Date20220323143801 extends SimpleMigrationStep { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { foreach (['ldap_user_mapping', 'ldap_group_mapping'] as $tableName) { $qb = $this->dbc->getQueryBuilder(); @@ -78,6 +79,7 @@ class Version1141Date20220323143801 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/apps/user_ldap/lib/Migration/Version1190Date20230706134108.php b/apps/user_ldap/lib/Migration/Version1190Date20230706134108.php index 7099712073f..87c6c29023e 100644 --- a/apps/user_ldap/lib/Migration/Version1190Date20230706134108.php +++ b/apps/user_ldap/lib/Migration/Version1190Date20230706134108.php @@ -22,9 +22,11 @@ class Version1190Date20230706134108 extends SimpleMigrationStep { ) { } + #[\Override] public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { } + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -53,6 +55,7 @@ class Version1190Date20230706134108 extends SimpleMigrationStep { } } + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/user_ldap/lib/Migration/Version1190Date20230706134109.php b/apps/user_ldap/lib/Migration/Version1190Date20230706134109.php index 2d3c26f0d49..54be8a857ca 100644 --- a/apps/user_ldap/lib/Migration/Version1190Date20230706134109.php +++ b/apps/user_ldap/lib/Migration/Version1190Date20230706134109.php @@ -15,6 +15,7 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version1190Date20230706134109 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/user_ldap/lib/Notification/Notifier.php b/apps/user_ldap/lib/Notification/Notifier.php index 0195cb9e65b..b4cafc1c732 100644 --- a/apps/user_ldap/lib/Notification/Notifier.php +++ b/apps/user_ldap/lib/Notification/Notifier.php @@ -27,6 +27,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getID(): string { return 'user_ldap'; } @@ -37,6 +38,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getName(): string { return $this->l10nFactory->get('user_ldap')->t('LDAP User backend'); } @@ -47,6 +49,7 @@ class Notifier implements INotifier { * @return INotification * @throws UnknownNotificationException When the notification was not prepared by a notifier */ + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'user_ldap') { // Not my app => throw diff --git a/apps/user_ldap/lib/Settings/Admin.php b/apps/user_ldap/lib/Settings/Admin.php index aab8fcfeccf..485117b3483 100644 --- a/apps/user_ldap/lib/Settings/Admin.php +++ b/apps/user_ldap/lib/Settings/Admin.php @@ -25,6 +25,7 @@ class Admin implements IDelegatedSettings { ) { } + #[\Override] public function getForm(): TemplateResponse { $helper = Server::get(Helper::class); $prefixes = $helper->getServerConfigurationPrefixes(); @@ -66,6 +67,7 @@ class Admin implements IDelegatedSettings { return new TemplateResponse(Application::APP_ID, 'settings', $parameters); } + #[\Override] public function getSection(): string { return 'ldap'; } @@ -77,14 +79,17 @@ class Admin implements IDelegatedSettings { * * E.g.: 70 */ + #[\Override] public function getPriority(): int { return 5; } + #[\Override] public function getName(): ?string { return null; // Only one setting in this section } + #[\Override] public function getAuthorizedAppConfig(): array { return []; // Custom controller } diff --git a/apps/user_ldap/lib/Settings/Section.php b/apps/user_ldap/lib/Settings/Section.php index 8abc77cb328..068637b5443 100644 --- a/apps/user_ldap/lib/Settings/Section.php +++ b/apps/user_ldap/lib/Settings/Section.php @@ -29,6 +29,7 @@ class Section implements IIconSection { * * @returns string */ + #[\Override] public function getID() { return 'ldap'; } @@ -39,6 +40,7 @@ class Section implements IIconSection { * * @return string */ + #[\Override] public function getName() { return $this->l->t('LDAP/AD integration'); } @@ -50,6 +52,7 @@ class Section implements IIconSection { * * E.g.: 70 */ + #[\Override] public function getPriority() { return 25; } @@ -57,6 +60,7 @@ class Section implements IIconSection { /** * {@inheritdoc} */ + #[\Override] public function getIcon() { return $this->url->imagePath('user_ldap', 'app-dark.svg'); } diff --git a/apps/user_ldap/lib/SetupChecks/LdapConnection.php b/apps/user_ldap/lib/SetupChecks/LdapConnection.php index ee8c4ddd595..6058c95451f 100644 --- a/apps/user_ldap/lib/SetupChecks/LdapConnection.php +++ b/apps/user_ldap/lib/SetupChecks/LdapConnection.php @@ -25,14 +25,17 @@ class LdapConnection implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'ldap'; } + #[\Override] public function getName(): string { return $this->l10n->t('LDAP Connection'); } + #[\Override] public function run(): SetupResult { $availableConfigs = $this->helper->getServerConfigurationPrefixes(); $inactiveConfigurations = []; diff --git a/apps/user_ldap/lib/SetupChecks/LdapInvalidUuids.php b/apps/user_ldap/lib/SetupChecks/LdapInvalidUuids.php index ac502b6b59e..de8dba43fee 100644 --- a/apps/user_ldap/lib/SetupChecks/LdapInvalidUuids.php +++ b/apps/user_ldap/lib/SetupChecks/LdapInvalidUuids.php @@ -23,14 +23,17 @@ class LdapInvalidUuids implements ISetupCheck { ) { } + #[\Override] public function getCategory(): string { return 'ldap'; } + #[\Override] public function getName(): string { return $this->l10n->t('Invalid LDAP UUIDs'); } + #[\Override] public function run(): SetupResult { if (count($this->userMapping->getList(0, 1, true)) === 0 && count($this->groupMapping->getList(0, 1, true)) === 0) { diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index 22475ceccab..eefe0a13335 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -106,6 +106,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I * @param string $dn * @return string|false with the username */ + #[\Override] public function dn2UserName($dn) { return $this->access->dn2username($dn); } @@ -219,6 +220,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I * @param integer $offset * @return string[] an array of all uids */ + #[\Override] public function getUsers($search = '', $limit = 10, $offset = 0) { $search = $this->access->escapeFilterPart($search, true); $cachekey = 'getUsers-' . $search . '-' . $limit . '-' . $offset; @@ -321,6 +323,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I * @return boolean * @throws \Exception when connection could not be established */ + #[\Override] public function userExists($uid) { $userExists = $this->access->connection->getFromCache('userExists' . $uid); if (!is_null($userExists)) { @@ -347,6 +350,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I * @param string $uid The username of the user to delete * @return bool */ + #[\Override] public function deleteUser($uid) { if ($this->userPluginManager->canDeleteUser()) { $status = $this->userPluginManager->deleteUser($uid); @@ -468,6 +472,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I return ''; } + #[\Override] public function getDisplayName($uid): string { if ($this->userPluginManager->implementsActions(Backend::GET_DISPLAYNAME)) { return $this->userPluginManager->getDisplayName($uid); @@ -518,6 +523,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I * @return array an array of all displayNames (value) and the corresponding * uids (key) */ + #[\Override] public function getDisplayNames($search = '', $limit = null, $offset = null) { $cacheKey = 'getDisplayNames-' . $search . '-' . $limit . '-' . $offset; if (!is_null($displayNames = $this->access->connection->getFromCache($cacheKey))) { @@ -541,6 +547,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I * Returns the supported actions as int to be * compared with \OC\User\Backend::CREATE_USER etc. */ + #[\Override] public function implementsActions($actions) { return (bool)((Backend::CHECK_PASSWORD | Backend::GET_HOME @@ -555,6 +562,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I /** * @return bool */ + #[\Override] public function hasUserListings() { return true; } @@ -562,6 +570,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I /** * counts the users in LDAP */ + #[\Override] public function countUsers(int $limit = 0): int|false { if ($this->userPluginManager->implementsActions(Backend::COUNT_USERS)) { return $this->userPluginManager->countUsers(); @@ -577,6 +586,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I return $entries; } + #[\Override] public function countMappedUsers(): int { return $this->access->getUserMapper()->count(); } @@ -585,6 +595,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I * Backend name to be shown in user management * @return string the name of the backend to be shown */ + #[\Override] public function getBackendName() { return 'LDAP'; } @@ -594,6 +605,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I * @param string $uid * @return Access instance of Access for LDAP interaction */ + #[\Override] public function getLDAPAccess($uid) { return $this->access; } @@ -605,6 +617,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I * @param string $uid * @return \LDAP\Connection The LDAP connection */ + #[\Override] public function getNewLDAPConnection($uid) { $connection = clone $this->access->getConnection(); return $connection->getConnectionResource(); @@ -649,6 +662,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I return false; } + #[\Override] public function isUserEnabled(string $uid, callable $queryDatabaseValue): bool { if ($this->deletedUsersIndex->isUserMarked($uid) && ((int)$this->access->connection->markRemnantsAsDisabled === 1)) { return false; @@ -657,15 +671,18 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I } } + #[\Override] public function setUserEnabled(string $uid, bool $enabled, callable $queryDatabaseValue, callable $setDatabaseValue): bool { $setDatabaseValue($enabled); return $enabled; } + #[\Override] public function getDisabledUserList(?int $limit = null, int $offset = 0, string $search = ''): array { throw new \Exception('This is implemented directly in User_Proxy'); } + #[\Override] public function canEditProperty(string $uid, string $property): bool { return match($property) { // Display name is always set by LDAP diff --git a/apps/user_ldap/lib/User_Proxy.php b/apps/user_ldap/lib/User_Proxy.php index 6a01ab34830..4119885a1d2 100644 --- a/apps/user_ldap/lib/User_Proxy.php +++ b/apps/user_ldap/lib/User_Proxy.php @@ -36,6 +36,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP parent::__construct($helper, $ldap, $accessFactory); } + #[\Override] protected function newInstance(string $configPrefix): User_LDAP { return new User_LDAP( $this->getAccess($configPrefix), @@ -54,6 +55,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP * @param array $parameters an array of parameters to be passed * @return mixed the result of the method or false */ + #[\Override] protected function walkBackends($id, $method, $parameters) { $this->setup(); @@ -84,6 +86,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP * @param mixed $passOnWhen the result matches this variable * @return mixed the result of the method or false */ + #[\Override] protected function callOnLastSeenOn($id, $method, $parameters, $passOnWhen) { $this->setup(); @@ -116,6 +119,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP return false; } + #[\Override] protected function activeBackends(): int { $this->setup(); return count($this->backends); @@ -130,6 +134,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP * Returns the supported actions as int to be * compared with \OC\User\Backend::CREATE_USER etc. */ + #[\Override] public function implementsActions($actions) { $this->setup(); //it's the same across all our user backends obviously @@ -141,6 +146,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP * * @return string the name of the backend to be shown */ + #[\Override] public function getBackendName() { $this->setup(); return $this->refBackend->getBackendName(); @@ -154,6 +160,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP * @param null|int $offset * @return string[] an array of all uids */ + #[\Override] public function getUsers($search = '', $limit = 10, $offset = 0) { $this->setup(); @@ -174,6 +181,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP * @param string $uid the username * @return boolean */ + #[\Override] public function userExists($uid) { $existsOnLDAP = false; $existsLocally = $this->handleRequest($uid, 'userExists', [$uid]); @@ -234,6 +242,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP * @param string $dn * @return string|false with the username */ + #[\Override] public function dn2UserName($dn) { $id = 'DN,' . $dn; return $this->handleRequest($id, 'dn2UserName', [$dn]); @@ -255,6 +264,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP * @param string $uid user ID of the user * @return string display name */ + #[\Override] public function getDisplayName($uid): string { return $this->handleRequest($uid, 'getDisplayName', [$uid]); } @@ -288,6 +298,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP * @param int|null $offset * @return array an array of all displayNames (value) and the corresponding uids (key) */ + #[\Override] public function getDisplayNames($search = '', $limit = null, $offset = null) { $this->setup(); @@ -310,6 +321,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP * * Deletes a user */ + #[\Override] public function deleteUser($uid) { return $this->handleRequest($uid, 'deleteUser', [$uid]); } @@ -329,6 +341,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP /** * @return bool */ + #[\Override] public function hasUserListings() { $this->setup(); return $this->refBackend->hasUserListings(); @@ -337,6 +350,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP /** * Count the number of users */ + #[\Override] public function countUsers(int $limit = 0): int|false { $this->setup(); @@ -359,6 +373,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP /** * Count the number of mapped users */ + #[\Override] public function countMappedUsers(): int { $this->setup(); @@ -375,6 +390,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP * @param string $uid * @return Access instance of Access for LDAP interaction */ + #[\Override] public function getLDAPAccess($uid) { return $this->handleRequest($uid, 'getLDAPAccess', [$uid]); } @@ -386,6 +402,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP * @param string $uid * @return \LDAP\Connection The LDAP connection */ + #[\Override] public function getNewLDAPConnection($uid) { return $this->handleRequest($uid, 'getNewLDAPConnection', [$uid]); } @@ -401,14 +418,17 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP return $this->handleRequest($username, 'createUser', [$username, $password]); } + #[\Override] public function isUserEnabled(string $uid, callable $queryDatabaseValue): bool { return $this->handleRequest($uid, 'isUserEnabled', [$uid, $queryDatabaseValue]); } + #[\Override] public function setUserEnabled(string $uid, bool $enabled, callable $queryDatabaseValue, callable $setDatabaseValue): bool { return $this->handleRequest($uid, 'setUserEnabled', [$uid, $enabled, $queryDatabaseValue, $setDatabaseValue]); } + #[\Override] public function getDisabledUserList(?int $limit = null, int $offset = 0, string $search = ''): array { if ((int)$this->getAccess(array_key_first($this->backends) ?? '')->connection->markRemnantsAsDisabled !== 1) { return []; @@ -434,6 +454,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP ); } + #[\Override] public function canEditProperty(string $uid, string $property): bool { return $this->handleRequest($uid, 'canEditProperty', [$uid, $property]); } diff --git a/apps/user_status/lib/AppInfo/Application.php b/apps/user_status/lib/AppInfo/Application.php index 5199c3fdbf0..01e4b5317d4 100644 --- a/apps/user_status/lib/AppInfo/Application.php +++ b/apps/user_status/lib/AppInfo/Application.php @@ -52,6 +52,7 @@ class Application extends App implements IBootstrap { /** * @inheritDoc */ + #[\Override] public function register(IRegistrationContext $context): void { // Register OCS Capabilities $context->registerCapability(Capabilities::class); @@ -77,6 +78,7 @@ class Application extends App implements IBootstrap { } } + #[\Override] public function boot(IBootContext $context): void { /** @var IManager $userStatusManager */ $userStatusManager = $context->getServerContainer()->get(IManager::class); diff --git a/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php b/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php index 51a9c623a03..0e8ee825f6d 100644 --- a/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php +++ b/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php @@ -38,6 +38,7 @@ class ClearOldStatusesBackgroundJob extends TimedJob { /** * @inheritDoc */ + #[\Override] protected function run($argument) { $now = $this->time->getTime(); diff --git a/apps/user_status/lib/Capabilities.php b/apps/user_status/lib/Capabilities.php index c3edbc032d6..e6084c21a73 100644 --- a/apps/user_status/lib/Capabilities.php +++ b/apps/user_status/lib/Capabilities.php @@ -25,6 +25,7 @@ class Capabilities implements ICapability { /** * @return array{user_status: array{enabled: bool, restore: bool, supports_emoji: bool, supports_busy: bool}} */ + #[\Override] public function getCapabilities() { return [ 'user_status' => [ diff --git a/apps/user_status/lib/Connector/UserStatus.php b/apps/user_status/lib/Connector/UserStatus.php index 04467a99e5e..562be840412 100644 --- a/apps/user_status/lib/Connector/UserStatus.php +++ b/apps/user_status/lib/Connector/UserStatus.php @@ -48,6 +48,7 @@ class UserStatus implements IUserStatus { /** * @inheritDoc */ + #[\Override] public function getUserId(): string { return $this->userId; } @@ -55,6 +56,7 @@ class UserStatus implements IUserStatus { /** * @inheritDoc */ + #[\Override] public function getStatus(): string { return $this->status; } @@ -62,6 +64,7 @@ class UserStatus implements IUserStatus { /** * @inheritDoc */ + #[\Override] public function getMessage(): ?string { return $this->message; } @@ -69,6 +72,7 @@ class UserStatus implements IUserStatus { /** * @inheritDoc */ + #[\Override] public function getIcon(): ?string { return $this->icon; } @@ -76,6 +80,7 @@ class UserStatus implements IUserStatus { /** * @inheritDoc */ + #[\Override] public function getClearAt(): ?DateTimeImmutable { return $this->clearAt; } diff --git a/apps/user_status/lib/Connector/UserStatusProvider.php b/apps/user_status/lib/Connector/UserStatusProvider.php index e84d69d1eb2..56215911b43 100644 --- a/apps/user_status/lib/Connector/UserStatusProvider.php +++ b/apps/user_status/lib/Connector/UserStatusProvider.php @@ -27,6 +27,7 @@ class UserStatusProvider implements IProvider, ISettableProvider { /** * @inheritDoc */ + #[\Override] public function getUserStatuses(array $userIds): array { $statuses = $this->service->findByUserIds($userIds); @@ -38,14 +39,17 @@ class UserStatusProvider implements IProvider, ISettableProvider { return $userStatuses; } + #[\Override] public function setUserStatus(string $userId, string $messageId, string $status, bool $createBackup, ?string $customMessage = null): void { $this->service->setUserStatus($userId, $status, $messageId, $createBackup, $customMessage); } + #[\Override] public function revertUserStatus(string $userId, string $messageId, string $status): void { $this->service->revertUserStatus($userId, $messageId); } + #[\Override] public function revertMultipleUserStatus(array $userIds, string $messageId, string $status): void { $this->service->revertMultipleUserStatus($userIds, $messageId); } diff --git a/apps/user_status/lib/ContactsMenu/StatusProvider.php b/apps/user_status/lib/ContactsMenu/StatusProvider.php index 6a6949b46ba..5eeaee669cc 100644 --- a/apps/user_status/lib/ContactsMenu/StatusProvider.php +++ b/apps/user_status/lib/ContactsMenu/StatusProvider.php @@ -24,6 +24,7 @@ class StatusProvider implements IBulkProvider { ) { } + #[\Override] public function process(array $entries): void { $uids = array_filter( array_map(fn (IEntry $entry): ?string => $entry->getProperty('UID'), $entries) diff --git a/apps/user_status/lib/Dashboard/UserStatusWidget.php b/apps/user_status/lib/Dashboard/UserStatusWidget.php index 2870a2c1907..49c618a2826 100644 --- a/apps/user_status/lib/Dashboard/UserStatusWidget.php +++ b/apps/user_status/lib/Dashboard/UserStatusWidget.php @@ -57,6 +57,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption /** * @inheritDoc */ + #[\Override] public function getId(): string { return Application::APP_ID; } @@ -64,6 +65,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption /** * @inheritDoc */ + #[\Override] public function getTitle(): string { return $this->l10n->t('Recent statuses'); } @@ -71,6 +73,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption /** * @inheritDoc */ + #[\Override] public function getOrder(): int { return 5; } @@ -78,6 +81,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption /** * @inheritDoc */ + #[\Override] public function getIconClass(): string { return 'icon-user-status-dark'; } @@ -85,6 +89,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption /** * @inheritDoc */ + #[\Override] public function getIconUrl(): string { return $this->urlGenerator->getAbsoluteURL( $this->urlGenerator->imagePath(Application::APP_ID, 'app-dark.svg') @@ -94,6 +99,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption /** * @inheritDoc */ + #[\Override] public function getUrl(): ?string { return null; } @@ -101,6 +107,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption /** * @inheritDoc */ + #[\Override] public function load(): void { } @@ -140,6 +147,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption /** * @inheritDoc */ + #[\Override] public function getItems(string $userId, ?string $since = null, int $limit = 7): array { $widgetItemsData = $this->getWidgetData($userId, $since, $limit); @@ -163,6 +171,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption /** * @inheritDoc */ + #[\Override] public function getItemsV2(string $userId, ?string $since = null, int $limit = 7): WidgetItems { $items = $this->getItems($userId, $since, $limit); return new WidgetItems( @@ -171,6 +180,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption ); } + #[\Override] public function getWidgetOptions(): WidgetOptions { return new WidgetOptions(true); } diff --git a/apps/user_status/lib/Listener/BeforeTemplateRenderedListener.php b/apps/user_status/lib/Listener/BeforeTemplateRenderedListener.php index 0fa165a8d03..fa4351d4b91 100644 --- a/apps/user_status/lib/Listener/BeforeTemplateRenderedListener.php +++ b/apps/user_status/lib/Listener/BeforeTemplateRenderedListener.php @@ -42,6 +42,7 @@ class BeforeTemplateRenderedListener implements IEventListener { /** * @inheritDoc */ + #[\Override] public function handle(Event $event): void { $user = $this->userSession->getUser(); if ($user === null) { diff --git a/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php b/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php index 6337d637896..c9bc233e84d 100644 --- a/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php +++ b/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php @@ -38,6 +38,7 @@ class OutOfOfficeStatusListener implements IEventListener { /** * @inheritDoc */ + #[\Override] public function handle(Event $event): void { if ($event instanceof OutOfOfficeClearedEvent) { $this->manager->revertUserStatus($event->getData()->getUser()->getUID(), IUserStatus::MESSAGE_OUT_OF_OFFICE, IUserStatus::DND); diff --git a/apps/user_status/lib/Listener/UserDeletedListener.php b/apps/user_status/lib/Listener/UserDeletedListener.php index bf021635156..0828b1b44e0 100644 --- a/apps/user_status/lib/Listener/UserDeletedListener.php +++ b/apps/user_status/lib/Listener/UserDeletedListener.php @@ -35,6 +35,7 @@ class UserDeletedListener implements IEventListener { /** * @inheritDoc */ + #[\Override] public function handle(Event $event): void { if (!($event instanceof UserDeletedEvent)) { // Unrelated diff --git a/apps/user_status/lib/Listener/UserLiveStatusListener.php b/apps/user_status/lib/Listener/UserLiveStatusListener.php index cd26bd03976..c65386b3e22 100644 --- a/apps/user_status/lib/Listener/UserLiveStatusListener.php +++ b/apps/user_status/lib/Listener/UserLiveStatusListener.php @@ -41,6 +41,7 @@ class UserLiveStatusListener implements IEventListener { /** * @inheritDoc */ + #[\Override] public function handle(Event $event): void { if (!($event instanceof UserLiveStatusEvent)) { // Unrelated diff --git a/apps/user_status/lib/Migration/Version0001Date20200602134824.php b/apps/user_status/lib/Migration/Version0001Date20200602134824.php index 678c2ec245a..2302befdfa6 100644 --- a/apps/user_status/lib/Migration/Version0001Date20200602134824.php +++ b/apps/user_status/lib/Migration/Version0001Date20200602134824.php @@ -27,6 +27,7 @@ class Version0001Date20200602134824 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 20.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/user_status/lib/Migration/Version0002Date20200902144824.php b/apps/user_status/lib/Migration/Version0002Date20200902144824.php index 199d2a4cc6b..ba372b439a4 100644 --- a/apps/user_status/lib/Migration/Version0002Date20200902144824.php +++ b/apps/user_status/lib/Migration/Version0002Date20200902144824.php @@ -26,6 +26,7 @@ class Version0002Date20200902144824 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 20.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/user_status/lib/Migration/Version1000Date20201111130204.php b/apps/user_status/lib/Migration/Version1000Date20201111130204.php index b0789684da0..12b75f576c2 100644 --- a/apps/user_status/lib/Migration/Version1000Date20201111130204.php +++ b/apps/user_status/lib/Migration/Version1000Date20201111130204.php @@ -21,6 +21,7 @@ class Version1000Date20201111130204 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/apps/user_status/lib/Migration/Version1003Date20210809144824.php b/apps/user_status/lib/Migration/Version1003Date20210809144824.php index 7c6cf76adbe..fe8395f701a 100644 --- a/apps/user_status/lib/Migration/Version1003Date20210809144824.php +++ b/apps/user_status/lib/Migration/Version1003Date20210809144824.php @@ -25,6 +25,7 @@ class Version1003Date20210809144824 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 23.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/user_status/lib/Migration/Version1008Date20230921144701.php b/apps/user_status/lib/Migration/Version1008Date20230921144701.php index 30ebbf37b0e..4ed2347e33e 100644 --- a/apps/user_status/lib/Migration/Version1008Date20230921144701.php +++ b/apps/user_status/lib/Migration/Version1008Date20230921144701.php @@ -23,6 +23,7 @@ class Version1008Date20230921144701 extends SimpleMigrationStep { ) { } + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -43,6 +44,7 @@ class Version1008Date20230921144701 extends SimpleMigrationStep { return $schema; } + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $qb = $this->connection->getQueryBuilder(); diff --git a/apps/user_status/lib/Service/JSDataService.php b/apps/user_status/lib/Service/JSDataService.php index a777e97fe57..0bf7a4fceb5 100644 --- a/apps/user_status/lib/Service/JSDataService.php +++ b/apps/user_status/lib/Service/JSDataService.php @@ -26,6 +26,7 @@ class JSDataService implements \JsonSerializable { ) { } + #[\Override] public function jsonSerialize(): array { $user = $this->userSession->getUser(); diff --git a/apps/weather_status/lib/AppInfo/Application.php b/apps/weather_status/lib/AppInfo/Application.php index 147d69ee543..1227f391c12 100644 --- a/apps/weather_status/lib/AppInfo/Application.php +++ b/apps/weather_status/lib/AppInfo/Application.php @@ -38,12 +38,14 @@ class Application extends App implements IBootstrap { /** * @inheritDoc */ + #[\Override] public function register(IRegistrationContext $context): void { // Register OCS Capabilities $context->registerCapability(Capabilities::class); $context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); } + #[\Override] public function boot(IBootContext $context): void { } } diff --git a/apps/weather_status/lib/Capabilities.php b/apps/weather_status/lib/Capabilities.php index 953b40036f3..ac6cd6986cd 100644 --- a/apps/weather_status/lib/Capabilities.php +++ b/apps/weather_status/lib/Capabilities.php @@ -29,6 +29,7 @@ class Capabilities implements ICapability { /** * @return array{weather_status: array{enabled: bool}} */ + #[\Override] public function getCapabilities() { return [ Application::APP_ID => [ diff --git a/apps/weather_status/lib/Listeners/BeforeTemplateRenderedListener.php b/apps/weather_status/lib/Listeners/BeforeTemplateRenderedListener.php index 5d3b76626b6..0c21a2cfc2f 100644 --- a/apps/weather_status/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/apps/weather_status/lib/Listeners/BeforeTemplateRenderedListener.php @@ -23,6 +23,7 @@ class BeforeTemplateRenderedListener implements IEventListener { * Inject our status widget script when the dashboard is loaded * We need to do it like this because there is currently no PHP API for registering "status widgets" */ + #[\Override] public function handle(Event $event): void { if (!($event instanceof BeforeTemplateRenderedEvent)) { return; diff --git a/apps/webhook_listeners/lib/AppInfo/Application.php b/apps/webhook_listeners/lib/AppInfo/Application.php index 30f2e0969f6..39d0ce83afb 100644 --- a/apps/webhook_listeners/lib/AppInfo/Application.php +++ b/apps/webhook_listeners/lib/AppInfo/Application.php @@ -27,9 +27,11 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID); } + #[\Override] public function register(IRegistrationContext $context): void { } + #[\Override] public function boot(IBootContext $context): void { $context->injectFn($this->registerRuleListeners(...)); } diff --git a/apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php b/apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php index 0bd76670d92..c7c06a886f0 100644 --- a/apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php +++ b/apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php @@ -40,6 +40,7 @@ class WebhookCall extends QueuedJob { /** * @param array $argument */ + #[\Override] protected function run($argument): void { [$data, $webhookId] = $argument; $webhookListener = $this->mapper->getById($webhookId); diff --git a/apps/webhook_listeners/lib/BackgroundJobs/WebhookTokenCleanup.php b/apps/webhook_listeners/lib/BackgroundJobs/WebhookTokenCleanup.php index 45f934333d0..954f1c6be21 100644 --- a/apps/webhook_listeners/lib/BackgroundJobs/WebhookTokenCleanup.php +++ b/apps/webhook_listeners/lib/BackgroundJobs/WebhookTokenCleanup.php @@ -27,6 +27,7 @@ class WebhookTokenCleanup extends TimedJob { /** * @param array $argument */ + #[\Override] protected function run($argument): void { $this->tokenMapper->invalidateOldTokens(); } diff --git a/apps/webhook_listeners/lib/Command/ListWebhooks.php b/apps/webhook_listeners/lib/Command/ListWebhooks.php index 157097f3f15..d7df591cf19 100644 --- a/apps/webhook_listeners/lib/Command/ListWebhooks.php +++ b/apps/webhook_listeners/lib/Command/ListWebhooks.php @@ -22,6 +22,7 @@ class ListWebhooks extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -29,6 +30,7 @@ class ListWebhooks extends Base { ->setDescription('Lists configured webhook listeners'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $webhookListeners = array_map( fn (WebhookListener $listener): array => array_map( diff --git a/apps/webhook_listeners/lib/Db/EphemeralToken.php b/apps/webhook_listeners/lib/Db/EphemeralToken.php index 41aad2ba2a9..a8e698cbafa 100644 --- a/apps/webhook_listeners/lib/Db/EphemeralToken.php +++ b/apps/webhook_listeners/lib/Db/EphemeralToken.php @@ -41,6 +41,7 @@ class EphemeralToken extends Entity implements \JsonSerializable { $this->addType('createdAt', 'integer'); } + #[\Override] public function jsonSerialize(): array { $fields = array_keys($this->getFieldTypes()); return array_combine( diff --git a/apps/webhook_listeners/lib/Db/WebhookListener.php b/apps/webhook_listeners/lib/Db/WebhookListener.php index 845624c87ad..da24ab4d2c5 100644 --- a/apps/webhook_listeners/lib/Db/WebhookListener.php +++ b/apps/webhook_listeners/lib/Db/WebhookListener.php @@ -140,6 +140,7 @@ class WebhookListener extends Entity implements \JsonSerializable { $this->setAuthData($this->crypto->encrypt(json_encode($data))); } + #[\Override] public function jsonSerialize(): array { $fields = array_keys($this->getFieldTypes()); return array_combine( diff --git a/apps/webhook_listeners/lib/Listener/WebhooksEventListener.php b/apps/webhook_listeners/lib/Listener/WebhooksEventListener.php index 6cd3af98368..dfea6586ba0 100644 --- a/apps/webhook_listeners/lib/Listener/WebhooksEventListener.php +++ b/apps/webhook_listeners/lib/Listener/WebhooksEventListener.php @@ -33,6 +33,7 @@ class WebhooksEventListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { $user = $this->userSession->getUser(); $webhookListeners = $this->mapper->getByEvent($event::class, $user?->getUID()); diff --git a/apps/webhook_listeners/lib/Settings/Admin.php b/apps/webhook_listeners/lib/Settings/Admin.php index f076f348c0d..f082f14132e 100644 --- a/apps/webhook_listeners/lib/Settings/Admin.php +++ b/apps/webhook_listeners/lib/Settings/Admin.php @@ -20,23 +20,28 @@ class Admin implements IDelegatedSettings { /** * Empty template response */ + #[\Override] public function getForm(): TemplateResponse { throw new \Exception('Admin delegation settings should never be rendered'); } + #[\Override] public function getSection(): string { return Application::APP_ID . '-admin'; } + #[\Override] public function getPriority(): int { return 0; } + #[\Override] public function getName(): ?string { /* Use section name alone */ return null; } + #[\Override] public function getAuthorizedAppConfig(): array { return []; } diff --git a/apps/webhook_listeners/lib/Settings/AdminSection.php b/apps/webhook_listeners/lib/Settings/AdminSection.php index 84670ebb2d8..ac3870c0d5d 100644 --- a/apps/webhook_listeners/lib/Settings/AdminSection.php +++ b/apps/webhook_listeners/lib/Settings/AdminSection.php @@ -19,18 +19,22 @@ class AdminSection implements IIconSection { ) { } + #[\Override] public function getID(): string { return Application::APP_ID . '-admin'; } + #[\Override] public function getName(): string { return $this->l->t('Webhooks'); } + #[\Override] public function getPriority(): int { return 56; } + #[\Override] public function getIcon(): string { return ''; } diff --git a/apps/workflowengine/lib/AppInfo/Application.php b/apps/workflowengine/lib/AppInfo/Application.php index 93b0ca49260..4f02b885ade 100644 --- a/apps/workflowengine/lib/AppInfo/Application.php +++ b/apps/workflowengine/lib/AppInfo/Application.php @@ -31,6 +31,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerEventListener( LoadSettingsScriptsEvent::class, @@ -39,6 +40,7 @@ class Application extends App implements IBootstrap { ); } + #[\Override] public function boot(IBootContext $context): void { $context->injectFn(Closure::fromCallable([$this, 'registerRuleListeners'])); } diff --git a/apps/workflowengine/lib/BackgroundJobs/Rotate.php b/apps/workflowengine/lib/BackgroundJobs/Rotate.php index 0479211d925..0921ddff199 100644 --- a/apps/workflowengine/lib/BackgroundJobs/Rotate.php +++ b/apps/workflowengine/lib/BackgroundJobs/Rotate.php @@ -22,6 +22,7 @@ class Rotate extends TimedJob { $this->setInterval(60 * 60 * 3); } + #[\Override] protected function run($argument): void { $config = Server::get(IConfig::class); $appConfig = Server::get(IAppConfig::class); diff --git a/apps/workflowengine/lib/Check/AbstractStringCheck.php b/apps/workflowengine/lib/Check/AbstractStringCheck.php index 2d564705c19..8e083ba3c26 100644 --- a/apps/workflowengine/lib/Check/AbstractStringCheck.php +++ b/apps/workflowengine/lib/Check/AbstractStringCheck.php @@ -33,6 +33,7 @@ abstract class AbstractStringCheck implements ICheck { * @param string $value * @return bool */ + #[\Override] public function executeCheck($operator, $value) { $actualValue = $this->getActualValue(); return $this->executeStringCheck($operator, $value, $actualValue); @@ -64,6 +65,7 @@ abstract class AbstractStringCheck implements ICheck { * @param string $value * @throws \UnexpectedValueException */ + #[\Override] public function validateCheck($operator, $value): void { if (!in_array($operator, ['is', '!is', 'matches', '!matches'])) { throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); @@ -75,11 +77,13 @@ abstract class AbstractStringCheck implements ICheck { } } + #[\Override] public function supportedEntities(): array { // universal by default return []; } + #[\Override] public function isAvailableForScope(int $scope): bool { // admin only by default return $scope === IManager::SCOPE_ADMIN; diff --git a/apps/workflowengine/lib/Check/FileMimeType.php b/apps/workflowengine/lib/Check/FileMimeType.php index a8dfa64528e..ee156db984b 100644 --- a/apps/workflowengine/lib/Check/FileMimeType.php +++ b/apps/workflowengine/lib/Check/FileMimeType.php @@ -40,6 +40,7 @@ class FileMimeType extends AbstractStringCheck implements IFileCheck { * @param string $path * @param bool $isDir */ + #[\Override] public function setFileInfo(IStorage $storage, string $path, bool $isDir = false): void { $this->_setFileInfo($storage, $path, $isDir); if (!isset($this->mimeType[$this->storage->getId()][$this->path]) @@ -82,6 +83,7 @@ class FileMimeType extends AbstractStringCheck implements IFileCheck { * @param string $value * @return bool */ + #[\Override] public function executeCheck($operator, $value) { return $this->executeStringCheck($operator, $value, $this->getActualValue()); } @@ -89,6 +91,7 @@ class FileMimeType extends AbstractStringCheck implements IFileCheck { /** * @return string */ + #[\Override] protected function getActualValue() { if ($this->mimeType[$this->storage->getId()][$this->path] !== null) { return $this->mimeType[$this->storage->getId()][$this->path]; @@ -145,10 +148,12 @@ class FileMimeType extends AbstractStringCheck implements IFileCheck { ); } + #[\Override] public function supportedEntities(): array { return [ File::class ]; } + #[\Override] public function isAvailableForScope(int $scope): bool { return true; } diff --git a/apps/workflowengine/lib/Check/FileName.php b/apps/workflowengine/lib/Check/FileName.php index 4a9d503018f..61dd23079d7 100644 --- a/apps/workflowengine/lib/Check/FileName.php +++ b/apps/workflowengine/lib/Check/FileName.php @@ -33,6 +33,7 @@ class FileName extends AbstractStringCheck implements IFileCheck { /** * @return string */ + #[\Override] protected function getActualValue(): string { $fileName = $this->path === null ? '' : basename($this->path); if ($fileName === '' && (!$this->storage->isLocal() || $this->storage->instanceOfStorage(Local::class))) { @@ -57,6 +58,7 @@ class FileName extends AbstractStringCheck implements IFileCheck { * @param string $actualValue * @return bool */ + #[\Override] protected function executeStringCheck($operator, $checkValue, $actualValue): bool { if ($operator === 'is' || $operator === '!is') { $checkValue = mb_strtolower($checkValue); @@ -65,10 +67,12 @@ class FileName extends AbstractStringCheck implements IFileCheck { return parent::executeStringCheck($operator, $checkValue, $actualValue); } + #[\Override] public function supportedEntities(): array { return [ File::class ]; } + #[\Override] public function isAvailableForScope(int $scope): bool { return true; } diff --git a/apps/workflowengine/lib/Check/FileSize.php b/apps/workflowengine/lib/Check/FileSize.php index b3a0ba57c84..f0998cb4dcf 100644 --- a/apps/workflowengine/lib/Check/FileSize.php +++ b/apps/workflowengine/lib/Check/FileSize.php @@ -26,6 +26,7 @@ class FileSize implements ICheck { * @param string $operator * @param string $value */ + #[\Override] public function executeCheck($operator, $value): bool { $size = $this->getFileSizeFromHeader(); if ($size === false) { @@ -47,6 +48,7 @@ class FileSize implements ICheck { * @param string $value * @throws \UnexpectedValueException */ + #[\Override] public function validateCheck($operator, $value): void { if (!in_array($operator, ['less', '!less', 'greater', '!greater'])) { throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); @@ -90,10 +92,12 @@ class FileSize implements ICheck { return $this->size; } + #[\Override] public function supportedEntities(): array { return [ File::class ]; } + #[\Override] public function isAvailableForScope(int $scope): bool { return true; } diff --git a/apps/workflowengine/lib/Check/FileSystemTags.php b/apps/workflowengine/lib/Check/FileSystemTags.php index 811571f558a..c9886fecd02 100644 --- a/apps/workflowengine/lib/Check/FileSystemTags.php +++ b/apps/workflowengine/lib/Check/FileSystemTags.php @@ -44,6 +44,7 @@ class FileSystemTags implements ICheck, IFileCheck { * @param string $value * @return bool */ + #[\Override] public function executeCheck($operator, $value) { $systemTags = $this->getSystemTags(); return ($operator === 'is') === in_array($value, $systemTags); @@ -54,6 +55,7 @@ class FileSystemTags implements ICheck, IFileCheck { * @param string $value * @throws \UnexpectedValueException */ + #[\Override] public function validateCheck($operator, $value) { if (!in_array($operator, ['is', '!is'])) { throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); @@ -149,10 +151,12 @@ class FileSystemTags implements ICheck, IFileCheck { return $dir === '.' ? '' : $dir; } + #[\Override] public function supportedEntities(): array { return [ File::class ]; } + #[\Override] public function isAvailableForScope(int $scope): bool { return true; } diff --git a/apps/workflowengine/lib/Check/RequestRemoteAddress.php b/apps/workflowengine/lib/Check/RequestRemoteAddress.php index 284cf87b50f..c3f50f9967a 100644 --- a/apps/workflowengine/lib/Check/RequestRemoteAddress.php +++ b/apps/workflowengine/lib/Check/RequestRemoteAddress.php @@ -27,6 +27,7 @@ class RequestRemoteAddress implements ICheck { * @param string $value * @return bool */ + #[\Override] public function executeCheck($operator, $value) { $actualValue = $this->request->getRemoteAddress(); $decodedValue = explode('/', $value); @@ -47,6 +48,7 @@ class RequestRemoteAddress implements ICheck { * @param string $value * @throws \UnexpectedValueException */ + #[\Override] public function validateCheck($operator, $value) { if (!in_array($operator, ['matchesIPv4', '!matchesIPv4', 'matchesIPv6', '!matchesIPv6'])) { throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); @@ -120,6 +122,7 @@ class RequestRemoteAddress implements ICheck { * * @since 18.0.0 */ + #[\Override] public function supportedEntities(): array { return []; } @@ -136,6 +139,7 @@ class RequestRemoteAddress implements ICheck { * * @since 18.0.0 */ + #[\Override] public function isAvailableForScope(int $scope): bool { return true; } diff --git a/apps/workflowengine/lib/Check/RequestTime.php b/apps/workflowengine/lib/Check/RequestTime.php index a49986652b8..87b99c841d4 100644 --- a/apps/workflowengine/lib/Check/RequestTime.php +++ b/apps/workflowengine/lib/Check/RequestTime.php @@ -31,6 +31,7 @@ class RequestTime implements ICheck { * @param string $value * @return bool */ + #[\Override] public function executeCheck($operator, $value) { $valueHash = md5($value); @@ -73,6 +74,7 @@ class RequestTime implements ICheck { * @param string $value * @throws \UnexpectedValueException */ + #[\Override] public function validateCheck($operator, $value) { if (!in_array($operator, ['in', '!in'])) { throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); @@ -96,6 +98,7 @@ class RequestTime implements ICheck { } } + #[\Override] public function isAvailableForScope(int $scope): bool { return true; } @@ -108,6 +111,7 @@ class RequestTime implements ICheck { * * @since 18.0.0 */ + #[\Override] public function supportedEntities(): array { return []; } diff --git a/apps/workflowengine/lib/Check/RequestURL.php b/apps/workflowengine/lib/Check/RequestURL.php index fb2ac7e8fd5..9f64517dff4 100644 --- a/apps/workflowengine/lib/Check/RequestURL.php +++ b/apps/workflowengine/lib/Check/RequestURL.php @@ -31,6 +31,7 @@ class RequestURL extends AbstractStringCheck { * @param string $value * @return bool */ + #[\Override] public function executeCheck($operator, $value) { if (\OC::$CLI) { $actualValue = $this->url = RequestURL::CLI; @@ -53,6 +54,7 @@ class RequestURL extends AbstractStringCheck { /** * @return string */ + #[\Override] protected function getActualValue() { if ($this->url !== null) { return $this->url; diff --git a/apps/workflowengine/lib/Check/RequestUserAgent.php b/apps/workflowengine/lib/Check/RequestUserAgent.php index 572ef567074..f7eb9be0db7 100644 --- a/apps/workflowengine/lib/Check/RequestUserAgent.php +++ b/apps/workflowengine/lib/Check/RequestUserAgent.php @@ -27,6 +27,7 @@ class RequestUserAgent extends AbstractStringCheck { * @param string $value * @return bool */ + #[\Override] public function executeCheck($operator, $value) { $actualValue = $this->getActualValue(); if (in_array($operator, ['is', '!is'], true)) { @@ -59,10 +60,12 @@ class RequestUserAgent extends AbstractStringCheck { /** * @return string */ + #[\Override] protected function getActualValue() { return $this->request->getHeader('User-Agent'); } + #[\Override] public function isAvailableForScope(int $scope): bool { return true; } diff --git a/apps/workflowengine/lib/Check/UserGroupMembership.php b/apps/workflowengine/lib/Check/UserGroupMembership.php index 690f9974a49..3e65d6062f8 100644 --- a/apps/workflowengine/lib/Check/UserGroupMembership.php +++ b/apps/workflowengine/lib/Check/UserGroupMembership.php @@ -38,6 +38,7 @@ class UserGroupMembership implements ICheck { * @param string $value * @return bool */ + #[\Override] public function executeCheck($operator, $value) { $user = $this->userSession->getUser(); @@ -55,6 +56,7 @@ class UserGroupMembership implements ICheck { * @param string $value * @throws \UnexpectedValueException */ + #[\Override] public function validateCheck($operator, $value) { if (!in_array($operator, ['is', '!is'])) { throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); @@ -80,11 +82,13 @@ class UserGroupMembership implements ICheck { return $this->cachedGroupMemberships; } + #[\Override] public function supportedEntities(): array { // universal by default return []; } + #[\Override] public function isAvailableForScope(int $scope): bool { // admin only by default return $scope === IManager::SCOPE_ADMIN; diff --git a/apps/workflowengine/lib/Command/Index.php b/apps/workflowengine/lib/Command/Index.php index c38d19a087e..686980bc484 100644 --- a/apps/workflowengine/lib/Command/Index.php +++ b/apps/workflowengine/lib/Command/Index.php @@ -25,6 +25,7 @@ class Index extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('workflows:list') @@ -51,6 +52,7 @@ class Index extends Command { }; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $ops = $this->manager->getAllOperations( new ScopeContext( diff --git a/apps/workflowengine/lib/Controller/GlobalWorkflowsController.php b/apps/workflowengine/lib/Controller/GlobalWorkflowsController.php index 29ac95f3f5d..7c4dcbf0634 100644 --- a/apps/workflowengine/lib/Controller/GlobalWorkflowsController.php +++ b/apps/workflowengine/lib/Controller/GlobalWorkflowsController.php @@ -35,6 +35,7 @@ class GlobalWorkflowsController extends AWorkflowOCSController { * * 200: List of workflows returned */ + #[\Override] #[ApiRoute(verb: 'GET', url: '/api/v1/workflows/global')] public function index(): DataResponse { return parent::index(); @@ -48,6 +49,7 @@ class GlobalWorkflowsController extends AWorkflowOCSController { * * 200: Workflow returned or empty array if the ID is unknown in the scope */ + #[\Override] #[ApiRoute(verb: 'GET', url: '/api/v1/workflows/global/{id}')] public function show(string $id): DataResponse { return parent::show($id); @@ -68,6 +70,7 @@ class GlobalWorkflowsController extends AWorkflowOCSController { * * @throws OCSBadRequestException Thrown when a check or check value is invalid */ + #[\Override] #[PasswordConfirmationRequired] #[ApiRoute(verb: 'POST', url: '/api/v1/workflows/global')] public function create(string $class, string $name, array $checks, string $operation, string $entity, array $events): DataResponse { @@ -90,6 +93,7 @@ class GlobalWorkflowsController extends AWorkflowOCSController { * @throws OCSBadRequestException Thrown when a check or check value is invalid * @throws OCSForbiddenException Thrown when workflow is from a different scope */ + #[\Override] #[PasswordConfirmationRequired] #[ApiRoute(verb: 'PUT', url: '/api/v1/workflows/global/{id}')] public function update(int $id, string $name, array $checks, string $operation, string $entity, array $events): DataResponse { @@ -106,12 +110,14 @@ class GlobalWorkflowsController extends AWorkflowOCSController { * * @throws OCSForbiddenException Thrown when workflow is from a different scope */ + #[\Override] #[PasswordConfirmationRequired] #[ApiRoute(verb: 'DELETE', url: '/api/v1/workflows/global/{id}')] public function destroy(int $id): DataResponse { return parent::destroy($id); } + #[\Override] protected function getScopeContext(): ScopeContext { if ($this->scopeContext === null) { $this->scopeContext = new ScopeContext(IManager::SCOPE_ADMIN); diff --git a/apps/workflowengine/lib/Controller/UserWorkflowsController.php b/apps/workflowengine/lib/Controller/UserWorkflowsController.php index da7dd2b4208..a359e8decf2 100644 --- a/apps/workflowengine/lib/Controller/UserWorkflowsController.php +++ b/apps/workflowengine/lib/Controller/UserWorkflowsController.php @@ -51,6 +51,7 @@ class UserWorkflowsController extends AWorkflowOCSController { * * 200: List of workflows returned */ + #[\Override] #[NoAdminRequired] #[ApiRoute(verb: 'GET', url: '/api/v1/workflows/user')] public function index(): DataResponse { @@ -65,6 +66,7 @@ class UserWorkflowsController extends AWorkflowOCSController { * * 200: Workflow returned or empty array if the ID is unknown in the scope */ + #[\Override] #[NoAdminRequired] #[ApiRoute(verb: 'GET', url: '/api/v1/workflows/user/{id}')] public function show(string $id): DataResponse { @@ -86,6 +88,7 @@ class UserWorkflowsController extends AWorkflowOCSController { * * @throws OCSBadRequestException Thrown when a check or check value is invalid */ + #[\Override] #[NoAdminRequired] #[PasswordConfirmationRequired] #[ApiRoute(verb: 'POST', url: '/api/v1/workflows/user')] @@ -109,6 +112,7 @@ class UserWorkflowsController extends AWorkflowOCSController { * @throws OCSBadRequestException Thrown when a check or check value is invalid * @throws OCSForbiddenException Thrown when workflow is from a different scope */ + #[\Override] #[NoAdminRequired] #[PasswordConfirmationRequired] #[ApiRoute(verb: 'PUT', url: '/api/v1/workflows/user/{id}')] @@ -126,6 +130,7 @@ class UserWorkflowsController extends AWorkflowOCSController { * * @throws OCSForbiddenException Thrown when workflow is from a different scope */ + #[\Override] #[NoAdminRequired] #[PasswordConfirmationRequired] #[ApiRoute(verb: 'DELETE', url: '/api/v1/workflows/user/{id}')] @@ -136,6 +141,7 @@ class UserWorkflowsController extends AWorkflowOCSController { /** * @throws OCSForbiddenException */ + #[\Override] protected function getScopeContext(): ScopeContext { if ($this->scopeContext === null) { $user = $this->session->getUser(); diff --git a/apps/workflowengine/lib/Entity/File.php b/apps/workflowengine/lib/Entity/File.php index 0dc929a325b..5c04bf2bbba 100644 --- a/apps/workflowengine/lib/Entity/File.php +++ b/apps/workflowengine/lib/Entity/File.php @@ -50,14 +50,17 @@ class File implements IEntity, IDisplayText, IUrl, IIcon, IContextPortation { ) { } + #[\Override] public function getName(): string { return $this->l10n->t('File'); } + #[\Override] public function getIcon(): string { return $this->urlGenerator->imagePath('core', 'categories/files.svg'); } + #[\Override] public function getEvents(): array { return [ new GenericEntityEvent($this->l10n->t('File created'), self::EVENT_NAMESPACE . 'postCreate'), @@ -70,6 +73,7 @@ class File implements IEntity, IDisplayText, IUrl, IIcon, IContextPortation { ]; } + #[\Override] public function prepareRuleMatcher(IRuleMatcher $ruleMatcher, string $eventName, Event $event): void { if (!$event instanceof GenericEvent && !$event instanceof MapperEvent) { return; @@ -86,6 +90,7 @@ class File implements IEntity, IDisplayText, IUrl, IIcon, IContextPortation { } } + #[\Override] public function isLegitimatedForUserId(string $userId): bool { try { $node = $this->getNode(); @@ -145,6 +150,7 @@ class File implements IEntity, IDisplayText, IUrl, IIcon, IContextPortation { throw new NotFoundException(); } + #[\Override] public function getDisplayText(int $verbosity = 0): string { try { $node = $this->getNode(); @@ -193,6 +199,7 @@ class File implements IEntity, IDisplayText, IUrl, IIcon, IContextPortation { } } + #[\Override] public function getUrl(): string { try { return $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $this->getNode()->getId()]); @@ -204,6 +211,7 @@ class File implements IEntity, IDisplayText, IUrl, IIcon, IContextPortation { /** * @inheritDoc */ + #[\Override] public function exportContextIDs(): array { $nodeOwner = $this->getNode()->getOwner(); $actingUserId = null; @@ -223,6 +231,7 @@ class File implements IEntity, IDisplayText, IUrl, IIcon, IContextPortation { /** * @inheritDoc */ + #[\Override] public function importContextIDs(array $contextIDs): void { $this->eventName = $contextIDs['eventName']; if ($contextIDs['nodeOwnerId'] !== null) { @@ -240,6 +249,7 @@ class File implements IEntity, IDisplayText, IUrl, IIcon, IContextPortation { /** * @inheritDoc */ + #[\Override] public function getIconUrl(): string { return $this->getIcon(); } diff --git a/apps/workflowengine/lib/Listener/LoadAdditionalSettingsScriptsListener.php b/apps/workflowengine/lib/Listener/LoadAdditionalSettingsScriptsListener.php index 9925ab1714a..32d2d109fea 100644 --- a/apps/workflowengine/lib/Listener/LoadAdditionalSettingsScriptsListener.php +++ b/apps/workflowengine/lib/Listener/LoadAdditionalSettingsScriptsListener.php @@ -17,6 +17,7 @@ use OCP\WorkflowEngine\Events\LoadSettingsScriptsEvent; /** @template-implements IEventListener */ class LoadAdditionalSettingsScriptsListener implements IEventListener { + #[\Override] public function handle(Event $event): void { Util::addScript(Application::APP_ID, 'workflowengine'); } diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php index a0f479c4370..a23a1f55524 100644 --- a/apps/workflowengine/lib/Manager.php +++ b/apps/workflowengine/lib/Manager.php @@ -81,6 +81,7 @@ class Manager implements IManager { $this->operationsByScope = new CappedMemoryCache(64); } + #[\Override] public function getRuleMatcher(): IRuleMatcher { return new RuleMatcher( $this->session, @@ -654,14 +655,17 @@ class Manager implements IManager { return array_merge($this->getBuildInChecks(), $this->registeredChecks); } + #[\Override] public function registerEntity(IEntity $entity): void { $this->registeredEntities[get_class($entity)] = $entity; } + #[\Override] public function registerOperation(IOperation $operator): void { $this->registeredOperators[get_class($operator)] = $operator; } + #[\Override] public function registerCheck(ICheck $check): void { $this->registeredChecks[get_class($check)] = $check; } diff --git a/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php b/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php index 633d946cd7e..95c7dd22d3c 100644 --- a/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php +++ b/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php @@ -21,10 +21,12 @@ class PopulateNewlyIntroducedDatabaseFields implements IRepairStep { ) { } + #[\Override] public function getName() { return 'Populating added database structures for workflows'; } + #[\Override] public function run(IOutput $output) { $result = $this->getIdsWithoutScope(); diff --git a/apps/workflowengine/lib/Migration/Version2000Date20190808074233.php b/apps/workflowengine/lib/Migration/Version2000Date20190808074233.php index 93f423cada7..c2d8e47aa59 100644 --- a/apps/workflowengine/lib/Migration/Version2000Date20190808074233.php +++ b/apps/workflowengine/lib/Migration/Version2000Date20190808074233.php @@ -24,6 +24,7 @@ class Version2000Date20190808074233 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/workflowengine/lib/Migration/Version2200Date20210805101925.php b/apps/workflowengine/lib/Migration/Version2200Date20210805101925.php index f924b7ae8ef..e0d21d6d799 100644 --- a/apps/workflowengine/lib/Migration/Version2200Date20210805101925.php +++ b/apps/workflowengine/lib/Migration/Version2200Date20210805101925.php @@ -21,6 +21,7 @@ class Version2200Date20210805101925 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/workflowengine/lib/Service/RuleMatcher.php b/apps/workflowengine/lib/Service/RuleMatcher.php index 3353875ba1d..b92bfdcff7b 100644 --- a/apps/workflowengine/lib/Service/RuleMatcher.php +++ b/apps/workflowengine/lib/Service/RuleMatcher.php @@ -46,16 +46,19 @@ class RuleMatcher implements IRuleMatcher { ) { } + #[\Override] public function setFileInfo(IStorage $storage, string $path, bool $isDir = false): void { $this->fileInfo['storage'] = $storage; $this->fileInfo['path'] = $path; $this->fileInfo['isDir'] = $isDir; } + #[\Override] public function setEntitySubject(IEntity $entity, $subject): void { $this->contexts[get_class($entity)] = [$entity, $subject]; } + #[\Override] public function setOperation(IOperation $operation): void { if ($this->operation !== null) { throw new RuntimeException('This method must not be called more than once'); @@ -63,6 +66,7 @@ class RuleMatcher implements IRuleMatcher { $this->operation = $operation; } + #[\Override] public function setEntity(IEntity $entity): void { if ($this->entity !== null) { throw new RuntimeException('This method must not be called more than once'); @@ -70,6 +74,7 @@ class RuleMatcher implements IRuleMatcher { $this->entity = $entity; } + #[\Override] public function setEventName(string $eventName): void { if ($this->eventName !== null) { throw new RuntimeException('This method must not be called more than once'); @@ -77,6 +82,7 @@ class RuleMatcher implements IRuleMatcher { $this->eventName = $eventName; } + #[\Override] public function getEntity(): IEntity { if ($this->entity === null) { throw new \LogicException('Entity was not set yet'); @@ -84,6 +90,7 @@ class RuleMatcher implements IRuleMatcher { return $this->entity; } + #[\Override] public function getFlows(bool $returnFirstMatchingOperationOnly = true): array { if (!$this->operation) { throw new RuntimeException('Operation is not set'); diff --git a/apps/workflowengine/lib/Settings/ASettings.php b/apps/workflowengine/lib/Settings/ASettings.php index 763f04a690f..065559aaf92 100644 --- a/apps/workflowengine/lib/Settings/ASettings.php +++ b/apps/workflowengine/lib/Settings/ASettings.php @@ -36,6 +36,7 @@ abstract class ASettings implements ISettings { abstract public function getScope(): int; + #[\Override] public function getForm(): TemplateResponse { $this->eventDispatcher->dispatchTyped(new LoadSettingsScriptsEvent()); @@ -78,6 +79,7 @@ abstract class ASettings implements ISettings { /** * @return string|null the section ID, e.g. 'sharing' */ + #[\Override] public function getSection(): ?string { return 'workflow'; } @@ -89,6 +91,7 @@ abstract class ASettings implements ISettings { * * E.g.: 70 */ + #[\Override] public function getPriority(): int { return 0; } diff --git a/apps/workflowengine/lib/Settings/Admin.php b/apps/workflowengine/lib/Settings/Admin.php index c2018593c66..95c1be66a9a 100644 --- a/apps/workflowengine/lib/Settings/Admin.php +++ b/apps/workflowengine/lib/Settings/Admin.php @@ -11,6 +11,7 @@ namespace OCA\WorkflowEngine\Settings; use OCP\WorkflowEngine\IManager; class Admin extends ASettings { + #[\Override] public function getScope(): int { return IManager::SCOPE_ADMIN; } diff --git a/apps/workflowengine/lib/Settings/Personal.php b/apps/workflowengine/lib/Settings/Personal.php index 0a70f8dbe75..47442487527 100644 --- a/apps/workflowengine/lib/Settings/Personal.php +++ b/apps/workflowengine/lib/Settings/Personal.php @@ -11,10 +11,12 @@ namespace OCA\WorkflowEngine\Settings; use OCP\WorkflowEngine\IManager; class Personal extends ASettings { + #[\Override] public function getScope(): int { return IManager::SCOPE_USER; } + #[\Override] public function getSection(): ?string { return $this->manager->isUserScopeEnabled() ? 'workflow' : null; } diff --git a/apps/workflowengine/lib/Settings/Section.php b/apps/workflowengine/lib/Settings/Section.php index a1fff9d3c75..6bd26c30609 100644 --- a/apps/workflowengine/lib/Settings/Section.php +++ b/apps/workflowengine/lib/Settings/Section.php @@ -27,6 +27,7 @@ class Section implements IIconSection { /** * {@inheritdoc} */ + #[\Override] public function getID(): string { return 'workflow'; } @@ -34,6 +35,7 @@ class Section implements IIconSection { /** * {@inheritdoc} */ + #[\Override] public function getName(): string { return $this->l->t('Flow'); } @@ -41,6 +43,7 @@ class Section implements IIconSection { /** * {@inheritdoc} */ + #[\Override] public function getPriority(): int { return 55; } @@ -48,6 +51,7 @@ class Section implements IIconSection { /** * {@inheritdoc} */ + #[\Override] public function getIcon(): string { return $this->url->imagePath(Application::APP_ID, 'app-dark.svg'); } diff --git a/build/psalm-baseline-ocp.xml b/build/psalm-baseline-ocp.xml index 8500cf735be..961ef0201ff 100644 --- a/build/psalm-baseline-ocp.xml +++ b/build/psalm-baseline-ocp.xml @@ -1,5 +1,5 @@ - + diff --git a/build/psalm-baseline-security.xml b/build/psalm-baseline-security.xml index d9ab9c91076..4d890a0fa5a 100644 --- a/build/psalm-baseline-security.xml +++ b/build/psalm-baseline-security.xml @@ -1,5 +1,5 @@ - + diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 64a33276448..4b83ed5e23a 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -1,5 +1,5 @@ - + @@ -64,6 +64,11 @@ + + + + + @@ -116,6 +121,33 @@ + + RRULE]]> + + + + + stream, strlen($this->boundary))]]> + + + + + + + + strtolower($matches[0]), + urlencode($raw), + )]]> + + + + + UID]]> + vobject->getBaseComponent()->{'LAST-MODIFIED'}]]> + vobject->getBaseComponent()->{'LAST-MODIFIED'}]]> + @@ -128,16 +160,20 @@ - - - - - - VEVENT->DTSTART]]> - VEVENT->SUMMARY]]> - VEVENT->DTSTART]]> - VEVENT->SUMMARY]]> - + + PRODID]]> + VERSION]]> + DTEND]]> + DTSTART]]> + + + UID]]> + VEVENT]]> + VEVENT]]> + DTEND]]> + DTSTART]]> + {'SUMMARY'}]]> + @@ -203,11 +239,40 @@ + + + baseEvent->DTSTART]]> + + + + + PRODID]]> + VERSION]]> + + + UID]]> + PRODID]]> + VERSION]]> + VTIMEZONE]]> + VTIMEZONE]]> + VTIMEZONE]]> + + + + + source, $end - $start)]]> + + + + + source, $end - $start)]]> + + @@ -244,11 +309,11 @@ DTEND]]> - - - - - + + DTSTART]]> + DTSTART]]> + STATUS]]> + @@ -257,16 +322,19 @@ ]]> - - - - - + + DTSTART]]> + ORGANIZER]]> + + + DTSTART]]> + UID]]> + @@ -291,9 +359,35 @@ + + DTSTART]]> + VALARM]]> + VALARM]]> + ACTION]]> + ACTION]]> + ACTION]]> + DURATION]]> + DURATION]]> + REPEAT]]> + TRIGGER]]> + TRIGGER]]> + DTEND]]> + DTSTART]]> + DTSTART]]> + DURATION]]> + EXDATE]]> + RDATE]]> + RRULE]]> + STATUS]]> + {'RECURRENCE-ID'}]]> + {'RECURRENCE-ID'}]]> + {'RECURRENCE-ID'}]]> + UID]]> + UID]]> + VTIMEZONE]]> + - parent->UID]]> @@ -328,6 +422,16 @@ + + + DTSTART]]> + UID]]> + message->VEVENT]]> + message->VEVENT]]> + VEVENT]]> + {'UID'}]]> + + @@ -343,11 +447,17 @@ + + METHOD]]> + + + message->VEVENT]]> + DTSTART]]> + DTSTART]]> + DTSTART]]> + UID]]> + - - - - @@ -380,6 +490,29 @@ + + + VTIMEZONE]]> + + + + + ATTENDEE]]> + ORGANIZER]]> + SEQUENCE]]> + METHOD]]> + + + + + {'X-PUBLISHED-TTL'}]]> + + + + + UID]]> + + getKey()]]> @@ -391,6 +524,9 @@ + + UID]]> + @@ -410,22 +546,44 @@ + + UID]]> + + + UID]]> + VERSION]]> + + + + + PHOTO]]> + + + + PHOTO]]> + + + + + UID]]> + + @@ -692,9 +850,9 @@ - - DTSTAMP]]> - + + {'VEVENT'}]]> + @@ -771,6 +929,12 @@ + + + VEVENT]]> + ATTENDEE]]> + + @@ -823,32 +987,45 @@ + + + {'RECURRENCE-ID'}]]> + + getCursor()]]> + + FN]]> + PHOTO]]> + TEL]]> + UID]]> + getCursor()]]> + + DTSTART]]> + DTSTART]]> + DTSTART]]> + DTSTART]]> + DTSTART]]> + - - - - getCursor()]]> - - - - - + + COMPLETED]]> + DUE]]> + @@ -862,6 +1039,20 @@ + + + Note]]> + REV]]> + UID]]> + + + + + DTEND]]> + DTSTART]]> + UID]]> + + @@ -903,6 +1094,8 @@ + + @@ -956,6 +1149,9 @@ + + PRODID]]> + @@ -1069,7 +1265,7 @@ - + @@ -1310,6 +1506,12 @@ + + + + + + @@ -1431,6 +1633,9 @@ + + + @@ -1570,6 +1775,14 @@ + + + + + + + + @@ -2083,7 +2296,6 @@ - @@ -2265,6 +2477,14 @@ + + $tag->getId(), + 'name' => $tag->getName(), + 'assignable' => $tag->isUserAssignable(), + 'visible' => $tag->isUserVisible(), + ])]]> + getObjectId()]]> getObjectId()]]> @@ -2312,6 +2532,11 @@ + + + + + @@ -2464,12 +2689,18 @@ + + + getRgb())]]> + + + @@ -2480,6 +2711,9 @@ + + + @@ -2487,6 +2721,9 @@ + + + getCode()]]> @@ -2511,6 +2748,9 @@ + + + @@ -2544,6 +2784,12 @@ + + + + + + @@ -2646,6 +2892,16 @@ + + + + + + + + + + @@ -2704,6 +2960,10 @@ + + + + @@ -3048,6 +3308,11 @@ + + + + + filterClasses]]> @@ -3061,6 +3326,31 @@ + + + + + + enabledAppsCache]]> + + + + + + + + + + + + + + + + + + + @@ -3077,6 +3367,9 @@ + + inputStream, 'rb')]]> + getOverwriteHost()]]> cookies[$key]) ? $this->cookies[$key] : null]]> @@ -3090,6 +3383,11 @@ + + + + + @@ -3106,6 +3404,24 @@ request->server]]> + + + + + + + + + + + + + @@ -3118,6 +3434,9 @@ getCode()]]> + + appName]]> + @@ -3167,6 +3486,19 @@ providers]]> + + + + + + + + + + + + + @@ -3209,6 +3541,18 @@ return $provider->getCalendars($principalUri, $calendarUris); }, $context->getCalendarProviders())]]> + + METHOD]]> + + + VFREEBUSY]]> + VFREEBUSY]]> + + + + + + @@ -3375,6 +3719,9 @@ + + querySearchHelper->searchInCaches($query, [$this]))]]> + @@ -3407,6 +3754,11 @@ + + + querySearchHelper->searchInCaches($query, [$this]))]]> + + @@ -3427,6 +3779,14 @@ + + + + + + + + @@ -3549,6 +3909,9 @@ + + + @@ -3560,6 +3923,11 @@ + + + + + @@ -3593,6 +3961,11 @@ + + + + + @@ -3627,6 +4000,9 @@ + + + @@ -3647,11 +4023,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3716,6 +4120,11 @@ value)]]> + + + getDefaultCertificatesBundlePath())]]> + + @@ -3726,6 +4135,11 @@ + + + + + hasNoAppContainer]]> @@ -3763,6 +4177,11 @@ dbprettyname]]> + + + + + @@ -3802,6 +4221,11 @@ + + + + + diff --git a/core/AppInfo/Application.php b/core/AppInfo/Application.php index 599ab4ddda4..15cf42c4a55 100644 --- a/core/AppInfo/Application.php +++ b/core/AppInfo/Application.php @@ -53,6 +53,7 @@ class Application extends App implements IBootstrap { parent::__construct(self::APP_ID, $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { $context->registerService('defaultMailAddress', function () { return Util::getDefaultEmailAddress('lostpassword-noreply'); @@ -90,6 +91,7 @@ class Application extends App implements IBootstrap { $context->registerCapability(Capabilities::class); } + #[\Override] public function boot(IBootContext $context): void { // ... } diff --git a/core/AppInfo/Capabilities.php b/core/AppInfo/Capabilities.php index 1596b8fbe5e..d06f944a127 100644 --- a/core/AppInfo/Capabilities.php +++ b/core/AppInfo/Capabilities.php @@ -29,6 +29,7 @@ class Capabilities implements ICapability { * * @return array{core: array{'user'?: array{language: string, locale: string, timezone: string}, 'can-create-app-token'?: bool } } */ + #[\Override] public function getCapabilities(): array { $capabilities = []; diff --git a/core/AppInfo/ConfigLexicon.php b/core/AppInfo/ConfigLexicon.php index 508a090e8a4..d733b552be0 100644 --- a/core/AppInfo/ConfigLexicon.php +++ b/core/AppInfo/ConfigLexicon.php @@ -40,10 +40,12 @@ class ConfigLexicon implements ILexicon { public const ON_DEMAND_PREVIEW_MIGRATION = 'on_demand_preview_migration'; + #[\Override] public function getStrictness(): Strictness { return Strictness::IGNORE; } + #[\Override] public function getAppConfigs(): array { return [ new Entry( @@ -104,6 +106,7 @@ class ConfigLexicon implements ILexicon { ]; } + #[\Override] public function getUserConfigs(): array { return [ new Entry(self::USER_LANGUAGE, ValueType::STRING, definition: 'language'), diff --git a/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php b/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php index d1ecc08ca4b..868c517a34c 100644 --- a/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php +++ b/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php @@ -28,6 +28,7 @@ class BackgroundCleanupUpdaterBackupsJob extends QueuedJob { * * @param array $argument */ + #[\Override] public function run($argument): void { $this->log->info('Running background job to clean-up outdated updater backups'); diff --git a/core/BackgroundJobs/CheckForUserCertificates.php b/core/BackgroundJobs/CheckForUserCertificates.php index e8dd0cffbdd..aec853252ad 100644 --- a/core/BackgroundJobs/CheckForUserCertificates.php +++ b/core/BackgroundJobs/CheckForUserCertificates.php @@ -30,6 +30,7 @@ class CheckForUserCertificates extends QueuedJob { /** * Checks all user directories for old user uploaded certificates */ + #[\Override] public function run($argument): void { $uploadList = []; $this->userManager->callForSeenUsers(function (IUser $user) use (&$uploadList): void { diff --git a/core/BackgroundJobs/CleanupLoginFlowV2.php b/core/BackgroundJobs/CleanupLoginFlowV2.php index e5bcf00a921..c7e7ba3dd43 100644 --- a/core/BackgroundJobs/CleanupLoginFlowV2.php +++ b/core/BackgroundJobs/CleanupLoginFlowV2.php @@ -22,6 +22,7 @@ class CleanupLoginFlowV2 extends TimedJob { $this->setInterval(60 * 60); } + #[\Override] protected function run($argument): void { $this->loginFlowV2Mapper->cleanup(); } diff --git a/core/BackgroundJobs/ExpirePreviewsJob.php b/core/BackgroundJobs/ExpirePreviewsJob.php index baed1a6768f..34cfd58b391 100644 --- a/core/BackgroundJobs/ExpirePreviewsJob.php +++ b/core/BackgroundJobs/ExpirePreviewsJob.php @@ -15,6 +15,9 @@ use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; use OCP\IConfig; +/** + * @psalm-api - we cannot use final as this will break unit tests + */ class ExpirePreviewsJob extends TimedJob { public function __construct( ITimeFactory $time, @@ -27,6 +30,7 @@ class ExpirePreviewsJob extends TimedJob { $this->setInterval(60 * 60 * 24); } + #[\Override] protected function run(mixed $argument): void { $days = $this->config->getSystemValueInt('preview_expiration_days'); if ($days <= 0) { diff --git a/core/BackgroundJobs/GenerateMetadataJob.php b/core/BackgroundJobs/GenerateMetadataJob.php index 8cf4a65ad2b..c1d784b3cab 100644 --- a/core/BackgroundJobs/GenerateMetadataJob.php +++ b/core/BackgroundJobs/GenerateMetadataJob.php @@ -41,6 +41,7 @@ class GenerateMetadataJob extends TimedJob { $this->setInterval(24 * 60 * 60); } + #[\Override] protected function run(mixed $argument): void { if ($this->appConfig->getValueBool('core', 'metadataGenerationDone', false)) { return; diff --git a/core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php b/core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php index 86622e58758..472f4235717 100644 --- a/core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php +++ b/core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php @@ -26,6 +26,7 @@ class LookupServerSendCheckBackgroundJob extends QueuedJob { /** * @param array $argument */ + #[\Override] public function run($argument): void { $this->userManager->callForSeenUsers(function (IUser $user): void { // If the user data was not updated yet (check if LUS is enabled and if then update on LUS or delete on LUS) diff --git a/core/Command/App/Disable.php b/core/Command/App/Disable.php index 121ad3f010c..7f25959bacd 100644 --- a/core/Command/App/Disable.php +++ b/core/Command/App/Disable.php @@ -23,6 +23,7 @@ class Disable extends Command implements CompletionAwareInterface { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('app:disable') @@ -34,6 +35,7 @@ class Disable extends Command implements CompletionAwareInterface { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $appIds = $input->getArgument('app-id'); @@ -65,6 +67,7 @@ class Disable extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context): array { return []; } @@ -74,6 +77,7 @@ class Disable extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context): array { if ($argumentName === 'app-id') { return array_diff(\OC_App::getEnabledApps(true, true), $this->appManager->getAlwaysEnabledApps()); diff --git a/core/Command/App/Enable.php b/core/Command/App/Enable.php index 3936acfbf6e..8c6c11e7b9c 100644 --- a/core/Command/App/Enable.php +++ b/core/Command/App/Enable.php @@ -32,6 +32,7 @@ class Enable extends Command implements CompletionAwareInterface { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('app:enable') @@ -55,6 +56,7 @@ class Enable extends Command implements CompletionAwareInterface { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $appIds = $input->getArgument('app-id'); $groups = $this->resolveGroupIds($input->getOption('groups')); @@ -127,6 +129,7 @@ class Enable extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context): array { if ($optionName === 'groups') { return array_map(function (IGroup $group) { @@ -141,6 +144,7 @@ class Enable extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context): array { if ($argumentName === 'app-id') { $allApps = $this->appManager->getAllAppsInAppsFolders(); diff --git a/core/Command/App/GetPath.php b/core/Command/App/GetPath.php index 3ba4ed7781b..222bbd278f4 100644 --- a/core/Command/App/GetPath.php +++ b/core/Command/App/GetPath.php @@ -23,6 +23,7 @@ class GetPath extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); @@ -44,6 +45,7 @@ class GetPath extends Base { * @param OutputInterface $output An OutputInterface instance * @return int 0 if everything went fine, or an error code */ + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $appName = $input->getArgument('app'); try { @@ -61,6 +63,7 @@ class GetPath extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context): array { if ($argumentName === 'app') { return $this->appManager->getAllAppsInAppsFolders(); diff --git a/core/Command/App/Install.php b/core/Command/App/Install.php index eab0a294cc3..bc426e8d8be 100644 --- a/core/Command/App/Install.php +++ b/core/Command/App/Install.php @@ -25,6 +25,7 @@ class Install extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('app:install') @@ -55,6 +56,7 @@ class Install extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $appId = $input->getArgument('app-id'); $forceEnable = (bool)$input->getOption('force'); diff --git a/core/Command/App/ListApps.php b/core/Command/App/ListApps.php index dc947bea55f..b51bc3149d4 100644 --- a/core/Command/App/ListApps.php +++ b/core/Command/App/ListApps.php @@ -20,6 +20,7 @@ class ListApps extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); @@ -47,6 +48,7 @@ class ListApps extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false') { $shippedFilter = $input->getOption('shipped') === 'true'; @@ -127,6 +129,7 @@ class ListApps extends Base { * @param CompletionContext $context * @return array */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context): array { if ($optionName === 'shipped') { return ['true', 'false']; @@ -139,6 +142,7 @@ class ListApps extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context): array { return []; } diff --git a/core/Command/App/Remove.php b/core/Command/App/Remove.php index 7d5b5b0de69..c078488f45b 100644 --- a/core/Command/App/Remove.php +++ b/core/Command/App/Remove.php @@ -30,6 +30,7 @@ class Remove extends Command implements CompletionAwareInterface { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('app:remove') @@ -54,6 +55,7 @@ class Remove extends Command implements CompletionAwareInterface { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $appId = (string)$input->getArgument('app-id'); $keepData = (bool)$input->getOption('keep-data'); @@ -124,6 +126,7 @@ class Remove extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context): array { return []; } @@ -133,6 +136,7 @@ class Remove extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context): array { if ($argumentName === 'app-id') { // TODO: Include disabled apps too diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php index 62e22e5465d..0061b4d6e76 100644 --- a/core/Command/App/Update.php +++ b/core/Command/App/Update.php @@ -27,6 +27,7 @@ class Update extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('app:update') @@ -63,6 +64,7 @@ class Update extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $singleAppId = $input->getArgument('app-id'); $updateFound = false; diff --git a/core/Command/Background/Delete.php b/core/Command/Background/Delete.php index c0b87e215c7..c7272c1f95c 100644 --- a/core/Command/Background/Delete.php +++ b/core/Command/Background/Delete.php @@ -23,6 +23,7 @@ class Delete extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('background-job:delete') @@ -34,6 +35,7 @@ class Delete extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $jobId = (string)$input->getArgument('job-id'); diff --git a/core/Command/Background/Job.php b/core/Command/Background/Job.php index a82bfe69b26..4ab7c930b79 100644 --- a/core/Command/Background/Job.php +++ b/core/Command/Background/Job.php @@ -25,6 +25,7 @@ class Job extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('background-job:execute') @@ -43,6 +44,7 @@ class Job extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $jobId = (string)$input->getArgument('job-id'); diff --git a/core/Command/Background/JobWorker.php b/core/Command/Background/JobWorker.php index 4ce7fba1517..f7c85cc0bae 100644 --- a/core/Command/Background/JobWorker.php +++ b/core/Command/Background/JobWorker.php @@ -28,6 +28,7 @@ class JobWorker extends JobBase { ) { parent::__construct($jobList, $logger); } + #[\Override] protected function configure(): void { parent::configure(); @@ -61,6 +62,7 @@ class JobWorker extends JobBase { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $startTime = time(); $stopAfterOptionValue = $input->getOption('stop_after'); diff --git a/core/Command/Background/ListCommand.php b/core/Command/Background/ListCommand.php index c8efbfef5c7..b60e33e7800 100644 --- a/core/Command/Background/ListCommand.php +++ b/core/Command/Background/ListCommand.php @@ -21,6 +21,7 @@ class ListCommand extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('background-job:list') @@ -48,6 +49,7 @@ class ListCommand extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $limit = (int)$input->getOption('limit'); $jobsInfo = $this->formatJobs($this->jobList->getJobsIterator($input->getOption('class'), $limit, (int)$input->getOption('offset'))); diff --git a/core/Command/Background/Mode.php b/core/Command/Background/Mode.php index 4c0f40bb4a2..302f0428818 100644 --- a/core/Command/Background/Mode.php +++ b/core/Command/Background/Mode.php @@ -21,6 +21,7 @@ class Mode extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('background:cron') @@ -28,6 +29,7 @@ class Mode extends Command { ->setDescription('Use cron, ajax or webcron to run background jobs'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { /** @var 'background:cron'|'background:ajax'|'background:webcron' $command */ $command = $input->getArgument('command'); diff --git a/core/Command/Base.php b/core/Command/Base.php index 138f3ca613b..ff95eccf02a 100644 --- a/core/Command/Base.php +++ b/core/Command/Base.php @@ -27,6 +27,7 @@ class Base extends Command implements CompletionAwareInterface { private bool $php_pcntl_signal = false; private bool $interrupted = false; + #[\Override] protected function configure() { // Some of our commands do not extend this class; and some of those that do do not call parent::configure() $defaultHelp = 'More extensive and thorough documentation may be found at ' . Server::get(Defaults::class)->getDocBaseUrl() . PHP_EOL; @@ -208,6 +209,7 @@ class Base extends Command implements CompletionAwareInterface { $this->interrupted = true; } + #[\Override] public function run(InputInterface $input, OutputInterface $output): int { // check if the php pcntl_signal functions are accessible $this->php_pcntl_signal = function_exists('pcntl_signal'); @@ -225,6 +227,7 @@ class Base extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context) { if ($optionName === 'output') { return ['plain', 'json', 'json_pretty']; @@ -237,6 +240,7 @@ class Base extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { return []; } diff --git a/core/Command/Broadcast/Test.php b/core/Command/Broadcast/Test.php index eb8b49bc3ee..5419c3d8b00 100644 --- a/core/Command/Broadcast/Test.php +++ b/core/Command/Broadcast/Test.php @@ -22,6 +22,7 @@ class Test extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('broadcast:test') @@ -39,6 +40,7 @@ class Test extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $name = $input->getArgument('name'); $uid = $input->getArgument('uid'); @@ -51,16 +53,19 @@ class Test extends Command { parent::__construct(); } + #[\Override] public function broadcastAs(): string { return $this->name; } + #[\Override] public function getUids(): array { return [ $this->uid, ]; } + #[\Override] public function jsonSerialize(): array { return [ 'description' => 'this is a test event', diff --git a/core/Command/Check.php b/core/Command/Check.php index dcc9b089e1c..51499b16f8e 100644 --- a/core/Command/Check.php +++ b/core/Command/Check.php @@ -18,6 +18,7 @@ class Check extends Base { parent::__construct(); } + #[\Override] protected function configure() { parent::configure(); @@ -27,6 +28,7 @@ class Check extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $errors = \OC_Util::checkServer($this->config); if (!empty($errors)) { diff --git a/core/Command/Config/App/Base.php b/core/Command/Config/App/Base.php index e90a8e78f5b..5844b112c19 100644 --- a/core/Command/Config/App/Base.php +++ b/core/Command/Config/App/Base.php @@ -24,6 +24,7 @@ abstract class Base extends \OC\Core\Command\Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'app') { return $this->appConfig->getApps(); diff --git a/core/Command/Config/App/DeleteConfig.php b/core/Command/Config/App/DeleteConfig.php index 5a08ecbdc42..64b00275ad7 100644 --- a/core/Command/Config/App/DeleteConfig.php +++ b/core/Command/Config/App/DeleteConfig.php @@ -14,6 +14,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class DeleteConfig extends Base { + #[\Override] protected function configure() { parent::configure(); @@ -39,6 +40,7 @@ class DeleteConfig extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $appName = $input->getArgument('app'); $configName = $input->getArgument('name'); diff --git a/core/Command/Config/App/GetConfig.php b/core/Command/Config/App/GetConfig.php index af0c5648232..f118dd01f8b 100644 --- a/core/Command/Config/App/GetConfig.php +++ b/core/Command/Config/App/GetConfig.php @@ -15,6 +15,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class GetConfig extends Base { + #[\Override] protected function configure() { parent::configure(); @@ -59,6 +60,7 @@ class GetConfig extends Base { * @param OutputInterface $output An OutputInterface instance * @return int 0 if everything went fine, or an error code */ + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $appName = $input->getArgument('app'); $configName = $input->getArgument('name'); diff --git a/core/Command/Config/App/SetConfig.php b/core/Command/Config/App/SetConfig.php index 97454b353d6..8dd91070633 100644 --- a/core/Command/Config/App/SetConfig.php +++ b/core/Command/Config/App/SetConfig.php @@ -19,6 +19,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\Question; class SetConfig extends Base { + #[\Override] protected function configure() { parent::configure(); @@ -75,6 +76,7 @@ class SetConfig extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $appName = $input->getArgument('app'); $configName = $input->getArgument('name'); diff --git a/core/Command/Config/Import.php b/core/Command/Config/Import.php index b58abec3390..95989e7c44f 100644 --- a/core/Command/Config/Import.php +++ b/core/Command/Config/Import.php @@ -26,6 +26,7 @@ class Import extends Command implements CompletionAwareInterface { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('config:import') @@ -38,6 +39,7 @@ class Import extends Command implements CompletionAwareInterface { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $importFile = $input->getArgument('file'); if ($importFile !== null) { @@ -183,6 +185,7 @@ class Import extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context) { return []; } @@ -192,6 +195,7 @@ class Import extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'file') { $helper = new ShellPathCompletion( diff --git a/core/Command/Config/ListConfigs.php b/core/Command/Config/ListConfigs.php index a7c195276eb..4c683974908 100644 --- a/core/Command/Config/ListConfigs.php +++ b/core/Command/Config/ListConfigs.php @@ -28,6 +28,7 @@ class ListConfigs extends Base { parent::__construct(); } + #[\Override] protected function configure() { parent::configure(); @@ -50,6 +51,7 @@ class ListConfigs extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $app = $input->getArgument('app'); $noSensitiveValues = !$input->getOption('private'); @@ -136,6 +138,7 @@ class ListConfigs extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'app') { return array_merge(['all', 'system'], \OC_App::getAllApps()); diff --git a/core/Command/Config/Preset.php b/core/Command/Config/Preset.php index bd98bc08c96..8e5d0d6b567 100644 --- a/core/Command/Config/Preset.php +++ b/core/Command/Config/Preset.php @@ -24,6 +24,7 @@ class Preset extends Base { parent::__construct(); } + #[\Override] protected function configure() { parent::configure(); $this->setName('config:preset') @@ -34,6 +35,7 @@ class Preset extends Base { ->addOption('compare', '', InputOption::VALUE_NONE, 'compare preset'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if ($input->getOption('list')) { $this->getEnum('', $list); diff --git a/core/Command/Config/System/Base.php b/core/Command/Config/System/Base.php index 088d902b4fd..bf722e96427 100644 --- a/core/Command/Config/System/Base.php +++ b/core/Command/Config/System/Base.php @@ -21,6 +21,7 @@ abstract class Base extends \OC\Core\Command\Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'name') { $words = $this->getPreviousNames($context, $context->getWordIndex()); diff --git a/core/Command/Config/System/DeleteConfig.php b/core/Command/Config/System/DeleteConfig.php index 03960136f6f..c588b37e705 100644 --- a/core/Command/Config/System/DeleteConfig.php +++ b/core/Command/Config/System/DeleteConfig.php @@ -20,6 +20,7 @@ class DeleteConfig extends Base { parent::__construct($systemConfig); } + #[\Override] protected function configure() { parent::configure(); @@ -40,6 +41,7 @@ class DeleteConfig extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $configNames = $input->getArgument('name'); $configName = $configNames[0]; diff --git a/core/Command/Config/System/GetConfig.php b/core/Command/Config/System/GetConfig.php index c0a9623a84e..3b9571b1290 100644 --- a/core/Command/Config/System/GetConfig.php +++ b/core/Command/Config/System/GetConfig.php @@ -20,6 +20,7 @@ class GetConfig extends Base { parent::__construct($systemConfig); } + #[\Override] protected function configure() { parent::configure(); @@ -47,6 +48,7 @@ class GetConfig extends Base { * @param OutputInterface $output An OutputInterface instance * @return int 0 if everything went fine, or an error code */ + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $configNames = $input->getArgument('name'); $configName = array_shift($configNames); diff --git a/core/Command/Config/System/SetConfig.php b/core/Command/Config/System/SetConfig.php index 1b1bdc66a6e..40227f3beca 100644 --- a/core/Command/Config/System/SetConfig.php +++ b/core/Command/Config/System/SetConfig.php @@ -22,6 +22,7 @@ class SetConfig extends Base { parent::__construct($systemConfig); } + #[\Override] protected function configure() { parent::configure(); @@ -55,6 +56,7 @@ class SetConfig extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $configNames = $input->getArgument('name'); $configName = $configNames[0]; @@ -115,6 +117,7 @@ class SetConfig extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context) { if ($optionName === 'type') { return ['string', 'integer', 'double', 'boolean', 'json', 'null']; diff --git a/core/Command/Db/AddMissingColumns.php b/core/Command/Db/AddMissingColumns.php index 33b4b24a6cb..1380c708d4b 100644 --- a/core/Command/Db/AddMissingColumns.php +++ b/core/Command/Db/AddMissingColumns.php @@ -33,6 +33,7 @@ class AddMissingColumns extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('db:add-missing-columns') @@ -40,6 +41,7 @@ class AddMissingColumns extends Command { ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Output the SQL queries instead of running them.'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $dryRun = $input->getOption('dry-run'); diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index eec0aedce11..31a28ea6588 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -33,6 +33,7 @@ class AddMissingIndices extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('db:add-missing-indices') @@ -40,6 +41,7 @@ class AddMissingIndices extends Command { ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Output the SQL queries instead of running them.'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $dryRun = $input->getOption('dry-run'); diff --git a/core/Command/Db/AddMissingPrimaryKeys.php b/core/Command/Db/AddMissingPrimaryKeys.php index aed7084c946..475715a94e6 100644 --- a/core/Command/Db/AddMissingPrimaryKeys.php +++ b/core/Command/Db/AddMissingPrimaryKeys.php @@ -33,6 +33,7 @@ class AddMissingPrimaryKeys extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('db:add-missing-primary-keys') @@ -40,6 +41,7 @@ class AddMissingPrimaryKeys extends Command { ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Output the SQL queries instead of running them.'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $dryRun = $input->getOption('dry-run'); diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php index 47111063582..04b58595a39 100644 --- a/core/Command/Db/ConvertFilecacheBigInt.php +++ b/core/Command/Db/ConvertFilecacheBigInt.php @@ -24,6 +24,7 @@ class ConvertFilecacheBigInt extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('db:convert-filecache-bigint') @@ -53,6 +54,7 @@ class ConvertFilecacheBigInt extends Command { ]; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $schema = new SchemaWrapper($this->connection); $isSqlite = $this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_SQLITE; diff --git a/core/Command/Db/ConvertMysqlToMB4.php b/core/Command/Db/ConvertMysqlToMB4.php index 926e56c4300..b83da3c7c06 100644 --- a/core/Command/Db/ConvertMysqlToMB4.php +++ b/core/Command/Db/ConvertMysqlToMB4.php @@ -27,12 +27,14 @@ class ConvertMysqlToMB4 extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('db:convert-mysql-charset') ->setDescription('Convert charset of MySQL/MariaDB to use utf8mb4'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_MYSQL) { $output->writeln('This command is only valid for MySQL/MariaDB databases.'); diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index 4e7e8c604f3..f6f2df92ae2 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -45,6 +45,7 @@ class ConvertType extends Command implements CompletionAwareInterface { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('db:convert-type') @@ -159,6 +160,7 @@ class ConvertType extends Command implements CompletionAwareInterface { } } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $this->validateInput($input, $output); $this->readPassword($input, $output); @@ -446,6 +448,7 @@ class ConvertType extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context) { return []; } @@ -457,6 +460,7 @@ class ConvertType extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'type') { return ['mysql', 'oci', 'pgsql']; diff --git a/core/Command/Db/ExportSchema.php b/core/Command/Db/ExportSchema.php index 1ea0a95d2e6..3903aa9f22c 100644 --- a/core/Command/Db/ExportSchema.php +++ b/core/Command/Db/ExportSchema.php @@ -22,6 +22,7 @@ class ExportSchema extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('db:schema:export') @@ -31,6 +32,7 @@ class ExportSchema extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $schema = $this->connection->createSchema(); $sql = $input->getOption('sql'); diff --git a/core/Command/Db/Migrations/ExecuteCommand.php b/core/Command/Db/Migrations/ExecuteCommand.php index a89072c1ad1..9a813a45c8e 100644 --- a/core/Command/Db/Migrations/ExecuteCommand.php +++ b/core/Command/Db/Migrations/ExecuteCommand.php @@ -26,6 +26,7 @@ class ExecuteCommand extends Command implements CompletionAwareInterface { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('migrations:execute') @@ -41,6 +42,7 @@ class ExecuteCommand extends Command implements CompletionAwareInterface { * @param OutputInterface $output * @return int */ + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $appName = $input->getArgument('app'); $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); @@ -66,6 +68,7 @@ class ExecuteCommand extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context) { return []; } @@ -75,6 +78,7 @@ class ExecuteCommand extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'app') { $allApps = \OC_App::getAllApps(); diff --git a/core/Command/Db/Migrations/GenerateCommand.php b/core/Command/Db/Migrations/GenerateCommand.php index 5bc7a3abdf2..86ff22cffde 100644 --- a/core/Command/Db/Migrations/GenerateCommand.php +++ b/core/Command/Db/Migrations/GenerateCommand.php @@ -84,6 +84,7 @@ class {{classname}} extends SimpleMigrationStep { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('migrations:generate') @@ -94,6 +95,7 @@ class {{classname}} extends SimpleMigrationStep { parent::configure(); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $appName = $input->getArgument('app'); $version = $input->getArgument('version'); @@ -148,6 +150,7 @@ class {{classname}} extends SimpleMigrationStep { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context) { return []; } @@ -157,6 +160,7 @@ class {{classname}} extends SimpleMigrationStep { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'app') { $allApps = $this->appManager->getAllAppsInAppsFolders(); diff --git a/core/Command/Db/Migrations/GenerateMetadataCommand.php b/core/Command/Db/Migrations/GenerateMetadataCommand.php index 581259c99df..438ef112689 100644 --- a/core/Command/Db/Migrations/GenerateMetadataCommand.php +++ b/core/Command/Db/Migrations/GenerateMetadataCommand.php @@ -25,6 +25,7 @@ class GenerateMetadataCommand extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this->setName('migrations:generate-metadata') ->setHidden(true) @@ -33,6 +34,7 @@ class GenerateMetadataCommand extends Command { parent::configure(); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $output->writeln( json_encode( diff --git a/core/Command/Db/Migrations/MigrateCommand.php b/core/Command/Db/Migrations/MigrateCommand.php index 2e02f031479..23b9204db00 100644 --- a/core/Command/Db/Migrations/MigrateCommand.php +++ b/core/Command/Db/Migrations/MigrateCommand.php @@ -24,6 +24,7 @@ class MigrateCommand extends Command implements CompletionAwareInterface { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('migrations:migrate') @@ -34,6 +35,7 @@ class MigrateCommand extends Command implements CompletionAwareInterface { parent::configure(); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $appName = $input->getArgument('app'); $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); @@ -48,6 +50,7 @@ class MigrateCommand extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context) { return []; } @@ -57,6 +60,7 @@ class MigrateCommand extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'app') { $allApps = \OC_App::getAllApps(); diff --git a/core/Command/Db/Migrations/PreviewCommand.php b/core/Command/Db/Migrations/PreviewCommand.php index f5b850fff76..2177f22a3df 100644 --- a/core/Command/Db/Migrations/PreviewCommand.php +++ b/core/Command/Db/Migrations/PreviewCommand.php @@ -32,6 +32,7 @@ class PreviewCommand extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('migrations:preview') @@ -41,6 +42,7 @@ class PreviewCommand extends Command { parent::configure(); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $version = $input->getArgument('version'); if (filter_var($version, FILTER_VALIDATE_URL)) { diff --git a/core/Command/Db/Migrations/StatusCommand.php b/core/Command/Db/Migrations/StatusCommand.php index f112763c800..abbfd10ed90 100644 --- a/core/Command/Db/Migrations/StatusCommand.php +++ b/core/Command/Db/Migrations/StatusCommand.php @@ -24,6 +24,7 @@ class StatusCommand extends Command implements CompletionAwareInterface { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('migrations:status') @@ -31,6 +32,7 @@ class StatusCommand extends Command implements CompletionAwareInterface { ->addArgument('app', InputArgument::REQUIRED, 'Name of the app this migration command shall work on'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $appName = $input->getArgument('app'); $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); @@ -54,6 +56,7 @@ class StatusCommand extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context) { return []; } @@ -63,6 +66,7 @@ class StatusCommand extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'app') { $allApps = \OC_App::getAllApps(); diff --git a/core/Command/Encryption/ChangeKeyStorageRoot.php b/core/Command/Encryption/ChangeKeyStorageRoot.php index 3049fd2ca08..ee914f73f0b 100644 --- a/core/Command/Encryption/ChangeKeyStorageRoot.php +++ b/core/Command/Encryption/ChangeKeyStorageRoot.php @@ -32,6 +32,7 @@ class ChangeKeyStorageRoot extends Command { parent::__construct(); } + #[\Override] protected function configure() { parent::configure(); $this @@ -44,6 +45,7 @@ class ChangeKeyStorageRoot extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $oldRoot = $this->util->getKeyStorageRoot(); $newRoot = $input->getArgument('newRoot'); diff --git a/core/Command/Encryption/DecryptAll.php b/core/Command/Encryption/DecryptAll.php index f3133fa33e8..85a70b49cec 100644 --- a/core/Command/Encryption/DecryptAll.php +++ b/core/Command/Encryption/DecryptAll.php @@ -52,6 +52,7 @@ class DecryptAll extends Command { } } + #[\Override] protected function configure() { parent::configure(); @@ -70,6 +71,7 @@ class DecryptAll extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if (!$input->isInteractive()) { $output->writeln('Invalid TTY.'); diff --git a/core/Command/Encryption/Disable.php b/core/Command/Encryption/Disable.php index d6b92a9f236..fe280daa111 100644 --- a/core/Command/Encryption/Disable.php +++ b/core/Command/Encryption/Disable.php @@ -21,6 +21,7 @@ class Disable extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('encryption:disable') @@ -28,6 +29,7 @@ class Disable extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if ($this->config->getAppValue('core', 'encryption_enabled', 'no') !== 'yes') { $output->writeln('Encryption is already disabled'); diff --git a/core/Command/Encryption/Enable.php b/core/Command/Encryption/Enable.php index c5f7bc6e0e6..02c61025001 100644 --- a/core/Command/Encryption/Enable.php +++ b/core/Command/Encryption/Enable.php @@ -23,6 +23,7 @@ class Enable extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('encryption:enable') @@ -30,6 +31,7 @@ class Enable extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if ($this->config->getAppValue('core', 'encryption_enabled', 'no') === 'yes') { $output->writeln('Encryption is already enabled'); diff --git a/core/Command/Encryption/EncryptAll.php b/core/Command/Encryption/EncryptAll.php index f6cdb2aa155..dfdf9c98a2e 100644 --- a/core/Command/Encryption/EncryptAll.php +++ b/core/Command/Encryption/EncryptAll.php @@ -49,6 +49,7 @@ class EncryptAll extends Command { } } + #[\Override] protected function configure() { parent::configure(); @@ -63,6 +64,7 @@ class EncryptAll extends Command { /** * @throws \Exception */ + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if (!$input->isInteractive() && !$input->getOption('no-interaction')) { $output->writeln('Invalid TTY.'); diff --git a/core/Command/Encryption/ListModules.php b/core/Command/Encryption/ListModules.php index bf02c29f432..3c5af72c701 100644 --- a/core/Command/Encryption/ListModules.php +++ b/core/Command/Encryption/ListModules.php @@ -21,6 +21,7 @@ class ListModules extends Base { parent::__construct(); } + #[\Override] protected function configure() { parent::configure(); @@ -30,6 +31,7 @@ class ListModules extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); if ($isMaintenanceModeEnabled) { diff --git a/core/Command/Encryption/MigrateKeyStorage.php b/core/Command/Encryption/MigrateKeyStorage.php index 937b17cde5f..0b61572fdc0 100644 --- a/core/Command/Encryption/MigrateKeyStorage.php +++ b/core/Command/Encryption/MigrateKeyStorage.php @@ -30,6 +30,7 @@ class MigrateKeyStorage extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -37,6 +38,7 @@ class MigrateKeyStorage extends Command { ->setDescription('Migrate the format of the keystorage to a newer format'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $root = $this->util->getKeyStorageRoot(); diff --git a/core/Command/Encryption/SetDefaultModule.php b/core/Command/Encryption/SetDefaultModule.php index d10872afd38..5324cd8cdee 100644 --- a/core/Command/Encryption/SetDefaultModule.php +++ b/core/Command/Encryption/SetDefaultModule.php @@ -22,6 +22,7 @@ class SetDefaultModule extends Command { parent::__construct(); } + #[\Override] protected function configure() { parent::configure(); @@ -36,6 +37,7 @@ class SetDefaultModule extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); if ($isMaintenanceModeEnabled) { diff --git a/core/Command/Encryption/ShowKeyStorageRoot.php b/core/Command/Encryption/ShowKeyStorageRoot.php index 17649a260d0..e717983bf25 100644 --- a/core/Command/Encryption/ShowKeyStorageRoot.php +++ b/core/Command/Encryption/ShowKeyStorageRoot.php @@ -21,6 +21,7 @@ class ShowKeyStorageRoot extends Command { parent::__construct(); } + #[\Override] protected function configure() { parent::configure(); $this @@ -28,6 +29,7 @@ class ShowKeyStorageRoot extends Command { ->setDescription('Show current key storage root'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $currentRoot = $this->util->getKeyStorageRoot(); diff --git a/core/Command/Encryption/Status.php b/core/Command/Encryption/Status.php index 7e8d0bd0c01..f8602236ffd 100644 --- a/core/Command/Encryption/Status.php +++ b/core/Command/Encryption/Status.php @@ -21,6 +21,7 @@ class Status extends Base { parent::__construct(); } + #[\Override] protected function configure() { parent::configure(); @@ -30,6 +31,7 @@ class Status extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $this->writeArrayInOutputFormat($input, $output, [ 'enabled' => $this->encryptionManager->isEnabled(), diff --git a/core/Command/FilesMetadata/Get.php b/core/Command/FilesMetadata/Get.php index 0b022d0951b..1f9e7cb53c7 100644 --- a/core/Command/FilesMetadata/Get.php +++ b/core/Command/FilesMetadata/Get.php @@ -29,6 +29,7 @@ class Get extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this->setName('metadata:get') ->setDescription('get stored metadata about a file, by its id') @@ -68,6 +69,7 @@ class Get extends Command { * @throws NoUserException * @throws NotFoundException */ + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $fileId = (int)$input->getArgument('fileId'); diff --git a/core/Command/Group/Add.php b/core/Command/Group/Add.php index 26d44c7ea83..a6d40178be6 100644 --- a/core/Command/Group/Add.php +++ b/core/Command/Group/Add.php @@ -23,6 +23,7 @@ class Add extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('group:add') @@ -40,6 +41,7 @@ class Add extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $gid = $input->getArgument('groupid'); $group = $this->groupManager->get($gid); diff --git a/core/Command/Group/AddUser.php b/core/Command/Group/AddUser.php index 2a74452949d..2f006485063 100644 --- a/core/Command/Group/AddUser.php +++ b/core/Command/Group/AddUser.php @@ -24,6 +24,7 @@ class AddUser extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('group:adduser') @@ -39,6 +40,7 @@ class AddUser extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $group = $this->groupManager->get($input->getArgument('group')); if (is_null($group)) { @@ -59,6 +61,7 @@ class AddUser extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'group') { return array_map(static fn (IGroup $group) => $group->getGID(), $this->groupManager->search($context->getCurrentWord())); diff --git a/core/Command/Group/Delete.php b/core/Command/Group/Delete.php index a2736476920..4c548e83b18 100644 --- a/core/Command/Group/Delete.php +++ b/core/Command/Group/Delete.php @@ -23,6 +23,7 @@ class Delete extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('group:delete') @@ -34,6 +35,7 @@ class Delete extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $gid = $input->getArgument('groupid'); if ($gid === 'admin') { @@ -59,6 +61,7 @@ class Delete extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'groupid') { return array_map(static fn (IGroup $group) => $group->getGID(), $this->groupManager->search($context->getCurrentWord())); diff --git a/core/Command/Group/Info.php b/core/Command/Group/Info.php index d42d2a64577..71492507086 100644 --- a/core/Command/Group/Info.php +++ b/core/Command/Group/Info.php @@ -24,6 +24,7 @@ class Info extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('group:info') @@ -41,6 +42,7 @@ class Info extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $gid = $input->getArgument('groupid'); $group = $this->groupManager->get($gid); @@ -64,6 +66,7 @@ class Info extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'groupid') { return array_map(static fn (IGroup $group) => $group->getGID(), $this->groupManager->search($context->getCurrentWord())); diff --git a/core/Command/Group/ListCommand.php b/core/Command/Group/ListCommand.php index 01522a23f7f..c80dc52f4ac 100644 --- a/core/Command/Group/ListCommand.php +++ b/core/Command/Group/ListCommand.php @@ -21,6 +21,7 @@ class ListCommand extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('group:list') @@ -57,6 +58,7 @@ class ListCommand extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $groups = $this->groupManager->search((string)$input->getArgument('searchstring'), (int)$input->getOption('limit'), (int)$input->getOption('offset')); $this->writeArrayInOutputFormat($input, $output, $this->formatGroups($groups, (bool)$input->getOption('info'))); diff --git a/core/Command/Group/RemoveUser.php b/core/Command/Group/RemoveUser.php index 952fc6e7712..3ca3d261821 100644 --- a/core/Command/Group/RemoveUser.php +++ b/core/Command/Group/RemoveUser.php @@ -24,6 +24,7 @@ class RemoveUser extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('group:removeuser') @@ -39,6 +40,7 @@ class RemoveUser extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $group = $this->groupManager->get($input->getArgument('group')); if (is_null($group)) { @@ -59,6 +61,7 @@ class RemoveUser extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'group') { return array_map(static fn (IGroup $group) => $group->getGID(), $this->groupManager->search($context->getCurrentWord())); diff --git a/core/Command/Info/File.php b/core/Command/Info/File.php index eb9657e62c3..4f5a04e521d 100644 --- a/core/Command/Info/File.php +++ b/core/Command/Info/File.php @@ -43,6 +43,7 @@ class File extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('info:file') @@ -52,6 +53,7 @@ class File extends Command { ->addOption('storage-tree', null, InputOption::VALUE_NONE, 'Show storage and cache wrapping tree'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $fileInput = $input->getArgument('file'); $showChildren = $input->getOption('children'); diff --git a/core/Command/Info/Space.php b/core/Command/Info/Space.php index 35c1d5c3228..990de828986 100644 --- a/core/Command/Info/Space.php +++ b/core/Command/Info/Space.php @@ -23,6 +23,7 @@ class Space extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('info:file:space') @@ -32,6 +33,7 @@ class Space extends Command { ->addOption('all', 'a', InputOption::VALUE_NONE, 'Display all items'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $fileInput = $input->getArgument('file'); $count = (int)$input->getOption('count'); diff --git a/core/Command/Info/Storage.php b/core/Command/Info/Storage.php index c1d0e1725ca..5f3263e7ce3 100644 --- a/core/Command/Info/Storage.php +++ b/core/Command/Info/Storage.php @@ -22,6 +22,7 @@ class Storage extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -30,6 +31,7 @@ class Storage extends Base { ->addArgument('storage', InputArgument::REQUIRED, 'Storage to get information for'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $storage = $input->getArgument('storage'); $storageId = $this->fileUtils->getNumericStorageId($storage); diff --git a/core/Command/Info/Storages.php b/core/Command/Info/Storages.php index ff767a2ff5d..75c3eb3625c 100644 --- a/core/Command/Info/Storages.php +++ b/core/Command/Info/Storages.php @@ -22,6 +22,7 @@ class Storages extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -31,6 +32,7 @@ class Storages extends Base { ->addOption('all', 'a', InputOption::VALUE_NONE, 'Display all storages'); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { $count = (int)$input->getOption('count'); $all = $input->getOption('all'); diff --git a/core/Command/Integrity/CheckApp.php b/core/Command/Integrity/CheckApp.php index df9e9973aa7..d4fdf5190e0 100644 --- a/core/Command/Integrity/CheckApp.php +++ b/core/Command/Integrity/CheckApp.php @@ -34,6 +34,7 @@ class CheckApp extends Base { /** * {@inheritdoc } */ + #[\Override] protected function configure() { parent::configure(); $this @@ -47,6 +48,7 @@ class CheckApp extends Base { /** * {@inheritdoc } */ + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if ($input->getOption('all') && $input->getArgument('appid')) { $output->writeln('Option "--all" cannot be combined with an appid'); diff --git a/core/Command/Integrity/CheckCore.php b/core/Command/Integrity/CheckCore.php index 1eee2679b70..750da22286c 100644 --- a/core/Command/Integrity/CheckCore.php +++ b/core/Command/Integrity/CheckCore.php @@ -29,6 +29,7 @@ class CheckCore extends Base { /** * {@inheritdoc } */ + #[\Override] protected function configure() { parent::configure(); $this @@ -39,6 +40,7 @@ class CheckCore extends Base { /** * {@inheritdoc } */ + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if (!$this->checker->isCodeCheckEnforced()) { $output->writeln('integrity:check-core can not be used on git checkouts'); diff --git a/core/Command/Integrity/SignApp.php b/core/Command/Integrity/SignApp.php index d307bc58985..a9c1cbb7be1 100644 --- a/core/Command/Integrity/SignApp.php +++ b/core/Command/Integrity/SignApp.php @@ -31,6 +31,7 @@ class SignApp extends Command { parent::__construct(null); } + #[\Override] protected function configure() { $this ->setName('integrity:sign-app') @@ -43,6 +44,7 @@ class SignApp extends Command { /** * {@inheritdoc } */ + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $path = $input->getOption('path'); $privateKeyPath = $input->getOption('privateKey'); diff --git a/core/Command/Integrity/SignCore.php b/core/Command/Integrity/SignCore.php index ed80091ec38..bd46e0e4f51 100644 --- a/core/Command/Integrity/SignCore.php +++ b/core/Command/Integrity/SignCore.php @@ -29,6 +29,7 @@ class SignCore extends Command { parent::__construct(null); } + #[\Override] protected function configure() { $this ->setName('integrity:sign-core') @@ -41,6 +42,7 @@ class SignCore extends Command { /** * {@inheritdoc } */ + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $privateKeyPath = $input->getOption('privateKey'); $keyBundlePath = $input->getOption('certificate'); diff --git a/core/Command/L10n/CreateJs.php b/core/Command/L10n/CreateJs.php index 64a21e6d48c..d4eee220e5f 100644 --- a/core/Command/L10n/CreateJs.php +++ b/core/Command/L10n/CreateJs.php @@ -28,6 +28,7 @@ class CreateJs extends Command implements CompletionAwareInterface { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('l10n:createjs') @@ -44,6 +45,7 @@ class CreateJs extends Command implements CompletionAwareInterface { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $app = $input->getArgument('app'); $lang = $input->getArgument('lang'); @@ -135,6 +137,7 @@ class CreateJs extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context) { return []; } @@ -146,6 +149,7 @@ class CreateJs extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'app') { return $this->appManager->getAllAppsInAppsFolders(); diff --git a/core/Command/Log/File.php b/core/Command/Log/File.php index ba5dad956e9..aa87ea59305 100644 --- a/core/Command/Log/File.php +++ b/core/Command/Log/File.php @@ -25,6 +25,7 @@ class File extends Command implements Completion\CompletionAwareInterface { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('log:file') @@ -50,6 +51,7 @@ class File extends Command implements Completion\CompletionAwareInterface { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $toBeSet = []; @@ -113,6 +115,7 @@ class File extends Command implements Completion\CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context) { if ($optionName === 'file') { $helper = new ShellPathCompletion( @@ -132,6 +135,7 @@ class File extends Command implements Completion\CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { return []; } diff --git a/core/Command/Log/Manage.php b/core/Command/Log/Manage.php index f67f0d969f6..c04ddf837a0 100644 --- a/core/Command/Log/Manage.php +++ b/core/Command/Log/Manage.php @@ -26,6 +26,7 @@ class Manage extends Command implements CompletionAwareInterface { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('log:manage') @@ -51,6 +52,7 @@ class Manage extends Command implements CompletionAwareInterface { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { // collate config setting to the end, to avoid partial configuration $toBeSet = []; @@ -163,6 +165,7 @@ class Manage extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context) { if ($optionName === 'backend') { return ['file', 'syslog', 'errorlog', 'systemd']; @@ -179,6 +182,7 @@ class Manage extends Command implements CompletionAwareInterface { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { return []; } diff --git a/core/Command/Maintenance/DataFingerprint.php b/core/Command/Maintenance/DataFingerprint.php index 014d6c411a4..99be354f09d 100644 --- a/core/Command/Maintenance/DataFingerprint.php +++ b/core/Command/Maintenance/DataFingerprint.php @@ -21,12 +21,14 @@ class DataFingerprint extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('maintenance:data-fingerprint') ->setDescription('update the systems data-fingerprint after a backup is restored'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $fingerPrint = md5($this->timeFactory->getTime()); $this->config->setSystemValue('data-fingerprint', $fingerPrint); diff --git a/core/Command/Maintenance/Install.php b/core/Command/Maintenance/Install.php index 63826d8a331..c91f500aa72 100644 --- a/core/Command/Maintenance/Install.php +++ b/core/Command/Maintenance/Install.php @@ -33,6 +33,7 @@ class Install extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('maintenance:install') @@ -53,6 +54,7 @@ class Install extends Command { ->addOption('server-secret', null, InputOption::VALUE_OPTIONAL, 'Server secret, at least ' . Setup::MIN_SECRET_LENGTH . ' characters (will be randomly generated if not provided)'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { // validate the environment $setupHelper = Server::get(Setup::class); diff --git a/core/Command/Maintenance/Mimetype/UpdateDB.php b/core/Command/Maintenance/Mimetype/UpdateDB.php index 4467e89eb32..3636e7d96ec 100644 --- a/core/Command/Maintenance/Mimetype/UpdateDB.php +++ b/core/Command/Maintenance/Mimetype/UpdateDB.php @@ -25,6 +25,7 @@ class UpdateDB extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('maintenance:mimetype:update-db') @@ -38,6 +39,7 @@ class UpdateDB extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $mappings = $this->mimetypeDetector->getAllMappings(); diff --git a/core/Command/Maintenance/Mimetype/UpdateJS.php b/core/Command/Maintenance/Mimetype/UpdateJS.php index 2132ff54c6d..a9e7e79db19 100644 --- a/core/Command/Maintenance/Mimetype/UpdateJS.php +++ b/core/Command/Maintenance/Mimetype/UpdateJS.php @@ -20,12 +20,14 @@ class UpdateJS extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('maintenance:mimetype:update-js') ->setDescription('Update mimetypelist.js'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { // Fetch all the aliases $aliases = $this->mimetypeDetector->getAllAliases(); diff --git a/core/Command/Maintenance/Mode.php b/core/Command/Maintenance/Mode.php index 19a12398022..7f8cfe4e012 100644 --- a/core/Command/Maintenance/Mode.php +++ b/core/Command/Maintenance/Mode.php @@ -23,6 +23,7 @@ class Mode extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('maintenance:mode') @@ -42,6 +43,7 @@ class Mode extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $maintenanceMode = $this->config->getSystemValueBool('maintenance'); if ($input->getOption('on')) { diff --git a/core/Command/Maintenance/Repair.php b/core/Command/Maintenance/Repair.php index 7b5959871c9..a79d296e520 100644 --- a/core/Command/Maintenance/Repair.php +++ b/core/Command/Maintenance/Repair.php @@ -39,6 +39,7 @@ class Repair extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('maintenance:repair') @@ -50,6 +51,7 @@ class Repair extends Command { 'Use this option when you want to include resource and load expensive tasks'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $includeExpensive = (bool)$input->getOption('include-expensive'); $repairSteps = $this->repair::getRepairSteps($includeExpensive); diff --git a/core/Command/Maintenance/RepairShareOwnership.php b/core/Command/Maintenance/RepairShareOwnership.php index 6556d7ee707..3288943dc56 100644 --- a/core/Command/Maintenance/RepairShareOwnership.php +++ b/core/Command/Maintenance/RepairShareOwnership.php @@ -29,6 +29,7 @@ class RepairShareOwnership extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('maintenance:repair-share-owner') @@ -37,6 +38,7 @@ class RepairShareOwnership extends Command { ->addArgument('user', InputArgument::OPTIONAL, 'User to fix incoming shares for, if omitted all users will be fixed'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $noConfirm = $input->getOption('no-confirm'); $userId = $input->getArgument('user'); diff --git a/core/Command/Maintenance/UpdateHtaccess.php b/core/Command/Maintenance/UpdateHtaccess.php index b4a99ddba34..881b5187ba3 100644 --- a/core/Command/Maintenance/UpdateHtaccess.php +++ b/core/Command/Maintenance/UpdateHtaccess.php @@ -15,12 +15,14 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class UpdateHtaccess extends Command { + #[\Override] protected function configure() { $this ->setName('maintenance:update:htaccess') ->setDescription('Updates the .htaccess file'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if (Setup::updateHtaccess()) { $output->writeln('.htaccess has been updated'); diff --git a/core/Command/Maintenance/UpdateTheme.php b/core/Command/Maintenance/UpdateTheme.php index d4c85ec020d..d077032935b 100644 --- a/core/Command/Maintenance/UpdateTheme.php +++ b/core/Command/Maintenance/UpdateTheme.php @@ -23,12 +23,14 @@ class UpdateTheme extends UpdateJS { parent::__construct($mimetypeDetector); } + #[\Override] protected function configure() { $this ->setName('maintenance:theme:update') ->setDescription('Apply custom theme changes'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { // run mimetypelist.js update since themes might change mimetype icons parent::execute($input, $output); diff --git a/core/Command/Memcache/DistributedClear.php b/core/Command/Memcache/DistributedClear.php index 424f21f1e81..73f9c0d9224 100644 --- a/core/Command/Memcache/DistributedClear.php +++ b/core/Command/Memcache/DistributedClear.php @@ -21,6 +21,7 @@ class DistributedClear extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('memcache:distributed:clear') @@ -29,6 +30,7 @@ class DistributedClear extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $cache = $this->cacheFactory->createDistributed(); $prefix = $input->getOption('prefix'); diff --git a/core/Command/Memcache/DistributedDelete.php b/core/Command/Memcache/DistributedDelete.php index ae0855acb03..d7654e357d2 100644 --- a/core/Command/Memcache/DistributedDelete.php +++ b/core/Command/Memcache/DistributedDelete.php @@ -21,6 +21,7 @@ class DistributedDelete extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('memcache:distributed:delete') @@ -29,6 +30,7 @@ class DistributedDelete extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $cache = $this->cacheFactory->createDistributed(); $key = $input->getArgument('key'); diff --git a/core/Command/Memcache/DistributedGet.php b/core/Command/Memcache/DistributedGet.php index bf1b00d312d..1612cebad4f 100644 --- a/core/Command/Memcache/DistributedGet.php +++ b/core/Command/Memcache/DistributedGet.php @@ -21,6 +21,7 @@ class DistributedGet extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('memcache:distributed:get') @@ -29,6 +30,7 @@ class DistributedGet extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $cache = $this->cacheFactory->createDistributed(); $key = $input->getArgument('key'); diff --git a/core/Command/Memcache/DistributedSet.php b/core/Command/Memcache/DistributedSet.php index 0f31c22f730..1f06029a258 100644 --- a/core/Command/Memcache/DistributedSet.php +++ b/core/Command/Memcache/DistributedSet.php @@ -24,6 +24,7 @@ class DistributedSet extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('memcache:distributed:set') @@ -40,6 +41,7 @@ class DistributedSet extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $cache = $this->cacheFactory->createDistributed(); $key = $input->getArgument('key'); diff --git a/core/Command/Memcache/RedisCommand.php b/core/Command/Memcache/RedisCommand.php index 1d1a7243d21..4de4f8b885a 100644 --- a/core/Command/Memcache/RedisCommand.php +++ b/core/Command/Memcache/RedisCommand.php @@ -23,6 +23,7 @@ class RedisCommand extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('memcache:redis:command') @@ -31,6 +32,7 @@ class RedisCommand extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $command = $input->getArgument('redis-command'); if (!$this->redisFactory->isAvailable()) { diff --git a/core/Command/Preview/Cleanup.php b/core/Command/Preview/Cleanup.php index b4cab0b1c9c..56508c3f0f0 100644 --- a/core/Command/Preview/Cleanup.php +++ b/core/Command/Preview/Cleanup.php @@ -30,12 +30,14 @@ class Cleanup extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('preview:cleanup') ->setDescription('Removes existing preview files'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if ($this->deletePreviewFromPreviewTable($output) !== 0) { return 1; diff --git a/core/Command/Preview/Generate.php b/core/Command/Preview/Generate.php index 222c42f613b..f827586c6b1 100644 --- a/core/Command/Preview/Generate.php +++ b/core/Command/Preview/Generate.php @@ -29,6 +29,7 @@ class Generate extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('preview:generate') @@ -39,6 +40,7 @@ class Generate extends Command { ->addOption('mode', 'm', InputOption::VALUE_REQUIRED, "mode for generating uncropped previews, 'cover' or 'fill'", IPreview::MODE_FILL); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $fileInput = $input->getArgument('file'); $sizes = $input->getOption('size'); diff --git a/core/Command/Router/ListRoutes.php b/core/Command/Router/ListRoutes.php index 8932b549a65..4dee82464e3 100644 --- a/core/Command/Router/ListRoutes.php +++ b/core/Command/Router/ListRoutes.php @@ -27,6 +27,7 @@ class ListRoutes extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -52,6 +53,7 @@ class ListRoutes extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $apps = $input->getArgument('app'); if (empty($apps)) { diff --git a/core/Command/Router/MatchRoute.php b/core/Command/Router/MatchRoute.php index 3b90463c7b2..a6b4262369d 100644 --- a/core/Command/Router/MatchRoute.php +++ b/core/Command/Router/MatchRoute.php @@ -29,6 +29,7 @@ class MatchRoute extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -49,6 +50,7 @@ class MatchRoute extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $context = new RequestContext(method: strtoupper($input->getOption('method'))); $this->router->setContext($context); diff --git a/core/Command/Security/BruteforceAttempts.php b/core/Command/Security/BruteforceAttempts.php index d5fa0a284fd..10bd5809d28 100644 --- a/core/Command/Security/BruteforceAttempts.php +++ b/core/Command/Security/BruteforceAttempts.php @@ -20,6 +20,7 @@ class BruteforceAttempts extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); $this @@ -38,6 +39,7 @@ class BruteforceAttempts extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $ip = $input->getArgument('ipaddress'); diff --git a/core/Command/Security/BruteforceResetAttempts.php b/core/Command/Security/BruteforceResetAttempts.php index 6987c0ef682..f882f1d0263 100644 --- a/core/Command/Security/BruteforceResetAttempts.php +++ b/core/Command/Security/BruteforceResetAttempts.php @@ -20,6 +20,7 @@ class BruteforceResetAttempts extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('security:bruteforce:reset') @@ -31,6 +32,7 @@ class BruteforceResetAttempts extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $ip = $input->getArgument('ipaddress'); diff --git a/core/Command/Security/ExportCertificates.php b/core/Command/Security/ExportCertificates.php index dcf34d4bce4..0af78e595f5 100644 --- a/core/Command/Security/ExportCertificates.php +++ b/core/Command/Security/ExportCertificates.php @@ -20,12 +20,14 @@ class ExportCertificates extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('security:certificates:export') ->setDescription('export the certificate bundle'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $bundlePath = $this->certificateManager->getAbsoluteBundlePath(); $bundle = file_get_contents($bundlePath); diff --git a/core/Command/Security/ImportCertificate.php b/core/Command/Security/ImportCertificate.php index b23612baeb1..b2fdabd3237 100644 --- a/core/Command/Security/ImportCertificate.php +++ b/core/Command/Security/ImportCertificate.php @@ -20,6 +20,7 @@ class ImportCertificate extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('security:certificates:import') @@ -31,6 +32,7 @@ class ImportCertificate extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $path = $input->getArgument('path'); diff --git a/core/Command/Security/ListCertificates.php b/core/Command/Security/ListCertificates.php index cf1874a09d3..0692d8204fb 100644 --- a/core/Command/Security/ListCertificates.php +++ b/core/Command/Security/ListCertificates.php @@ -27,6 +27,7 @@ class ListCertificates extends Base { $this->l = $l10nFactory->get('core'); } + #[\Override] protected function configure() { $this ->setName('security:certificates') @@ -34,6 +35,7 @@ class ListCertificates extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $outputType = $input->getOption('output'); if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) { diff --git a/core/Command/Security/RemoveCertificate.php b/core/Command/Security/RemoveCertificate.php index 48062724d52..4c37eb0670b 100644 --- a/core/Command/Security/RemoveCertificate.php +++ b/core/Command/Security/RemoveCertificate.php @@ -20,6 +20,7 @@ class RemoveCertificate extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('security:certificates:remove') @@ -31,6 +32,7 @@ class RemoveCertificate extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $name = $input->getArgument('name'); diff --git a/core/Command/SetupChecks.php b/core/Command/SetupChecks.php index 6ef67726839..c8f7aa4c51d 100644 --- a/core/Command/SetupChecks.php +++ b/core/Command/SetupChecks.php @@ -22,6 +22,7 @@ class SetupChecks extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); @@ -31,6 +32,7 @@ class SetupChecks extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $results = $this->setupCheckManager->runAll(); switch ($input->getOption('output')) { diff --git a/core/Command/SnowflakeDecodeId.php b/core/Command/SnowflakeDecodeId.php index e9993077aae..4c75488ab1a 100644 --- a/core/Command/SnowflakeDecodeId.php +++ b/core/Command/SnowflakeDecodeId.php @@ -21,6 +21,7 @@ class SnowflakeDecodeId extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); @@ -30,6 +31,7 @@ class SnowflakeDecodeId extends Base { ->addArgument('snowflake-id', InputArgument::REQUIRED, 'Nextcloud Snowflake ID to decode'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $snowflakeId = $input->getArgument('snowflake-id'); $data = $this->decoder->decode($snowflakeId); diff --git a/core/Command/Status.php b/core/Command/Status.php index b76da40ba20..77aaa537419 100644 --- a/core/Command/Status.php +++ b/core/Command/Status.php @@ -26,6 +26,7 @@ class Status extends Base { parent::__construct('status'); } + #[\Override] protected function configure() { parent::configure(); @@ -39,6 +40,7 @@ class Status extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $maintenanceMode = $this->config->getSystemValueBool('maintenance', false); $needUpgrade = Util::needUpgrade(); diff --git a/core/Command/SystemTag/Add.php b/core/Command/SystemTag/Add.php index df8b507b07d..7e2006d6aff 100644 --- a/core/Command/SystemTag/Add.php +++ b/core/Command/SystemTag/Add.php @@ -21,6 +21,7 @@ class Add extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('tag:add') @@ -38,6 +39,7 @@ class Add extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $name = $input->getArgument('name'); if ($name === '') { diff --git a/core/Command/SystemTag/Delete.php b/core/Command/SystemTag/Delete.php index f657f4473ab..93a2d015bfc 100644 --- a/core/Command/SystemTag/Delete.php +++ b/core/Command/SystemTag/Delete.php @@ -20,6 +20,7 @@ class Delete extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('tag:delete') @@ -31,6 +32,7 @@ class Delete extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { try { $this->systemTagManager->deleteTags($input->getArgument('id')); diff --git a/core/Command/SystemTag/Edit.php b/core/Command/SystemTag/Edit.php index 09c662e58e9..6e6295c486d 100644 --- a/core/Command/SystemTag/Edit.php +++ b/core/Command/SystemTag/Edit.php @@ -21,6 +21,7 @@ class Edit extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('tag:edit') @@ -50,6 +51,7 @@ class Edit extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $tagArray = $this->systemTagManager->getTagsByIds($input->getArgument('id')); // returns an array, but we always expect 0 or 1 results diff --git a/core/Command/SystemTag/ListCommand.php b/core/Command/SystemTag/ListCommand.php index 2c6435d6faf..c96e6af405f 100644 --- a/core/Command/SystemTag/ListCommand.php +++ b/core/Command/SystemTag/ListCommand.php @@ -20,6 +20,7 @@ class ListCommand extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('tag:list') @@ -39,6 +40,7 @@ class ListCommand extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $tags = $this->systemTagManager->getAllTags( $input->getOption('visibilityFilter'), diff --git a/core/Command/TaskProcessing/Cleanup.php b/core/Command/TaskProcessing/Cleanup.php index b032bf898f9..63a5cee393e 100644 --- a/core/Command/TaskProcessing/Cleanup.php +++ b/core/Command/TaskProcessing/Cleanup.php @@ -32,6 +32,7 @@ class Cleanup extends Base { $this->appData = $appDataFactory->get('core'); } + #[\Override] protected function configure() { $this ->setName('taskprocessing:task:cleanup') @@ -45,6 +46,7 @@ class Cleanup extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $maxAgeSeconds = (int)($input->getArgument('maxAgeSeconds') ?? Manager::MAX_TASK_AGE_SECONDS); $output->writeln('Cleanup up tasks older than ' . $maxAgeSeconds . ' seconds and the related output files'); diff --git a/core/Command/TaskProcessing/EnabledCommand.php b/core/Command/TaskProcessing/EnabledCommand.php index a99e3e001b9..c0136398104 100644 --- a/core/Command/TaskProcessing/EnabledCommand.php +++ b/core/Command/TaskProcessing/EnabledCommand.php @@ -23,6 +23,7 @@ class EnabledCommand extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('taskprocessing:task-type:set-enabled') @@ -40,6 +41,7 @@ class EnabledCommand extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $enabled = (bool)$input->getArgument('enabled'); $taskType = $input->getArgument('task-type-id'); diff --git a/core/Command/TaskProcessing/GetCommand.php b/core/Command/TaskProcessing/GetCommand.php index f97556281a1..f7cfe3c8750 100644 --- a/core/Command/TaskProcessing/GetCommand.php +++ b/core/Command/TaskProcessing/GetCommand.php @@ -21,6 +21,7 @@ class GetCommand extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('taskprocessing:task:get') @@ -33,6 +34,7 @@ class GetCommand extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $taskId = (int)$input->getArgument('task-id'); $task = $this->taskProcessingManager->getTask($taskId); diff --git a/core/Command/TaskProcessing/ListCommand.php b/core/Command/TaskProcessing/ListCommand.php index 59ede7d2e1d..0fb208ad72a 100644 --- a/core/Command/TaskProcessing/ListCommand.php +++ b/core/Command/TaskProcessing/ListCommand.php @@ -22,6 +22,7 @@ class ListCommand extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('taskprocessing:task:list') @@ -71,6 +72,7 @@ class ListCommand extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $userIdFilter = $input->getOption('userIdFilter'); if ($userIdFilter === null) { diff --git a/core/Command/TaskProcessing/Statistics.php b/core/Command/TaskProcessing/Statistics.php index 84aaf812651..4a8622efefb 100644 --- a/core/Command/TaskProcessing/Statistics.php +++ b/core/Command/TaskProcessing/Statistics.php @@ -22,6 +22,7 @@ class Statistics extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('taskprocessing:task:stats') @@ -71,6 +72,7 @@ class Statistics extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $userIdFilter = $input->getOption('userIdFilter'); if ($userIdFilter === null) { diff --git a/core/Command/TaskProcessing/WorkerCommand.php b/core/Command/TaskProcessing/WorkerCommand.php index 09f3f3573d2..2fb2aa30ff3 100644 --- a/core/Command/TaskProcessing/WorkerCommand.php +++ b/core/Command/TaskProcessing/WorkerCommand.php @@ -27,6 +27,7 @@ class WorkerCommand extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('taskprocessing:worker') @@ -60,6 +61,7 @@ class WorkerCommand extends Base { parent::configure(); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $startTime = time(); $timeout = (int)$input->getOption('timeout'); diff --git a/core/Command/TwoFactorAuth/Base.php b/core/Command/TwoFactorAuth/Base.php index ec4faf0835b..8d417eb4400 100644 --- a/core/Command/TwoFactorAuth/Base.php +++ b/core/Command/TwoFactorAuth/Base.php @@ -25,6 +25,7 @@ class Base extends \OC\Core\Command\Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeOptionValues($optionName, CompletionContext $context) { return []; } @@ -36,6 +37,7 @@ class Base extends \OC\Core\Command\Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'uid') { return array_map(function (IUser $user) { diff --git a/core/Command/TwoFactorAuth/Cleanup.php b/core/Command/TwoFactorAuth/Cleanup.php index f8f116af3fd..02fa86251d6 100644 --- a/core/Command/TwoFactorAuth/Cleanup.php +++ b/core/Command/TwoFactorAuth/Cleanup.php @@ -25,6 +25,7 @@ class Cleanup extends Base { ); } + #[\Override] protected function configure() { parent::configure(); @@ -33,6 +34,7 @@ class Cleanup extends Base { $this->addArgument('provider-id', InputArgument::REQUIRED); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $providerId = $input->getArgument('provider-id'); diff --git a/core/Command/TwoFactorAuth/Disable.php b/core/Command/TwoFactorAuth/Disable.php index c60c1245735..201dd9c1991 100644 --- a/core/Command/TwoFactorAuth/Disable.php +++ b/core/Command/TwoFactorAuth/Disable.php @@ -24,6 +24,7 @@ class Disable extends Base { ); } + #[\Override] protected function configure() { parent::configure(); @@ -33,6 +34,7 @@ class Disable extends Base { $this->addArgument('provider_id', InputArgument::REQUIRED); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $uid = $input->getArgument('uid'); $providerId = $input->getArgument('provider_id'); diff --git a/core/Command/TwoFactorAuth/Enable.php b/core/Command/TwoFactorAuth/Enable.php index 215cb31397e..7158a4695fd 100644 --- a/core/Command/TwoFactorAuth/Enable.php +++ b/core/Command/TwoFactorAuth/Enable.php @@ -24,6 +24,7 @@ class Enable extends Base { ); } + #[\Override] protected function configure() { parent::configure(); @@ -33,6 +34,7 @@ class Enable extends Base { $this->addArgument('provider_id', InputArgument::REQUIRED); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $uid = $input->getArgument('uid'); $providerId = $input->getArgument('provider_id'); diff --git a/core/Command/TwoFactorAuth/Enforce.php b/core/Command/TwoFactorAuth/Enforce.php index 3315f045bc8..dfa6ce362e1 100644 --- a/core/Command/TwoFactorAuth/Enforce.php +++ b/core/Command/TwoFactorAuth/Enforce.php @@ -23,6 +23,7 @@ class Enforce extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this->setName('twofactorauth:enforce'); $this->setDescription('Enabled/disable enforced two-factor authentication'); @@ -52,6 +53,7 @@ class Enforce extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if ($input->getOption('on')) { $enforcedGroups = $input->getOption('group'); diff --git a/core/Command/TwoFactorAuth/State.php b/core/Command/TwoFactorAuth/State.php index ab2e8f2aecf..dc718cb0c8b 100644 --- a/core/Command/TwoFactorAuth/State.php +++ b/core/Command/TwoFactorAuth/State.php @@ -25,6 +25,7 @@ class State extends Base { ); } + #[\Override] protected function configure() { parent::configure(); @@ -33,6 +34,7 @@ class State extends Base { $this->addArgument('uid', InputArgument::REQUIRED); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $uid = $input->getArgument('uid'); $user = $this->userManager->get($uid); diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php index fbf7768ec74..20c2ec0d5ef 100644 --- a/core/Command/Upgrade.php +++ b/core/Command/Upgrade.php @@ -43,6 +43,7 @@ class Upgrade extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('upgrade') @@ -55,6 +56,7 @@ class Upgrade extends Command { * @param InputInterface $input input interface * @param OutputInterface $output output interface */ + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { if (Util::needUpgrade()) { if ($output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) { diff --git a/core/Command/User/Add.php b/core/Command/User/Add.php index 440bced4c2e..35a4dca5cc1 100644 --- a/core/Command/User/Add.php +++ b/core/Command/User/Add.php @@ -39,6 +39,7 @@ class Add extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('user:add') @@ -80,6 +81,7 @@ class Add extends Command { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $uid = $input->getArgument('uid'); if ($this->userManager->userExists($uid)) { diff --git a/core/Command/User/AuthTokens/Add.php b/core/Command/User/AuthTokens/Add.php index e7bf9a59a2a..bbfd7f38cea 100644 --- a/core/Command/User/AuthTokens/Add.php +++ b/core/Command/User/AuthTokens/Add.php @@ -32,6 +32,7 @@ class Add extends Command { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('user:auth-tokens:add') @@ -57,6 +58,7 @@ class Add extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $username = $input->getArgument('user'); $password = null; diff --git a/core/Command/User/AuthTokens/Delete.php b/core/Command/User/AuthTokens/Delete.php index 2047d2eae2a..2c7a958d9a7 100644 --- a/core/Command/User/AuthTokens/Delete.php +++ b/core/Command/User/AuthTokens/Delete.php @@ -23,6 +23,7 @@ class Delete extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('user:auth-tokens:delete') @@ -45,6 +46,7 @@ class Delete extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $uid = $input->getArgument('uid'); $id = (int)$input->getArgument('id'); diff --git a/core/Command/User/AuthTokens/ListCommand.php b/core/Command/User/AuthTokens/ListCommand.php index b36aa717505..7b26090735f 100644 --- a/core/Command/User/AuthTokens/ListCommand.php +++ b/core/Command/User/AuthTokens/ListCommand.php @@ -22,6 +22,7 @@ class ListCommand extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { parent::configure(); @@ -35,6 +36,7 @@ class ListCommand extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = $this->userManager->get($input->getArgument('user')); diff --git a/core/Command/User/ClearGeneratedAvatarCacheCommand.php b/core/Command/User/ClearGeneratedAvatarCacheCommand.php index 515b3a913b7..ff9073dcf4b 100644 --- a/core/Command/User/ClearGeneratedAvatarCacheCommand.php +++ b/core/Command/User/ClearGeneratedAvatarCacheCommand.php @@ -20,12 +20,14 @@ class ClearGeneratedAvatarCacheCommand extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setDescription('clear avatar cache') ->setName('user:clear-avatar-cache'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $output->writeln('Clearing avatar cache has started'); $this->avatarManager->clearCachedAvatars(); diff --git a/core/Command/User/Delete.php b/core/Command/User/Delete.php index c5d0578f5f8..c8cc5beb98a 100644 --- a/core/Command/User/Delete.php +++ b/core/Command/User/Delete.php @@ -22,6 +22,7 @@ class Delete extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('user:delete') @@ -33,6 +34,7 @@ class Delete extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = $this->userManager->get($input->getArgument('uid')); if (is_null($user)) { @@ -54,6 +56,7 @@ class Delete extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'uid') { return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord())); diff --git a/core/Command/User/Disable.php b/core/Command/User/Disable.php index 71d7d3087c4..c13cbb4a4e5 100644 --- a/core/Command/User/Disable.php +++ b/core/Command/User/Disable.php @@ -22,6 +22,7 @@ class Disable extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('user:disable') @@ -33,6 +34,7 @@ class Disable extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = $this->userManager->get($input->getArgument('uid')); if (is_null($user)) { @@ -50,6 +52,7 @@ class Disable extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'uid') { return array_map( diff --git a/core/Command/User/Enable.php b/core/Command/User/Enable.php index 7edd1849886..be6888ac65b 100644 --- a/core/Command/User/Enable.php +++ b/core/Command/User/Enable.php @@ -22,6 +22,7 @@ class Enable extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('user:enable') @@ -33,6 +34,7 @@ class Enable extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = $this->userManager->get($input->getArgument('uid')); if (is_null($user)) { @@ -50,6 +52,7 @@ class Enable extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'uid') { return array_map( diff --git a/core/Command/User/Info.php b/core/Command/User/Info.php index 4be0caefae3..f9c7600800f 100644 --- a/core/Command/User/Info.php +++ b/core/Command/User/Info.php @@ -27,6 +27,7 @@ class Info extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('user:info') @@ -44,6 +45,7 @@ class Info extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $user = $this->userManager->get($input->getArgument('user')); if (is_null($user)) { @@ -105,6 +107,7 @@ class Info extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'user') { return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->searchDisplayName($context->getCurrentWord())); diff --git a/core/Command/User/Keys/Verify.php b/core/Command/User/Keys/Verify.php index 053a51049e8..6113eaedad5 100644 --- a/core/Command/User/Keys/Verify.php +++ b/core/Command/User/Keys/Verify.php @@ -26,6 +26,7 @@ class Verify extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('user:keys:verify') @@ -49,6 +50,7 @@ class Verify extends Command { * @param OutputInterface $output * @return int */ + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $userId = $input->getArgument('user-id'); diff --git a/core/Command/User/LastSeen.php b/core/Command/User/LastSeen.php index 514396f9f52..fdbbe13915e 100644 --- a/core/Command/User/LastSeen.php +++ b/core/Command/User/LastSeen.php @@ -23,6 +23,7 @@ class LastSeen extends Base { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('user:lastseen') @@ -41,6 +42,7 @@ class LastSeen extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $singleUserId = $input->getArgument('uid'); @@ -86,6 +88,7 @@ class LastSeen extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'uid') { return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->searchDisplayName($context->getCurrentWord())); diff --git a/core/Command/User/ListCommand.php b/core/Command/User/ListCommand.php index ec2d94e101a..bbd835e0f3c 100644 --- a/core/Command/User/ListCommand.php +++ b/core/Command/User/ListCommand.php @@ -22,6 +22,7 @@ class ListCommand extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('user:list') @@ -57,6 +58,7 @@ class ListCommand extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $limit = (int)$input->getOption('limit'); $offset = (int)$input->getOption('offset'); diff --git a/core/Command/User/Profile.php b/core/Command/User/Profile.php index b12dc697cb3..e4ec87c5f02 100644 --- a/core/Command/User/Profile.php +++ b/core/Command/User/Profile.php @@ -28,6 +28,7 @@ class Profile extends Base { parent::__construct(); } + #[\Override] protected function configure() { parent::configure(); $this @@ -125,6 +126,7 @@ class Profile extends Base { return $user; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { try { $user = $this->checkInput($input); @@ -213,6 +215,7 @@ class Profile extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context): array { if ($argumentName === 'uid') { return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->searchDisplayName($context->getCurrentWord())); diff --git a/core/Command/User/Report.php b/core/Command/User/Report.php index c0f054adb00..c8d6b5bcb50 100644 --- a/core/Command/User/Report.php +++ b/core/Command/User/Report.php @@ -28,6 +28,7 @@ class Report extends Command { parent::__construct(); } + #[\Override] protected function configure(): void { $this ->setName('user:report') @@ -41,6 +42,7 @@ class Report extends Command { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $table = new Table($output); $table->setHeaders(['Account Report', '']); diff --git a/core/Command/User/ResetPassword.php b/core/Command/User/ResetPassword.php index cdda5df1c18..59b4b40c0f9 100644 --- a/core/Command/User/ResetPassword.php +++ b/core/Command/User/ResetPassword.php @@ -28,6 +28,7 @@ class ResetPassword extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('user:resetpassword') @@ -52,6 +53,7 @@ class ResetPassword extends Base { ; } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $username = $input->getArgument('user'); @@ -136,6 +138,7 @@ class ResetPassword extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'user') { return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->searchDisplayName($context->getCurrentWord())); diff --git a/core/Command/User/Setting.php b/core/Command/User/Setting.php index 7fc5aab1dc7..17b11fa0838 100644 --- a/core/Command/User/Setting.php +++ b/core/Command/User/Setting.php @@ -25,6 +25,7 @@ class Setting extends Base { parent::__construct(); } + #[\Override] protected function configure() { parent::configure(); $this @@ -131,6 +132,7 @@ class Setting extends Base { } } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { try { $this->checkInput($input); @@ -244,6 +246,7 @@ class Setting extends Base { * @param CompletionContext $context * @return string[] */ + #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'uid') { return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord())); diff --git a/core/Command/User/SyncAccountDataCommand.php b/core/Command/User/SyncAccountDataCommand.php index c353df6fe9f..1cbbca7fc20 100644 --- a/core/Command/User/SyncAccountDataCommand.php +++ b/core/Command/User/SyncAccountDataCommand.php @@ -24,6 +24,7 @@ class SyncAccountDataCommand extends Base { parent::__construct(); } + #[\Override] protected function configure() { $this ->setName('user:sync-account-data') @@ -43,6 +44,7 @@ class SyncAccountDataCommand extends Base { ); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $users = $this->userManager->searchDisplayName('', (int)$input->getOption('limit'), (int)$input->getOption('offset')); diff --git a/core/Command/User/Welcome.php b/core/Command/User/Welcome.php index 65637759689..75a4c550015 100644 --- a/core/Command/User/Welcome.php +++ b/core/Command/User/Welcome.php @@ -30,6 +30,7 @@ class Welcome extends Base { /** * @return void */ + #[\Override] protected function configure() { $this ->setName('user:welcome') @@ -53,6 +54,7 @@ class Welcome extends Base { * @param OutputInterface $output * @return int */ + #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $userId = $input->getArgument('user'); // check if user exists diff --git a/core/Data/LoginFlowV2Credentials.php b/core/Data/LoginFlowV2Credentials.php index 0997b2cbe06..211d6a23696 100644 --- a/core/Data/LoginFlowV2Credentials.php +++ b/core/Data/LoginFlowV2Credentials.php @@ -37,6 +37,7 @@ class LoginFlowV2Credentials implements \JsonSerializable { return $this->appPassword; } + #[\Override] public function jsonSerialize(): array { return [ 'server' => $this->server, diff --git a/core/Db/ProfileConfig.php b/core/Db/ProfileConfig.php index c61b3921a9f..125e5ac205f 100644 --- a/core/Db/ProfileConfig.php +++ b/core/Db/ProfileConfig.php @@ -98,6 +98,7 @@ class ProfileConfig extends Entity implements JsonSerializable { $this->setVisibilityMap($visibilityMap); } + #[\Override] public function jsonSerialize(): array { return [ 'userId' => $this->userId, diff --git a/core/Listener/AddMissingIndicesListener.php b/core/Listener/AddMissingIndicesListener.php index f1d93218a41..f91bad7998b 100644 --- a/core/Listener/AddMissingIndicesListener.php +++ b/core/Listener/AddMissingIndicesListener.php @@ -23,6 +23,7 @@ class AddMissingIndicesListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof AddMissingIndicesEvent)) { return; diff --git a/core/Listener/AddMissingPrimaryKeyListener.php b/core/Listener/AddMissingPrimaryKeyListener.php index 1cd6951c9a1..98b6542b4d7 100644 --- a/core/Listener/AddMissingPrimaryKeyListener.php +++ b/core/Listener/AddMissingPrimaryKeyListener.php @@ -18,6 +18,7 @@ use OCP\EventDispatcher\IEventListener; */ class AddMissingPrimaryKeyListener implements IEventListener { + #[\Override] public function handle(Event $event): void { if (!($event instanceof AddMissingPrimaryKeyEvent)) { return; diff --git a/core/Listener/BeforeMessageLoggedEventListener.php b/core/Listener/BeforeMessageLoggedEventListener.php index 9010f7755eb..b203094ca1c 100644 --- a/core/Listener/BeforeMessageLoggedEventListener.php +++ b/core/Listener/BeforeMessageLoggedEventListener.php @@ -26,6 +26,7 @@ class BeforeMessageLoggedEventListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof BeforeMessageLoggedEvent) { return; diff --git a/core/Listener/BeforeTemplateRenderedListener.php b/core/Listener/BeforeTemplateRenderedListener.php index 714083bf424..949d58eea55 100644 --- a/core/Listener/BeforeTemplateRenderedListener.php +++ b/core/Listener/BeforeTemplateRenderedListener.php @@ -23,6 +23,7 @@ class BeforeTemplateRenderedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof BeforeTemplateRenderedEvent || $event instanceof BeforeLoginTemplateRenderedEvent)) { return; diff --git a/core/Listener/PasswordUpdatedListener.php b/core/Listener/PasswordUpdatedListener.php index 4830c767442..6d9e815cd44 100644 --- a/core/Listener/PasswordUpdatedListener.php +++ b/core/Listener/PasswordUpdatedListener.php @@ -24,6 +24,7 @@ class PasswordUpdatedListener implements IEventListener { } + #[\Override] public function handle(Event $event): void { if ($event instanceof PasswordUpdatedEvent) { $this->verificationToken->delete('', $event->getUser(), 'lostpassword'); diff --git a/core/Middleware/TwoFactorMiddleware.php b/core/Middleware/TwoFactorMiddleware.php index ffbcc2ce3da..e2ea5296a04 100644 --- a/core/Middleware/TwoFactorMiddleware.php +++ b/core/Middleware/TwoFactorMiddleware.php @@ -45,6 +45,7 @@ class TwoFactorMiddleware extends Middleware { * @param Controller $controller * @param string $methodName */ + #[\Override] public function beforeController($controller, $methodName) { if ($this->reflector->hasAnnotationOrAttribute('NoTwoFactorRequired', NoTwoFactorRequired::class)) { // Route handler explicitly marked to work without finished 2FA are @@ -118,6 +119,7 @@ class TwoFactorMiddleware extends Middleware { } } + #[\Override] public function afterException($controller, $methodName, Exception $exception) { if ($exception instanceof TwoFactorAuthRequiredException) { $params = [ diff --git a/core/Migrations/Version13000Date20170705121758.php b/core/Migrations/Version13000Date20170705121758.php index 17262cf0743..effc0e7fc25 100644 --- a/core/Migrations/Version13000Date20170705121758.php +++ b/core/Migrations/Version13000Date20170705121758.php @@ -19,6 +19,7 @@ class Version13000Date20170705121758 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php index 933cd49f784..2de0c2b9ba0 100644 --- a/core/Migrations/Version13000Date20170718121200.php +++ b/core/Migrations/Version13000Date20170718121200.php @@ -18,6 +18,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep { ) { } + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -43,6 +44,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -1000,6 +1002,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep { return $schema; } + #[\Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version13000Date20170814074715.php b/core/Migrations/Version13000Date20170814074715.php index 6e7ca19fc3c..beb492ac557 100644 --- a/core/Migrations/Version13000Date20170814074715.php +++ b/core/Migrations/Version13000Date20170814074715.php @@ -17,6 +17,7 @@ class Version13000Date20170814074715 extends SimpleMigrationStep { * @param array $options * @since 13.0.0 */ + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { } @@ -27,6 +28,7 @@ class Version13000Date20170814074715 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -55,6 +57,7 @@ class Version13000Date20170814074715 extends SimpleMigrationStep { * @param array $options * @since 13.0.0 */ + #[\Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { } } diff --git a/core/Migrations/Version13000Date20170919121250.php b/core/Migrations/Version13000Date20170919121250.php index b3e9541d605..104c3739c43 100644 --- a/core/Migrations/Version13000Date20170919121250.php +++ b/core/Migrations/Version13000Date20170919121250.php @@ -20,6 +20,7 @@ class Version13000Date20170919121250 extends SimpleMigrationStep { * @param array $options * @since 13.0.0 */ + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { } @@ -30,6 +31,7 @@ class Version13000Date20170919121250 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -110,6 +112,7 @@ class Version13000Date20170919121250 extends SimpleMigrationStep { * @param array $options * @since 13.0.0 */ + #[\Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { } } diff --git a/core/Migrations/Version13000Date20170926101637.php b/core/Migrations/Version13000Date20170926101637.php index 61bb690be08..4c14168c87a 100644 --- a/core/Migrations/Version13000Date20170926101637.php +++ b/core/Migrations/Version13000Date20170926101637.php @@ -19,6 +19,7 @@ class Version13000Date20170926101637 extends BigIntMigration { * ['table1' => ['column1', 'column2'], ...] * @since 13.0.0 */ + #[\Override] protected function getColumnsByTable() { return [ 'admin_settings' => ['id'], diff --git a/core/Migrations/Version14000Date20180129121024.php b/core/Migrations/Version14000Date20180129121024.php index c16d95ed71b..cc9b19de588 100644 --- a/core/Migrations/Version14000Date20180129121024.php +++ b/core/Migrations/Version14000Date20180129121024.php @@ -14,10 +14,12 @@ use OCP\Migration\SimpleMigrationStep; * Delete the admin|personal sections and settings tables */ class Version14000Date20180129121024 extends SimpleMigrationStep { + #[\Override] public function name(): string { return 'Drop obsolete settings tables'; } + #[\Override] public function description(): string { return 'Drops the following obsolete tables: "admin_sections", "admin_settings", "personal_sections" and "personal_settings"'; } @@ -29,6 +31,7 @@ class Version14000Date20180129121024 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version14000Date20180404140050.php b/core/Migrations/Version14000Date20180404140050.php index 6f477f7fcdc..b512af080d9 100644 --- a/core/Migrations/Version14000Date20180404140050.php +++ b/core/Migrations/Version14000Date20180404140050.php @@ -22,10 +22,12 @@ class Version14000Date20180404140050 extends SimpleMigrationStep { ) { } + #[\Override] public function name(): string { return 'Add lowercase user id column to users table'; } + #[\Override] public function description(): string { return 'Adds "uid_lower" column to the users table and fills the column to allow indexed case-insensitive searches'; } @@ -36,6 +38,7 @@ class Version14000Date20180404140050 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -57,6 +60,7 @@ class Version14000Date20180404140050 extends SimpleMigrationStep { * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { $qb = $this->connection->getQueryBuilder(); diff --git a/core/Migrations/Version14000Date20180516101403.php b/core/Migrations/Version14000Date20180516101403.php index a71673a9674..d4ddf083f39 100644 --- a/core/Migrations/Version14000Date20180516101403.php +++ b/core/Migrations/Version14000Date20180516101403.php @@ -17,6 +17,7 @@ class Version14000Date20180516101403 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version14000Date20180518120534.php b/core/Migrations/Version14000Date20180518120534.php index 850862070ab..b7d65cd3f25 100644 --- a/core/Migrations/Version14000Date20180518120534.php +++ b/core/Migrations/Version14000Date20180518120534.php @@ -13,6 +13,7 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version14000Date20180518120534 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version14000Date20180522074438.php b/core/Migrations/Version14000Date20180522074438.php index e605d674daa..4e90d9fbc0d 100644 --- a/core/Migrations/Version14000Date20180522074438.php +++ b/core/Migrations/Version14000Date20180522074438.php @@ -14,6 +14,7 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version14000Date20180522074438 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { $schema = $schemaClosure(); diff --git a/core/Migrations/Version14000Date20180710092004.php b/core/Migrations/Version14000Date20180710092004.php index dffaef0fe0c..81fc3b61988 100644 --- a/core/Migrations/Version14000Date20180710092004.php +++ b/core/Migrations/Version14000Date20180710092004.php @@ -14,6 +14,7 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version14000Date20180710092004 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version14000Date20180712153140.php b/core/Migrations/Version14000Date20180712153140.php index b1a295ea2f6..89d50bdc338 100644 --- a/core/Migrations/Version14000Date20180712153140.php +++ b/core/Migrations/Version14000Date20180712153140.php @@ -16,6 +16,7 @@ use OCP\Migration\SimpleMigrationStep; * Class Version14000Date20180712153140 */ class Version14000Date20180712153140 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version15000Date20180926101451.php b/core/Migrations/Version15000Date20180926101451.php index 6e254a3f840..be2cc70ad6c 100644 --- a/core/Migrations/Version15000Date20180926101451.php +++ b/core/Migrations/Version15000Date20180926101451.php @@ -20,6 +20,7 @@ class Version15000Date20180926101451 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version15000Date20181015062942.php b/core/Migrations/Version15000Date20181015062942.php index 83fc9a61ade..ddde2a2ca84 100644 --- a/core/Migrations/Version15000Date20181015062942.php +++ b/core/Migrations/Version15000Date20181015062942.php @@ -20,6 +20,7 @@ class Version15000Date20181015062942 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version15000Date20181029084625.php b/core/Migrations/Version15000Date20181029084625.php index 06c307d00d2..65a45bb7bdb 100644 --- a/core/Migrations/Version15000Date20181029084625.php +++ b/core/Migrations/Version15000Date20181029084625.php @@ -20,6 +20,7 @@ class Version15000Date20181029084625 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version16000Date20190207141427.php b/core/Migrations/Version16000Date20190207141427.php index 3e94748062b..291eb56ecce 100644 --- a/core/Migrations/Version16000Date20190207141427.php +++ b/core/Migrations/Version16000Date20190207141427.php @@ -21,6 +21,7 @@ class Version16000Date20190207141427 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version16000Date20190212081545.php b/core/Migrations/Version16000Date20190212081545.php index bb45f411bcd..f9c077e1470 100644 --- a/core/Migrations/Version16000Date20190212081545.php +++ b/core/Migrations/Version16000Date20190212081545.php @@ -22,6 +22,7 @@ class Version16000Date20190212081545 extends SimpleMigrationStep { * * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version16000Date20190427105638.php b/core/Migrations/Version16000Date20190427105638.php index 98a81e1a2ff..9e98cee0d07 100644 --- a/core/Migrations/Version16000Date20190427105638.php +++ b/core/Migrations/Version16000Date20190427105638.php @@ -25,6 +25,7 @@ class Version16000Date20190427105638 extends SimpleMigrationStep { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { $this->connection ->getQueryBuilder() @@ -39,6 +40,7 @@ class Version16000Date20190427105638 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @throws \Doctrine\DBAL\Schema\SchemaException */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version16000Date20190428150708.php b/core/Migrations/Version16000Date20190428150708.php index 1dcc108a0d7..95c9bb0b690 100644 --- a/core/Migrations/Version16000Date20190428150708.php +++ b/core/Migrations/Version16000Date20190428150708.php @@ -22,6 +22,7 @@ class Version16000Date20190428150708 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @throws \Doctrine\DBAL\Schema\SchemaException */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version17000Date20190514105811.php b/core/Migrations/Version17000Date20190514105811.php index b603e85c8f6..e15619e57f3 100644 --- a/core/Migrations/Version17000Date20190514105811.php +++ b/core/Migrations/Version17000Date20190514105811.php @@ -21,6 +21,7 @@ class Version17000Date20190514105811 extends SimpleMigrationStep { * @param array $options * @return ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version18000Date20190920085628.php b/core/Migrations/Version18000Date20190920085628.php index ed48792d694..e07ce3fbfb9 100644 --- a/core/Migrations/Version18000Date20190920085628.php +++ b/core/Migrations/Version18000Date20190920085628.php @@ -27,6 +27,7 @@ class Version18000Date20190920085628 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -51,6 +52,7 @@ class Version18000Date20190920085628 extends SimpleMigrationStep { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { $query = $this->connection->getQueryBuilder(); $query->update('groups') diff --git a/core/Migrations/Version18000Date20191014105105.php b/core/Migrations/Version18000Date20191014105105.php index adfd65a4dc2..bdc28fa4261 100644 --- a/core/Migrations/Version18000Date20191014105105.php +++ b/core/Migrations/Version18000Date20191014105105.php @@ -27,6 +27,7 @@ class Version18000Date20191014105105 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/core/Migrations/Version18000Date20191204114856.php b/core/Migrations/Version18000Date20191204114856.php index fca1a9c43b8..aafaf95c15f 100644 --- a/core/Migrations/Version18000Date20191204114856.php +++ b/core/Migrations/Version18000Date20191204114856.php @@ -27,6 +27,7 @@ class Version18000Date20191204114856 extends SimpleMigrationStep { * @return null|ISchemaWrapper * @throws \Doctrine\DBAL\Schema\SchemaException */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version19000Date20200211083441.php b/core/Migrations/Version19000Date20200211083441.php index 2f8b46ad772..f4995e333f7 100644 --- a/core/Migrations/Version19000Date20200211083441.php +++ b/core/Migrations/Version19000Date20200211083441.php @@ -14,6 +14,7 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version19000Date20200211083441 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version20000Date20201109081915.php b/core/Migrations/Version20000Date20201109081915.php index 285eaa124fc..88948caea89 100644 --- a/core/Migrations/Version20000Date20201109081915.php +++ b/core/Migrations/Version20000Date20201109081915.php @@ -20,6 +20,7 @@ class Version20000Date20201109081915 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/core/Migrations/Version20000Date20201109081918.php b/core/Migrations/Version20000Date20201109081918.php index 6ae20c11035..1f5679f7741 100644 --- a/core/Migrations/Version20000Date20201109081918.php +++ b/core/Migrations/Version20000Date20201109081918.php @@ -27,6 +27,7 @@ class Version20000Date20201109081918 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -62,6 +63,7 @@ class Version20000Date20201109081918 extends SimpleMigrationStep { * * @since 13.0.0 */ + #[\Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { if (!$this->connection->tableExists('credentials')) { return; diff --git a/core/Migrations/Version20000Date20201109081919.php b/core/Migrations/Version20000Date20201109081919.php index c283490e26b..c625c607905 100644 --- a/core/Migrations/Version20000Date20201109081919.php +++ b/core/Migrations/Version20000Date20201109081919.php @@ -20,6 +20,7 @@ class Version20000Date20201109081919 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/core/Migrations/Version20000Date20201111081915.php b/core/Migrations/Version20000Date20201111081915.php index af2965a12ed..a879563cebc 100644 --- a/core/Migrations/Version20000Date20201111081915.php +++ b/core/Migrations/Version20000Date20201111081915.php @@ -20,6 +20,7 @@ class Version20000Date20201111081915 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/core/Migrations/Version21000Date20201120141228.php b/core/Migrations/Version21000Date20201120141228.php index feba7c469bb..1bba2f769a2 100644 --- a/core/Migrations/Version21000Date20201120141228.php +++ b/core/Migrations/Version21000Date20201120141228.php @@ -14,6 +14,7 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version21000Date20201120141228 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version21000Date20201202095923.php b/core/Migrations/Version21000Date20201202095923.php index a96bdd5a1fc..eb3418031e2 100644 --- a/core/Migrations/Version21000Date20201202095923.php +++ b/core/Migrations/Version21000Date20201202095923.php @@ -21,6 +21,7 @@ class Version21000Date20201202095923 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/core/Migrations/Version21000Date20210119195004.php b/core/Migrations/Version21000Date20210119195004.php index ec136e4e8b2..951af95a7fc 100644 --- a/core/Migrations/Version21000Date20210119195004.php +++ b/core/Migrations/Version21000Date20210119195004.php @@ -23,6 +23,7 @@ class Version21000Date20210119195004 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/core/Migrations/Version21000Date20210309185126.php b/core/Migrations/Version21000Date20210309185126.php index e03e0a24b3e..696b50514b7 100644 --- a/core/Migrations/Version21000Date20210309185126.php +++ b/core/Migrations/Version21000Date20210309185126.php @@ -21,6 +21,7 @@ class Version21000Date20210309185126 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/core/Migrations/Version21000Date20210309185127.php b/core/Migrations/Version21000Date20210309185127.php index 35efc1e5ab7..ea9bb493c0d 100644 --- a/core/Migrations/Version21000Date20210309185127.php +++ b/core/Migrations/Version21000Date20210309185127.php @@ -20,6 +20,7 @@ class Version21000Date20210309185127 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/core/Migrations/Version22000Date20210216080825.php b/core/Migrations/Version22000Date20210216080825.php index c8bfe38f2bc..353e0037e3c 100644 --- a/core/Migrations/Version22000Date20210216080825.php +++ b/core/Migrations/Version22000Date20210216080825.php @@ -23,6 +23,7 @@ class Version22000Date20210216080825 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/core/Migrations/Version23000Date20210721100600.php b/core/Migrations/Version23000Date20210721100600.php index a611c0c4b36..853b36d77ec 100644 --- a/core/Migrations/Version23000Date20210721100600.php +++ b/core/Migrations/Version23000Date20210721100600.php @@ -18,6 +18,7 @@ class Version23000Date20210721100600 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version23000Date20210906132259.php b/core/Migrations/Version23000Date20210906132259.php index 422b96fa397..a80331591d1 100644 --- a/core/Migrations/Version23000Date20210906132259.php +++ b/core/Migrations/Version23000Date20210906132259.php @@ -20,6 +20,7 @@ class Version23000Date20210906132259 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** * Table was missing a primary key diff --git a/core/Migrations/Version23000Date20210930122352.php b/core/Migrations/Version23000Date20210930122352.php index 1e1df825429..9f64a5c5162 100644 --- a/core/Migrations/Version23000Date20210930122352.php +++ b/core/Migrations/Version23000Date20210930122352.php @@ -24,6 +24,7 @@ class Version23000Date20210930122352 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/core/Migrations/Version23000Date20211203110726.php b/core/Migrations/Version23000Date20211203110726.php index c91645ddeb3..e98cb6818fc 100644 --- a/core/Migrations/Version23000Date20211203110726.php +++ b/core/Migrations/Version23000Date20211203110726.php @@ -23,6 +23,7 @@ class Version23000Date20211203110726 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/core/Migrations/Version23000Date20211213203940.php b/core/Migrations/Version23000Date20211213203940.php index f31f13a14d7..08471f1ade0 100644 --- a/core/Migrations/Version23000Date20211213203940.php +++ b/core/Migrations/Version23000Date20211213203940.php @@ -16,6 +16,7 @@ class Version23000Date20211213203940 extends BigIntMigration { * @return array Returns an array with the following structure * ['table1' => ['column1', 'column2'], ...] */ + #[\Override] protected function getColumnsByTable() { return [ 'profile_config' => ['id'], diff --git a/core/Migrations/Version24000Date20211210141942.php b/core/Migrations/Version24000Date20211210141942.php index 50b1d89557e..becd4b14692 100644 --- a/core/Migrations/Version24000Date20211210141942.php +++ b/core/Migrations/Version24000Date20211210141942.php @@ -30,6 +30,7 @@ class Version24000Date20211210141942 extends SimpleMigrationStep { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $update = $this->connection->getQueryBuilder(); diff --git a/core/Migrations/Version24000Date20211213081506.php b/core/Migrations/Version24000Date20211213081506.php index ad46d1a8890..66acd0de6b2 100644 --- a/core/Migrations/Version24000Date20211213081506.php +++ b/core/Migrations/Version24000Date20211213081506.php @@ -20,6 +20,7 @@ class Version24000Date20211213081506 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/core/Migrations/Version24000Date20211213081604.php b/core/Migrations/Version24000Date20211213081604.php index 3e557817d33..5961dd82b81 100644 --- a/core/Migrations/Version24000Date20211213081604.php +++ b/core/Migrations/Version24000Date20211213081604.php @@ -21,6 +21,7 @@ class Version24000Date20211213081604 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/core/Migrations/Version24000Date20211222112246.php b/core/Migrations/Version24000Date20211222112246.php index 2bc3e1a3fca..debf0968ec8 100644 --- a/core/Migrations/Version24000Date20211222112246.php +++ b/core/Migrations/Version24000Date20211222112246.php @@ -24,6 +24,7 @@ class Version24000Date20211222112246 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/core/Migrations/Version24000Date20211230140012.php b/core/Migrations/Version24000Date20211230140012.php index cda9a6d5530..a14b45f022c 100644 --- a/core/Migrations/Version24000Date20211230140012.php +++ b/core/Migrations/Version24000Date20211230140012.php @@ -21,6 +21,7 @@ class Version24000Date20211230140012 extends SimpleMigrationStep { ) { } + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -37,6 +38,7 @@ class Version24000Date20211230140012 extends SimpleMigrationStep { return null; } + #[\Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { $update = $this->connection->getQueryBuilder(); diff --git a/core/Migrations/Version24000Date20220131153041.php b/core/Migrations/Version24000Date20220131153041.php index f1dc6af776d..ca1c7b14b02 100644 --- a/core/Migrations/Version24000Date20220131153041.php +++ b/core/Migrations/Version24000Date20220131153041.php @@ -21,6 +21,7 @@ class Version24000Date20220131153041 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/core/Migrations/Version24000Date20220202150027.php b/core/Migrations/Version24000Date20220202150027.php index 4533d34380a..9983a55403c 100644 --- a/core/Migrations/Version24000Date20220202150027.php +++ b/core/Migrations/Version24000Date20220202150027.php @@ -23,6 +23,7 @@ class Version24000Date20220202150027 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/core/Migrations/Version24000Date20220404230027.php b/core/Migrations/Version24000Date20220404230027.php index df24ec29e6c..d9111872da1 100644 --- a/core/Migrations/Version24000Date20220404230027.php +++ b/core/Migrations/Version24000Date20220404230027.php @@ -24,6 +24,7 @@ class Version24000Date20220404230027 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/core/Migrations/Version24000Date20220425072957.php b/core/Migrations/Version24000Date20220425072957.php index 5737249fa22..c75ce10bdae 100644 --- a/core/Migrations/Version24000Date20220425072957.php +++ b/core/Migrations/Version24000Date20220425072957.php @@ -21,6 +21,7 @@ class Version24000Date20220425072957 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/core/Migrations/Version25000Date20220515204012.php b/core/Migrations/Version25000Date20220515204012.php index 7f7c6b6cee2..f0868393f23 100644 --- a/core/Migrations/Version25000Date20220515204012.php +++ b/core/Migrations/Version25000Date20220515204012.php @@ -14,6 +14,7 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version25000Date20220515204012 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version25000Date20220602190540.php b/core/Migrations/Version25000Date20220602190540.php index 999a0c50e60..a698d77b592 100644 --- a/core/Migrations/Version25000Date20220602190540.php +++ b/core/Migrations/Version25000Date20220602190540.php @@ -22,6 +22,7 @@ class Version25000Date20220602190540 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/core/Migrations/Version25000Date20220905140840.php b/core/Migrations/Version25000Date20220905140840.php index 29d881c4777..a0e4e004061 100644 --- a/core/Migrations/Version25000Date20220905140840.php +++ b/core/Migrations/Version25000Date20220905140840.php @@ -22,6 +22,7 @@ class Version25000Date20220905140840 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/core/Migrations/Version25000Date20221007010957.php b/core/Migrations/Version25000Date20221007010957.php index dbd7f68ed34..a6d92b7124b 100644 --- a/core/Migrations/Version25000Date20221007010957.php +++ b/core/Migrations/Version25000Date20221007010957.php @@ -31,6 +31,7 @@ class Version25000Date20221007010957 extends SimpleMigrationStep { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param array $options */ + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $cleanUpQuery = $this->connection->getQueryBuilder(); $cleanUpQuery->delete('preferences') diff --git a/core/Migrations/Version27000Date20220613163520.php b/core/Migrations/Version27000Date20220613163520.php index 4a5601b6cd5..50cc713895f 100644 --- a/core/Migrations/Version27000Date20220613163520.php +++ b/core/Migrations/Version27000Date20220613163520.php @@ -15,10 +15,12 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version27000Date20220613163520 extends SimpleMigrationStep { + #[\Override] public function name(): string { return 'Add mountpoint path to mounts table unique index'; } + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version27000Date20230309104325.php b/core/Migrations/Version27000Date20230309104325.php index a15f9228211..af43916b65d 100644 --- a/core/Migrations/Version27000Date20230309104325.php +++ b/core/Migrations/Version27000Date20230309104325.php @@ -32,6 +32,7 @@ class Version27000Date20230309104325 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { // /** @var ISchemaWrapper $schema */ // $schema = $schemaClosure(); @@ -56,6 +57,7 @@ class Version27000Date20230309104325 extends SimpleMigrationStep { * @param array $options * @return void */ + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ // $schema = $schemaClosure(); diff --git a/core/Migrations/Version27000Date20230309104802.php b/core/Migrations/Version27000Date20230309104802.php index d5c8577fcf4..7c84dfab0d2 100644 --- a/core/Migrations/Version27000Date20230309104802.php +++ b/core/Migrations/Version27000Date20230309104802.php @@ -25,6 +25,7 @@ class Version27000Date20230309104802 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/core/Migrations/Version28000Date20230616104802.php b/core/Migrations/Version28000Date20230616104802.php index 05acf8183ba..5cf7608df13 100644 --- a/core/Migrations/Version28000Date20230616104802.php +++ b/core/Migrations/Version28000Date20230616104802.php @@ -25,6 +25,7 @@ class Version28000Date20230616104802 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/core/Migrations/Version28000Date20230728104802.php b/core/Migrations/Version28000Date20230728104802.php index e9dadcfd836..05312f17fb1 100644 --- a/core/Migrations/Version28000Date20230728104802.php +++ b/core/Migrations/Version28000Date20230728104802.php @@ -25,6 +25,7 @@ class Version28000Date20230728104802 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/core/Migrations/Version28000Date20230803221055.php b/core/Migrations/Version28000Date20230803221055.php index 60b9fa4ed3d..28d32506719 100644 --- a/core/Migrations/Version28000Date20230803221055.php +++ b/core/Migrations/Version28000Date20230803221055.php @@ -24,6 +24,7 @@ class Version28000Date20230803221055 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/core/Migrations/Version28000Date20230906104802.php b/core/Migrations/Version28000Date20230906104802.php index 9eec3ad8da1..4eeb39a6ae8 100644 --- a/core/Migrations/Version28000Date20230906104802.php +++ b/core/Migrations/Version28000Date20230906104802.php @@ -25,6 +25,7 @@ class Version28000Date20230906104802 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/core/Migrations/Version28000Date20231004103301.php b/core/Migrations/Version28000Date20231004103301.php index e1cd619f749..9e778365689 100644 --- a/core/Migrations/Version28000Date20231004103301.php +++ b/core/Migrations/Version28000Date20231004103301.php @@ -16,6 +16,7 @@ use OCP\Migration\SimpleMigrationStep; // Create new tables for the Metadata API (files_metadata and files_metadata_index). class Version28000Date20231004103301 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version28000Date20231103104802.php b/core/Migrations/Version28000Date20231103104802.php index 238c792991d..a5e78d8419b 100644 --- a/core/Migrations/Version28000Date20231103104802.php +++ b/core/Migrations/Version28000Date20231103104802.php @@ -25,6 +25,7 @@ class Version28000Date20231103104802 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/core/Migrations/Version28000Date20231126110901.php b/core/Migrations/Version28000Date20231126110901.php index 95984df61bb..6a5f014a3fd 100644 --- a/core/Migrations/Version28000Date20231126110901.php +++ b/core/Migrations/Version28000Date20231126110901.php @@ -17,6 +17,7 @@ use OCP\Migration\SimpleMigrationStep; * Create new fields for type and lazy loading in appconfig for the new IAppConfig API. */ class Version28000Date20231126110901 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { return null; diff --git a/core/Migrations/Version28000Date20240828142927.php b/core/Migrations/Version28000Date20240828142927.php index 30382e778d3..baa35ab995e 100644 --- a/core/Migrations/Version28000Date20240828142927.php +++ b/core/Migrations/Version28000Date20240828142927.php @@ -29,6 +29,7 @@ class Version28000Date20240828142927 extends SimpleMigrationStep { ) { } + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -43,6 +44,7 @@ class Version28000Date20240828142927 extends SimpleMigrationStep { return $schema; } + #[\Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $chunkSize = 1000; $offset = 0; diff --git a/core/Migrations/Version29000Date20231126110901.php b/core/Migrations/Version29000Date20231126110901.php index cbed14bf2f5..11afec44d25 100644 --- a/core/Migrations/Version29000Date20231126110901.php +++ b/core/Migrations/Version29000Date20231126110901.php @@ -18,6 +18,7 @@ use OCP\Migration\SimpleMigrationStep; * Create new fields for type and lazy loading in appconfig for the new IAppConfig API. */ class Version29000Date20231126110901 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version29000Date20240124132201.php b/core/Migrations/Version29000Date20240124132201.php index a3166435704..64a18f5398a 100644 --- a/core/Migrations/Version29000Date20240124132201.php +++ b/core/Migrations/Version29000Date20240124132201.php @@ -18,6 +18,7 @@ use OCP\Migration\SimpleMigrationStep; * Create new column for type and remove previous lazy column in appconfig (will be recreated by Version29000Date20240124132202) for the new IAppConfig API. */ class Version29000Date20240124132201 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version29000Date20240124132202.php b/core/Migrations/Version29000Date20240124132202.php index 3246adf21a7..65adb15e74f 100644 --- a/core/Migrations/Version29000Date20240124132202.php +++ b/core/Migrations/Version29000Date20240124132202.php @@ -18,6 +18,7 @@ use OCP\Migration\SimpleMigrationStep; * Create new column and index for lazy loading in appconfig for the new IAppConfig API. */ class Version29000Date20240124132202 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version30000Date20240429122720.php b/core/Migrations/Version30000Date20240429122720.php index eeefc8dd10c..8a2f4aa586b 100644 --- a/core/Migrations/Version30000Date20240429122720.php +++ b/core/Migrations/Version30000Date20240429122720.php @@ -33,6 +33,7 @@ class Version30000Date20240429122720 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/core/Migrations/Version30000Date20240708160048.php b/core/Migrations/Version30000Date20240708160048.php index 83edd84e56a..c1d9b84d112 100644 --- a/core/Migrations/Version30000Date20240708160048.php +++ b/core/Migrations/Version30000Date20240708160048.php @@ -30,6 +30,7 @@ class Version30000Date20240708160048 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/core/Migrations/Version30000Date20240717111406.php b/core/Migrations/Version30000Date20240717111406.php index 558ac432387..c57e9caa330 100644 --- a/core/Migrations/Version30000Date20240717111406.php +++ b/core/Migrations/Version30000Date20240717111406.php @@ -29,6 +29,7 @@ class Version30000Date20240717111406 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/core/Migrations/Version30000Date20240814180800.php b/core/Migrations/Version30000Date20240814180800.php index 199af8cc0aa..d81da356965 100644 --- a/core/Migrations/Version30000Date20240814180800.php +++ b/core/Migrations/Version30000Date20240814180800.php @@ -14,6 +14,7 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version30000Date20240814180800 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version30000Date20240815080800.php b/core/Migrations/Version30000Date20240815080800.php index 5212467ece0..18c1a143443 100644 --- a/core/Migrations/Version30000Date20240815080800.php +++ b/core/Migrations/Version30000Date20240815080800.php @@ -19,6 +19,7 @@ use OCP\Migration\SimpleMigrationStep; #[AddColumn(table: 'webauthn', name: 'user_verification', type: ColumnType::BOOLEAN)] class Version30000Date20240815080800 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version31000Date20240101084401.php b/core/Migrations/Version31000Date20240101084401.php index 60792dcac21..223b78b6056 100644 --- a/core/Migrations/Version31000Date20240101084401.php +++ b/core/Migrations/Version31000Date20240101084401.php @@ -40,10 +40,12 @@ use OCP\Migration\SimpleMigrationStep; description: 'to search on key and provider' )] class Version31000Date20240101084401 extends SimpleMigrationStep { + #[\Override] public function description(): string { return "creating new table 'sec_signatory' to store remote signatories"; } + #[\Override] public function name(): string { return 'create sec_signatory'; } @@ -54,6 +56,7 @@ class Version31000Date20240101084401 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/core/Migrations/Version31000Date20240814184402.php b/core/Migrations/Version31000Date20240814184402.php index 14b32a704be..4302a785029 100644 --- a/core/Migrations/Version31000Date20240814184402.php +++ b/core/Migrations/Version31000Date20240814184402.php @@ -30,6 +30,7 @@ use OCP\Migration\SimpleMigrationStep; #[AddIndex(table: 'preferences', type: IndexType::INDEX, description: 'new index including user+lazy')] #[AddIndex(table: 'preferences', type: IndexType::INDEX, description: 'new index including app/key and indexed')] class Version31000Date20240814184402 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version31000Date20250213102442.php b/core/Migrations/Version31000Date20250213102442.php index d267e867129..f35ce498ddf 100644 --- a/core/Migrations/Version31000Date20250213102442.php +++ b/core/Migrations/Version31000Date20250213102442.php @@ -21,6 +21,7 @@ use OCP\Migration\SimpleMigrationStep; */ #[DropIndex(table: 'filecache', type: IndexType::INDEX, description: 'remove index fs_id_storage_size (concurrent with PRIMARY KEY)')] class Version31000Date20250213102442 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version32000Date20250806110519.php b/core/Migrations/Version32000Date20250806110519.php index c498a1cc820..ca3b993c507 100644 --- a/core/Migrations/Version32000Date20250806110519.php +++ b/core/Migrations/Version32000Date20250806110519.php @@ -28,6 +28,7 @@ class Version32000Date20250806110519 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/core/Migrations/Version33000Date20251013110519.php b/core/Migrations/Version33000Date20251013110519.php index c43979170ea..78ab693e2b9 100644 --- a/core/Migrations/Version33000Date20251013110519.php +++ b/core/Migrations/Version33000Date20251013110519.php @@ -28,6 +28,7 @@ class Version33000Date20251013110519 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/core/Migrations/Version33000Date20251106131209.php b/core/Migrations/Version33000Date20251106131209.php index 9fab7d6d3c0..5d26abfedd2 100644 --- a/core/Migrations/Version33000Date20251106131209.php +++ b/core/Migrations/Version33000Date20251106131209.php @@ -22,6 +22,7 @@ class Version33000Date20251106131209 extends SimpleMigrationStep { ) { } + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { $qb = $this->connection->getQueryBuilder(); $qb->update('share') diff --git a/core/Migrations/Version33000Date20251126152410.php b/core/Migrations/Version33000Date20251126152410.php index 96d590409db..2962bffc8cc 100644 --- a/core/Migrations/Version33000Date20251126152410.php +++ b/core/Migrations/Version33000Date20251126152410.php @@ -25,6 +25,7 @@ class Version33000Date20251126152410 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/core/Migrations/Version33000Date20260126120000.php b/core/Migrations/Version33000Date20260126120000.php index 3b3c4c7cd95..ef04b175a74 100644 --- a/core/Migrations/Version33000Date20260126120000.php +++ b/core/Migrations/Version33000Date20260126120000.php @@ -12,6 +12,7 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version33000Date20260126120000 extends SimpleMigrationStep { + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Notification/CoreNotifier.php b/core/Notification/CoreNotifier.php index 83a86513e03..c4ee339c766 100644 --- a/core/Notification/CoreNotifier.php +++ b/core/Notification/CoreNotifier.php @@ -30,6 +30,7 @@ class CoreNotifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getID(): string { return 'core'; } @@ -40,10 +41,12 @@ class CoreNotifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getName(): string { return $this->factory->get('core')->t('Nextcloud Server'); } + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'core') { throw new UnknownNotificationException(); diff --git a/lib/private/Accounts/Account.php b/lib/private/Accounts/Account.php index 946168d7755..e443f65870a 100644 --- a/lib/private/Accounts/Account.php +++ b/lib/private/Accounts/Account.php @@ -27,6 +27,7 @@ class Account implements IAccount { ) { } + #[\Override] public function setProperty(string $property, string $value, string $scope, string $verified, string $verificationData = ''): IAccount { if ($this->isCollection($property)) { throw new \InvalidArgumentException('setProperty cannot set an IAccountsPropertyCollection'); @@ -35,6 +36,7 @@ class Account implements IAccount { return $this; } + #[\Override] public function getProperty(string $property): IAccountProperty { if ($this->isCollection($property)) { throw new \InvalidArgumentException('getProperty cannot retrieve an IAccountsPropertyCollection'); @@ -45,12 +47,14 @@ class Account implements IAccount { return $this->properties[$property]; } + #[\Override] public function getProperties(): array { return array_filter($this->properties, function ($obj) { return $obj instanceof IAccountProperty; }); } + #[\Override] public function setAllPropertiesFromJson(array $properties): IAccount { foreach ($properties as $propertyName => $propertyObject) { if ($this->isCollection($propertyName)) { @@ -73,6 +77,7 @@ class Account implements IAccount { return $this; } + #[\Override] public function getAllProperties(): Generator { foreach ($this->properties as $propertyObject) { if ($propertyObject instanceof IAccountProperty) { @@ -85,6 +90,7 @@ class Account implements IAccount { } } + #[\Override] public function getFilteredProperties(?string $scope = null, ?string $verified = null): array { $result = $incrementals = []; /** @var IAccountProperty $obj */ @@ -106,6 +112,7 @@ class Account implements IAccount { } /** @return array> */ + #[\Override] public function jsonSerialize(): array { $properties = $this->properties; foreach ($properties as $propertyName => $propertyObject) { @@ -117,15 +124,18 @@ class Account implements IAccount { return $properties; } + #[\Override] public function getUser(): IUser { return $this->user; } + #[\Override] public function setPropertyCollection(IAccountPropertyCollection $propertyCollection): IAccount { $this->properties[$propertyCollection->getName()] = $propertyCollection; return $this; } + #[\Override] public function getPropertyCollection(string $propertyCollectionName): IAccountPropertyCollection { if (!$this->isCollection($propertyCollectionName)) { throw new PropertyDoesNotExistException($propertyCollectionName); diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 102e6a8b9cb..f3d2878b254 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -216,6 +216,7 @@ class AccountManager implements IAccountManager { return $this->addMissingDefaultValues($userDataArray, $this->buildDefaultUserRecord($user)); } + #[\Override] public function searchUsers(string $property, array $values): array { // the value col is limited to 255 bytes. It is used for searches only. $values = array_map(function (string $value) { @@ -655,6 +656,7 @@ class AccountManager implements IAccountManager { return $account; } + #[\Override] public function getAccount(IUser $user): IAccount { $cached = $this->internalCache->get($user->getUID()); if ($cached !== null) { @@ -826,6 +828,7 @@ class AccountManager implements IAccountManager { } } + #[\Override] public function updateAccount(IAccount $account): void { $this->testValueLengths(iterator_to_array($account->getAllProperties()), true); try { diff --git a/lib/private/Accounts/AccountProperty.php b/lib/private/Accounts/AccountProperty.php index 11ad03d6c7f..685fa013ed2 100644 --- a/lib/private/Accounts/AccountProperty.php +++ b/lib/private/Accounts/AccountProperty.php @@ -29,6 +29,7 @@ class AccountProperty implements IAccountProperty { $this->setScope($scope); } + #[\Override] public function jsonSerialize(): array { return [ 'name' => $this->getName(), @@ -44,6 +45,7 @@ class AccountProperty implements IAccountProperty { * * @since 15.0.0 */ + #[\Override] public function setValue(string $value): IAccountProperty { $this->value = $value; return $this; @@ -54,6 +56,7 @@ class AccountProperty implements IAccountProperty { * * @since 15.0.0 */ + #[\Override] public function setScope(string $scope): IAccountProperty { $newScope = $this->mapScopeToV2($scope); if (!in_array($newScope, [ @@ -73,6 +76,7 @@ class AccountProperty implements IAccountProperty { * * @since 15.0.0 */ + #[\Override] public function setVerified(string $verified): IAccountProperty { $this->verified = $verified; return $this; @@ -83,6 +87,7 @@ class AccountProperty implements IAccountProperty { * * @since 15.0.0 */ + #[\Override] public function getName(): string { return $this->name; } @@ -92,6 +97,7 @@ class AccountProperty implements IAccountProperty { * * @since 15.0.0 */ + #[\Override] public function getValue(): string { return $this->value; } @@ -101,6 +107,7 @@ class AccountProperty implements IAccountProperty { * * @since 15.0.0 */ + #[\Override] public function getScope(): string { return $this->scope; } @@ -123,19 +130,23 @@ class AccountProperty implements IAccountProperty { * * @since 15.0.0 */ + #[\Override] public function getVerified(): string { return $this->verified; } + #[\Override] public function setVerificationData(string $verificationData): IAccountProperty { $this->verificationData = $verificationData; return $this; } + #[\Override] public function getVerificationData(): string { return $this->verificationData; } + #[\Override] public function setLocallyVerified(string $verified): IAccountProperty { if (!in_array($verified, [ IAccountManager::NOT_VERIFIED, @@ -148,6 +159,7 @@ class AccountProperty implements IAccountProperty { return $this; } + #[\Override] public function getLocallyVerified(): string { return $this->locallyVerified; } diff --git a/lib/private/Accounts/AccountPropertyCollection.php b/lib/private/Accounts/AccountPropertyCollection.php index 75eea76e686..b163b7ac87d 100644 --- a/lib/private/Accounts/AccountPropertyCollection.php +++ b/lib/private/Accounts/AccountPropertyCollection.php @@ -21,6 +21,7 @@ class AccountPropertyCollection implements IAccountPropertyCollection { ) { } + #[\Override] public function setProperties(array $properties): IAccountPropertyCollection { /** @var IAccountProperty $property */ $this->properties = []; @@ -30,10 +31,12 @@ class AccountPropertyCollection implements IAccountPropertyCollection { return $this; } + #[\Override] public function getProperties(): array { return $this->properties; } + #[\Override] public function addProperty(IAccountProperty $property): IAccountPropertyCollection { if ($property->getName() !== $this->collectionName) { throw new InvalidArgumentException('Provided property does not match collection name'); @@ -42,6 +45,7 @@ class AccountPropertyCollection implements IAccountPropertyCollection { return $this; } + #[\Override] public function addPropertyWithDefaults(string $value): IAccountPropertyCollection { $property = new AccountProperty( $this->collectionName, @@ -54,6 +58,7 @@ class AccountPropertyCollection implements IAccountPropertyCollection { return $this; } + #[\Override] public function removeProperty(IAccountProperty $property): IAccountPropertyCollection { $ref = array_search($property, $this->properties, true); if ($ref !== false) { @@ -62,6 +67,7 @@ class AccountPropertyCollection implements IAccountPropertyCollection { return $this; } + #[\Override] public function getPropertyByValue(string $value): ?IAccountProperty { foreach ($this->properties as $i => $property) { if ($property->getValue() === $value) { @@ -71,6 +77,7 @@ class AccountPropertyCollection implements IAccountPropertyCollection { return null; } + #[\Override] public function removePropertyByValue(string $value): IAccountPropertyCollection { foreach ($this->properties as $i => $property) { if ($property->getValue() === $value) { @@ -80,10 +87,12 @@ class AccountPropertyCollection implements IAccountPropertyCollection { return $this; } + #[\Override] public function jsonSerialize(): array { return [$this->collectionName => $this->properties]; } + #[\Override] public function getName(): string { return $this->collectionName; } diff --git a/lib/private/Accounts/Hooks.php b/lib/private/Accounts/Hooks.php index 12f2b4777f8..eebc2300f49 100644 --- a/lib/private/Accounts/Hooks.php +++ b/lib/private/Accounts/Hooks.php @@ -50,6 +50,7 @@ class Hooks implements IEventListener { } } + #[\Override] public function handle(Event $event): void { if (!$event instanceof UserChangedEvent) { return; diff --git a/lib/private/Activity/ActivitySettingsAdapter.php b/lib/private/Activity/ActivitySettingsAdapter.php index 27c85ee5554..a165d32dc98 100644 --- a/lib/private/Activity/ActivitySettingsAdapter.php +++ b/lib/private/Activity/ActivitySettingsAdapter.php @@ -23,30 +23,37 @@ class ActivitySettingsAdapter extends ActivitySettings { ) { } + #[\Override] public function getIdentifier() { return $this->oldSettings->getIdentifier(); } + #[\Override] public function getName() { return $this->oldSettings->getName(); } + #[\Override] public function getGroupIdentifier() { return 'other'; } + #[\Override] public function getGroupName() { return $this->l10n->t('Other activities'); } + #[\Override] public function getPriority() { return $this->oldSettings->getPriority(); } + #[\Override] public function canChangeMail() { return $this->oldSettings->canChangeMail(); } + #[\Override] public function isDefaultEnabledMail() { return $this->oldSettings->isDefaultEnabledMail(); } diff --git a/lib/private/Activity/Event.php b/lib/private/Activity/Event.php index 6a2bc5dba77..1c3ea936d82 100644 --- a/lib/private/Activity/Event.php +++ b/lib/private/Activity/Event.php @@ -70,6 +70,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setApp(string $app): IEvent { if ($app === '' || isset($app[32])) { throw new InvalidValueException('app'); @@ -81,6 +82,7 @@ class Event implements IEvent { /** * @return string */ + #[\Override] public function getApp(): string { return $this->app; } @@ -88,6 +90,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setType(string $type): IEvent { if ($type === '' || isset($type[255])) { throw new InvalidValueException('type'); @@ -99,6 +102,7 @@ class Event implements IEvent { /** * @return string */ + #[\Override] public function getType(): string { return $this->type; } @@ -106,6 +110,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setAffectedUser(string $affectedUser): IEvent { if ($affectedUser === '' || isset($affectedUser[64])) { throw new InvalidValueException('affectedUser'); @@ -117,6 +122,7 @@ class Event implements IEvent { /** * @return string */ + #[\Override] public function getAffectedUser(): string { return $this->affectedUser; } @@ -124,6 +130,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setAuthor(string $author): IEvent { if (isset($author[64])) { throw new InvalidValueException('author'); @@ -135,6 +142,7 @@ class Event implements IEvent { /** * @return string */ + #[\Override] public function getAuthor(): string { return $this->author; } @@ -142,6 +150,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setTimestamp(int $timestamp): IEvent { if ($timestamp < 0) { throw new InvalidValueException('timestamp'); @@ -153,6 +162,7 @@ class Event implements IEvent { /** * @return int */ + #[\Override] public function getTimestamp(): int { return $this->timestamp; } @@ -160,6 +170,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setSubject(string $subject, array $parameters = []): IEvent { if (isset($subject[255])) { throw new InvalidValueException('subject'); @@ -172,6 +183,7 @@ class Event implements IEvent { /** * @return string */ + #[\Override] public function getSubject(): string { return $this->subject; } @@ -179,6 +191,7 @@ class Event implements IEvent { /** * @return array */ + #[\Override] public function getSubjectParameters(): array { return $this->subjectParameters; } @@ -186,6 +199,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setParsedSubject(string $subject): IEvent { if ($subject === '') { throw new InvalidValueException('parsedSubject'); @@ -198,6 +212,7 @@ class Event implements IEvent { * @return string * @since 11.0.0 */ + #[\Override] public function getParsedSubject(): string { return $this->subjectParsed; } @@ -205,6 +220,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setRichSubject(string $subject, array $parameters = []): IEvent { if ($subject === '') { throw new InvalidValueException('richSubject'); @@ -227,6 +243,7 @@ class Event implements IEvent { * @return string * @since 11.0.0 */ + #[\Override] public function getRichSubject(): string { return $this->subjectRich; } @@ -235,6 +252,7 @@ class Event implements IEvent { * @return array> * @since 11.0.0 */ + #[\Override] public function getRichSubjectParameters(): array { return $this->subjectRichParameters; } @@ -242,6 +260,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setMessage(string $message, array $parameters = []): IEvent { if (isset($message[255])) { throw new InvalidValueException('message'); @@ -254,6 +273,7 @@ class Event implements IEvent { /** * @return string */ + #[\Override] public function getMessage(): string { return $this->message; } @@ -261,6 +281,7 @@ class Event implements IEvent { /** * @return array */ + #[\Override] public function getMessageParameters(): array { return $this->messageParameters; } @@ -268,6 +289,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setParsedMessage(string $message): IEvent { $this->messageParsed = $message; return $this; @@ -277,6 +299,7 @@ class Event implements IEvent { * @return string * @since 11.0.0 */ + #[\Override] public function getParsedMessage(): string { return $this->messageParsed; } @@ -284,6 +307,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setRichMessage(string $message, array $parameters = []): IEvent { $this->messageRich = $message; $this->messageRichParameters = $parameters; @@ -303,6 +327,7 @@ class Event implements IEvent { * @return string * @since 11.0.0 */ + #[\Override] public function getRichMessage(): string { return $this->messageRich; } @@ -311,6 +336,7 @@ class Event implements IEvent { * @return array> * @since 11.0.0 */ + #[\Override] public function getRichMessageParameters(): array { return $this->messageRichParameters; } @@ -318,6 +344,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setObject(string $objectType, string|int $objectId, string $objectName = ''): IEvent { if (isset($objectType[255])) { throw new InvalidValueException('objectType'); @@ -337,6 +364,7 @@ class Event implements IEvent { /** * @return string */ + #[\Override] public function getObjectType(): string { return $this->objectType; } @@ -344,6 +372,7 @@ class Event implements IEvent { /** * @return int|string */ + #[\Override] public function getObjectId(): string|int { return $this->objectId; } @@ -351,6 +380,7 @@ class Event implements IEvent { /** * @return string */ + #[\Override] public function getObjectName(): string { return $this->objectName; } @@ -358,6 +388,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setLink(string $link): IEvent { if (isset($link[4000])) { throw new InvalidValueException('link'); @@ -369,6 +400,7 @@ class Event implements IEvent { /** * @return string */ + #[\Override] public function getLink(): string { return $this->link; } @@ -376,6 +408,7 @@ class Event implements IEvent { /** * {@inheritDoc} */ + #[\Override] public function setIcon(string $icon): IEvent { if (isset($icon[4000])) { throw new InvalidValueException('icon'); @@ -388,6 +421,7 @@ class Event implements IEvent { * @return string * @since 11.0.0 */ + #[\Override] public function getIcon(): string { return $this->icon; } @@ -397,6 +431,7 @@ class Event implements IEvent { * @return $this * @since 11.0.0 - Since 15.0.0 returns $this */ + #[\Override] public function setChildEvent(IEvent $child): IEvent { $this->child = $child; return $this; @@ -406,6 +441,7 @@ class Event implements IEvent { * @return IEvent|null * @since 11.0.0 */ + #[\Override] public function getChildEvent() { return $this->child; } @@ -414,6 +450,7 @@ class Event implements IEvent { * @return bool * @since 8.2.0 */ + #[\Override] public function isValid(): bool { return $this->isValidCommon() @@ -425,6 +462,7 @@ class Event implements IEvent { * @return bool * @since 8.2.0 */ + #[\Override] public function isValidParsed(): bool { if ($this->getRichSubject() !== '' || !empty($this->getRichSubjectParameters())) { try { @@ -463,11 +501,13 @@ class Event implements IEvent { ; } + #[\Override] public function setGenerateNotification(bool $generate): IEvent { $this->generateNotification = $generate; return $this; } + #[\Override] public function getGenerateNotification(): bool { return $this->generateNotification; } diff --git a/lib/private/Activity/EventMerger.php b/lib/private/Activity/EventMerger.php index 2b9294f5852..486874ddae9 100644 --- a/lib/private/Activity/EventMerger.php +++ b/lib/private/Activity/EventMerger.php @@ -47,6 +47,7 @@ class EventMerger implements IEventMerger { * @param IEvent|null $previousEvent * @return IEvent */ + #[\Override] public function mergeEvents($mergeParameter, IEvent $event, ?IEvent $previousEvent = null) { // No second event => can not combine if (!$previousEvent instanceof IEvent) { diff --git a/lib/private/Activity/Manager.php b/lib/private/Activity/Manager.php index 186ef843e2f..3981345c698 100644 --- a/lib/private/Activity/Manager.php +++ b/lib/private/Activity/Manager.php @@ -92,6 +92,7 @@ class Manager implements IManager { * * @return IEvent */ + #[\Override] public function generateEvent(): IEvent { return new Event($this->validator, $this->richTextFormatter); } @@ -99,6 +100,7 @@ class Manager implements IManager { /** * {@inheritDoc} */ + #[\Override] public function publish(IEvent $event): void { if ($event->getAuthor() === '' && $this->session->getUser() instanceof IUser) { $event->setAuthor($this->session->getUser()->getUID()); @@ -120,6 +122,7 @@ class Manager implements IManager { /** * {@inheritDoc} */ + #[\Override] public function bulkPublish(IEvent $event, array $affectedUserIds, ISetting $setting): void { if (empty($affectedUserIds)) { throw new IncompleteActivityException('The given event is invalid'); @@ -158,6 +161,7 @@ class Manager implements IManager { * * @param \Closure $callable */ + #[\Override] public function registerConsumer(\Closure $callable): void { $this->consumersClosures[] = $callable; $this->consumers = []; @@ -173,6 +177,7 @@ class Manager implements IManager { * @param string $filter Class must implement OCA\Activity\IFilter * @return void */ + #[\Override] public function registerFilter(string $filter): void { $this->filterClasses[$filter] = false; } @@ -181,6 +186,7 @@ class Manager implements IManager { * @return IFilter[] * @throws \InvalidArgumentException */ + #[\Override] public function getFilters(): array { foreach ($this->filterClasses as $class => $false) { /** @var IFilter $filter */ @@ -200,6 +206,7 @@ class Manager implements IManager { /** * {@inheritDoc} */ + #[\Override] public function getFilterById(string $id): IFilter { $filters = $this->getFilters(); @@ -220,6 +227,7 @@ class Manager implements IManager { * @param string $provider Class must implement OCA\Activity\IProvider * @return void */ + #[\Override] public function registerProvider(string $provider): void { $this->providerClasses[$provider] = false; } @@ -228,6 +236,7 @@ class Manager implements IManager { * @return IProvider[] * @throws \InvalidArgumentException */ + #[\Override] public function getProviders(): array { foreach ($this->providerClasses as $class => $false) { /** @var IProvider $provider */ @@ -254,6 +263,7 @@ class Manager implements IManager { * @param string $setting Class must implement OCA\Activity\ISetting * @return void */ + #[\Override] public function registerSetting(string $setting): void { $this->settingsClasses[$setting] = false; } @@ -262,6 +272,7 @@ class Manager implements IManager { * @return ActivitySettings[] * @throws \InvalidArgumentException */ + #[\Override] public function getSettings(): array { foreach ($this->settingsClasses as $class => $false) { /** @var ISetting $setting */ @@ -285,6 +296,7 @@ class Manager implements IManager { /** * {@inheritDoc} */ + #[\Override] public function getSettingById(string $id): ActivitySettings { $settings = $this->getSettings(); @@ -300,6 +312,7 @@ class Manager implements IManager { * @param string $type * @param int|numeric-string $id */ + #[\Override] public function setFormattingObject(string $type, int|string $id): void { $this->formattingObjectType = $type; $this->formattingObjectId = $id; @@ -308,6 +321,7 @@ class Manager implements IManager { /** * @return bool */ + #[\Override] public function isFormattingFilteredObject(): bool { return $this->formattingObjectType !== null && $this->formattingObjectId !== null && $this->formattingObjectType === $this->request->getParam('object_type') @@ -317,6 +331,7 @@ class Manager implements IManager { /** * @param bool $status Set to true, when parsing events should not use SVG icons */ + #[\Override] public function setRequirePNG(bool $status): void { $this->requirePNG = $status; } @@ -324,6 +339,7 @@ class Manager implements IManager { /** * @return bool */ + #[\Override] public function getRequirePNG(): bool { return $this->requirePNG; } @@ -333,6 +349,7 @@ class Manager implements IManager { * * @param string|null $currentUserId */ + #[\Override] public function setCurrentUserId(?string $currentUserId = null): void { $this->currentUserId = $currentUserId; } @@ -345,6 +362,7 @@ class Manager implements IManager { * @return string * @throws \UnexpectedValueException If the token is invalid, does not exist or is not unique */ + #[\Override] public function getCurrentUserId(): string { if ($this->currentUserId !== null) { return $this->currentUserId; diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php index 4f8229a8f99..9779c91ae59 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -30,6 +30,7 @@ class AllConfig implements IConfig { * @param array $configs Associative array with `key => value` pairs * If value is null, the config key will be deleted */ + #[\Override] public function setSystemValues(array $configs) { $this->systemConfig->setValues($configs); } @@ -40,6 +41,7 @@ class AllConfig implements IConfig { * @param string $key the key of the value, under which will be saved * @param mixed $value the value that should be stored */ + #[\Override] public function setSystemValue($key, $value) { $this->systemConfig->setValue($key, $value); } @@ -51,6 +53,7 @@ class AllConfig implements IConfig { * @param mixed $default the default value to be returned if the value isn't set * @return mixed the value or $default */ + #[\Override] public function getSystemValue($key, $default = '') { return $this->systemConfig->getValue($key, $default); } @@ -65,6 +68,7 @@ class AllConfig implements IConfig { * * @since 16.0.0 */ + #[\Override] public function getSystemValueBool(string $key, bool $default = false): bool { return (bool)$this->getSystemValue($key, $default); } @@ -79,6 +83,7 @@ class AllConfig implements IConfig { * * @since 16.0.0 */ + #[\Override] public function getSystemValueInt(string $key, int $default = 0): int { return (int)$this->getSystemValue($key, $default); } @@ -93,6 +98,7 @@ class AllConfig implements IConfig { * * @since 16.0.0 */ + #[\Override] public function getSystemValueString(string $key, string $default = ''): string { return (string)$this->getSystemValue($key, $default); } @@ -104,6 +110,7 @@ class AllConfig implements IConfig { * @param mixed $default the default value to be returned if the value isn't set * @return mixed the value or $default */ + #[\Override] public function getFilteredSystemValue($key, $default = '') { return $this->systemConfig->getFilteredValue($key, $default); } @@ -113,6 +120,7 @@ class AllConfig implements IConfig { * * @param string $key the key of the value, under which it was saved */ + #[\Override] public function deleteSystemValue($key) { $this->systemConfig->deleteValue($key); } @@ -124,6 +132,7 @@ class AllConfig implements IConfig { * @return string[] the keys stored for the app * @deprecated 29.0.0 Use {@see IAppConfig} directly */ + #[\Override] public function getAppKeys($appName) { return Server::get(AppConfig::class)->getKeys($appName); } @@ -136,6 +145,7 @@ class AllConfig implements IConfig { * @param string|float|int $value the value that should be stored * @deprecated 29.0.0 Use {@see IAppConfig} directly */ + #[\Override] public function setAppValue($appName, $key, $value) { Server::get(AppConfig::class)->setValue($appName, $key, $value); } @@ -149,6 +159,7 @@ class AllConfig implements IConfig { * @return string the saved value * @deprecated 29.0.0 Use {@see IAppConfig} directly */ + #[\Override] public function getAppValue($appName, $key, $default = '') { return Server::get(AppConfig::class)->getValue($appName, $key, $default) ?? $default; } @@ -160,6 +171,7 @@ class AllConfig implements IConfig { * @param string $key the key of the value, under which it was saved * @deprecated 29.0.0 Use {@see IAppConfig} directly */ + #[\Override] public function deleteAppValue($appName, $key) { Server::get(AppConfig::class)->deleteKey($appName, $key); } @@ -170,6 +182,7 @@ class AllConfig implements IConfig { * @param string $appName the appName the configs are stored under * @deprecated 29.0.0 Use {@see IAppConfig} directly */ + #[\Override] public function deleteAppValues($appName) { Server::get(AppConfig::class)->deleteApp($appName); } @@ -193,6 +206,7 @@ class AllConfig implements IConfig { * @see IUserConfig::getValueArray * @see IUserConfig::getValueBool */ + #[\Override] public function setUserValue($userId, $appName, $key, $value, $preCondition = null) { if (!is_int($value) && !is_float($value) && !is_string($value)) { throw new \UnexpectedValueException('Only integers, floats and strings are allowed as value'); @@ -228,6 +242,7 @@ class AllConfig implements IConfig { * @see IUserConfig::getValueArray * @see IUserConfig::getValueBool */ + #[\Override] public function getUserValue($userId, $appName, $key, $default = '') { if ($userId === null || $userId === '') { return $default; @@ -250,6 +265,7 @@ class AllConfig implements IConfig { * @return string[] * @deprecated 31.0.0 - use {@see IUserConfig::getKeys} directly */ + #[\Override] public function getUserKeys($userId, $appName) { return Server::get(IUserConfig::class)->getKeys($userId, $appName); } @@ -263,6 +279,7 @@ class AllConfig implements IConfig { * * @deprecated 31.0.0 - use {@see IUserConfig::deleteUserConfig} directly */ + #[\Override] public function deleteUserValue($userId, $appName, $key) { Server::get(IUserConfig::class)->deleteUserConfig($userId, $appName, $key); } @@ -274,6 +291,7 @@ class AllConfig implements IConfig { * * @deprecated 31.0.0 - use {@see IUserConfig::deleteAllUserConfig} directly */ + #[\Override] public function deleteAllUserValues($userId) { if ($userId === null) { return; @@ -288,6 +306,7 @@ class AllConfig implements IConfig { * * @deprecated 31.0.0 - use {@see IUserConfig::deleteApp} directly */ + #[\Override] public function deleteAppFromAllUsers($appName) { Server::get(IUserConfig::class)->deleteApp($appName); } @@ -304,6 +323,7 @@ class AllConfig implements IConfig { * ] * @deprecated 31.0.0 - use {@see IUserConfig::getAllValues} directly */ + #[\Override] public function getAllUserValues(?string $userId): array { if ($userId === null || $userId === '') { return []; @@ -329,6 +349,7 @@ class AllConfig implements IConfig { * @return array Mapped values: userId => value * @deprecated 31.0.0 - use {@see IUserConfig::getValuesByUsers} directly */ + #[\Override] public function getUserValueForUsers($appName, $key, $userIds) { return Server::get(IUserConfig::class)->getValuesByUsers($appName, $key, ValueType::MIXED, $userIds); } @@ -343,6 +364,7 @@ class AllConfig implements IConfig { * @return list of user IDs * @deprecated 31.0.0 - use {@see IUserConfig::searchUsersByValueString} directly */ + #[\Override] public function getUsersForUserValue($appName, $key, $value) { /** @var list $result */ $result = iterator_to_array(Server::get(IUserConfig::class)->searchUsersByValueString($appName, $key, $value)); diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 2859e00aa8f..3cf84ef9046 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -104,6 +104,7 @@ class AppManager implements IAppManager { return $this->navigationManager; } + #[\Override] public function getAppIcon(string $appId, bool $dark = false): ?string { $possibleIcons = $dark ? [$appId . '-dark.svg', 'app-dark.svg'] : [$appId . '.svg', 'app.svg']; $icon = null; @@ -168,6 +169,7 @@ class AppManager implements IAppManager { * * @return string[] */ + #[\Override] public function getInstalledApps() { return $this->getEnabledApps(); } @@ -177,6 +179,7 @@ class AppManager implements IAppManager { * * @return list */ + #[\Override] public function getEnabledApps(): array { return array_keys($this->getEnabledAppsValues()); } @@ -186,6 +189,7 @@ class AppManager implements IAppManager { * * @return list an array of app names (string IDs) */ + #[\Override] public function getAllAppsInAppsFolders(): array { $apps = []; @@ -218,6 +222,7 @@ class AppManager implements IAppManager { * @param IUser $user * @return list */ + #[\Override] public function getEnabledAppsForUser(IUser $user) { $apps = $this->getEnabledAppsValues(); $appsForUser = array_filter($apps, function ($enabled) use ($user) { @@ -226,6 +231,7 @@ class AppManager implements IAppManager { return array_keys($appsForUser); } + #[\Override] public function getEnabledAppsForGroup(IGroup $group): array { $apps = $this->getEnabledAppsValues(); $appsForGroups = array_filter($apps, function ($enabled) use ($group) { @@ -246,6 +252,7 @@ class AppManager implements IAppManager { * * if $types is set to non-empty array, only apps of those types will be loaded */ + #[\Override] public function loadApps(array $types = []): bool { if ($this->config->getSystemValueBool('maintenance', false)) { return false; @@ -295,6 +302,7 @@ class AppManager implements IAppManager { * @param array $types * @return bool */ + #[\Override] public function isType(string $app, array $types): bool { $appTypes = $this->getAppTypes($app); foreach ($types as $type) { @@ -331,6 +339,7 @@ class AppManager implements IAppManager { return $this->autoDisabledApps; } + #[\Override] public function getAppRestriction(string $appId): array { $values = $this->getEnabledAppsValues(); @@ -351,6 +360,7 @@ class AppManager implements IAppManager { * @param IUser|null $user (optional) if not defined, the currently logged in user will be used * @return bool */ + #[\Override] public function isEnabledForUser($appId, $user = null) { if ($this->isAlwaysEnabled($appId)) { return true; @@ -425,10 +435,12 @@ class AppManager implements IAppManager { * * @param string $appId */ + #[\Override] public function isInstalled($appId): bool { return $this->isEnabledForAnyone($appId); } + #[\Override] public function isEnabledForAnyone(string $appId): bool { $enabledAppsValues = $this->getEnabledAppsValues(); return isset($enabledAppsValues[$appId]); @@ -455,6 +467,7 @@ class AppManager implements IAppManager { $this->config->setSystemValue('app_install_overwrite', $ignoreMaxApps); } + #[\Override] public function loadApp(string $app): void { if (isset($this->loadedApps[$app])) { return; @@ -569,6 +582,7 @@ class AppManager implements IAppManager { * @param string $app app id * @since 26.0.0 */ + #[\Override] public function isAppLoaded(string $app): bool { return isset($this->loadedApps[$app]); } @@ -581,6 +595,7 @@ class AppManager implements IAppManager { * @throws AppPathNotFoundException * @throws \InvalidArgumentException if the application is not installed yet */ + #[\Override] public function enableApp(string $appId, bool $forceEnable = false): void { // Check if app exists $this->getAppPath($appId); @@ -610,6 +625,7 @@ class AppManager implements IAppManager { * @param string[] $types * @return bool */ + #[\Override] public function hasProtectedAppType($types) { if (empty($types)) { return false; @@ -628,6 +644,7 @@ class AppManager implements IAppManager { * @throws \InvalidArgumentException if app can't be enabled for groups * @throws AppPathNotFoundException */ + #[\Override] public function enableAppForGroups(string $appId, array $groups, bool $forceEnable = false): void { // Check if app exists $this->getAppPath($appId); @@ -671,6 +688,7 @@ class AppManager implements IAppManager { * @param bool $automaticDisabled * @throws \Exception if app can't be disabled */ + #[\Override] public function disableApp($appId, $automaticDisabled = false): void { if ($this->isAlwaysEnabled($appId)) { throw new \Exception("$appId can't be disabled."); @@ -707,6 +725,7 @@ class AppManager implements IAppManager { * * @throws AppPathNotFoundException if app folder can't be found */ + #[\Override] public function getAppPath(string $appId, bool $ignoreCache = false): string { $appId = $this->cleanAppId($appId); if ($appId === '') { @@ -726,6 +745,7 @@ class AppManager implements IAppManager { * * @throws AppPathNotFoundException if app path can't be found */ + #[\Override] public function getAppWebPath(string $appId): string { if (($dir = $this->findAppInDirectories($appId)) != false) { return \OC::$WEBROOT . $dir['url'] . '/' . $appId; @@ -787,6 +807,7 @@ class AppManager implements IAppManager { /** * Clear the cached list of apps when enabling/disabling an app */ + #[\Override] public function clearAppsCache(): void { $this->appInfos = []; } @@ -823,6 +844,7 @@ class AppManager implements IAppManager { * @param string|null $lang * @return array|null app info */ + #[\Override] public function getAppInfo(string $appId, bool $path = false, $lang = null) { if ($path) { throw new \InvalidArgumentException('Calling IAppManager::getAppInfo() with a path is no longer supported. Please call IAppManager::getAppInfoByPath() instead and verify that the path is good before calling.'); @@ -846,6 +868,7 @@ class AppManager implements IAppManager { return $data; } + #[\Override] public function getAppInfoByPath(string $path, ?string $lang = null): ?array { if (!str_ends_with($path, '/appinfo/info.xml')) { return null; @@ -861,6 +884,7 @@ class AppManager implements IAppManager { return $data; } + #[\Override] public function getAppVersion(string $appId, bool $useCache = true): string { if (!$useCache || !isset($this->appVersions[$appId])) { if ($appId === 'core') { @@ -878,6 +902,7 @@ class AppManager implements IAppManager { * * @return array */ + #[\Override] public function getAppInstalledVersions(bool $onlyEnabled = false): array { return $this->getAppConfig()->getAppInstalledVersions($onlyEnabled); } @@ -909,6 +934,7 @@ class AppManager implements IAppManager { * @inheritdoc * In case you change this method, also change \OC\App\CodeChecker\InfoChecker::isShipped() */ + #[\Override] public function isShipped($appId) { $this->loadShippedJson(); return in_array($appId, $this->shippedApps, true); @@ -943,6 +969,7 @@ class AppManager implements IAppManager { /** * @inheritdoc */ + #[\Override] public function getAlwaysEnabledApps() { $this->loadShippedJson(); return $this->alwaysEnabled; @@ -951,6 +978,7 @@ class AppManager implements IAppManager { /** * @inheritdoc */ + #[\Override] public function isDefaultEnabled(string $appId): bool { return (in_array($appId, $this->getDefaultEnabledApps())); } @@ -958,6 +986,7 @@ class AppManager implements IAppManager { /** * @inheritdoc */ + #[\Override] public function getDefaultEnabledApps(): array { $this->loadShippedJson(); @@ -967,6 +996,7 @@ class AppManager implements IAppManager { /** * @inheritdoc */ + #[\Override] public function getDefaultAppForUser(?IUser $user = null, bool $withFallbacks = true): string { $id = $this->getNavigationManager()->getDefaultEntryIdForUser($user, $withFallbacks); $entry = $this->getNavigationManager()->get($id); @@ -976,6 +1006,7 @@ class AppManager implements IAppManager { /** * @inheritdoc */ + #[\Override] public function getDefaultApps(): array { $ids = $this->getNavigationManager()->getDefaultEntryIds(); @@ -988,6 +1019,7 @@ class AppManager implements IAppManager { /** * @inheritdoc */ + #[\Override] public function setDefaultApps(array $defaultApps): void { $entries = $this->getNavigationManager()->getAll(); $ids = []; @@ -1002,6 +1034,7 @@ class AppManager implements IAppManager { $this->getNavigationManager()->setDefaultEntryIds($ids); } + #[\Override] public function isBackendRequired(string $backend): bool { foreach ($this->appInfos as $appInfo) { if ( @@ -1031,6 +1064,7 @@ class AppManager implements IAppManager { * @psalm-taint-escape sql * @psalm-taint-escape unserialize */ + #[\Override] public function cleanAppId(string $app): string { /* Only lowercase alphanumeric is allowed */ $cleanAppId = preg_replace('/(^[0-9_-]+|[^a-z0-9_-]+|[_-]+$)/', '', $app, -1, $count); @@ -1068,6 +1102,7 @@ class AppManager implements IAppManager { * * @throws AppPathNotFoundException if app folder can't be found */ + #[\Override] public function upgradeApp(string $appId): bool { // for apps distributed with core, we refresh app path in case the downloaded version // have been installed in custom apps and not in the default path @@ -1138,6 +1173,7 @@ class AppManager implements IAppManager { return true; } + #[\Override] public function isUpgradeRequired(string $appId): bool { $versions = $this->getAppInstalledVersions(); $currentVersion = $this->getAppVersion($appId); @@ -1157,6 +1193,7 @@ class AppManager implements IAppManager { return false; } + #[\Override] public function isAppCompatible(string $serverVersion, array $appInfo, bool $ignoreMax = false): bool { return count($this->dependencyAnalyzer->analyzeServerVersion($serverVersion, $appInfo, $ignoreMax)) === 0; } diff --git a/lib/private/App/AppStore/Bundles/EducationBundle.php b/lib/private/App/AppStore/Bundles/EducationBundle.php index 47a14d3c530..e91fa3b49e2 100644 --- a/lib/private/App/AppStore/Bundles/EducationBundle.php +++ b/lib/private/App/AppStore/Bundles/EducationBundle.php @@ -12,6 +12,7 @@ class EducationBundle extends Bundle { /** * {@inheritDoc} */ + #[\Override] public function getName() { return $this->l10n->t('Education bundle'); } @@ -19,6 +20,7 @@ class EducationBundle extends Bundle { /** * {@inheritDoc} */ + #[\Override] public function getAppIdentifiers() { return [ 'dashboard', diff --git a/lib/private/App/AppStore/Bundles/EnterpriseBundle.php b/lib/private/App/AppStore/Bundles/EnterpriseBundle.php index fbc4019353b..d8845830cf7 100644 --- a/lib/private/App/AppStore/Bundles/EnterpriseBundle.php +++ b/lib/private/App/AppStore/Bundles/EnterpriseBundle.php @@ -12,6 +12,7 @@ class EnterpriseBundle extends Bundle { /** * {@inheritDoc} */ + #[\Override] public function getName(): string { return $this->l10n->t('Enterprise bundle'); } @@ -19,6 +20,7 @@ class EnterpriseBundle extends Bundle { /** * {@inheritDoc} */ + #[\Override] public function getAppIdentifiers(): array { return [ 'admin_audit', diff --git a/lib/private/App/AppStore/Bundles/GroupwareBundle.php b/lib/private/App/AppStore/Bundles/GroupwareBundle.php index cddb18cf817..6cc535329a2 100644 --- a/lib/private/App/AppStore/Bundles/GroupwareBundle.php +++ b/lib/private/App/AppStore/Bundles/GroupwareBundle.php @@ -12,6 +12,7 @@ class GroupwareBundle extends Bundle { /** * {@inheritDoc} */ + #[\Override] public function getName() { return $this->l10n->t('Groupware bundle'); } @@ -19,6 +20,7 @@ class GroupwareBundle extends Bundle { /** * {@inheritDoc} */ + #[\Override] public function getAppIdentifiers() { return [ 'calendar', diff --git a/lib/private/App/AppStore/Bundles/HubBundle.php b/lib/private/App/AppStore/Bundles/HubBundle.php index 354e01e25c2..640e8a610a3 100644 --- a/lib/private/App/AppStore/Bundles/HubBundle.php +++ b/lib/private/App/AppStore/Bundles/HubBundle.php @@ -9,10 +9,12 @@ declare(strict_types=1); namespace OC\App\AppStore\Bundles; class HubBundle extends Bundle { + #[\Override] public function getName() { return $this->l10n->t('Hub bundle'); } + #[\Override] public function getAppIdentifiers() { $hubApps = [ 'spreed', diff --git a/lib/private/App/AppStore/Bundles/PublicSectorBundle.php b/lib/private/App/AppStore/Bundles/PublicSectorBundle.php index 06c5c6c2c39..759e0e551c2 100644 --- a/lib/private/App/AppStore/Bundles/PublicSectorBundle.php +++ b/lib/private/App/AppStore/Bundles/PublicSectorBundle.php @@ -12,6 +12,7 @@ class PublicSectorBundle extends Bundle { /** * {@inheritDoc} */ + #[\Override] public function getName(): string { return $this->l10n->t('Public sector bundle'); } @@ -19,6 +20,7 @@ class PublicSectorBundle extends Bundle { /** * {@inheritDoc} */ + #[\Override] public function getAppIdentifiers(): array { return [ diff --git a/lib/private/App/AppStore/Bundles/SocialSharingBundle.php b/lib/private/App/AppStore/Bundles/SocialSharingBundle.php index 013e8db3a83..533fafb2d92 100644 --- a/lib/private/App/AppStore/Bundles/SocialSharingBundle.php +++ b/lib/private/App/AppStore/Bundles/SocialSharingBundle.php @@ -12,6 +12,7 @@ class SocialSharingBundle extends Bundle { /** * {@inheritDoc} */ + #[\Override] public function getName() { return $this->l10n->t('Social sharing bundle'); } @@ -19,6 +20,7 @@ class SocialSharingBundle extends Bundle { /** * {@inheritDoc} */ + #[\Override] public function getAppIdentifiers() { return [ 'socialsharing_twitter', diff --git a/lib/private/App/AppStore/Fetcher/AppDiscoverFetcher.php b/lib/private/App/AppStore/Fetcher/AppDiscoverFetcher.php index 8389e525750..535ad42665c 100644 --- a/lib/private/App/AppStore/Fetcher/AppDiscoverFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppDiscoverFetcher.php @@ -47,6 +47,7 @@ class AppDiscoverFetcher extends Fetcher { * * @param bool $allowUnstable Include also upcoming entries */ + #[\Override] public function get($allowUnstable = false) { $entries = parent::get(false); $now = new DateTimeImmutable(); diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php index bbf4b00245b..8b4c31573ef 100644 --- a/lib/private/App/AppStore/Fetcher/AppFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php @@ -51,6 +51,7 @@ class AppFetcher extends Fetcher { * * @return array */ + #[\Override] protected function fetch($ETag, $content, $allowUnstable = false) { /** @var mixed[] $response */ $response = parent::fetch($ETag, $content); @@ -145,12 +146,14 @@ class AppFetcher extends Fetcher { * @param string $fileName * @param bool $ignoreMaxVersion */ + #[\Override] public function setVersion(string $version, string $fileName = 'apps.json', bool $ignoreMaxVersion = true) { parent::setVersion($version); $this->fileName = $fileName; $this->ignoreMaxVersion = $ignoreMaxVersion; } + #[\Override] public function get($allowUnstable = false): array { $allowPreReleases = $allowUnstable || $this->getChannel() === 'beta' || $this->getChannel() === 'daily' || $this->getChannel() === 'git'; diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index e4da80b94d9..40e5a84d8b2 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -98,6 +98,7 @@ class AppConfig implements IAppConfig { * @return list list of app ids * @since 7.0.0 */ + #[\Override] public function getApps(): array { $this->loadConfig(lazy: true); $apps = array_merge(array_keys($this->fastCache), array_keys($this->lazyCache)); @@ -115,6 +116,7 @@ class AppConfig implements IAppConfig { * * @since 29.0.0 */ + #[\Override] public function getKeys(string $app): array { $this->assertParams($app); $this->loadConfig($app, true); @@ -133,6 +135,7 @@ class AppConfig implements IAppConfig { * @return list list of stored config keys * @since 32.0.0 */ + #[\Override] public function searchKeys(string $app, string $prefix = '', bool $lazy = false): array { $this->assertParams($app); $this->loadConfig($app, $lazy); @@ -161,6 +164,7 @@ class AppConfig implements IAppConfig { * @since 7.0.0 * @since 29.0.0 Added the $lazy argument */ + #[\Override] public function hasKey(string $app, string $key, ?bool $lazy = false): bool { $this->assertParams($app, $key); $this->loadConfig($app, $lazy ?? true); @@ -184,6 +188,7 @@ class AppConfig implements IAppConfig { * @throws AppConfigUnknownKeyException if config key is not known * @since 29.0.0 */ + #[\Override] public function isSensitive(string $app, string $key, ?bool $lazy = false): bool { $this->assertParams($app, $key); $this->loadConfig(null, $lazy ?? true); @@ -207,6 +212,7 @@ class AppConfig implements IAppConfig { * @see IAppConfig for details about lazy loading * @since 29.0.0 */ + #[\Override] public function isLazy(string $app, string $key): bool { $this->assertParams($app, $key); $this->matchAndApplyLexiconDefinition($app, $key); @@ -235,6 +241,7 @@ class AppConfig implements IAppConfig { * @return array [configKey => configValue] * @since 29.0.0 */ + #[\Override] public function getAllValues(string $app, string $prefix = '', bool $filtered = false): array { $this->assertParams($app, $prefix); // if we want to filter values, we need to get sensitivity @@ -280,6 +287,7 @@ class AppConfig implements IAppConfig { * @return array [appId => configValue] * @since 29.0.0 */ + #[\Override] public function searchValues(string $key, bool $lazy = false, ?int $typedAs = null): array { $this->assertParams('', $key, true); $this->loadConfig(null, $lazy); @@ -360,6 +368,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see IAppConfig for explanation about lazy loading */ + #[\Override] public function getValueString( string $app, string $key, @@ -383,6 +392,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see IAppConfig for explanation about lazy loading */ + #[\Override] public function getValueInt( string $app, string $key, @@ -406,6 +416,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see IAppConfig for explanation about lazy loading */ + #[\Override] public function getValueFloat(string $app, string $key, float $default = 0, bool $lazy = false): float { return (float)$this->getTypedValue($app, $key, (string)$default, $lazy, self::VALUE_FLOAT); } @@ -424,6 +435,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see IAppConfig for explanation about lazy loading */ + #[\Override] public function getValueBool(string $app, string $key, bool $default = false, bool $lazy = false): bool { $b = strtolower($this->getTypedValue($app, $key, $default ? 'true' : 'false', $lazy, self::VALUE_BOOL)); return in_array($b, ['1', 'true', 'yes', 'on']); @@ -443,6 +455,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see IAppConfig for explanation about lazy loading */ + #[\Override] public function getValueArray( string $app, string $key, @@ -552,6 +565,7 @@ class AppConfig implements IAppConfig { * @see VALUE_BOOL * @see VALUE_ARRAY */ + #[\Override] public function getValueType(string $app, string $key, ?bool $lazy = null): int { $type = self::VALUE_MIXED; $ignorable = $lazy ?? false; @@ -627,6 +641,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see IAppConfig for explanation about lazy loading */ + #[\Override] public function setValueString( string $app, string $key, @@ -657,6 +672,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see IAppConfig for explanation about lazy loading */ + #[\Override] public function setValueInt( string $app, string $key, @@ -691,6 +707,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see IAppConfig for explanation about lazy loading */ + #[\Override] public function setValueFloat( string $app, string $key, @@ -720,6 +737,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see IAppConfig for explanation about lazy loading */ + #[\Override] public function setValueBool( string $app, string $key, @@ -750,6 +768,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see IAppConfig for explanation about lazy loading */ + #[\Override] public function setValueArray( string $app, string $key, @@ -973,6 +992,7 @@ class AppConfig implements IAppConfig { * @return bool TRUE if entry was found in database and an update was necessary * @since 29.0.0 */ + #[\Override] public function updateSensitive(string $app, string $key, bool $sensitive): bool { $this->assertParams($app, $key); $this->loadConfig(lazy: true); @@ -1033,6 +1053,7 @@ class AppConfig implements IAppConfig { * @return bool TRUE if entry was found in database and an update was necessary * @since 29.0.0 */ + #[\Override] public function updateLazy(string $app, string $key, bool $lazy): bool { $this->assertParams($app, $key); $this->loadConfig(lazy: true); @@ -1069,6 +1090,7 @@ class AppConfig implements IAppConfig { * @throws AppConfigUnknownKeyException if config key is not known in database * @since 29.0.0 */ + #[\Override] public function getDetails(string $app, string $key): array { $this->assertParams($app, $key); $this->loadConfig(lazy: true); @@ -1119,6 +1141,7 @@ class AppConfig implements IAppConfig { * @return array{app: string, key: string, lazy?: bool, valueType?: ValueType, valueTypeName?: string, sensitive?: bool, internal?: bool, default?: string, definition?: string, note?: string} * @since 32.0.0 */ + #[\Override] public function getKeyDetails(string $app, string $key): array { $this->assertParams($app, $key); try { @@ -1161,6 +1184,7 @@ class AppConfig implements IAppConfig { * @throws AppConfigIncorrectTypeException * @since 29.0.0 */ + #[\Override] public function convertTypeToInt(string $type): int { return match (strtolower($type)) { 'mixed' => IAppConfig::VALUE_MIXED, @@ -1180,6 +1204,7 @@ class AppConfig implements IAppConfig { * @throws AppConfigIncorrectTypeException * @since 29.0.0 */ + #[\Override] public function convertTypeToString(int $type): string { $type &= ~self::VALUE_SENSITIVE; @@ -1202,6 +1227,7 @@ class AppConfig implements IAppConfig { * * @since 29.0.0 */ + #[\Override] public function deleteKey(string $app, string $key): void { $this->assertParams($app, $key); $this->matchAndApplyLexiconDefinition($app, $key); @@ -1225,6 +1251,7 @@ class AppConfig implements IAppConfig { * * @since 29.0.0 */ + #[\Override] public function deleteApp(string $app): void { $this->assertParams($app); $qb = $this->connection->getQueryBuilder(); @@ -1243,6 +1270,7 @@ class AppConfig implements IAppConfig { * @internal * @since 29.0.0 */ + #[\Override] public function clearCache(bool $reload = false): void { $this->lazyLoaded = $this->fastLoaded = false; $this->lazyCache = $this->fastCache = $this->valueTypes = $this->configLexiconDetails = []; @@ -1448,6 +1476,7 @@ class AppConfig implements IAppConfig { * @return array|false * @deprecated 29.0.0 use {@see getAllValues()} */ + #[\Override] public function getValues($app, $key) { if (($app !== false) === ($key !== false)) { return false; @@ -1469,6 +1498,7 @@ class AppConfig implements IAppConfig { * @return array * @deprecated 29.0.0 use {@see getAllValues()} */ + #[\Override] public function getFilteredValues($app) { return $this->getAllValues($app, filtered: true); } @@ -1828,6 +1858,7 @@ class AppConfig implements IAppConfig { * * @return array */ + #[\Override] public function getAppInstalledVersions(bool $onlyEnabled = false): array { if ($this->appVersionsCache === null) { /** @var array */ diff --git a/lib/private/AppFramework/Bootstrap/BootContext.php b/lib/private/AppFramework/Bootstrap/BootContext.php index 5240f18d3b8..60b30c9c799 100644 --- a/lib/private/AppFramework/Bootstrap/BootContext.php +++ b/lib/private/AppFramework/Bootstrap/BootContext.php @@ -18,14 +18,17 @@ class BootContext implements IBootContext { ) { } + #[\Override] public function getAppContainer(): IAppContainer { return $this->appContainer; } + #[\Override] public function getServerContainer(): IServerContainer { return $this->appContainer->get(IServerContainer::class); } + #[\Override] public function injectFn(callable $fn) { return (new FunctionInjector($this->appContainer))->injectFn($fn); } diff --git a/lib/private/AppFramework/Bootstrap/RegistrationContext.php b/lib/private/AppFramework/Bootstrap/RegistrationContext.php index ec880706da2..1119d1b8fb7 100644 --- a/lib/private/AppFramework/Bootstrap/RegistrationContext.php +++ b/lib/private/AppFramework/Bootstrap/RegistrationContext.php @@ -179,6 +179,7 @@ class RegistrationContext { ) { } + #[\Override] public function registerCapability(string $capability): void { $this->context->registerCapability( $this->appId, @@ -186,6 +187,7 @@ class RegistrationContext { ); } + #[\Override] public function registerCrashReporter(string $reporterClass): void { $this->context->registerCrashReporter( $this->appId, @@ -193,6 +195,7 @@ class RegistrationContext { ); } + #[\Override] public function registerDashboardWidget(string $widgetClass): void { $this->context->registerDashboardPanel( $this->appId, @@ -200,6 +203,7 @@ class RegistrationContext { ); } + #[\Override] public function registerService(string $name, callable $factory, bool $shared = true): void { $this->context->registerService( $this->appId, @@ -209,6 +213,7 @@ class RegistrationContext { ); } + #[\Override] public function registerServiceAlias(string $alias, string $target): void { $this->context->registerServiceAlias( $this->appId, @@ -217,6 +222,7 @@ class RegistrationContext { ); } + #[\Override] public function registerParameter(string $name, $value): void { $this->context->registerParameter( $this->appId, @@ -225,6 +231,7 @@ class RegistrationContext { ); } + #[\Override] public function registerEventListener(string $event, string $listener, int $priority = 0): void { $this->context->registerEventListener( $this->appId, @@ -234,6 +241,7 @@ class RegistrationContext { ); } + #[\Override] public function registerMiddleware(string $class, bool $global = false): void { $this->context->registerMiddleware( $this->appId, @@ -242,6 +250,7 @@ class RegistrationContext { ); } + #[\Override] public function registerSearchProvider(string $class): void { $this->context->registerSearchProvider( $this->appId, @@ -249,6 +258,7 @@ class RegistrationContext { ); } + #[\Override] public function registerAlternativeLogin(string $class): void { $this->context->registerAlternativeLogin( $this->appId, @@ -264,6 +274,7 @@ class RegistrationContext { ); } + #[\Override] public function registerInitialStateProvider(string $class): void { $this->context->registerInitialState( $this->appId, @@ -271,6 +282,7 @@ class RegistrationContext { ); } + #[\Override] public function registerWellKnownHandler(string $class): void { $this->context->registerWellKnown( $this->appId, @@ -278,12 +290,14 @@ class RegistrationContext { ); } + #[\Override] public function registerSpeechToTextProvider(string $providerClass): void { $this->context->registerSpeechToTextProvider( $this->appId, $providerClass ); } + #[\Override] public function registerTextProcessingProvider(string $providerClass): void { $this->context->registerTextProcessingProvider( $this->appId, @@ -291,6 +305,7 @@ class RegistrationContext { ); } + #[\Override] public function registerTextToImageProvider(string $providerClass): void { $this->context->registerTextToImageProvider( $this->appId, @@ -298,6 +313,7 @@ class RegistrationContext { ); } + #[\Override] public function registerTemplateProvider(string $providerClass): void { $this->context->registerTemplateProvider( $this->appId, @@ -305,6 +321,7 @@ class RegistrationContext { ); } + #[\Override] public function registerTranslationProvider(string $providerClass): void { $this->context->registerTranslationProvider( $this->appId, @@ -312,6 +329,7 @@ class RegistrationContext { ); } + #[\Override] public function registerNotifierService(string $notifierClass): void { $this->context->registerNotifierService( $this->appId, @@ -319,6 +337,7 @@ class RegistrationContext { ); } + #[\Override] public function registerTwoFactorProvider(string $twoFactorProviderClass): void { $this->context->registerTwoFactorProvider( $this->appId, @@ -326,6 +345,7 @@ class RegistrationContext { ); } + #[\Override] public function registerPreviewProvider(string $previewProviderClass, string $mimeTypeRegex): void { $this->context->registerPreviewProvider( $this->appId, @@ -334,6 +354,7 @@ class RegistrationContext { ); } + #[\Override] public function registerCalendarProvider(string $class): void { $this->context->registerCalendarProvider( $this->appId, @@ -341,6 +362,7 @@ class RegistrationContext { ); } + #[\Override] public function registerReferenceProvider(string $class): void { $this->context->registerReferenceProvider( $this->appId, @@ -348,6 +370,7 @@ class RegistrationContext { ); } + #[\Override] public function registerProfileLinkAction(string $actionClass): void { $this->context->registerProfileLinkAction( $this->appId, @@ -355,6 +378,7 @@ class RegistrationContext { ); } + #[\Override] public function registerTalkBackend(string $backend): void { $this->context->registerTalkBackend( $this->appId, @@ -362,6 +386,7 @@ class RegistrationContext { ); } + #[\Override] public function registerCalendarResourceBackend(string $class): void { $this->context->registerCalendarResourceBackend( $this->appId, @@ -369,6 +394,7 @@ class RegistrationContext { ); } + #[\Override] public function registerTeamResourceProvider(string $class) : void { $this->context->registerTeamResourceProvider( $this->appId, @@ -376,6 +402,7 @@ class RegistrationContext { ); } + #[\Override] public function registerCalendarRoomBackend(string $class): void { $this->context->registerCalendarRoomBackend( $this->appId, @@ -383,6 +410,7 @@ class RegistrationContext { ); } + #[\Override] public function registerUserMigrator(string $migratorClass): void { $this->context->registerUserMigrator( $this->appId, @@ -390,6 +418,7 @@ class RegistrationContext { ); } + #[\Override] public function registerSensitiveMethods(string $class, array $methods): void { $this->context->registerSensitiveMethods( $this->appId, @@ -398,6 +427,7 @@ class RegistrationContext { ); } + #[\Override] public function registerPublicShareTemplateProvider(string $class): void { $this->context->registerPublicShareTemplateProvider( $this->appId, @@ -405,6 +435,7 @@ class RegistrationContext { ); } + #[\Override] public function registerSetupCheck(string $setupCheckClass): void { $this->context->registerSetupCheck( $this->appId, @@ -412,6 +443,7 @@ class RegistrationContext { ); } + #[\Override] public function registerDeclarativeSettings(string $declarativeSettingsClass): void { $this->context->registerDeclarativeSettings( $this->appId, @@ -419,6 +451,7 @@ class RegistrationContext { ); } + #[\Override] public function registerTaskProcessingProvider(string $taskProcessingProviderClass): void { $this->context->registerTaskProcessingProvider( $this->appId, @@ -426,6 +459,7 @@ class RegistrationContext { ); } + #[\Override] public function registerTaskProcessingTaskType(string $taskProcessingTaskTypeClass): void { $this->context->registerTaskProcessingTaskType( $this->appId, @@ -433,6 +467,7 @@ class RegistrationContext { ); } + #[\Override] public function registerFileConversionProvider(string $class): void { $this->context->registerFileConversionProvider( $this->appId, @@ -440,6 +475,7 @@ class RegistrationContext { ); } + #[\Override] public function registerMailProvider(string $class): void { $this->context->registerMailProvider( $this->appId, @@ -447,6 +483,7 @@ class RegistrationContext { ); } + #[\Override] public function registerConfigLexicon(string $configLexiconClass): void { $this->context->registerConfigLexicon( $this->appId, diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index 7527d249586..942e4787d88 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -256,6 +256,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { $this->registerAlias(IInitialState::class, InitialState::class); } + #[\Override] public function getServer(): ServerContainer { return $this->server; } @@ -263,6 +264,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { /** * @param string $middleWare */ + #[\Override] public function registerMiddleWare($middleWare): bool { if (in_array($middleWare, $this->middleWares, true) !== false) { return false; @@ -275,6 +277,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { * used to return the appname of the set application * @return string the name of your application */ + #[\Override] public function getAppName() { return $this->query('appName'); } @@ -305,12 +308,14 @@ class DIContainer extends SimpleContainer implements IAppContainer { * * @param string $serviceName e.g. 'OCA\Files\Capabilities' */ + #[\Override] public function registerCapability($serviceName) { $this->query(CapabilitiesManager::class)->registerCapability(function () use ($serviceName) { return $this->query($serviceName); }); } + #[\Override] public function has($id): bool { if (parent::has($id)) { return true; @@ -327,6 +332,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { * @inheritDoc * @param list $chain */ + #[\Override] public function query(string $name, bool $autoload = true, array $chain = []): mixed { if ($name === 'AppName' || $name === 'appName') { return $this->appName; diff --git a/lib/private/AppFramework/Http/Output.php b/lib/private/AppFramework/Http/Output.php index b4a8672fdc7..aee009b4654 100644 --- a/lib/private/AppFramework/Http/Output.php +++ b/lib/private/AppFramework/Http/Output.php @@ -21,6 +21,7 @@ class Output implements IOutput { /** * @param string $out */ + #[\Override] public function setOutput($out) { print($out); } @@ -30,6 +31,7 @@ class Output implements IOutput { * * @return bool false if an error occurred */ + #[\Override] public function setReadfile($path) { if (is_resource($path)) { $output = fopen('php://output', 'w'); @@ -42,6 +44,7 @@ class Output implements IOutput { /** * @param string $header */ + #[\Override] public function setHeader($header) { header($header); } @@ -49,6 +52,7 @@ class Output implements IOutput { /** * @param int $code sets the http status code */ + #[\Override] public function setHttpResponseCode($code) { http_response_code($code); } @@ -56,6 +60,7 @@ class Output implements IOutput { /** * @return int returns the current http response code */ + #[\Override] public function getHttpResponseCode() { return http_response_code(); } @@ -69,6 +74,7 @@ class Output implements IOutput { * @param bool $secure * @param bool $httpOnly */ + #[\Override] public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly, $sameSite = 'Lax') { $path = $this->webRoot ? : '/'; diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index a66860dbe60..eb8b5b33fc6 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -119,6 +119,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * Countable method * @return int */ + #[\Override] public function count(): int { return \count($this->items['parameters']); } @@ -143,6 +144,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @param string $offset The key to lookup * @return boolean */ + #[\Override] public function offsetExists($offset): bool { return isset($this->items['parameters'][$offset]); } @@ -152,6 +154,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @param string $offset * @return mixed */ + #[\Override] #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->items['parameters'][$offset] ?? null; @@ -162,6 +165,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @param string $offset * @param mixed $value */ + #[\Override] public function offsetSet($offset, $value): void { throw new \RuntimeException('You cannot change the contents of the request object'); } @@ -170,6 +174,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @see offsetExists * @param string $offset */ + #[\Override] public function offsetUnset($offset): void { throw new \RuntimeException('You cannot change the contents of the request object'); } @@ -254,6 +259,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @param string $name * @return string */ + #[\Override] public function getHeader(string $name): string { $name = strtoupper(str_replace('-', '_', $name)); if (isset($this->server['HTTP_' . $name])) { @@ -288,6 +294,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @param mixed $default If the key is not found, this value will be returned * @return mixed the content of the array */ + #[\Override] public function getParam(string $key, $default = null) { return isset($this->parameters[$key]) ? $this->parameters[$key] @@ -299,6 +306,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * (as GET or POST) or through the URL by the route * @return array the array with all parameters */ + #[\Override] public function getParams(): array { return is_array($this->parameters) ? $this->parameters : []; } @@ -307,6 +315,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * Returns the method of the request * @return string the method of the request (POST, GET, etc) */ + #[\Override] public function getMethod(): string { return $this->method; } @@ -316,6 +325,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @param string $key the key that will be taken from the $_FILES array * @return array the file in the $_FILES element */ + #[\Override] public function getUploadedFile(string $key) { return isset($this->files[$key]) ? $this->files[$key] : null; } @@ -325,6 +335,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @param string $key the key that will be taken from the $_ENV array * @return array the value in the $_ENV element */ + #[\Override] public function getEnv(string $key) { return isset($this->env[$key]) ? $this->env[$key] : null; } @@ -334,6 +345,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @param string $key the key that will be taken from the $_COOKIE array * @return string the value in the $_COOKIE element */ + #[\Override] public function getCookie(string $key) { return isset($this->cookies[$key]) ? $this->cookies[$key] : null; } @@ -416,6 +428,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { $this->contentDecoded = true; } + #[\Override] public function throwDecodingExceptionIfAny(): void { if ($this->decodingException !== null) { throw $this->decodingException; @@ -427,6 +440,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * Checks if the CSRF check was correct * @return bool true if CSRF check passed */ + #[\Override] public function passesCSRFCheck(): bool { if ($this->csrfTokenManager === null) { return false; @@ -503,6 +517,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @return bool * @since 9.1.0 */ + #[\Override] public function passesStrictCookieCheck(): bool { if (!$this->cookieCheckRequired()) { return true; @@ -523,6 +538,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @return bool * @since 9.1.0 */ + #[\Override] public function passesLaxCookieCheck(): bool { if (!$this->cookieCheckRequired()) { return true; @@ -541,6 +557,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * If `mod_unique_id` is installed this value will be taken. * @return string */ + #[\Override] public function getId(): string { return $this->requestId->getId(); } @@ -568,6 +585,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * Do always use this instead of $_SERVER['REMOTE_ADDR'] * @return string IP address */ + #[\Override] public function getRemoteAddress(): string { $remoteAddress = isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : ''; $trustedProxies = $this->config->getSystemValue('trusted_proxies', []); @@ -630,6 +648,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * * @return string Server protocol (http or https) */ + #[\Override] public function getServerProtocol(): string { $proto = 'http'; @@ -669,6 +688,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0. */ + #[\Override] public function getHttpProtocol(): string { $claimedProtocol = $this->server['SERVER_PROTOCOL'] ?? ''; @@ -694,6 +714,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * reverse proxies * @return string */ + #[\Override] public function getRequestUri(): string { $uri = isset($this->server['REQUEST_URI']) ? $this->server['REQUEST_URI'] : ''; if ($this->config->getSystemValueString('overwritewebroot') !== '' && $this->isOverwriteCondition()) { @@ -707,6 +728,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @throws \Exception * @return string Path info */ + #[\Override] public function getRawPathInfo(): string { $requestUri = isset($this->server['REQUEST_URI']) ? $this->server['REQUEST_URI'] : ''; // remove too many slashes - can be caused by reverse proxy configuration @@ -752,6 +774,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @throws \Exception * @return string|false Path info or false when not found */ + #[\Override] public function getPathInfo(): string|false { $pathInfo = $this->getRawPathInfo(); return \Sabre\HTTP\decodePath($pathInfo); @@ -762,6 +785,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * reverse proxies * @return string the script name */ + #[\Override] public function getScriptName(): string { $name = $this->server['SCRIPT_NAME'] ?? ''; $overwriteWebRoot = $this->config->getSystemValueString('overwritewebroot'); @@ -779,6 +803,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @param array $agent array of agent names * @return bool true if at least one of the given agent matches, false otherwise */ + #[\Override] public function isUserAgent(array $agent): bool { if (!isset($this->server['HTTP_USER_AGENT'])) { return false; @@ -796,6 +821,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * whether it is a trusted domain * @return string Server host */ + #[\Override] public function getInsecureServerHost(): string { if ($this->fromTrustedProxy() && $this->getOverwriteHost() !== null) { return $this->getOverwriteHost(); @@ -826,6 +852,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * trusted domain if the host isn't in the trusted list * @return string Server host */ + #[\Override] public function getServerHost(): string { // overwritehost is always trusted $host = $this->getOverwriteHost(); @@ -872,6 +899,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { return \is_array($trustedProxies) && $this->isTrustedProxy($trustedProxies, $remoteAddress); } + #[\Override] public function getFormat(): ?string { $format = $this->getParam('format'); if ($format !== null) { diff --git a/lib/private/AppFramework/Http/RequestId.php b/lib/private/AppFramework/Http/RequestId.php index 1fa2d351456..45dd2246be6 100644 --- a/lib/private/AppFramework/Http/RequestId.php +++ b/lib/private/AppFramework/Http/RequestId.php @@ -22,6 +22,7 @@ class RequestId implements IRequestId { * If `mod_unique_id` is installed this value will be taken. * @return string */ + #[\Override] public function getId(): string { if (empty($this->requestId)) { $validChars = ISecureRandom::CHAR_ALPHANUMERIC; diff --git a/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php b/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php index 4f1c69b104f..281e52a159d 100644 --- a/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php +++ b/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php @@ -25,6 +25,7 @@ class AdditionalScriptsMiddleware extends Middleware { ) { } + #[\Override] public function afterController($controller, $methodName, Response $response): Response { if ($response instanceof TemplateResponse) { if ($controller instanceof LoginController) { diff --git a/lib/private/AppFramework/Middleware/CompressionMiddleware.php b/lib/private/AppFramework/Middleware/CompressionMiddleware.php index 1cdd8c19f05..a6e4f65035f 100644 --- a/lib/private/AppFramework/Middleware/CompressionMiddleware.php +++ b/lib/private/AppFramework/Middleware/CompressionMiddleware.php @@ -26,6 +26,7 @@ class CompressionMiddleware extends Middleware { $this->useGZip = false; } + #[\Override] public function afterController($controller, $methodName, Response $response) { // By default we do not gzip $allowGzip = false; @@ -60,6 +61,7 @@ class CompressionMiddleware extends Middleware { return $response; } + #[\Override] public function beforeOutput($controller, $methodName, $output) { if (!$this->useGZip) { return $output; diff --git a/lib/private/AppFramework/Middleware/FlowV2EphemeralSessionsMiddleware.php b/lib/private/AppFramework/Middleware/FlowV2EphemeralSessionsMiddleware.php index 658a120320e..56f5babcc6f 100644 --- a/lib/private/AppFramework/Middleware/FlowV2EphemeralSessionsMiddleware.php +++ b/lib/private/AppFramework/Middleware/FlowV2EphemeralSessionsMiddleware.php @@ -34,6 +34,7 @@ class FlowV2EphemeralSessionsMiddleware extends Middleware { ) { } + #[\Override] public function beforeController(Controller $controller, string $methodName) { $sessionCreationTime = $this->session->get(ClientFlowLoginV2Controller::EPHEMERAL_NAME); diff --git a/lib/private/AppFramework/Middleware/NotModifiedMiddleware.php b/lib/private/AppFramework/Middleware/NotModifiedMiddleware.php index 60cf06f7b9c..07a7ed0addf 100644 --- a/lib/private/AppFramework/Middleware/NotModifiedMiddleware.php +++ b/lib/private/AppFramework/Middleware/NotModifiedMiddleware.php @@ -20,6 +20,7 @@ class NotModifiedMiddleware extends Middleware { ) { } + #[\Override] public function afterController($controller, $methodName, Response $response) { $etagHeader = $this->request->getHeader('IF_NONE_MATCH'); if ($etagHeader !== '' && $response->getETag() !== null && trim($etagHeader) === '"' . $response->getETag() . '"') { diff --git a/lib/private/AppFramework/Middleware/OCSMiddleware.php b/lib/private/AppFramework/Middleware/OCSMiddleware.php index d592b24a289..dc2bf5cb4e1 100644 --- a/lib/private/AppFramework/Middleware/OCSMiddleware.php +++ b/lib/private/AppFramework/Middleware/OCSMiddleware.php @@ -35,6 +35,7 @@ class OCSMiddleware extends Middleware { * @param Controller $controller * @param string $methodName */ + #[\Override] public function beforeController($controller, $methodName) { if ($controller instanceof OCSController) { if (substr_compare($this->request->getScriptName(), '/ocs/v2.php', -strlen('/ocs/v2.php')) === 0) { @@ -53,6 +54,7 @@ class OCSMiddleware extends Middleware { * @throws \Exception * @return BaseResponse */ + #[\Override] public function afterException($controller, $methodName, \Exception $exception) { if ($controller instanceof OCSController && $exception instanceof OCSException) { $code = $exception->getCode(); @@ -72,6 +74,7 @@ class OCSMiddleware extends Middleware { * @param Response $response * @return Response */ + #[\Override] public function afterController($controller, $methodName, Response $response) { /* * If a different middleware has detected that a request unauthorized or forbidden diff --git a/lib/private/AppFramework/Middleware/PublicShare/PublicShareMiddleware.php b/lib/private/AppFramework/Middleware/PublicShare/PublicShareMiddleware.php index 83e799e3d3b..a8aacc63724 100644 --- a/lib/private/AppFramework/Middleware/PublicShare/PublicShareMiddleware.php +++ b/lib/private/AppFramework/Middleware/PublicShare/PublicShareMiddleware.php @@ -29,6 +29,7 @@ class PublicShareMiddleware extends Middleware { ) { } + #[\Override] public function beforeController($controller, $methodName) { if (!($controller instanceof PublicShareController)) { return; @@ -79,6 +80,7 @@ class PublicShareMiddleware extends Middleware { throw new NotFoundException(); } + #[\Override] public function afterException($controller, $methodName, \Exception $exception) { if (!($controller instanceof PublicShareController)) { throw $exception; diff --git a/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php b/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php index 4b4425517e0..2630e7821f8 100644 --- a/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php @@ -44,6 +44,7 @@ class BruteForceMiddleware extends Middleware { /** * {@inheritDoc} */ + #[\Override] public function beforeController($controller, $methodName) { parent::beforeController($controller, $methodName); @@ -70,6 +71,7 @@ class BruteForceMiddleware extends Middleware { /** * {@inheritDoc} */ + #[\Override] public function afterController($controller, $methodName, Response $response) { if ($response->isThrottled()) { try { @@ -123,6 +125,7 @@ class BruteForceMiddleware extends Middleware { * @throws \Exception * @return Response */ + #[\Override] public function afterException($controller, $methodName, \Exception $exception): Response { if ($exception instanceof MaxDelayReached) { if ($controller instanceof OCSController) { diff --git a/lib/private/AppFramework/Middleware/Security/CSPMiddleware.php b/lib/private/AppFramework/Middleware/Security/CSPMiddleware.php index e88c9563c00..3cc4fe1a101 100644 --- a/lib/private/AppFramework/Middleware/Security/CSPMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/CSPMiddleware.php @@ -33,6 +33,7 @@ class CSPMiddleware extends Middleware { * @param Response $response * @return Response */ + #[\Override] public function afterController($controller, $methodName, Response $response): Response { $policy = !is_null($response->getContentSecurityPolicy()) ? $response->getContentSecurityPolicy() : new ContentSecurityPolicy(); diff --git a/lib/private/AppFramework/Middleware/Security/FeaturePolicyMiddleware.php b/lib/private/AppFramework/Middleware/Security/FeaturePolicyMiddleware.php index 632eceaa71b..d1d9bfbe5b4 100644 --- a/lib/private/AppFramework/Middleware/Security/FeaturePolicyMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/FeaturePolicyMiddleware.php @@ -30,6 +30,7 @@ class FeaturePolicyMiddleware extends Middleware { * @param Response $response * @return Response */ + #[\Override] public function afterController($controller, $methodName, Response $response): Response { $policy = !is_null($response->getFeaturePolicy()) ? $response->getFeaturePolicy() : new FeaturePolicy(); diff --git a/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php b/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php index 60b925876b1..94fc329d5c7 100644 --- a/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php @@ -45,6 +45,7 @@ class PasswordConfirmationMiddleware extends Middleware { /** * @throws NotConfirmedException */ + #[\Override] public function beforeController(Controller $controller, string $methodName) { if (!$this->needsPasswordConfirmation()) { return; diff --git a/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php b/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php index 906e57a86ef..bec5a3c3db3 100644 --- a/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php @@ -68,6 +68,7 @@ class RateLimitingMiddleware extends Middleware { * {@inheritDoc} * @throws RateLimitExceededException */ + #[\Override] public function beforeController(Controller $controller, string $methodName): void { parent::beforeController($controller, $methodName); $rateLimitIdentifier = get_class($controller) . '::' . $methodName; @@ -184,6 +185,7 @@ class RateLimitingMiddleware extends Middleware { /** * {@inheritDoc} */ + #[\Override] public function afterException(Controller $controller, string $methodName, \Exception $exception): Response { if ($exception instanceof RateLimitExceededException) { if (stripos($this->request->getHeader('Accept'), 'html') === false) { diff --git a/lib/private/AppFramework/Middleware/Security/ReloadExecutionMiddleware.php b/lib/private/AppFramework/Middleware/Security/ReloadExecutionMiddleware.php index 298921eedaa..488093149ad 100644 --- a/lib/private/AppFramework/Middleware/Security/ReloadExecutionMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/ReloadExecutionMiddleware.php @@ -25,12 +25,14 @@ class ReloadExecutionMiddleware extends Middleware { ) { } + #[\Override] public function beforeController($controller, $methodName) { if ($this->session->exists('clearingExecutionContexts')) { throw new ReloadExecutionException(); } } + #[\Override] public function afterException($controller, $methodName, \Exception $exception) { if ($exception instanceof ReloadExecutionException) { $this->session->remove('clearingExecutionContexts'); diff --git a/lib/private/AppFramework/Middleware/Security/SameSiteCookieMiddleware.php b/lib/private/AppFramework/Middleware/Security/SameSiteCookieMiddleware.php index 7334b56bac1..99263d125cf 100644 --- a/lib/private/AppFramework/Middleware/Security/SameSiteCookieMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/SameSiteCookieMiddleware.php @@ -24,6 +24,7 @@ class SameSiteCookieMiddleware extends Middleware { ) { } + #[\Override] public function beforeController($controller, $methodName) { $requestUri = $this->request->getScriptName(); $processingScript = explode('/', $requestUri); @@ -44,6 +45,7 @@ class SameSiteCookieMiddleware extends Middleware { } } + #[\Override] public function afterException($controller, $methodName, \Exception $exception) { if ($exception instanceof LaxSameSiteCookieFailedException) { $response = new Response(); diff --git a/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php b/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php index 2a7b058fd51..8731dab4835 100644 --- a/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php @@ -105,6 +105,7 @@ class SecurityMiddleware extends Middleware { * * @suppress PhanUndeclaredClassConstant */ + #[\Override] public function beforeController($controller, $methodName) { // this will set the current navigation entry of the app, use this only // for normal HTML requests and not for AJAX requests @@ -250,6 +251,7 @@ class SecurityMiddleware extends Middleware { * @return Response a Response object or null in case that the exception could not be handled * @throws \Exception the passed in exception if it can't handle it */ + #[\Override] public function afterException($controller, $methodName, \Exception $exception): Response { if ($exception instanceof SecurityException) { if ($exception instanceof StrictCookieMissingException) { diff --git a/lib/private/AppFramework/Middleware/SessionMiddleware.php b/lib/private/AppFramework/Middleware/SessionMiddleware.php index c1cff28ce78..2f10b24ec60 100644 --- a/lib/private/AppFramework/Middleware/SessionMiddleware.php +++ b/lib/private/AppFramework/Middleware/SessionMiddleware.php @@ -26,6 +26,7 @@ class SessionMiddleware extends Middleware { * @param Controller $controller * @param string $methodName */ + #[\Override] public function beforeController($controller, $methodName) { if ($this->reflector->hasAnnotationOrAttribute('UseSession', UseSession::class)) { $this->session->reopen(); @@ -38,6 +39,7 @@ class SessionMiddleware extends Middleware { * @param Response $response * @return Response */ + #[\Override] public function afterController($controller, $methodName, Response $response) { if ($this->reflector->hasAnnotationOrAttribute('UseSession', UseSession::class)) { $this->session->close(); diff --git a/lib/private/AppFramework/OCS/V1Response.php b/lib/private/AppFramework/OCS/V1Response.php index c628a2c7b50..11d674b57f5 100644 --- a/lib/private/AppFramework/OCS/V1Response.php +++ b/lib/private/AppFramework/OCS/V1Response.php @@ -23,6 +23,7 @@ class V1Response extends BaseResponse { * * @return Http::STATUS_* */ + #[\Override] public function getStatus() { $status = parent::getStatus(); if ($status === OCSController::RESPOND_UNAUTHORISED) { @@ -37,6 +38,7 @@ class V1Response extends BaseResponse { * * @return int */ + #[\Override] public function getOCSStatus() { $status = parent::getOCSStatus(); @@ -53,6 +55,7 @@ class V1Response extends BaseResponse { * * @return string */ + #[\Override] public function render() { $meta = [ 'status' => $this->getOCSStatus() === 100 ? 'ok' : 'failure', diff --git a/lib/private/AppFramework/OCS/V2Response.php b/lib/private/AppFramework/OCS/V2Response.php index 0398a587ec4..1c6c2cd076e 100644 --- a/lib/private/AppFramework/OCS/V2Response.php +++ b/lib/private/AppFramework/OCS/V2Response.php @@ -23,6 +23,7 @@ class V2Response extends BaseResponse { * * @return Http::STATUS_* */ + #[\Override] public function getStatus() { $status = parent::getStatus(); if ($status === OCSController::RESPOND_UNAUTHORISED) { @@ -44,6 +45,7 @@ class V2Response extends BaseResponse { * * @return string */ + #[\Override] public function render() { $status = parent::getStatus(); diff --git a/lib/private/AppFramework/ScopedPsrLogger.php b/lib/private/AppFramework/ScopedPsrLogger.php index a413710a7d7..4a14a9d0b03 100644 --- a/lib/private/AppFramework/ScopedPsrLogger.php +++ b/lib/private/AppFramework/ScopedPsrLogger.php @@ -18,6 +18,7 @@ class ScopedPsrLogger implements LoggerInterface { ) { } + #[\Override] public function emergency($message, array $context = []): void { $this->inner->emergency( $message, @@ -30,6 +31,7 @@ class ScopedPsrLogger implements LoggerInterface { ); } + #[\Override] public function alert($message, array $context = []): void { $this->inner->alert( $message, @@ -42,6 +44,7 @@ class ScopedPsrLogger implements LoggerInterface { ); } + #[\Override] public function critical($message, array $context = []): void { $this->inner->critical( $message, @@ -54,6 +57,7 @@ class ScopedPsrLogger implements LoggerInterface { ); } + #[\Override] public function error($message, array $context = []): void { $this->inner->error( $message, @@ -66,6 +70,7 @@ class ScopedPsrLogger implements LoggerInterface { ); } + #[\Override] public function warning($message, array $context = []): void { $this->inner->warning( $message, @@ -78,6 +83,7 @@ class ScopedPsrLogger implements LoggerInterface { ); } + #[\Override] public function notice($message, array $context = []): void { $this->inner->notice( $message, @@ -90,6 +96,7 @@ class ScopedPsrLogger implements LoggerInterface { ); } + #[\Override] public function info($message, array $context = []): void { $this->inner->info( $message, @@ -102,6 +109,7 @@ class ScopedPsrLogger implements LoggerInterface { ); } + #[\Override] public function debug($message, array $context = []): void { $this->inner->debug( $message, @@ -114,6 +122,7 @@ class ScopedPsrLogger implements LoggerInterface { ); } + #[\Override] public function log($level, $message, array $context = []): void { $this->inner->log( $level, diff --git a/lib/private/AppFramework/Services/AppConfig.php b/lib/private/AppFramework/Services/AppConfig.php index 04d97738483..04178d042c4 100644 --- a/lib/private/AppFramework/Services/AppConfig.php +++ b/lib/private/AppFramework/Services/AppConfig.php @@ -30,6 +30,7 @@ class AppConfig implements IAppConfig { * @return string[] list of stored config keys * @since 20.0.0 */ + #[\Override] public function getAppKeys(): array { return $this->appConfig->getKeys($this->appName); } @@ -43,6 +44,7 @@ class AppConfig implements IAppConfig { * @return bool TRUE if key exists * @since 29.0.0 */ + #[\Override] public function hasAppKey(string $key, ?bool $lazy = false): bool { return $this->appConfig->hasKey($this->appName, $key, $lazy); } @@ -55,6 +57,7 @@ class AppConfig implements IAppConfig { * @throws AppConfigUnknownKeyException if config key is not known * @since 29.0.0 */ + #[\Override] public function isSensitive(string $key, ?bool $lazy = false): bool { return $this->appConfig->isSensitive($this->appName, $key, $lazy); } @@ -69,6 +72,7 @@ class AppConfig implements IAppConfig { * @see \OCP\IAppConfig for details about lazy loading * @since 29.0.0 */ + #[\Override] public function isLazy(string $key): bool { return $this->appConfig->isLazy($this->appName, $key); } @@ -82,6 +86,7 @@ class AppConfig implements IAppConfig { * @return array [configKey => configValue] * @since 29.0.0 */ + #[\Override] public function getAllAppValues(string $key = '', bool $filtered = false): array { return $this->appConfig->getAllValues($this->appName, $key, $filtered); } @@ -94,6 +99,7 @@ class AppConfig implements IAppConfig { * @since 20.0.0 * @deprecated 29.0.0 use {@see setAppValueString()} */ + #[\Override] public function setAppValue(string $key, string $value): void { /** @psalm-suppress InternalMethod */ $this->appConfig->setValueMixed($this->appName, $key, $value); @@ -112,6 +118,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see \OCP\IAppConfig for explanation about lazy loading */ + #[\Override] public function setAppValueString( string $key, string $value, @@ -134,6 +141,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see \OCP\IAppConfig for explanation about lazy loading */ + #[\Override] public function setAppValueInt( string $key, int $value, @@ -156,6 +164,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see \OCP\IAppConfig for explanation about lazy loading */ + #[\Override] public function setAppValueFloat( string $key, float $value, @@ -177,6 +186,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see \OCP\IAppConfig for explanation about lazy loading */ + #[\Override] public function setAppValueBool( string $key, bool $value, @@ -199,6 +209,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see \OCP\IAppConfig for explanation about lazy loading */ + #[\Override] public function setAppValueArray( string $key, array $value, @@ -216,6 +227,7 @@ class AppConfig implements IAppConfig { * @deprecated 29.0.0 use {@see getAppValueString()} * @return string */ + #[\Override] public function getAppValue(string $key, string $default = ''): string { /** @psalm-suppress InternalMethod */ /** @psalm-suppress UndefinedInterfaceMethod */ @@ -235,6 +247,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see \OCP\IAppConfig for explanation about lazy loading */ + #[\Override] public function getAppValueString(string $key, string $default = '', bool $lazy = false): string { return $this->appConfig->getValueString($this->appName, $key, $default, $lazy); } @@ -252,6 +265,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see \OCP\IAppConfig for explanation about lazy loading */ + #[\Override] public function getAppValueInt(string $key, int $default = 0, bool $lazy = false): int { return $this->appConfig->getValueInt($this->appName, $key, $default, $lazy); } @@ -269,6 +283,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see \OCP\IAppConfig for explanation about lazy loading */ + #[\Override] public function getAppValueFloat(string $key, float $default = 0, bool $lazy = false): float { return $this->appConfig->getValueFloat($this->appName, $key, $default, $lazy); } @@ -286,6 +301,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see \OCP\IAppConfig for explanation about lazy loading */ + #[\Override] public function getAppValueBool(string $key, bool $default = false, bool $lazy = false): bool { return $this->appConfig->getValueBool($this->appName, $key, $default, $lazy); } @@ -303,6 +319,7 @@ class AppConfig implements IAppConfig { * @since 29.0.0 * @see \OCP\IAppConfig for explanation about lazy loading */ + #[\Override] public function getAppValueArray(string $key, array $default = [], bool $lazy = false): array { return $this->appConfig->getValueArray($this->appName, $key, $default, $lazy); } @@ -313,6 +330,7 @@ class AppConfig implements IAppConfig { * @param string $key the key of the value, under which it was saved * @since 20.0.0 */ + #[\Override] public function deleteAppValue(string $key): void { $this->appConfig->deleteKey($this->appName, $key); } @@ -322,18 +340,22 @@ class AppConfig implements IAppConfig { * * @since 20.0.0 */ + #[\Override] public function deleteAppValues(): void { $this->appConfig->deleteApp($this->appName); } + #[\Override] public function setUserValue(string $userId, string $key, string $value, ?string $preCondition = null): void { $this->config->setUserValue($userId, $this->appName, $key, $value, $preCondition); } + #[\Override] public function getUserValue(string $userId, string $key, string $default = ''): string { return $this->config->getUserValue($userId, $this->appName, $key, $default); } + #[\Override] public function deleteUserValue(string $userId, string $key): void { $this->config->deleteUserValue($userId, $this->appName, $key); } diff --git a/lib/private/AppFramework/Services/InitialState.php b/lib/private/AppFramework/Services/InitialState.php index 51c5fbe672d..d2caca47f7e 100644 --- a/lib/private/AppFramework/Services/InitialState.php +++ b/lib/private/AppFramework/Services/InitialState.php @@ -18,10 +18,12 @@ class InitialState implements IInitialState { ) { } + #[\Override] public function provideInitialState(string $key, $data): void { $this->state->provideInitialState($this->appName, $key, $data); } + #[\Override] public function provideLazyInitialState(string $key, \Closure $closure): void { $this->state->provideLazyInitialState($this->appName, $key, $closure); } diff --git a/lib/private/AppFramework/Utility/ControllerMethodReflector.php b/lib/private/AppFramework/Utility/ControllerMethodReflector.php index 1d30ff2e137..8d76d6a1028 100644 --- a/lib/private/AppFramework/Utility/ControllerMethodReflector.php +++ b/lib/private/AppFramework/Utility/ControllerMethodReflector.php @@ -102,6 +102,7 @@ class ControllerMethodReflector implements IControllerMethodReflector { * @return string|null type in the type parameters (@param int $something) * would return int or null if not existing */ + #[\Override] public function getType(string $parameter) { if (array_key_exists($parameter, $this->types)) { return $this->types[$parameter]; @@ -121,6 +122,7 @@ class ControllerMethodReflector implements IControllerMethodReflector { /** * @return array the arguments of the method with key => default value */ + #[\Override] public function getParameters(): array { return $this->parameters; } @@ -130,6 +132,7 @@ class ControllerMethodReflector implements IControllerMethodReflector { * * @param class-string $attributeClass */ + #[\Override] public function hasAnnotationOrAttribute(?string $annotationName, string $attributeClass): bool { if (!empty($this->reflectionMethod->getAttributes($attributeClass))) { return true; @@ -148,6 +151,7 @@ class ControllerMethodReflector implements IControllerMethodReflector { * @param string $name the name of the annotation * @return bool true if the annotation is found */ + #[\Override] public function hasAnnotation(string $name): bool { $name = strtolower($name); return array_key_exists($name, $this->annotations); diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php index 429b7d617ed..9afdfbef718 100644 --- a/lib/private/AppFramework/Utility/SimpleContainer.php +++ b/lib/private/AppFramework/Utility/SimpleContainer.php @@ -39,10 +39,12 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { * @param class-string|string $id * @return ($id is class-string ? T : mixed) */ + #[\Override] public function get(string $id): mixed { return $this->query($id); } + #[\Override] public function has(string $id): bool { // If a service is no registered but is an existing class, we can probably load it return isset($this->container[$id]) || class_exists($id); @@ -120,6 +122,7 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { * @inheritDoc * @param list $chain */ + #[\Override] public function resolve(string $name, array $chain = []): mixed { $baseMsg = 'Could not resolve ' . $name . '!'; try { @@ -140,6 +143,7 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { * @inheritDoc * @param list $chain */ + #[\Override] public function query(string $name, bool $autoload = true, array $chain = []): mixed { $name = $this->sanitizeName($name); if (isset($this->container[$name])) { @@ -161,10 +165,12 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { throw new QueryNotFoundException('Could not resolve ' . $name . '!'); } + #[\Override] public function registerParameter(string $name, mixed $value): void { $this[$name] = $value; } + #[\Override] public function registerService(string $name, Closure $closure, bool $shared = true): void { $wrapped = function () use ($closure) { return $closure($this); @@ -187,6 +193,7 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { * @param string $alias the alias that should be registered * @param string $target the target that should be resolved instead */ + #[\Override] public function registerAlias(string $alias, string $target): void { $this->registerService($alias, function (ContainerInterface $container) use ($target): mixed { return $container->get($target); @@ -222,6 +229,7 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { /** * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::has */ + #[\Override] public function offsetExists($id): bool { return $this->container->offsetExists($id); } @@ -230,6 +238,7 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get * @return mixed */ + #[\Override] #[\ReturnTypeWillChange] public function offsetGet($id) { return $this->container->offsetGet($id); @@ -238,6 +247,7 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { /** * @deprecated 20.0.0 use \OCP\IContainer::registerService */ + #[\Override] public function offsetSet($offset, $value): void { $this->container->offsetSet($offset, $value); } @@ -245,6 +255,7 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { /** * @deprecated 20.0.0 */ + #[\Override] public function offsetUnset($offset): void { $this->container->offsetUnset($offset); } diff --git a/lib/private/AppFramework/Utility/TimeFactory.php b/lib/private/AppFramework/Utility/TimeFactory.php index 0584fd05ef9..5aba31577b2 100644 --- a/lib/private/AppFramework/Utility/TimeFactory.php +++ b/lib/private/AppFramework/Utility/TimeFactory.php @@ -29,6 +29,7 @@ class TimeFactory implements ITimeFactory { * @since 8.0.0 * @deprecated 26.0.0 {@see ITimeFactory::now()} */ + #[\Override] public function getTime(): int { return time(); } @@ -40,13 +41,16 @@ class TimeFactory implements ITimeFactory { * @since 15.0.0 * @deprecated 26.0.0 {@see ITimeFactory::now()} */ + #[\Override] public function getDateTime(string $time = 'now', ?\DateTimeZone $timezone = null): \DateTime { return new \DateTime($time, $timezone); } + #[\Override] public function now(): \DateTimeImmutable { return new \DateTimeImmutable('now', $this->timezone); } + #[\Override] public function withTimeZone(\DateTimeZone $timezone): static { $clone = clone $this; $clone->timezone = $timezone; @@ -54,6 +58,7 @@ class TimeFactory implements ITimeFactory { return $clone; } + #[\Override] public function getTimeZone(?string $timezone = null): \DateTimeZone { if ($timezone !== null) { return new \DateTimeZone($timezone); diff --git a/lib/private/Archive/TAR.php b/lib/private/Archive/TAR.php index 4de0f35ccfa..1376e428060 100644 --- a/lib/private/Archive/TAR.php +++ b/lib/private/Archive/TAR.php @@ -61,6 +61,7 @@ class TAR extends Archive { /** * add an empty folder to the archive */ + #[\Override] public function addFolder(string $path): bool { $tmpBase = Server::get(ITempManager::class)->getTemporaryFolder(); $path = rtrim($path, '/') . '/'; @@ -87,6 +88,7 @@ class TAR extends Archive { * * @param string $source either a local file or string data */ + #[\Override] public function addFile(string $path, string $source = ''): bool { if ($this->fileExists($path)) { $this->remove($path); @@ -103,6 +105,7 @@ class TAR extends Archive { /** * rename a file or folder in the archive */ + #[\Override] public function rename(string $source, string $dest): bool { //no proper way to delete, rename entire archive, rename file and remake archive $tmp = Server::get(ITempManager::class)->getTemporaryFolder(); @@ -137,6 +140,7 @@ class TAR extends Archive { /** * get the uncompressed size of a file in the archive */ + #[\Override] public function filesize(string $path): false|int|float { $stat = $this->getHeader($path); return $stat['size'] ?? false; @@ -147,6 +151,7 @@ class TAR extends Archive { * * @return int|false */ + #[\Override] public function mtime(string $path) { $stat = $this->getHeader($path); return $stat['mtime'] ?? false; @@ -155,6 +160,7 @@ class TAR extends Archive { /** * get the files in a folder */ + #[\Override] public function getFolder(string $path): array { $files = $this->getFiles(); $folderContent = []; @@ -179,6 +185,7 @@ class TAR extends Archive { /** * get all files in the archive */ + #[\Override] public function getFiles(): array { if ($this->fileList !== false) { return $this->fileList; @@ -204,6 +211,7 @@ class TAR extends Archive { * * @return string|false */ + #[\Override] public function getFile(string $path) { $string = $this->tar->extractInString($path); /** @var ?string $string */ @@ -217,6 +225,7 @@ class TAR extends Archive { /** * extract a single file from the archive */ + #[\Override] public function extractFile(string $path, string $dest): bool { $tmp = Server::get(ITempManager::class)->getTemporaryFolder(); if (!$this->fileExists($path)) { @@ -237,6 +246,7 @@ class TAR extends Archive { /** * extract the archive */ + #[\Override] public function extract(string $dest): bool { return $this->tar->extract($dest); } @@ -244,6 +254,7 @@ class TAR extends Archive { /** * check if a file or folder exists in the archive */ + #[\Override] public function fileExists(string $path): bool { $files = $this->getFiles(); if ((in_array($path, $files)) || (in_array($path . '/', $files))) { @@ -267,6 +278,7 @@ class TAR extends Archive { /** * remove a file or folder from the archive */ + #[\Override] public function remove(string $path): bool { if (!$this->fileExists($path)) { return false; @@ -288,6 +300,7 @@ class TAR extends Archive { * * @return bool|resource */ + #[\Override] public function getStream(string $path, string $mode) { $lastPoint = strrpos($path, '.'); if ($lastPoint !== false) { diff --git a/lib/private/Archive/ZIP.php b/lib/private/Archive/ZIP.php index 0ed83110632..e3d20ccfd66 100644 --- a/lib/private/Archive/ZIP.php +++ b/lib/private/Archive/ZIP.php @@ -33,6 +33,7 @@ class ZIP extends Archive { * @param string $path * @return bool */ + #[\Override] public function addFolder(string $path): bool { return $this->zip->addEmptyDir($path); } @@ -41,6 +42,7 @@ class ZIP extends Archive { * add a file to the archive * @param string $source either a local file or string data */ + #[\Override] public function addFile(string $path, string $source = ''): bool { if ($source && $source[0] === '/' && file_exists($source)) { $result = $this->zip->addFile($source, $path); @@ -57,6 +59,7 @@ class ZIP extends Archive { /** * rename a file or folder in the archive */ + #[\Override] public function rename(string $source, string $dest): bool { $source = $this->stripPath($source); $dest = $this->stripPath($dest); @@ -66,6 +69,7 @@ class ZIP extends Archive { /** * get the uncompressed size of a file in the archive */ + #[\Override] public function filesize(string $path): false|int|float { $stat = $this->zip->statName($path); return $stat['size'] ?? false; @@ -75,6 +79,7 @@ class ZIP extends Archive { * get the last modified time of a file in the archive * @return int|false */ + #[\Override] public function mtime(string $path) { return filemtime($this->path); } @@ -82,6 +87,7 @@ class ZIP extends Archive { /** * get the files in a folder */ + #[\Override] public function getFolder(string $path): array { // FIXME: multiple calls on getFolder would traverse // the whole file list over and over again @@ -128,6 +134,7 @@ class ZIP extends Archive { /** * get all files in the archive */ + #[\Override] public function getFiles(): array { $fileCount = $this->zip->numFiles; $files = []; @@ -141,6 +148,7 @@ class ZIP extends Archive { * get the content of a file * @return string|false */ + #[\Override] public function getFile(string $path) { return $this->zip->getFromName($path); } @@ -148,6 +156,7 @@ class ZIP extends Archive { /** * extract a single file from the archive */ + #[\Override] public function extractFile(string $path, string $dest): bool { $fp = $this->zip->getStream($path); if ($fp === false) { @@ -159,6 +168,7 @@ class ZIP extends Archive { /** * extract the archive */ + #[\Override] public function extract(string $dest): bool { return $this->zip->extractTo($dest); } @@ -166,6 +176,7 @@ class ZIP extends Archive { /** * check if a file or folder exists in the archive */ + #[\Override] public function fileExists(string $path): bool { return ($this->zip->locateName($path) !== false) || ($this->zip->locateName($path . '/') !== false); } @@ -173,6 +184,7 @@ class ZIP extends Archive { /** * remove a file or folder from the archive */ + #[\Override] public function remove(string $path): bool { if ($this->fileExists($path . '/')) { return $this->zip->deleteName($path . '/'); @@ -185,6 +197,7 @@ class ZIP extends Archive { * get a file handler * @return bool|resource */ + #[\Override] public function getStream(string $path, string $mode) { if ($mode === 'r' || $mode === 'rb') { return $this->zip->getStream($path); diff --git a/lib/private/Authentication/Exceptions/ExpiredTokenException.php b/lib/private/Authentication/Exceptions/ExpiredTokenException.php index eed2358d29d..58ee79dd41c 100644 --- a/lib/private/Authentication/Exceptions/ExpiredTokenException.php +++ b/lib/private/Authentication/Exceptions/ExpiredTokenException.php @@ -20,6 +20,7 @@ class ExpiredTokenException extends \OCP\Authentication\Exceptions\ExpiredTokenE parent::__construct($token); } + #[\Override] public function getToken(): IToken { $token = parent::getToken(); /** @var IToken $token We know that we passed OC interface from constructor */ diff --git a/lib/private/Authentication/Exceptions/WipeTokenException.php b/lib/private/Authentication/Exceptions/WipeTokenException.php index 6bf0565434a..00b28e8e2a1 100644 --- a/lib/private/Authentication/Exceptions/WipeTokenException.php +++ b/lib/private/Authentication/Exceptions/WipeTokenException.php @@ -20,6 +20,7 @@ class WipeTokenException extends \OCP\Authentication\Exceptions\WipeTokenExcepti parent::__construct($token); } + #[\Override] public function getToken(): IToken { $token = parent::getToken(); /** @var IToken $token We know that we passed OC interface from constructor */ diff --git a/lib/private/Authentication/Listeners/LoginFailedListener.php b/lib/private/Authentication/Listeners/LoginFailedListener.php index 7e46d2e7b24..c8747d53b55 100644 --- a/lib/private/Authentication/Listeners/LoginFailedListener.php +++ b/lib/private/Authentication/Listeners/LoginFailedListener.php @@ -27,6 +27,7 @@ class LoginFailedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof LoginFailed)) { return; diff --git a/lib/private/Authentication/Listeners/RemoteWipeActivityListener.php b/lib/private/Authentication/Listeners/RemoteWipeActivityListener.php index b071886fd74..a7c605569f4 100644 --- a/lib/private/Authentication/Listeners/RemoteWipeActivityListener.php +++ b/lib/private/Authentication/Listeners/RemoteWipeActivityListener.php @@ -28,6 +28,7 @@ class RemoteWipeActivityListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof RemoteWipeStarted) { $this->publishActivity('remote_wipe_start', $event->getToken()); diff --git a/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php b/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php index cf18ae2afcc..943df1e44e1 100644 --- a/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php +++ b/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php @@ -41,6 +41,7 @@ class RemoteWipeEmailListener implements IEventListener { /** * @param Event $event */ + #[\Override] public function handle(Event $event): void { if ($event instanceof RemoteWipeStarted) { $uid = $event->getToken()->getUID(); diff --git a/lib/private/Authentication/Listeners/RemoteWipeNotificationsListener.php b/lib/private/Authentication/Listeners/RemoteWipeNotificationsListener.php index 5e5b0fcaa50..b3fafa44c98 100644 --- a/lib/private/Authentication/Listeners/RemoteWipeNotificationsListener.php +++ b/lib/private/Authentication/Listeners/RemoteWipeNotificationsListener.php @@ -27,6 +27,7 @@ class RemoteWipeNotificationsListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof RemoteWipeStarted) { $this->sendNotification('remote_wipe_start', $event->getToken()); diff --git a/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php b/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php index a619021d192..45de836482d 100644 --- a/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php +++ b/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php @@ -29,6 +29,7 @@ class UserDeletedFilesCleanupListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { $user = $event->getUser(); diff --git a/lib/private/Authentication/Listeners/UserDeletedStoreCleanupListener.php b/lib/private/Authentication/Listeners/UserDeletedStoreCleanupListener.php index d7a9bf4fb29..a3933116bd2 100644 --- a/lib/private/Authentication/Listeners/UserDeletedStoreCleanupListener.php +++ b/lib/private/Authentication/Listeners/UserDeletedStoreCleanupListener.php @@ -22,6 +22,7 @@ class UserDeletedStoreCleanupListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof UserDeletedEvent)) { return; diff --git a/lib/private/Authentication/Listeners/UserDeletedTokenCleanupListener.php b/lib/private/Authentication/Listeners/UserDeletedTokenCleanupListener.php index 6365e973ec6..bc67ef0feec 100644 --- a/lib/private/Authentication/Listeners/UserDeletedTokenCleanupListener.php +++ b/lib/private/Authentication/Listeners/UserDeletedTokenCleanupListener.php @@ -25,6 +25,7 @@ class UserDeletedTokenCleanupListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof UserDeletedEvent)) { // Unrelated diff --git a/lib/private/Authentication/Listeners/UserDeletedWebAuthnCleanupListener.php b/lib/private/Authentication/Listeners/UserDeletedWebAuthnCleanupListener.php index d025a2150a3..cd3f9af5924 100644 --- a/lib/private/Authentication/Listeners/UserDeletedWebAuthnCleanupListener.php +++ b/lib/private/Authentication/Listeners/UserDeletedWebAuthnCleanupListener.php @@ -21,6 +21,7 @@ class UserDeletedWebAuthnCleanupListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof UserDeletedEvent)) { return; diff --git a/lib/private/Authentication/Listeners/UserLoggedInListener.php b/lib/private/Authentication/Listeners/UserLoggedInListener.php index a4fc2d50611..2eafc7e1c4e 100644 --- a/lib/private/Authentication/Listeners/UserLoggedInListener.php +++ b/lib/private/Authentication/Listeners/UserLoggedInListener.php @@ -22,6 +22,7 @@ class UserLoggedInListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof PostLoginEvent)) { return; diff --git a/lib/private/Authentication/Login/ClearLostPasswordTokensCommand.php b/lib/private/Authentication/Login/ClearLostPasswordTokensCommand.php index cd40348b056..0b6bb19da80 100644 --- a/lib/private/Authentication/Login/ClearLostPasswordTokensCommand.php +++ b/lib/private/Authentication/Login/ClearLostPasswordTokensCommand.php @@ -19,6 +19,7 @@ class ClearLostPasswordTokensCommand extends ALoginCommand { /** * User has successfully logged in, now remove the password reset link, when it is available */ + #[\Override] public function process(LoginData $loginData): LoginResult { $this->config->deleteUserValue( $loginData->getUser()->getUID(), diff --git a/lib/private/Authentication/Login/CompleteLoginCommand.php b/lib/private/Authentication/Login/CompleteLoginCommand.php index 974775a2a3d..3726de7cc3a 100644 --- a/lib/private/Authentication/Login/CompleteLoginCommand.php +++ b/lib/private/Authentication/Login/CompleteLoginCommand.php @@ -16,6 +16,7 @@ class CompleteLoginCommand extends ALoginCommand { ) { } + #[\Override] public function process(LoginData $loginData): LoginResult { $this->userSession->completeLogin( $loginData->getUser(), diff --git a/lib/private/Authentication/Login/CreateSessionTokenCommand.php b/lib/private/Authentication/Login/CreateSessionTokenCommand.php index 806af13eae4..8ad098cebe1 100644 --- a/lib/private/Authentication/Login/CreateSessionTokenCommand.php +++ b/lib/private/Authentication/Login/CreateSessionTokenCommand.php @@ -19,6 +19,7 @@ class CreateSessionTokenCommand extends ALoginCommand { ) { } + #[\Override] public function process(LoginData $loginData): LoginResult { if ($this->config->getSystemValueInt('remember_login_cookie_lifetime', 60 * 60 * 24 * 15) === 0) { $loginData->setRememberLogin(false); diff --git a/lib/private/Authentication/Login/FinishRememberedLoginCommand.php b/lib/private/Authentication/Login/FinishRememberedLoginCommand.php index e455a67f31d..e76ecd61407 100644 --- a/lib/private/Authentication/Login/FinishRememberedLoginCommand.php +++ b/lib/private/Authentication/Login/FinishRememberedLoginCommand.php @@ -18,6 +18,7 @@ class FinishRememberedLoginCommand extends ALoginCommand { ) { } + #[\Override] public function process(LoginData $loginData): LoginResult { if ($loginData->isRememberLogin() && !$this->config->getSystemValueBool('auto_logout', false)) { $this->userSession->createRememberMeToken($loginData->getUser()); diff --git a/lib/private/Authentication/Login/FlowV2EphemeralSessionsCommand.php b/lib/private/Authentication/Login/FlowV2EphemeralSessionsCommand.php index 362aab7933e..40b78229306 100644 --- a/lib/private/Authentication/Login/FlowV2EphemeralSessionsCommand.php +++ b/lib/private/Authentication/Login/FlowV2EphemeralSessionsCommand.php @@ -21,6 +21,7 @@ class FlowV2EphemeralSessionsCommand extends ALoginCommand { ) { } + #[\Override] public function process(LoginData $loginData): LoginResult { $loginV2GrantRoute = $this->urlGenerator->linkToRoute('core.ClientFlowLoginV2.grantPage'); if (str_starts_with($loginData->getRedirectUrl() ?? '', $loginV2GrantRoute)) { diff --git a/lib/private/Authentication/Login/LoggedInCheckCommand.php b/lib/private/Authentication/Login/LoggedInCheckCommand.php index 58a07691943..7b359c619aa 100644 --- a/lib/private/Authentication/Login/LoggedInCheckCommand.php +++ b/lib/private/Authentication/Login/LoggedInCheckCommand.php @@ -20,6 +20,7 @@ class LoggedInCheckCommand extends ALoginCommand { ) { } + #[\Override] public function process(LoginData $loginData): LoginResult { if ($loginData->getUser() === false) { $loginName = $loginData->getUsername(); diff --git a/lib/private/Authentication/Login/PreLoginHookCommand.php b/lib/private/Authentication/Login/PreLoginHookCommand.php index 5fd8a9dbaef..71f545f79b7 100644 --- a/lib/private/Authentication/Login/PreLoginHookCommand.php +++ b/lib/private/Authentication/Login/PreLoginHookCommand.php @@ -17,6 +17,7 @@ class PreLoginHookCommand extends ALoginCommand { ) { } + #[\Override] public function process(LoginData $loginData): LoginResult { if ($this->userManager instanceof PublicEmitter) { $this->userManager->emit( diff --git a/lib/private/Authentication/Login/SetUserTimezoneCommand.php b/lib/private/Authentication/Login/SetUserTimezoneCommand.php index 635be703336..182e6967227 100644 --- a/lib/private/Authentication/Login/SetUserTimezoneCommand.php +++ b/lib/private/Authentication/Login/SetUserTimezoneCommand.php @@ -20,6 +20,7 @@ class SetUserTimezoneCommand extends ALoginCommand { ) { } + #[\Override] public function process(LoginData $loginData): LoginResult { if ($loginData->getTimeZoneOffset() !== '' && $this->isValidTimezone($loginData->getTimeZone())) { $userId = $loginData->getUser()->getUID(); diff --git a/lib/private/Authentication/Login/TwoFactorCommand.php b/lib/private/Authentication/Login/TwoFactorCommand.php index af425744122..f770067824d 100644 --- a/lib/private/Authentication/Login/TwoFactorCommand.php +++ b/lib/private/Authentication/Login/TwoFactorCommand.php @@ -23,6 +23,7 @@ class TwoFactorCommand extends ALoginCommand { ) { } + #[\Override] public function process(LoginData $loginData): LoginResult { if (!$this->twoFactorManager->isTwoFactorAuthenticated($loginData->getUser())) { return $this->processNextOrFinishSuccessfully($loginData); diff --git a/lib/private/Authentication/Login/UidLoginCommand.php b/lib/private/Authentication/Login/UidLoginCommand.php index c722a5057cc..09c87ad3a8d 100644 --- a/lib/private/Authentication/Login/UidLoginCommand.php +++ b/lib/private/Authentication/Login/UidLoginCommand.php @@ -22,6 +22,7 @@ class UidLoginCommand extends ALoginCommand { * * @return LoginResult */ + #[\Override] public function process(LoginData $loginData): LoginResult { /* @var $loginResult IUser */ $user = $this->userManager->checkPasswordNoLogging( diff --git a/lib/private/Authentication/Login/UpdateLastPasswordConfirmCommand.php b/lib/private/Authentication/Login/UpdateLastPasswordConfirmCommand.php index a13dd1d6f17..a03ccd5d243 100644 --- a/lib/private/Authentication/Login/UpdateLastPasswordConfirmCommand.php +++ b/lib/private/Authentication/Login/UpdateLastPasswordConfirmCommand.php @@ -16,6 +16,7 @@ class UpdateLastPasswordConfirmCommand extends ALoginCommand { ) { } + #[\Override] public function process(LoginData $loginData): LoginResult { $this->session->set( 'last-password-confirm', diff --git a/lib/private/Authentication/Login/UserDisabledCheckCommand.php b/lib/private/Authentication/Login/UserDisabledCheckCommand.php index b8977b58304..d9c5fc3aa92 100644 --- a/lib/private/Authentication/Login/UserDisabledCheckCommand.php +++ b/lib/private/Authentication/Login/UserDisabledCheckCommand.php @@ -19,6 +19,7 @@ class UserDisabledCheckCommand extends ALoginCommand { ) { } + #[\Override] public function process(LoginData $loginData): LoginResult { $user = $this->userManager->get($loginData->getUsername()); if ($user !== null && $user->isEnabled() === false) { diff --git a/lib/private/Authentication/Login/WebAuthnLoginCommand.php b/lib/private/Authentication/Login/WebAuthnLoginCommand.php index 3c9dcacbc8f..3ceec3eeb6e 100644 --- a/lib/private/Authentication/Login/WebAuthnLoginCommand.php +++ b/lib/private/Authentication/Login/WebAuthnLoginCommand.php @@ -16,6 +16,7 @@ class WebAuthnLoginCommand extends ALoginCommand { ) { } + #[\Override] public function process(LoginData $loginData): LoginResult { $user = $this->userManager->get($loginData->getUsername()); $loginData->setUser($user); diff --git a/lib/private/Authentication/LoginCredentials/Store.php b/lib/private/Authentication/LoginCredentials/Store.php index 45812ba4350..bab1d1cf910 100644 --- a/lib/private/Authentication/LoginCredentials/Store.php +++ b/lib/private/Authentication/LoginCredentials/Store.php @@ -58,6 +58,7 @@ class Store implements IStore { * @return ICredentials the login credentials of the current user * @throws CredentialsUnavailableException */ + #[\Override] public function getLoginCredentials(): ICredentials { if ($this->tokenProvider === null) { throw new CredentialsUnavailableException(); diff --git a/lib/private/Authentication/Notifications/Notifier.php b/lib/private/Authentication/Notifications/Notifier.php index 7742eb95a2b..af92e476110 100644 --- a/lib/private/Authentication/Notifications/Notifier.php +++ b/lib/private/Authentication/Notifications/Notifier.php @@ -22,6 +22,7 @@ class Notifier implements INotifier { /** * @inheritDoc */ + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'auth') { // Not my app => throw @@ -60,6 +61,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getID(): string { return 'auth'; } @@ -70,6 +72,7 @@ class Notifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getName(): string { return $this->factory->get('lib')->t('Authentication'); } diff --git a/lib/private/Authentication/Token/Manager.php b/lib/private/Authentication/Token/Manager.php index f3eb78876b0..836484dbf7f 100644 --- a/lib/private/Authentication/Token/Manager.php +++ b/lib/private/Authentication/Token/Manager.php @@ -34,6 +34,7 @@ class Manager implements IProvider, OCPIProvider { * @param int $remember whether the session token should be used for remember-me * @return OCPIToken */ + #[\Override] public function generateToken(string $token, string $uid, string $loginName, @@ -82,6 +83,7 @@ class Manager implements IProvider, OCPIProvider { * @param OCPIToken $token * @throws InvalidTokenException */ + #[\Override] public function updateToken(OCPIToken $token) { $provider = $this->getProvider($token); $provider->updateToken($token); @@ -93,6 +95,7 @@ class Manager implements IProvider, OCPIProvider { * @throws InvalidTokenException * @param OCPIToken $token */ + #[\Override] public function updateTokenActivity(OCPIToken $token) { $provider = $this->getProvider($token); $provider->updateTokenActivity($token); @@ -102,6 +105,7 @@ class Manager implements IProvider, OCPIProvider { * @param string $uid * @return OCPIToken[] */ + #[\Override] public function getTokenByUser(string $uid): array { return $this->publicKeyTokenProvider->getTokenByUser($uid); } @@ -114,6 +118,7 @@ class Manager implements IProvider, OCPIProvider { * @throws \RuntimeException when OpenSSL reports a problem * @return OCPIToken */ + #[\Override] public function getToken(string $tokenId): OCPIToken { try { return $this->publicKeyTokenProvider->getToken($tokenId); @@ -133,6 +138,7 @@ class Manager implements IProvider, OCPIProvider { * @throws InvalidTokenException * @return OCPIToken */ + #[\Override] public function getTokenById(int $tokenId): OCPIToken { try { return $this->publicKeyTokenProvider->getTokenById($tokenId); @@ -151,6 +157,7 @@ class Manager implements IProvider, OCPIProvider { * @throws InvalidTokenException * @return OCPIToken */ + #[\Override] public function renewSessionToken(string $oldSessionId, string $sessionId): OCPIToken { try { return $this->publicKeyTokenProvider->renewSessionToken($oldSessionId, $sessionId); @@ -168,28 +175,34 @@ class Manager implements IProvider, OCPIProvider { * @throws PasswordlessTokenException * @return string */ + #[\Override] public function getPassword(OCPIToken $savedToken, string $tokenId): string { $provider = $this->getProvider($savedToken); return $provider->getPassword($savedToken, $tokenId); } + #[\Override] public function setPassword(OCPIToken $token, string $tokenId, string $password) { $provider = $this->getProvider($token); $provider->setPassword($token, $tokenId, $password); } + #[\Override] public function invalidateToken(string $token) { $this->publicKeyTokenProvider->invalidateToken($token); } + #[\Override] public function invalidateTokenById(string $uid, int $id) { $this->publicKeyTokenProvider->invalidateTokenById($uid, $id); } + #[\Override] public function invalidateOldTokens() { $this->publicKeyTokenProvider->invalidateOldTokens(); } + #[\Override] public function invalidateLastUsedBefore(string $uid, int $before): void { $this->publicKeyTokenProvider->invalidateLastUsedBefore($uid, $before); } @@ -202,6 +215,7 @@ class Manager implements IProvider, OCPIProvider { * @throws InvalidTokenException * @throws \RuntimeException when OpenSSL reports a problem */ + #[\Override] public function rotate(OCPIToken $token, string $oldTokenId, string $newTokenId): OCPIToken { if ($token instanceof PublicKeyToken) { return $this->publicKeyTokenProvider->rotate($token, $oldTokenId, $newTokenId); @@ -225,14 +239,17 @@ class Manager implements IProvider, OCPIProvider { } + #[\Override] public function markPasswordInvalid(OCPIToken $token, string $tokenId) { $this->getProvider($token)->markPasswordInvalid($token, $tokenId); } + #[\Override] public function updatePasswords(string $uid, string $password) { $this->publicKeyTokenProvider->updatePasswords($uid, $password); } + #[\Override] public function invalidateTokensOfUser(string $uid, ?string $clientName) { $tokens = $this->getTokenByUser($uid); foreach ($tokens as $token) { diff --git a/lib/private/Authentication/Token/PublicKeyToken.php b/lib/private/Authentication/Token/PublicKeyToken.php index cf3a8b16141..11739507851 100644 --- a/lib/private/Authentication/Token/PublicKeyToken.php +++ b/lib/private/Authentication/Token/PublicKeyToken.php @@ -101,11 +101,13 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken { $this->addType('passwordInvalid', Types::BOOLEAN); } + #[\Override] public function getId(): int { assert(!is_string($this->id) && $this->id !== null); return $this->id; } + #[\Override] public function getUID(): string { return $this->uid; } @@ -115,6 +117,7 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken { * * @return string */ + #[\Override] public function getLoginName(): string { return parent::getLoginName(); } @@ -122,10 +125,12 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken { /** * Get the (encrypted) login password */ + #[\Override] public function getPassword(): ?string { return parent::getPassword(); } + #[\Override] public function jsonSerialize(): array { return [ 'id' => $this->id, @@ -141,6 +146,7 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken { * * @return int */ + #[\Override] public function getLastCheck(): int { return parent::getLastCheck(); } @@ -148,10 +154,12 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken { /** * Get the timestamp of the last password check */ + #[\Override] public function setLastCheck(int $time): void { parent::setLastCheck($time); } + #[\Override] public function getScope(): string { $scope = parent::getScope(); if ($scope === null) { @@ -161,6 +169,7 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken { return $scope; } + #[\Override] public function getScopeAsArray(): array { $scope = json_decode($this->getScope(), true); if (!$scope) { @@ -171,6 +180,7 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken { return $scope; } + #[\Override] public function setScope(array|string|null $scope): void { if (is_array($scope)) { parent::setScope(json_encode($scope)); @@ -179,26 +189,32 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken { } } + #[\Override] public function getName(): string { return parent::getName(); } + #[\Override] public function setName(string $name): void { parent::setName($name); } + #[\Override] public function getRemember(): int { return parent::getRemember(); } + #[\Override] public function setToken(string $token): void { parent::setToken($token); } + #[\Override] public function setPassword(?string $password = null): void { parent::setPassword($password); } + #[\Override] public function setExpires($expires): void { parent::setExpires($expires); } @@ -214,6 +230,7 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken { parent::setPasswordInvalid($invalid); } + #[\Override] public function wipe(): void { parent::setType(IToken::WIPE_TOKEN); } diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php index 14cd53435e3..a43d4a7f888 100644 --- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php +++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php @@ -56,6 +56,7 @@ class PublicKeyTokenProvider implements IProvider { /** * {@inheritDoc} */ + #[\Override] public function generateToken(string $token, string $uid, string $loginName, @@ -102,6 +103,7 @@ class PublicKeyTokenProvider implements IProvider { return $dbToken; } + #[\Override] public function getToken(string $tokenId): OCPIToken { /** * Token length: 72 @@ -177,6 +179,7 @@ class PublicKeyTokenProvider implements IProvider { $this->cache->set($tokenHash, false, self::TOKEN_CACHE_TTL * 2); } + #[\Override] public function getTokenById(int $tokenId): OCPIToken { try { $token = $this->mapper->getTokenById($tokenId); @@ -204,6 +207,7 @@ class PublicKeyTokenProvider implements IProvider { } } + #[\Override] public function renewSessionToken(string $oldSessionId, string $sessionId): OCPIToken { return $this->atomic(function () use ($oldSessionId, $sessionId) { $token = $this->getToken($oldSessionId); @@ -238,6 +242,7 @@ class PublicKeyTokenProvider implements IProvider { }, $this->db); } + #[\Override] public function invalidateToken(string $token) { $tokenHash = $this->hashToken($token); $tokenEntry = null; @@ -253,6 +258,7 @@ class PublicKeyTokenProvider implements IProvider { } } + #[\Override] public function invalidateTokenById(string $uid, int $id) { $token = $this->mapper->getTokenById($id); if ($token->getUID() !== $uid) { @@ -263,6 +269,7 @@ class PublicKeyTokenProvider implements IProvider { $this->eventDispatcher->dispatchTyped(new TokenInvalidatedEvent($token)); } + #[\Override] public function invalidateOldTokens() { $olderThan = $this->time->getTime() - $this->config->getSystemValueInt('session_lifetime', 60 * 60 * 24); $this->logger->debug('Invalidating session tokens older than ' . date('c', $olderThan), ['app' => 'cron']); @@ -281,10 +288,12 @@ class PublicKeyTokenProvider implements IProvider { $this->mapper->invalidateOld($authTokenThreshold, OCPIToken::PERMANENT_TOKEN); } + #[\Override] public function invalidateLastUsedBefore(string $uid, int $before): void { $this->mapper->invalidateLastUsedBefore($uid, $before); } + #[\Override] public function updateToken(OCPIToken $token) { if (!($token instanceof PublicKeyToken)) { throw new InvalidTokenException('Invalid token type'); @@ -293,6 +302,7 @@ class PublicKeyTokenProvider implements IProvider { $this->cacheToken($token); } + #[\Override] public function updateTokenActivity(OCPIToken $token) { if (!($token instanceof PublicKeyToken)) { throw new InvalidTokenException('Invalid token type'); @@ -310,10 +320,12 @@ class PublicKeyTokenProvider implements IProvider { } } + #[\Override] public function getTokenByUser(string $uid): array { return $this->mapper->getTokenByUser($uid); } + #[\Override] public function getPassword(OCPIToken $savedToken, string $tokenId): string { if (!($savedToken instanceof PublicKeyToken)) { throw new InvalidTokenException('Invalid token type'); @@ -330,6 +342,7 @@ class PublicKeyTokenProvider implements IProvider { return $this->decryptPassword($savedToken->getPassword(), $privateKey); } + #[\Override] public function setPassword(OCPIToken $token, string $tokenId, string $password) { if (!($token instanceof PublicKeyToken)) { throw new InvalidTokenException('Invalid token type'); @@ -355,6 +368,7 @@ class PublicKeyTokenProvider implements IProvider { return $this->hasher->hash(sha1($password) . $password); } + #[\Override] public function rotate(OCPIToken $token, string $oldTokenId, string $newTokenId): OCPIToken { if (!($token instanceof PublicKeyToken)) { throw new InvalidTokenException('Invalid token type'); @@ -484,6 +498,7 @@ class PublicKeyTokenProvider implements IProvider { return $dbToken; } + #[\Override] public function markPasswordInvalid(OCPIToken $token, string $tokenId) { if (!($token instanceof PublicKeyToken)) { throw new InvalidTokenException('Invalid token type'); @@ -494,6 +509,7 @@ class PublicKeyTokenProvider implements IProvider { $this->cacheToken($token); } + #[\Override] public function updatePasswords(string $uid, string $password) { // prevent setting an empty pw as result of pw-less-login if ($password === '' || !$this->config->getSystemValueBool('auth.storeCryptedPassword', true)) { diff --git a/lib/private/Authentication/Token/TokenCleanupJob.php b/lib/private/Authentication/Token/TokenCleanupJob.php index 5834d40cb52..76998eea4c1 100644 --- a/lib/private/Authentication/Token/TokenCleanupJob.php +++ b/lib/private/Authentication/Token/TokenCleanupJob.php @@ -22,6 +22,7 @@ class TokenCleanupJob extends TimedJob { $this->setTimeSensitivity(self::TIME_INSENSITIVE); } + #[\Override] protected function run($argument) { $this->provider->invalidateOldTokens(); } diff --git a/lib/private/Authentication/TwoFactorAuth/EnforcementState.php b/lib/private/Authentication/TwoFactorAuth/EnforcementState.php index 05014e09128..f7b4e85e3ab 100644 --- a/lib/private/Authentication/TwoFactorAuth/EnforcementState.php +++ b/lib/private/Authentication/TwoFactorAuth/EnforcementState.php @@ -46,6 +46,7 @@ class EnforcementState implements JsonSerializable { return $this->excludedGroups; } + #[\Override] public function jsonSerialize(): array { return [ 'enforced' => $this->enforced, diff --git a/lib/private/Authentication/TwoFactorAuth/Registry.php b/lib/private/Authentication/TwoFactorAuth/Registry.php index 6534daa41ca..1224a6caaf0 100644 --- a/lib/private/Authentication/TwoFactorAuth/Registry.php +++ b/lib/private/Authentication/TwoFactorAuth/Registry.php @@ -26,10 +26,12 @@ class Registry implements IRegistry { ) { } + #[\Override] public function getProviderStates(IUser $user): array { return $this->assignmentDao->getState($user->getUID()); } + #[\Override] public function enableProviderFor(IProvider $provider, IUser $user) { $this->assignmentDao->persist($provider->getId(), $user->getUID(), 1); @@ -38,6 +40,7 @@ class Registry implements IRegistry { $this->dispatcher->dispatchTyped(new TwoFactorProviderForUserRegistered($user, $provider)); } + #[\Override] public function disableProviderFor(IProvider $provider, IUser $user) { $this->assignmentDao->persist($provider->getId(), $user->getUID(), 0); @@ -54,6 +57,7 @@ class Registry implements IRegistry { } } + #[\Override] public function cleanUp(string $providerId) { $this->assignmentDao->deleteAll($providerId); } diff --git a/lib/private/Authentication/WebAuthn/CredentialRepository.php b/lib/private/Authentication/WebAuthn/CredentialRepository.php index e6503d1c38a..bf24d2b0b77 100644 --- a/lib/private/Authentication/WebAuthn/CredentialRepository.php +++ b/lib/private/Authentication/WebAuthn/CredentialRepository.php @@ -21,6 +21,7 @@ class CredentialRepository implements PublicKeyCredentialSourceRepository { ) { } + #[\Override] public function findOneByCredentialId(string $publicKeyCredentialId): ?PublicKeyCredentialSource { try { $entity = $this->credentialMapper->findOneByCredentialId($publicKeyCredentialId); @@ -33,6 +34,7 @@ class CredentialRepository implements PublicKeyCredentialSourceRepository { /** * @return PublicKeyCredentialSource[] */ + #[\Override] public function findAllForUserEntity(PublicKeyCredentialUserEntity $publicKeyCredentialUserEntity): array { $uid = $publicKeyCredentialUserEntity->getId(); $entities = $this->credentialMapper->findAllForUid($uid); @@ -73,6 +75,7 @@ class CredentialRepository implements PublicKeyCredentialSourceRepository { return $this->credentialMapper->insertOrUpdate($entity); } + #[\Override] public function saveCredentialSource(PublicKeyCredentialSource $publicKeyCredentialSource, ?string $name = null): void { $this->saveAndReturnCredentialSource($publicKeyCredentialSource, $name); } diff --git a/lib/private/Authentication/WebAuthn/Db/PublicKeyCredentialEntity.php b/lib/private/Authentication/WebAuthn/Db/PublicKeyCredentialEntity.php index 6c4bc3ca81b..abc9a74f5c8 100644 --- a/lib/private/Authentication/WebAuthn/Db/PublicKeyCredentialEntity.php +++ b/lib/private/Authentication/WebAuthn/Db/PublicKeyCredentialEntity.php @@ -73,6 +73,7 @@ class PublicKeyCredentialEntity extends Entity implements JsonSerializable { /** * @inheritDoc */ + #[\Override] public function jsonSerialize(): array { return [ 'id' => $this->getId(), diff --git a/lib/private/Avatar/Avatar.php b/lib/private/Avatar/Avatar.php index 987298e0483..b92a7aafacd 100644 --- a/lib/private/Avatar/Avatar.php +++ b/lib/private/Avatar/Avatar.php @@ -64,6 +64,7 @@ abstract class Avatar implements IAvatar { /** * @inheritdoc */ + #[\Override] public function get(int $size = 64, bool $darkTheme = false) { try { $file = $this->getFile($size, $darkTheme); @@ -254,6 +255,7 @@ abstract class Avatar implements IAvatar { /** * @return Color Object containing r g b int in the range [0, 255] */ + #[\Override] public function avatarBackgroundColor(string $hash): Color { // Normalize hash $hash = strtolower($hash); diff --git a/lib/private/Avatar/AvatarManager.php b/lib/private/Avatar/AvatarManager.php index c68467085f0..d4ea69a9584 100644 --- a/lib/private/Avatar/AvatarManager.php +++ b/lib/private/Avatar/AvatarManager.php @@ -50,6 +50,7 @@ class AvatarManager implements IAvatarManager { * @throws \Exception In case the username is potentially dangerous * @throws NotFoundException In case there is no user folder yet */ + #[\Override] public function getAvatar(string $userId): IAvatar { $user = $this->userManager->get($userId); if ($user === null) { @@ -128,6 +129,7 @@ class AvatarManager implements IAvatarManager { * * @param string $name The guest name, e.g. "Albert". */ + #[\Override] public function getGuestAvatar(string $name): IAvatar { return new GuestAvatar($name, $this->config, $this->logger); } diff --git a/lib/private/Avatar/GuestAvatar.php b/lib/private/Avatar/GuestAvatar.php index 6d2e2df19fc..11e9a47223f 100644 --- a/lib/private/Avatar/GuestAvatar.php +++ b/lib/private/Avatar/GuestAvatar.php @@ -35,6 +35,7 @@ class GuestAvatar extends Avatar { /** * Tests if the user has an avatar. */ + #[\Override] public function exists(): bool { // Guests always have an avatar. return true; @@ -43,6 +44,7 @@ class GuestAvatar extends Avatar { /** * Returns the guest user display name. */ + #[\Override] public function getDisplayName(): string { return $this->userDisplayName; } @@ -52,6 +54,7 @@ class GuestAvatar extends Avatar { * * @param IImage|resource|string $data */ + #[\Override] public function set($data): void { // unimplemented for guest user avatars } @@ -59,6 +62,7 @@ class GuestAvatar extends Avatar { /** * Removing avatars isn't implemented for guests. */ + #[\Override] public function remove(bool $silent = false): void { // unimplemented for guest user avatars } @@ -66,6 +70,7 @@ class GuestAvatar extends Avatar { /** * Generates an avatar for the guest. */ + #[\Override] public function getFile(int $size, bool $darkTheme = false): ISimpleFile { $avatar = $this->generateAvatar($this->userDisplayName, $size, $darkTheme); return new InMemoryFile('avatar.png', $avatar); @@ -78,6 +83,7 @@ class GuestAvatar extends Avatar { * @param mixed $oldValue The previous value * @param mixed $newValue The new value */ + #[\Override] public function userChanged(string $feature, $oldValue, $newValue): void { if ($feature === 'displayName') { $this->userDisplayName = $newValue; @@ -87,6 +93,7 @@ class GuestAvatar extends Avatar { /** * Guests don't have custom avatars. */ + #[\Override] public function isCustomAvatar(): bool { return false; } @@ -96,6 +103,7 @@ class GuestAvatar extends Avatar { * Different color than for authorized user with the same name * to make it harder to impersonate people. */ + #[\Override] public function avatarBackgroundColor(string $hash): Color { return parent::avatarBackgroundColor($hash . ' (guest)'); } diff --git a/lib/private/Avatar/PlaceholderAvatar.php b/lib/private/Avatar/PlaceholderAvatar.php index 8edf4d39a68..7e3c35cbddf 100644 --- a/lib/private/Avatar/PlaceholderAvatar.php +++ b/lib/private/Avatar/PlaceholderAvatar.php @@ -38,6 +38,7 @@ class PlaceholderAvatar extends Avatar { /** * Check if an avatar exists for the user */ + #[\Override] public function exists(): bool { return true; } @@ -50,6 +51,7 @@ class PlaceholderAvatar extends Avatar { * @throws \Exception if the provided image is not valid * @throws NotSquareException if the image is not square */ + #[\Override] public function set($data): void { // unimplemented for placeholder avatars } @@ -57,6 +59,7 @@ class PlaceholderAvatar extends Avatar { /** * Removes the users avatar. */ + #[\Override] public function remove(bool $silent = false): void { $avatars = $this->folder->getDirectoryListing(); @@ -74,6 +77,7 @@ class PlaceholderAvatar extends Avatar { * @throws NotPermittedException * @throws PreConditionNotMetException */ + #[\Override] public function getFile(int $size, bool $darkTheme = false): ISimpleFile { $ext = 'png'; @@ -110,6 +114,7 @@ class PlaceholderAvatar extends Avatar { /** * Returns the user display name. */ + #[\Override] public function getDisplayName(): string { return $this->user->getDisplayName(); } @@ -123,6 +128,7 @@ class PlaceholderAvatar extends Avatar { * @throws NotPermittedException * @throws PreConditionNotMetException */ + #[\Override] public function userChanged(string $feature, $oldValue, $newValue): void { $this->remove(); } @@ -130,6 +136,7 @@ class PlaceholderAvatar extends Avatar { /** * Check if the avatar of a user is a custom uploaded one */ + #[\Override] public function isCustomAvatar(): bool { return false; } diff --git a/lib/private/Avatar/UserAvatar.php b/lib/private/Avatar/UserAvatar.php index 86fd1cf1220..f2dd98bcced 100644 --- a/lib/private/Avatar/UserAvatar.php +++ b/lib/private/Avatar/UserAvatar.php @@ -38,6 +38,7 @@ class UserAvatar extends Avatar { /** * Check if an avatar exists for the user */ + #[\Override] public function exists(): bool { return $this->folder->fileExists('avatar.jpg') || $this->folder->fileExists('avatar.png'); } @@ -50,6 +51,7 @@ class UserAvatar extends Avatar { * @throws \Exception if the provided image is not valid * @throws NotSquareException if the image is not square */ + #[\Override] public function set($data): void { $img = $this->getAvatarImage($data); $data = $img->data(); @@ -150,6 +152,7 @@ class UserAvatar extends Avatar { * @throws NotPermittedException * @throws PreConditionNotMetException */ + #[\Override] public function remove(bool $silent = false): void { $avatars = $this->folder->getDirectoryListing(); @@ -197,6 +200,7 @@ class UserAvatar extends Avatar { * @throws NotPermittedException * @throws PreConditionNotMetException */ + #[\Override] public function getFile(int $size, bool $darkTheme = false): ISimpleFile { $generated = $this->folder->fileExists('generated'); @@ -269,6 +273,7 @@ class UserAvatar extends Avatar { /** * Returns the user display name. */ + #[\Override] public function getDisplayName(): string { return $this->user->getDisplayName(); } @@ -282,6 +287,7 @@ class UserAvatar extends Avatar { * @throws NotPermittedException * @throws PreConditionNotMetException */ + #[\Override] public function userChanged(string $feature, $oldValue, $newValue): void { // If the avatar is not generated (so an uploaded image) we skip this if (!$this->folder->fileExists('generated')) { @@ -294,6 +300,7 @@ class UserAvatar extends Avatar { /** * Check if the avatar of a user is a custom uploaded one */ + #[\Override] public function isCustomAvatar(): bool { return $this->config->getUserValue($this->user->getUID(), 'avatar', 'generated', 'false') !== 'true'; } diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php index b62bec1ae5f..242b78ade85 100644 --- a/lib/private/BackgroundJob/JobList.php +++ b/lib/private/BackgroundJob/JobList.php @@ -77,6 +77,7 @@ class JobList implements IJobList { $query->executeStatement(); } + #[\Override] public function scheduleAfter(string $job, int $runAfter, mixed $argument = null): void { $this->add($job, $argument, $runAfter); } @@ -346,6 +347,7 @@ class JobList implements IJobList { /** * set the job that was last ran */ + #[\Override] public function setLastJob(IJob $job): void { $this->unlockJob($job); $this->config->setAppValue('backgroundjob', 'lastjob', $job->getId()); diff --git a/lib/private/BinaryFinder.php b/lib/private/BinaryFinder.php index 221d05f5c27..d0598206fa3 100644 --- a/lib/private/BinaryFinder.php +++ b/lib/private/BinaryFinder.php @@ -42,6 +42,7 @@ class BinaryFinder implements IBinaryFinder { * * @return false|string */ + #[\Override] public function findBinaryPath(string $program) { $result = $this->cache->get($program); if ($result !== null) { diff --git a/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php b/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php index 8faf4627251..aa950874534 100644 --- a/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php +++ b/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php @@ -41,6 +41,7 @@ class GenerateBlurhashMetadata implements IEventListener { * @throws GenericFileException * @throws LockedException */ + #[\Override] public function handle(Event $event): void { if (!($event instanceof MetadataLiveEvent) && !($event instanceof MetadataBackgroundEvent)) { diff --git a/lib/private/Broadcast/Events/BroadcastEvent.php b/lib/private/Broadcast/Events/BroadcastEvent.php index c0227a75c6a..6d834e0b58d 100644 --- a/lib/private/Broadcast/Events/BroadcastEvent.php +++ b/lib/private/Broadcast/Events/BroadcastEvent.php @@ -20,18 +20,22 @@ class BroadcastEvent extends Event implements IBroadcastEvent { parent::__construct(); } + #[\Override] public function getName(): string { return $this->event->broadcastAs(); } + #[\Override] public function getUids(): array { return $this->event->getUids(); } + #[\Override] public function getPayload(): JsonSerializable { return $this->event; } + #[\Override] public function setBroadcasted(): void { $this->event->setBroadcasted(); } diff --git a/lib/private/Cache/File.php b/lib/private/Cache/File.php index d9a3e5e8b63..0d312bd9797 100644 --- a/lib/private/Cache/File.php +++ b/lib/private/Cache/File.php @@ -56,6 +56,7 @@ class File implements ICache { * @return mixed|null * @throws ForbiddenException */ + #[\Override] public function get($key) { $result = null; if ($this->hasKey($key)) { @@ -87,6 +88,7 @@ class File implements ICache { * @return bool|mixed * @throws ForbiddenException */ + #[\Override] public function set($key, $value, $ttl = 0) { $storage = $this->getStorage(); $result = false; @@ -114,6 +116,7 @@ class File implements ICache { * @return bool * @throws ForbiddenException */ + #[\Override] public function hasKey($key) { $storage = $this->getStorage(); if ($storage && $storage->is_file($key) && $storage->isReadable($key)) { @@ -127,6 +130,7 @@ class File implements ICache { * @return bool|mixed * @throws ForbiddenException */ + #[\Override] public function remove($key) { $storage = $this->getStorage(); if (!$storage) { @@ -140,6 +144,7 @@ class File implements ICache { * @return bool * @throws ForbiddenException */ + #[\Override] public function clear($prefix = '') { $storage = $this->getStorage(); if ($storage && $storage->is_dir('/')) { @@ -189,6 +194,7 @@ class File implements ICache { } } + #[\Override] public static function isAvailable(): bool { return true; } diff --git a/lib/private/Calendar/AvailabilityResult.php b/lib/private/Calendar/AvailabilityResult.php index 8031758f64e..0ee0ce10166 100644 --- a/lib/private/Calendar/AvailabilityResult.php +++ b/lib/private/Calendar/AvailabilityResult.php @@ -18,10 +18,12 @@ class AvailabilityResult implements IAvailabilityResult { ) { } + #[\Override] public function getAttendeeEmail(): string { return $this->attendee; } + #[\Override] public function isAvailable(): bool { return $this->available; } diff --git a/lib/private/Calendar/CalendarEventBuilder.php b/lib/private/Calendar/CalendarEventBuilder.php index 1aa11c2436d..818a034911b 100644 --- a/lib/private/Calendar/CalendarEventBuilder.php +++ b/lib/private/Calendar/CalendarEventBuilder.php @@ -34,46 +34,55 @@ class CalendarEventBuilder implements ICalendarEventBuilder { ) { } + #[\Override] public function setStartDate(DateTimeInterface $start): ICalendarEventBuilder { $this->startDate = $start; return $this; } + #[\Override] public function setEndDate(DateTimeInterface $end): ICalendarEventBuilder { $this->endDate = $end; return $this; } + #[\Override] public function setSummary(string $summary): ICalendarEventBuilder { $this->summary = $summary; return $this; } + #[\Override] public function setDescription(string $description): ICalendarEventBuilder { $this->description = $description; return $this; } + #[\Override] public function setLocation(string $location): ICalendarEventBuilder { $this->location = $location; return $this; } + #[\Override] public function setStatus(CalendarEventStatus $status): static { $this->status = $status; return $this; } + #[\Override] public function setOrganizer(string $email, ?string $commonName = null): ICalendarEventBuilder { $this->organizer = [$email, $commonName]; return $this; } + #[\Override] public function addAttendee(string $email, ?string $commonName = null): ICalendarEventBuilder { $this->attendees[] = [$email, $commonName]; return $this; } + #[\Override] public function toIcs(): string { if ($this->startDate === null) { throw new InvalidArgumentException('Event is missing a start date'); @@ -117,6 +126,7 @@ class CalendarEventBuilder implements ICalendarEventBuilder { return $vcalendar->serialize(); } + #[\Override] public function createInCalendar(ICreateFromString $calendar): string { $fileName = $this->uid . '.ics'; $calendar->createFromString($fileName, $this->toIcs()); diff --git a/lib/private/Calendar/CalendarQuery.php b/lib/private/Calendar/CalendarQuery.php index 4eb4a4cd636..f45a0ba30d7 100644 --- a/lib/private/Calendar/CalendarQuery.php +++ b/lib/private/Calendar/CalendarQuery.php @@ -39,6 +39,7 @@ class CalendarQuery implements ICalendarQuery { $this->principalUri = $principalUri; } + #[\Override] public function setSearchPattern(string $pattern): void { $this->searchPattern = $pattern; } @@ -47,6 +48,7 @@ class CalendarQuery implements ICalendarQuery { return $this->searchPattern; } + #[\Override] public function addSearchProperty(string $value): void { $this->searchProperties[] = $value; } @@ -55,6 +57,7 @@ class CalendarQuery implements ICalendarQuery { return $this->searchProperties; } + #[\Override] public function addSearchCalendar(string $calendarUri): void { $this->calendarUris[] = $calendarUri; } @@ -70,6 +73,7 @@ class CalendarQuery implements ICalendarQuery { return $this->limit; } + #[\Override] public function setLimit(int $limit): void { $this->limit = $limit; } @@ -78,18 +82,22 @@ class CalendarQuery implements ICalendarQuery { return $this->offset; } + #[\Override] public function setOffset(int $offset): void { $this->offset = $offset; } + #[\Override] public function addType(string $value): void { $this->options['types'][] = $value; } + #[\Override] public function setTimerangeStart(\DateTimeImmutable $startTime): void { $this->options['timerange']['start'] = $startTime; } + #[\Override] public function setTimerangeEnd(\DateTimeImmutable $endTime): void { $this->options['timerange']['end'] = $endTime; } diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php index 0c1c9a0d725..1ef694ac6c2 100644 --- a/lib/private/Calendar/Manager.php +++ b/lib/private/Calendar/Manager.php @@ -76,6 +76,7 @@ class Manager implements IManager { * @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs * @since 13.0.0 */ + #[\Override] public function search( $pattern, array $searchProperties = [], @@ -102,6 +103,7 @@ class Manager implements IManager { * @return bool true if enabled, false if not * @since 13.0.0 */ + #[\Override] public function isEnabled(): bool { return !empty($this->calendars) || !empty($this->calendarLoaders); } @@ -111,6 +113,7 @@ class Manager implements IManager { * * @since 13.0.0 */ + #[\Override] public function registerCalendar(ICalendar $calendar): void { $this->calendars[$calendar->getKey()] = $calendar; } @@ -120,6 +123,7 @@ class Manager implements IManager { * * @since 13.0.0 */ + #[\Override] public function unregisterCalendar(ICalendar $calendar): void { unset($this->calendars[$calendar->getKey()]); } @@ -130,6 +134,7 @@ class Manager implements IManager { * * @since 13.0.0 */ + #[\Override] public function register(\Closure $callable): void { $this->calendarLoaders[] = $callable; } @@ -139,6 +144,7 @@ class Manager implements IManager { * * @since 13.0.0 */ + #[\Override] public function getCalendars(): array { $this->loadCalendars(); @@ -150,6 +156,7 @@ class Manager implements IManager { * * @since 13.0.0 */ + #[\Override] public function clear(): void { $this->calendars = []; $this->calendarLoaders = []; @@ -168,6 +175,7 @@ class Manager implements IManager { /** * @return ICreateFromString[] */ + #[\Override] public function getCalendarsForPrincipal(string $principalUri, array $calendarUris = []): array { $context = $this->coordinator->getRegistrationContext(); if ($context === null) { @@ -191,6 +199,7 @@ class Manager implements IManager { ); } + #[\Override] public function searchForPrincipal(ICalendarQuery $query): array { /** @var CalendarQuery $query */ $calendars = $this->getCalendarsForPrincipal( @@ -217,6 +226,7 @@ class Manager implements IManager { return $results; } + #[\Override] public function newQuery(string $principalUri): ICalendarQuery { return new CalendarQuery($principalUri); } @@ -226,6 +236,7 @@ class Manager implements IManager { * * @throws \OCP\DB\Exception */ + #[\Override] public function handleIMip( string $userId, string $message, @@ -351,6 +362,7 @@ class Manager implements IManager { * * @throws \OCP\DB\Exception */ + #[\Override] public function handleIMipRequest( string $principalUri, string $sender, @@ -371,6 +383,7 @@ class Manager implements IManager { * * @throws \OCP\DB\Exception */ + #[\Override] public function handleIMipReply( string $principalUri, string $sender, @@ -391,6 +404,7 @@ class Manager implements IManager { * * @throws \OCP\DB\Exception */ + #[\Override] public function handleIMipCancel( string $principalUri, string $sender, @@ -407,11 +421,13 @@ class Manager implements IManager { return $this->handleIMip($userId, $calendarData, $options); } + #[\Override] public function createEventBuilder(): ICalendarEventBuilder { $uid = $this->random->generate(32, ISecureRandom::CHAR_ALPHANUMERIC); return new CalendarEventBuilder($uid, $this->timeFactory); } + #[\Override] public function checkAvailability( DateTimeInterface $start, DateTimeInterface $end, diff --git a/lib/private/Calendar/Resource/Manager.php b/lib/private/Calendar/Resource/Manager.php index 221b77d4704..4c5154ddbb9 100644 --- a/lib/private/Calendar/Resource/Manager.php +++ b/lib/private/Calendar/Resource/Manager.php @@ -39,6 +39,7 @@ class Manager implements IManager { * * @since 14.0.0 */ + #[\Override] public function registerBackend(string $backendClass): void { $this->backends[$backendClass] = $backendClass; } @@ -48,6 +49,7 @@ class Manager implements IManager { * * @since 14.0.0 */ + #[\Override] public function unregisterBackend(string $backendClass): void { unset($this->backends[$backendClass], $this->initializedBackends[$backendClass]); } @@ -73,6 +75,7 @@ class Manager implements IManager { * @throws QueryException * @since 14.0.0 */ + #[\Override] public function getBackends():array { $this->fetchBootstrapBackends(); @@ -91,6 +94,7 @@ class Manager implements IManager { * @param string $backendId * @throws QueryException */ + #[\Override] public function getBackend($backendId): ?IBackend { $backends = $this->getBackends(); foreach ($backends as $backend) { @@ -107,11 +111,13 @@ class Manager implements IManager { * * @since 14.0.0 */ + #[\Override] public function clear(): void { $this->backends = []; $this->initializedBackends = []; } + #[\Override] public function update(): void { $this->updater->updateResources(); } diff --git a/lib/private/Calendar/Room/Manager.php b/lib/private/Calendar/Room/Manager.php index 8097fecb2ac..b19727054e3 100644 --- a/lib/private/Calendar/Room/Manager.php +++ b/lib/private/Calendar/Room/Manager.php @@ -39,6 +39,7 @@ class Manager implements IManager { * * @since 14.0.0 */ + #[\Override] public function registerBackend(string $backendClass): void { $this->backends[$backendClass] = $backendClass; } @@ -49,6 +50,7 @@ class Manager implements IManager { * @param string $backendClass * @since 14.0.0 */ + #[\Override] public function unregisterBackend(string $backendClass): void { unset($this->backends[$backendClass], $this->initializedBackends[$backendClass]); } @@ -74,6 +76,7 @@ class Manager implements IManager { * @throws QueryException * @since 14.0.0 */ + #[\Override] public function getBackends():array { $this->fetchBootstrapBackends(); @@ -98,6 +101,7 @@ class Manager implements IManager { * @param string $backendId * @throws QueryException */ + #[\Override] public function getBackend($backendId): ?IBackend { $backends = $this->getBackends(); foreach ($backends as $backend) { @@ -114,11 +118,13 @@ class Manager implements IManager { * * @since 14.0.0 */ + #[\Override] public function clear(): void { $this->backends = []; $this->initializedBackends = []; } + #[\Override] public function update(): void { $this->updater->updateRooms(); } diff --git a/lib/private/Collaboration/AutoComplete/Manager.php b/lib/private/Collaboration/AutoComplete/Manager.php index cc5df78beea..d94e4c431bc 100644 --- a/lib/private/Collaboration/AutoComplete/Manager.php +++ b/lib/private/Collaboration/AutoComplete/Manager.php @@ -25,6 +25,7 @@ class Manager implements IManager { ) { } + #[\Override] public function runSorters(array $sorters, array &$sortArray, array $context): void { $sorterInstances = $this->getSorters(); while ($sorter = array_shift($sorters)) { @@ -38,6 +39,7 @@ class Manager implements IManager { } } + #[\Override] public function registerSorter($className): void { $this->sorters[] = $className; } diff --git a/lib/private/Collaboration/Collaborators/GroupPlugin.php b/lib/private/Collaboration/Collaborators/GroupPlugin.php index a59d5981825..36143b7479f 100644 --- a/lib/private/Collaboration/Collaborators/GroupPlugin.php +++ b/lib/private/Collaboration/Collaborators/GroupPlugin.php @@ -40,6 +40,7 @@ class GroupPlugin implements ISearchPlugin { } } + #[\Override] public function search($search, $limit, $offset, ISearchResult $searchResult): bool { if ($this->groupSharingDisabled) { return false; diff --git a/lib/private/Collaboration/Collaborators/LookupPlugin.php b/lib/private/Collaboration/Collaborators/LookupPlugin.php index b65431fe347..de1bfa9edb9 100644 --- a/lib/private/Collaboration/Collaborators/LookupPlugin.php +++ b/lib/private/Collaboration/Collaborators/LookupPlugin.php @@ -33,6 +33,7 @@ class LookupPlugin implements ISearchPlugin { $this->currentUserRemote = $cloudIdManager->resolveCloudId($currentUserCloudId)->getRemote(); } + #[\Override] public function search($search, $limit, $offset, ISearchResult $searchResult): bool { $isGlobalScaleEnabled = $this->config->getSystemValueBool('gs.enabled', false); $isLookupServerEnabled = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'no') === 'yes'; diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index 84ff487203f..3149a4d14f9 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -59,6 +59,7 @@ class MailPlugin implements ISearchPlugin { /** * {@inheritdoc} */ + #[\Override] public function search($search, $limit, $offset, ISearchResult $searchResult): bool { if ($this->shareeEnumerationFullMatch && !$this->shareeEnumerationFullMatchEmail) { return false; diff --git a/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php b/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php index f4c1793ea0a..68d0a462f00 100644 --- a/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php +++ b/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php @@ -32,6 +32,7 @@ class RemoteGroupPlugin implements ISearchPlugin { } } + #[\Override] public function search($search, $limit, $offset, ISearchResult $searchResult): bool { $result = ['wide' => [], 'exact' => []]; $resultType = new SearchResultType('remote_groups'); diff --git a/lib/private/Collaboration/Collaborators/RemotePlugin.php b/lib/private/Collaboration/Collaborators/RemotePlugin.php index e52683cfd5a..5dd17c9527b 100644 --- a/lib/private/Collaboration/Collaborators/RemotePlugin.php +++ b/lib/private/Collaboration/Collaborators/RemotePlugin.php @@ -37,6 +37,7 @@ class RemotePlugin implements ISearchPlugin { } + #[\Override] public function search($search, $limit, $offset, ISearchResult $searchResult): bool { $result = ['wide' => [], 'exact' => []]; $resultType = new SearchResultType('remotes'); diff --git a/lib/private/Collaboration/Collaborators/Search.php b/lib/private/Collaboration/Collaborators/Search.php index 4fbfb787996..4eb3b275c67 100644 --- a/lib/private/Collaboration/Collaborators/Search.php +++ b/lib/private/Collaboration/Collaborators/Search.php @@ -29,6 +29,7 @@ class Search implements ISearch { * @param int|null $offset * @throws QueryException */ + #[\Override] public function search($search, array $shareTypes, $lookup, $limit, $offset): array { $hasMoreResults = false; @@ -81,6 +82,7 @@ class Search implements ISearch { return [$searchResult->asArray(), $hasMoreResults]; } + #[\Override] public function registerPlugin(array $pluginInfo): void { $shareType = constant(IShare::class . '::' . substr($pluginInfo['shareType'], strlen('SHARE_'))); if ($shareType === null) { diff --git a/lib/private/Collaboration/Collaborators/SearchResult.php b/lib/private/Collaboration/Collaborators/SearchResult.php index c9c2f032f36..0b887aac545 100644 --- a/lib/private/Collaboration/Collaborators/SearchResult.php +++ b/lib/private/Collaboration/Collaborators/SearchResult.php @@ -16,6 +16,7 @@ class SearchResult implements ISearchResult { protected array $exactIdMatches = []; + #[\Override] public function addResultSet(SearchResultType $type, array $matches, ?array $exactMatches = null): void { $type = $type->getLabel(); if (!isset($this->result[$type])) { @@ -29,14 +30,17 @@ class SearchResult implements ISearchResult { } } + #[\Override] public function markExactIdMatch(SearchResultType $type): void { $this->exactIdMatches[$type->getLabel()] = 1; } + #[\Override] public function hasExactIdMatch(SearchResultType $type): bool { return isset($this->exactIdMatches[$type->getLabel()]); } + #[\Override] public function hasResult(SearchResultType $type, $collaboratorId): bool { $type = $type->getLabel(); if (!isset($this->result[$type])) { @@ -55,10 +59,12 @@ class SearchResult implements ISearchResult { return false; } + #[\Override] public function asArray(): array { return $this->result; } + #[\Override] public function unsetResult(SearchResultType $type): void { $type = $type->getLabel(); $this->result[$type] = []; @@ -67,6 +73,7 @@ class SearchResult implements ISearchResult { } } + #[\Override] public function removeCollaboratorResult(SearchResultType $type, string $collaboratorId): bool { $type = $type->getLabel(); if (!isset($this->result[$type])) { diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index c21c5d03d8c..9ccdfc6b67a 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -34,6 +34,7 @@ readonly class UserPlugin implements ISearchPlugin { ) { } + #[\Override] public function search($search, $limit, $offset, ISearchResult $searchResult): bool { /** @var IUser $currentUser */ $currentUser = $this->userSession->getUser(); diff --git a/lib/private/Collaboration/Reference/File/FileReferenceEventListener.php b/lib/private/Collaboration/Reference/File/FileReferenceEventListener.php index 0b2385a0555..18f6894673c 100644 --- a/lib/private/Collaboration/Reference/File/FileReferenceEventListener.php +++ b/lib/private/Collaboration/Reference/File/FileReferenceEventListener.php @@ -37,6 +37,7 @@ class FileReferenceEventListener implements IEventListener { /** * @inheritDoc */ + #[\Override] public function handle(Event $event): void { if ($event instanceof NodeDeletedEvent) { try { diff --git a/lib/private/Collaboration/Reference/File/FileReferenceProvider.php b/lib/private/Collaboration/Reference/File/FileReferenceProvider.php index 3cb174d9607..acfa0c7d138 100644 --- a/lib/private/Collaboration/Reference/File/FileReferenceProvider.php +++ b/lib/private/Collaboration/Reference/File/FileReferenceProvider.php @@ -39,6 +39,7 @@ class FileReferenceProvider extends ADiscoverableReferenceProvider { $this->l10n = $l10n->get('files'); } + #[\Override] public function matchReference(string $referenceText): bool { return $this->getFilesAppLinkId($referenceText) !== null; } @@ -74,6 +75,7 @@ class FileReferenceProvider extends ADiscoverableReferenceProvider { return $fileId !== null ? (int)$fileId : null; } + #[\Override] public function resolveReference(string $referenceText): ?IReference { if ($this->matchReference($referenceText)) { $reference = new Reference($referenceText); @@ -135,26 +137,32 @@ class FileReferenceProvider extends ADiscoverableReferenceProvider { } } + #[\Override] public function getCachePrefix(string $referenceId): string { return (string)$this->getFilesAppLinkId($referenceId); } + #[\Override] public function getCacheKey(string $referenceId): ?string { return $this->userId ?? ''; } + #[\Override] public function getId(): string { return 'files'; } + #[\Override] public function getTitle(): string { return $this->l10n->t('Files'); } + #[\Override] public function getOrder(): int { return 0; } + #[\Override] public function getIconUrl(): string { return $this->urlGenerator->imagePath('files', 'folder.svg'); } diff --git a/lib/private/Collaboration/Reference/ReferenceManager.php b/lib/private/Collaboration/Reference/ReferenceManager.php index 9287b66b2a2..693d84fc99c 100644 --- a/lib/private/Collaboration/Reference/ReferenceManager.php +++ b/lib/private/Collaboration/Reference/ReferenceManager.php @@ -49,6 +49,7 @@ class ReferenceManager implements IReferenceManager { * * @return string[] */ + #[\Override] public function extractReferences(string $text): array { preg_match_all(IURLGenerator::URL_REGEX, $text, $matches); $references = $matches[0] ?? []; @@ -60,6 +61,7 @@ class ReferenceManager implements IReferenceManager { /** * Try to get a cached reference object from a reference string */ + #[\Override] public function getReferenceFromCache(string $referenceId, bool $public = false, string $sharingToken = ''): ?IReference { $matchedProvider = $this->getMatchedProvider($referenceId, $public); @@ -74,6 +76,7 @@ class ReferenceManager implements IReferenceManager { /** * Try to get a cached reference object from a full cache key */ + #[\Override] public function getReferenceByCacheKey(string $cacheKey): ?IReference { $cached = $this->cache->get($cacheKey); if ($cached) { @@ -87,6 +90,7 @@ class ReferenceManager implements IReferenceManager { * Get a reference object from a reference string with a matching provider * Use a cached reference if possible */ + #[\Override] public function resolveReference(string $referenceId, bool $public = false, $sharingToken = ''): ?IReference { $matchedProvider = $this->getMatchedProvider($referenceId, $public); @@ -162,6 +166,7 @@ class ReferenceManager implements IReferenceManager { /** * Remove a specific cache entry from its key+prefix */ + #[\Override] public function invalidateCache(string $cachePrefix, ?string $cacheKey = null): void { if ($cacheKey === null) { // clear might be a heavy operation, so we only do it if there have actually been keys set @@ -208,6 +213,7 @@ class ReferenceManager implements IReferenceManager { /** * @inheritDoc */ + #[\Override] public function getDiscoverableProviders(): array { // preserve 0 based index to avoid returning an object in data responses return array_values( @@ -220,6 +226,7 @@ class ReferenceManager implements IReferenceManager { /** * @inheritDoc */ + #[\Override] public function touchProvider(string $userId, string $providerId, ?int $timestamp = null): bool { $providers = $this->getDiscoverableProviders(); $matchingProviders = array_filter($providers, static function (IDiscoverableReferenceProvider $provider) use ($providerId) { @@ -240,6 +247,7 @@ class ReferenceManager implements IReferenceManager { /** * @inheritDoc */ + #[\Override] public function getUserProviderTimestamps(): array { $user = $this->userSession->getUser(); if ($user === null) { diff --git a/lib/private/Collaboration/Reference/RenderReferenceEventListener.php b/lib/private/Collaboration/Reference/RenderReferenceEventListener.php index 9e6192314cb..db26df60005 100644 --- a/lib/private/Collaboration/Reference/RenderReferenceEventListener.php +++ b/lib/private/Collaboration/Reference/RenderReferenceEventListener.php @@ -31,6 +31,7 @@ class RenderReferenceEventListener implements IEventListener { /** * @inheritDoc */ + #[\Override] public function handle(Event $event): void { if (!($event instanceof RenderReferenceEvent)) { return; diff --git a/lib/private/Collaboration/Resources/Collection.php b/lib/private/Collaboration/Resources/Collection.php index 9bee7ea8dc8..59d52b94344 100644 --- a/lib/private/Collaboration/Resources/Collection.php +++ b/lib/private/Collaboration/Resources/Collection.php @@ -35,6 +35,7 @@ class Collection implements ICollection { /** * @since 16.0.0 */ + #[\Override] public function getId(): int { return $this->id; } @@ -42,6 +43,7 @@ class Collection implements ICollection { /** * @since 16.0.0 */ + #[\Override] public function getName(): string { return $this->name; } @@ -49,6 +51,7 @@ class Collection implements ICollection { /** * @since 16.0.0 */ + #[\Override] public function setName(string $name): void { $query = $this->connection->getQueryBuilder(); $query->update(Manager::TABLE_COLLECTIONS) @@ -63,6 +66,7 @@ class Collection implements ICollection { * @return IResource[] * @since 16.0.0 */ + #[\Override] public function getResources(): array { if (empty($this->resources)) { $this->resources = $this->manager->getResourcesByCollectionForUser($this, $this->userForAccess); @@ -77,6 +81,7 @@ class Collection implements ICollection { * @throws ResourceException when the resource is already part of the collection * @since 16.0.0 */ + #[\Override] public function addResource(IResource $resource): void { array_map(function (IResource $r) use ($resource): void { if ($this->isSameResource($r, $resource)) { @@ -108,6 +113,7 @@ class Collection implements ICollection { * * @since 16.0.0 */ + #[\Override] public function removeResource(IResource $resource): void { $this->resources = array_filter($this->getResources(), function (IResource $r) use ($resource) { return !$this->isSameResource($r, $resource); @@ -132,6 +138,7 @@ class Collection implements ICollection { * * @since 16.0.0 */ + #[\Override] public function canAccess(?IUser $user): bool { if ($user instanceof IUser) { return $this->canUserAccess($user); diff --git a/lib/private/Collaboration/Resources/Manager.php b/lib/private/Collaboration/Resources/Manager.php index 7cf039c2174..3e6e7e5d5bc 100644 --- a/lib/private/Collaboration/Resources/Manager.php +++ b/lib/private/Collaboration/Resources/Manager.php @@ -40,6 +40,7 @@ class Manager implements IManager { * @throws CollectionException when the collection could not be found * @since 16.0.0 */ + #[\Override] public function getCollection(int $id): ICollection { $query = $this->connection->getQueryBuilder(); $query->select('*') @@ -60,6 +61,7 @@ class Manager implements IManager { * @throws CollectionException when the collection could not be found * @since 16.0.0 */ + #[\Override] public function getCollectionForUser(int $id, ?IUser $user): ICollection { $query = $this->connection->getQueryBuilder(); $userId = $user instanceof IUser ? $user->getUID() : ''; @@ -140,6 +142,7 @@ class Manager implements IManager { /** * @since 16.0.0 */ + #[\Override] public function newCollection(string $name): ICollection { $query = $this->connection->getQueryBuilder(); $query->insert(self::TABLE_COLLECTIONS) @@ -154,6 +157,7 @@ class Manager implements IManager { /** * @since 16.0.0 */ + #[\Override] public function createResource(string $type, string $id): IResource { return new Resource($this, $this->connection, $type, $id); } @@ -162,6 +166,7 @@ class Manager implements IManager { * @throws ResourceException * @since 16.0.0 */ + #[\Override] public function getResourceForUser(string $type, string $id, ?IUser $user): IResource { $query = $this->connection->getQueryBuilder(); $userId = $user instanceof IUser ? $user->getUID() : ''; @@ -230,6 +235,7 @@ class Manager implements IManager { * * @since 16.0.0 */ + #[\Override] public function getResourceRichObject(IResource $resource): array { foreach ($this->providerManager->getResourceProviders() as $provider) { if ($provider->getType() === $resource->getType()) { @@ -248,6 +254,7 @@ class Manager implements IManager { * * @since 16.0.0 */ + #[\Override] public function canAccessResource(IResource $resource, ?IUser $user): bool { $access = $this->checkAccessCacheForUserByResource($resource, $user); if (\is_bool($access)) { @@ -276,6 +283,7 @@ class Manager implements IManager { * * @since 16.0.0 */ + #[\Override] public function canAccessCollection(ICollection $collection, ?IUser $user): bool { $access = $this->checkAccessCacheForUserByCollection($collection, $user); if (\is_bool($access)) { @@ -377,6 +385,7 @@ class Manager implements IManager { } } + #[\Override] public function invalidateAccessCacheForUser(?IUser $user): void { $query = $this->connection->getQueryBuilder(); $userId = $user instanceof IUser ? $user->getUID() : ''; @@ -386,6 +395,7 @@ class Manager implements IManager { $query->executeStatement(); } + #[\Override] public function invalidateAccessCacheForResource(IResource $resource): void { $query = $this->connection->getQueryBuilder(); @@ -415,6 +425,7 @@ class Manager implements IManager { $query->executeStatement(); } + #[\Override] public function invalidateAccessCacheForProvider(IProvider $provider): void { $query = $this->connection->getQueryBuilder(); @@ -423,6 +434,7 @@ class Manager implements IManager { $query->executeStatement(); } + #[\Override] public function invalidateAccessCacheForResourceByUser(IResource $resource, ?IUser $user): void { $query = $this->connection->getQueryBuilder(); $userId = $user instanceof IUser ? $user->getUID() : ''; @@ -447,6 +459,7 @@ class Manager implements IManager { $query->executeStatement(); } + #[\Override] public function invalidateAccessCacheForProviderByUser(IProvider $provider, ?IUser $user): void { $query = $this->connection->getQueryBuilder(); $userId = $user instanceof IUser ? $user->getUID() : ''; @@ -462,6 +475,7 @@ class Manager implements IManager { * * @since 16.0.0 */ + #[\Override] public function getType(): string { return ''; } diff --git a/lib/private/Collaboration/Resources/ProviderManager.php b/lib/private/Collaboration/Resources/ProviderManager.php index 0ce4ae7155a..72155cf7fa4 100644 --- a/lib/private/Collaboration/Resources/ProviderManager.php +++ b/lib/private/Collaboration/Resources/ProviderManager.php @@ -27,6 +27,7 @@ class ProviderManager implements IProviderManager { ) { } + #[\Override] public function getResourceProviders(): array { if ($this->providers !== []) { foreach ($this->providers as $provider) { @@ -44,6 +45,7 @@ class ProviderManager implements IProviderManager { return $this->providerInstances; } + #[\Override] public function registerResourceProvider(string $provider): void { $this->providers[] = $provider; } diff --git a/lib/private/Collaboration/Resources/Resource.php b/lib/private/Collaboration/Resources/Resource.php index 05eaeb8f6aa..2af252da598 100644 --- a/lib/private/Collaboration/Resources/Resource.php +++ b/lib/private/Collaboration/Resources/Resource.php @@ -30,6 +30,7 @@ class Resource implements IResource { /** * @since 16.0.0 */ + #[\Override] public function getType(): string { return $this->type; } @@ -37,6 +38,7 @@ class Resource implements IResource { /** * @since 16.0.0 */ + #[\Override] public function getId(): string { return $this->id; } @@ -44,6 +46,7 @@ class Resource implements IResource { /** * @since 16.0.0 */ + #[\Override] public function getRichObject(): array { if ($this->data === null) { $this->data = $this->manager->getResourceRichObject($this); @@ -57,6 +60,7 @@ class Resource implements IResource { * * @since 16.0.0 */ + #[\Override] public function canAccess(?IUser $user): bool { if ($user instanceof IUser) { return $this->canUserAccess($user); @@ -92,6 +96,7 @@ class Resource implements IResource { * @return ICollection[] * @since 16.0.0 */ + #[\Override] public function getCollections(): array { $collections = []; diff --git a/lib/private/Command/AsyncBus.php b/lib/private/Command/AsyncBus.php index 54dc6d94e5a..0215b131238 100644 --- a/lib/private/Command/AsyncBus.php +++ b/lib/private/Command/AsyncBus.php @@ -26,6 +26,7 @@ abstract class AsyncBus implements IBus { /** * Schedule a command to be fired */ + #[\Override] public function push(ICommand $command): void { if ($this->canRunAsync($command)) { $this->queueCommand($command); @@ -44,6 +45,7 @@ abstract class AsyncBus implements IBus { * * @param string $trait */ + #[\Override] public function requireSync(string $trait): void { $this->syncTraits[] = trim($trait, '\\'); } diff --git a/lib/private/Command/CommandJob.php b/lib/private/Command/CommandJob.php index ac73987e59c..b00e6159f91 100644 --- a/lib/private/Command/CommandJob.php +++ b/lib/private/Command/CommandJob.php @@ -18,6 +18,7 @@ use Test\Command\StateFullCommand; * Wrap a command in the background job interface */ class CommandJob extends QueuedJob { + #[\Override] protected function run($argument) { $command = unserialize($argument, ['allowed_classes' => [ SimpleCommand::class, diff --git a/lib/private/Command/CronBus.php b/lib/private/Command/CronBus.php index 1fa8cd45e7a..0b059e2e5af 100644 --- a/lib/private/Command/CronBus.php +++ b/lib/private/Command/CronBus.php @@ -17,6 +17,7 @@ class CronBus extends AsyncBus { ) { } + #[\Override] protected function queueCommand(ICommand $command): void { $this->jobList->add(CommandJob::class, serialize($command)); } diff --git a/lib/private/Command/QueueBus.php b/lib/private/Command/QueueBus.php index 6a355c8ca6b..9c3c2467959 100644 --- a/lib/private/Command/QueueBus.php +++ b/lib/private/Command/QueueBus.php @@ -25,6 +25,7 @@ class QueueBus implements IBus { /** * Schedule a command to be fired */ + #[\Override] public function push(ICommand $command): void { $this->queue[] = $command; } @@ -32,6 +33,7 @@ class QueueBus implements IBus { /** * Require all commands using a trait to be run synchronous */ + #[\Override] public function requireSync(string $trait): void { } diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php index 7d2d861e8b4..2736d14ccaf 100644 --- a/lib/private/Comments/Comment.php +++ b/lib/private/Comments/Comment.php @@ -52,6 +52,7 @@ class Comment implements IComment { * * @since 9.0.0 */ + #[\Override] public function getId(): string { return $this->data['id']; } @@ -69,6 +70,7 @@ class Comment implements IComment { * @throws IllegalIDChangeException * @since 9.0.0 */ + #[\Override] public function setId($id): IComment { if (!is_string($id)) { throw new \InvalidArgumentException('String expected.'); @@ -88,6 +90,7 @@ class Comment implements IComment { * * @since 9.0.0 */ + #[\Override] public function getParentId(): string { return $this->data['parentId']; } @@ -98,6 +101,7 @@ class Comment implements IComment { * @param string $parentId * @since 9.0.0 */ + #[\Override] public function setParentId($parentId): IComment { if (!is_string($parentId)) { throw new \InvalidArgumentException('String expected.'); @@ -111,6 +115,7 @@ class Comment implements IComment { * * @since 9.0.0 */ + #[\Override] public function getTopmostParentId(): string { return $this->data['topmostParentId']; } @@ -122,6 +127,7 @@ class Comment implements IComment { * @param string $id * @since 9.0.0 */ + #[\Override] public function setTopmostParentId($id): IComment { if (!is_string($id)) { throw new \InvalidArgumentException('String expected.'); @@ -135,6 +141,7 @@ class Comment implements IComment { * * @since 9.0.0 */ + #[\Override] public function getChildrenCount(): int { return $this->data['childrenCount']; } @@ -145,6 +152,7 @@ class Comment implements IComment { * @param int $count * @since 9.0.0 */ + #[\Override] public function setChildrenCount($count): IComment { if (!is_int($count)) { throw new \InvalidArgumentException('Integer expected.'); @@ -157,6 +165,7 @@ class Comment implements IComment { * Returns the message of the comment * @since 9.0.0 */ + #[\Override] public function getMessage(): string { return $this->data['message']; } @@ -169,6 +178,7 @@ class Comment implements IComment { * @throws MessageTooLongException * @since 9.0.0 */ + #[\Override] public function setMessage($message, $maxLength = self::MAX_MESSAGE_LENGTH): IComment { if (!is_string($message)) { throw new \InvalidArgumentException('String expected.'); @@ -194,6 +204,7 @@ class Comment implements IComment { * @since 17.0.0 Type 'guest' is supported * @since 11.0.0 */ + #[\Override] public function getMentions(bool $supportMarkdown = true): array { $message = $this->getMessage(); if ($supportMarkdown) { @@ -254,6 +265,7 @@ class Comment implements IComment { * * @since 9.0.0 */ + #[\Override] public function getVerb(): string { return $this->data['verb']; } @@ -264,6 +276,7 @@ class Comment implements IComment { * @param string $verb * @since 9.0.0 */ + #[\Override] public function setVerb($verb): IComment { if (!is_string($verb) || !trim($verb)) { throw new \InvalidArgumentException('Non-empty String expected.'); @@ -276,6 +289,7 @@ class Comment implements IComment { * Returns the actor type * @since 9.0.0 */ + #[\Override] public function getActorType(): string { return $this->data['actorType']; } @@ -284,6 +298,7 @@ class Comment implements IComment { * Returns the actor ID * @since 9.0.0 */ + #[\Override] public function getActorId(): string { return $this->data['actorId']; } @@ -295,6 +310,7 @@ class Comment implements IComment { * @param string $actorId e.g. 'zombie234' * @since 9.0.0 */ + #[\Override] public function setActor($actorType, $actorId): IComment { if ( !is_string($actorType) || !trim($actorType) @@ -314,6 +330,7 @@ class Comment implements IComment { * @since 9.0.0 * @throws \LogicException if creation date time is not set yet */ + #[\Override] public function getCreationDateTime(): \DateTime { if (!isset($this->data['creationDT'])) { throw new \LogicException('Cannot get creation date before setting one or writting to database'); @@ -325,6 +342,7 @@ class Comment implements IComment { * Sets the creation date of the comment and returns itself * @since 9.0.0 */ + #[\Override] public function setCreationDateTime(\DateTime $dateTime): IComment { $this->data['creationDT'] = $dateTime; return $this; @@ -334,6 +352,7 @@ class Comment implements IComment { * Returns the DateTime of the most recent child, if set, otherwise null * @since 9.0.0 */ + #[\Override] public function getLatestChildDateTime(): ?\DateTime { return $this->data['latestChildDT']; } @@ -341,6 +360,7 @@ class Comment implements IComment { /** * @inheritDoc */ + #[\Override] public function setLatestChildDateTime(?\DateTime $dateTime = null): IComment { $this->data['latestChildDT'] = $dateTime; return $this; @@ -350,6 +370,7 @@ class Comment implements IComment { * Returns the object type the comment is attached to * @since 9.0.0 */ + #[\Override] public function getObjectType(): string { return $this->data['objectType']; } @@ -358,6 +379,7 @@ class Comment implements IComment { * Returns the object id the comment is attached to * @since 9.0.0 */ + #[\Override] public function getObjectId(): string { return $this->data['objectId']; } @@ -369,6 +391,7 @@ class Comment implements IComment { * @param string $objectId e.g. '16435' * @since 9.0.0 */ + #[\Override] public function setObject($objectType, $objectId): IComment { if ( !is_string($objectType) || !trim($objectType) @@ -385,6 +408,7 @@ class Comment implements IComment { * Returns the reference id of the comment * @since 19.0.0 */ + #[\Override] public function getReferenceId(): ?string { return $this->data['referenceId']; } @@ -395,6 +419,7 @@ class Comment implements IComment { * @param string $referenceId e.g. sha256 hash sum * @since 19.0.0 */ + #[\Override] public function setReferenceId(?string $referenceId): IComment { if ($referenceId === null) { $this->data['referenceId'] = $referenceId; @@ -411,6 +436,7 @@ class Comment implements IComment { /** * @inheritDoc */ + #[\Override] public function getMetaData(): ?array { if ($this->data['metaData'] === null) { return null; @@ -427,6 +453,7 @@ class Comment implements IComment { /** * @inheritDoc */ + #[\Override] public function setMetaData(?array $metaData): IComment { if ($metaData === null) { $this->data['metaData'] = null; @@ -439,6 +466,7 @@ class Comment implements IComment { /** * @inheritDoc */ + #[\Override] public function getReactions(): array { return $this->data['reactions'] ?? []; } @@ -446,6 +474,7 @@ class Comment implements IComment { /** * @inheritDoc */ + #[\Override] public function setReactions(?array $reactions): IComment { $this->data['reactions'] = $reactions; return $this; @@ -454,6 +483,7 @@ class Comment implements IComment { /** * @inheritDoc */ + #[\Override] public function setExpireDate(?\DateTime $dateTime): IComment { $this->data['expire_date'] = $dateTime; return $this; @@ -462,6 +492,7 @@ class Comment implements IComment { /** * @inheritDoc */ + #[\Override] public function getExpireDate(): ?\DateTime { return $this->data['expire_date']; } diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index 59f4c824882..b4922f967e5 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -239,6 +239,7 @@ class Manager implements ICommentsManager { * @throws \InvalidArgumentException * @since 9.0.0 */ + #[\Override] public function get($id): IComment { if ((int)$id === 0) { throw new \InvalidArgumentException('IDs must be translatable to a number in this implementation.'); @@ -270,6 +271,7 @@ class Manager implements ICommentsManager { /** * @inheritDoc */ + #[\Override] public function getTree($id, $limit = 0, $offset = 0): array { $tree = []; $tree['comment'] = $this->get($id); @@ -318,6 +320,7 @@ class Manager implements ICommentsManager { * @return list * @since 9.0.0 */ + #[\Override] public function getForObject( $objectType, $objectId, @@ -370,6 +373,7 @@ class Manager implements ICommentsManager { * @param string $topmostParentId Limit the comments to a list of replies and its original root comment * @return list */ + #[\Override] public function getForObjectSince( string $objectType, string $objectId, @@ -403,6 +407,7 @@ class Manager implements ICommentsManager { * @param string $topmostParentId Limit the comments to a list of replies and its original root comment * @return list */ + #[\Override] public function getCommentsWithVerbForObjectSinceComment( string $objectType, string $objectId, @@ -560,6 +565,7 @@ class Manager implements ICommentsManager { * @param int $limit * @return list */ + #[\Override] public function search(string $search, string $objectType, string $objectId, string $verb, int $offset, int $limit = 50): array { $objectIds = []; if ($objectId) { @@ -579,6 +585,7 @@ class Manager implements ICommentsManager { * @param int $limit * @return list */ + #[\Override] public function searchForObjects(string $search, string $objectType, array $objectIds, string $verb, int $offset, int $limit = 50): array { $query = $this->dbConn->getQueryBuilder(); @@ -628,11 +635,13 @@ class Manager implements ICommentsManager { * @return Int * @since 9.0.0 */ + #[\Override] public function getNumberOfCommentsForObject($objectType, $objectId, ?\DateTime $notOlderThan = null, $verb = ''): int { return $this->getNumberOfCommentsForObjects($objectType, [$objectId], $notOlderThan, $verb)[$objectId]; } /** @inheritDoc */ + #[\Override] public function getNumberOfCommentsForObjects(string $objectType, array $objectIds, ?\DateTime $notOlderThan = null, string $verb = ''): array { $qb = $this->dbConn->getQueryBuilder(); $query = $qb->select($qb->func()->count('id', 'num_comments'), 'object_id') @@ -670,6 +679,7 @@ class Manager implements ICommentsManager { * @psalm-return array * @since 21.0.0 */ + #[\Override] public function getNumberOfUnreadCommentsForObjects(string $objectType, array $objectIds, IUser $user, $verb = ''): array { $unreadComments = []; $query = $this->dbConn->getQueryBuilder(); @@ -714,6 +724,7 @@ class Manager implements ICommentsManager { * @return int * @since 21.0.0 */ + #[\Override] public function getNumberOfCommentsForObjectSinceComment(string $objectType, string $objectId, int $lastRead, string $verb = ''): int { if ($verb !== '') { return $this->getNumberOfCommentsWithVerbsForObjectSinceComment($objectType, $objectId, $lastRead, [$verb]); @@ -730,6 +741,7 @@ class Manager implements ICommentsManager { * @return int * @since 24.0.0 */ + #[\Override] public function getNumberOfCommentsWithVerbsForObjectSinceComment(string $objectType, string $objectId, int $lastRead, array $verbs): int { $query = $this->dbConn->getQueryBuilder(); $query->select($query->func()->count('id', 'num_messages')) @@ -757,6 +769,7 @@ class Manager implements ICommentsManager { * @return int * @since 21.0.0 */ + #[\Override] public function getLastCommentBeforeDate(string $objectType, string $objectId, \DateTime $beforeDate, string $verb = ''): int { $query = $this->dbConn->getQueryBuilder(); $query->select('id') @@ -787,6 +800,7 @@ class Manager implements ICommentsManager { * @psalm-return array * @since 21.0.0 */ + #[\Override] public function getLastCommentDateByActor( string $objectType, string $objectId, @@ -825,6 +839,7 @@ class Manager implements ICommentsManager { * @param IUser $user * @return array [$fileId => $unreadCount] */ + #[\Override] public function getNumberOfUnreadCommentsForFolder($folderId, IUser $user) { $directory = $this->rootFolder->getFirstNodeById($folderId); if (!$directory instanceof Folder) { @@ -852,6 +867,7 @@ class Manager implements ICommentsManager { * @return IComment * @since 9.0.0 */ + #[\Override] public function create($actorType, $actorId, $objectType, $objectId) { $comment = new Comment(); $comment @@ -871,6 +887,7 @@ class Manager implements ICommentsManager { * @throws \InvalidArgumentException * @since 9.0.0 */ + #[\Override] public function delete($id) { if (!is_string($id)) { throw new \InvalidArgumentException('Parameter must be string'); @@ -936,6 +953,7 @@ class Manager implements ICommentsManager { * @throws PreConditionNotMetException * @since 24.0.0 */ + #[\Override] public function getReactionComment(int $parentId, string $actorType, string $actorId, string $reaction): IComment { $this->throwIfNotSupportReactions(); $qb = $this->dbConn->getQueryBuilder(); @@ -965,6 +983,7 @@ class Manager implements ICommentsManager { * @throws PreConditionNotMetException * @since 24.0.0 */ + #[\Override] public function retrieveAllReactions(int $parentId): array { $this->throwIfNotSupportReactions(); $qb = $this->dbConn->getQueryBuilder(); @@ -995,6 +1014,7 @@ class Manager implements ICommentsManager { * @throws PreConditionNotMetException * @since 24.0.0 */ + #[\Override] public function retrieveAllReactionsWithSpecificReaction(int $parentId, string $reaction): array { $this->throwIfNotSupportReactions(); $qb = $this->dbConn->getQueryBuilder(); @@ -1023,6 +1043,7 @@ class Manager implements ICommentsManager { * @return bool * @since 24.0.0 */ + #[\Override] public function supportReactions(): bool { return $this->emojiHelper->doesPlatformSupportEmoji(); } @@ -1094,6 +1115,7 @@ class Manager implements ICommentsManager { * @throws PreConditionNotMetException * @since 9.0.0 */ + #[\Override] public function save(IComment $comment) { if ($comment->getVerb() === 'reaction') { $this->throwIfNotSupportReactions(); @@ -1286,6 +1308,7 @@ class Manager implements ICommentsManager { /** * @inheritDoc */ + #[\Override] public function deleteReferencesOfActor($actorType, $actorId): bool { $this->checkRoleParameters('Actor', $actorType, $actorId); @@ -1306,6 +1329,7 @@ class Manager implements ICommentsManager { /** * @inheritDoc */ + #[\Override] public function deleteCommentsAtObject($objectType, $objectId): bool { $this->checkRoleParameters('Object', $objectType, $objectId); @@ -1329,6 +1353,7 @@ class Manager implements ICommentsManager { * @return bool * @since 9.0.0 */ + #[\Override] public function deleteReadMarksFromUser(IUser $user) { $qb = $this->dbConn->getQueryBuilder(); $query = $qb->delete('comments_read_markers') @@ -1357,6 +1382,7 @@ class Manager implements ICommentsManager { * @param IUser $user * @since 9.0.0 */ + #[\Override] public function setReadMark($objectType, $objectId, \DateTime $dateTime, IUser $user) { $this->checkRoleParameters('Object', $objectType, $objectId); @@ -1403,6 +1429,7 @@ class Manager implements ICommentsManager { * @return \DateTime|null * @since 9.0.0 */ + #[\Override] public function getReadMark($objectType, $objectId, IUser $user) { $qb = $this->dbConn->getQueryBuilder(); $resultStatement = $qb->select('marker_datetime') @@ -1432,6 +1459,7 @@ class Manager implements ICommentsManager { * @return bool * @since 9.0.0 */ + #[\Override] public function deleteReadMarksOnObject($objectType, $objectId) { $this->checkRoleParameters('Object', $objectType, $objectId); @@ -1460,6 +1488,7 @@ class Manager implements ICommentsManager { * * @param \Closure $closure */ + #[\Override] public function registerEventHandler(\Closure $closure) { $this->eventHandlerClosures[] = $closure; $this->eventHandlers = []; @@ -1476,6 +1505,7 @@ class Manager implements ICommentsManager { * Only one resolver shall be registered per type. Otherwise a * \OutOfBoundsException has to thrown. */ + #[\Override] public function registerDisplayNameResolver($type, \Closure $closure) { if (!is_string($type)) { throw new \InvalidArgumentException('String expected.'); @@ -1499,6 +1529,7 @@ class Manager implements ICommentsManager { * be thrown. It is upon the resolver discretion what to return of the * provided ID is unknown. It must be ensured that a string is returned. */ + #[\Override] public function resolveDisplayName($type, $id) { if (!is_string($type)) { throw new \InvalidArgumentException('String expected.'); @@ -1547,6 +1578,7 @@ class Manager implements ICommentsManager { * * @since 21.0.0 */ + #[\Override] public function load(): void { $this->initialStateService->provideInitialState('comments', 'max-message-length', IComment::MAX_MESSAGE_LENGTH); Util::addScript('comments', 'comments-app'); @@ -1555,6 +1587,7 @@ class Manager implements ICommentsManager { /** * @inheritDoc */ + #[\Override] public function deleteCommentsExpiredAtObject(string $objectType, string $objectId = ''): bool { $qb = $this->dbConn->getQueryBuilder(); $qb->delete('comments') diff --git a/lib/private/Comments/ManagerFactory.php b/lib/private/Comments/ManagerFactory.php index d377bf58696..2fd21598e91 100644 --- a/lib/private/Comments/ManagerFactory.php +++ b/lib/private/Comments/ManagerFactory.php @@ -33,6 +33,7 @@ class ManagerFactory implements ICommentsManagerFactory { * @return ICommentsManager * @since 9.0.0 */ + #[\Override] public function getManager() { return $this->serverContainer->get(Manager::class); } diff --git a/lib/private/Config/UserConfig.php b/lib/private/Config/UserConfig.php index 1c6b819571e..12222b02ebd 100644 --- a/lib/private/Config/UserConfig.php +++ b/lib/private/Config/UserConfig.php @@ -90,6 +90,7 @@ class UserConfig implements IUserConfig { * @return list list of userIds * @since 31.0.0 */ + #[\Override] public function getUserIds(string $appId = ''): array { $this->assertParams(app: $appId, allowEmptyUser: true, allowEmptyApp: true); @@ -117,6 +118,7 @@ class UserConfig implements IUserConfig { * @return list list of app ids * @since 31.0.0 */ + #[\Override] public function getApps(string $userId): array { $this->assertParams($userId, allowEmptyApp: true); $this->loadConfigAll($userId); @@ -135,6 +137,7 @@ class UserConfig implements IUserConfig { * @return list list of stored config keys * @since 31.0.0 */ + #[\Override] public function getKeys(string $userId, string $app): array { $this->assertParams($userId, $app); $this->loadConfigAll($userId); @@ -156,6 +159,7 @@ class UserConfig implements IUserConfig { * @return bool TRUE if key exists * @since 31.0.0 */ + #[\Override] public function hasKey(string $userId, string $app, string $key, ?bool $lazy = false): bool { $this->assertParams($userId, $app, $key); $this->loadConfig($userId, $lazy); @@ -185,6 +189,7 @@ class UserConfig implements IUserConfig { * @throws UnknownKeyException if config key is not known * @since 31.0.0 */ + #[\Override] public function isSensitive(string $userId, string $app, string $key, ?bool $lazy = false): bool { $this->assertParams($userId, $app, $key); $this->loadConfig($userId, $lazy); @@ -209,6 +214,7 @@ class UserConfig implements IUserConfig { * @throws UnknownKeyException if config key is not known * @since 31.0.0 */ + #[\Override] public function isIndexed(string $userId, string $app, string $key, ?bool $lazy = false): bool { $this->assertParams($userId, $app, $key); $this->loadConfig($userId, $lazy); @@ -233,6 +239,7 @@ class UserConfig implements IUserConfig { * @see IUserConfig for details about lazy loading * @since 31.0.0 */ + #[\Override] public function isLazy(string $userId, string $app, string $key): bool { $this->matchAndApplyLexiconDefinition($userId, $app, $key); @@ -262,6 +269,7 @@ class UserConfig implements IUserConfig { * @return array [key => value] * @since 31.0.0 */ + #[\Override] public function getValues( string $userId, string $app, @@ -292,6 +300,7 @@ class UserConfig implements IUserConfig { * @return array> [appId => [key => value]] * @since 31.0.0 */ + #[\Override] public function getAllValues(string $userId, bool $filtered = false): array { $this->assertParams($userId, allowEmptyApp: true); $this->loadConfigAll($userId); @@ -317,6 +326,7 @@ class UserConfig implements IUserConfig { * @return array [appId => value] * @since 31.0.0 */ + #[\Override] public function getValuesByApps(string $userId, string $key, bool $lazy = false, ?ValueType $typedAs = null): array { $this->assertParams($userId, '', $key, allowEmptyApp: true); $this->loadConfig($userId, $lazy); @@ -356,6 +366,7 @@ class UserConfig implements IUserConfig { * @return array [userId => value] * @since 31.0.0 */ + #[\Override] public function getValuesByUsers( string $app, string $key, @@ -416,6 +427,7 @@ class UserConfig implements IUserConfig { * @return Generator * @since 31.0.0 */ + #[\Override] public function searchUsersByValueString(string $app, string $key, string $value, bool $caseInsensitive = false): Generator { return $this->searchUsersByTypedValue($app, $key, $value, $caseInsensitive); } @@ -430,6 +442,7 @@ class UserConfig implements IUserConfig { * @return Generator * @since 31.0.0 */ + #[\Override] public function searchUsersByValueInt(string $app, string $key, int $value): Generator { return $this->searchUsersByValueString($app, $key, (string)$value); } @@ -444,6 +457,7 @@ class UserConfig implements IUserConfig { * @return Generator * @since 31.0.0 */ + #[\Override] public function searchUsersByValues(string $app, string $key, array $values): Generator { return $this->searchUsersByTypedValue($app, $key, $values); } @@ -458,6 +472,7 @@ class UserConfig implements IUserConfig { * @return Generator * @since 31.0.0 */ + #[\Override] public function searchUsersByValueBool(string $app, string $key, bool $value): Generator { $values = ['0', 'off', 'false', 'no']; if ($value) { @@ -604,6 +619,7 @@ class UserConfig implements IUserConfig { * @since 31.0.0 * @see IUserConfig for explanation about lazy loading */ + #[\Override] public function getValueString( string $userId, string $app, @@ -629,6 +645,7 @@ class UserConfig implements IUserConfig { * @since 31.0.0 * @see IUserConfig for explanation about lazy loading */ + #[\Override] public function getValueInt( string $userId, string $app, @@ -654,6 +671,7 @@ class UserConfig implements IUserConfig { * @since 31.0.0 * @see IUserConfig for explanation about lazy loading */ + #[\Override] public function getValueFloat( string $userId, string $app, @@ -679,6 +697,7 @@ class UserConfig implements IUserConfig { * @since 31.0.0 * @see IUserConfig for explanation about lazy loading */ + #[\Override] public function getValueBool( string $userId, string $app, @@ -705,6 +724,7 @@ class UserConfig implements IUserConfig { * @since 31.0.0 * @see IUserConfig for explanation about lazy loading */ + #[\Override] public function getValueArray( string $userId, string $app, @@ -809,6 +829,7 @@ class UserConfig implements IUserConfig { * @throws IncorrectTypeException if config value type is not known * @since 31.0.0 */ + #[\Override] public function getValueType(string $userId, string $app, string $key, ?bool $lazy = null): ValueType { $this->assertParams($userId, $app, $key); $this->loadConfig($userId, $lazy); @@ -834,6 +855,7 @@ class UserConfig implements IUserConfig { * @throws IncorrectTypeException if config value type is not known * @since 31.0.0 */ + #[\Override] public function getValueFlags(string $userId, string $app, string $key, bool $lazy = false): int { $this->assertParams($userId, $app, $key); $this->loadConfig($userId, $lazy); @@ -904,6 +926,7 @@ class UserConfig implements IUserConfig { * @since 31.0.0 * @see IUserConfig for explanation about lazy loading */ + #[\Override] public function setValueString( string $userId, string $app, @@ -938,6 +961,7 @@ class UserConfig implements IUserConfig { * @since 31.0.0 * @see IUserConfig for explanation about lazy loading */ + #[\Override] public function setValueInt( string $userId, string $app, @@ -976,6 +1000,7 @@ class UserConfig implements IUserConfig { * @since 31.0.0 * @see IUserConfig for explanation about lazy loading */ + #[\Override] public function setValueFloat( string $userId, string $app, @@ -1009,6 +1034,7 @@ class UserConfig implements IUserConfig { * @since 31.0.0 * @see IUserConfig for explanation about lazy loading */ + #[\Override] public function setValueBool( string $userId, string $app, @@ -1044,6 +1070,7 @@ class UserConfig implements IUserConfig { * @since 31.0.0 * @see IUserConfig for explanation about lazy loading */ + #[\Override] public function setValueArray( string $userId, string $app, @@ -1283,6 +1310,7 @@ class UserConfig implements IUserConfig { * @return bool TRUE if entry was found in database and an update was necessary * @since 31.0.0 */ + #[\Override] public function updateSensitive(string $userId, string $app, string $key, bool $sensitive): bool { $this->assertParams($userId, $app, $key); $this->loadConfigAll($userId); @@ -1340,6 +1368,7 @@ class UserConfig implements IUserConfig { * * @since 31.0.0 */ + #[\Override] public function updateGlobalSensitive(string $app, string $key, bool $sensitive): void { $this->assertParams('', $app, $key, allowEmptyUser: true); $this->matchAndApplyLexiconDefinition('', $app, $key); @@ -1370,6 +1399,7 @@ class UserConfig implements IUserConfig { * @throws UnknownKeyException * @since 31.0.0 */ + #[\Override] public function updateIndexed(string $userId, string $app, string $key, bool $indexed): bool { $this->assertParams($userId, $app, $key); $this->loadConfigAll($userId); @@ -1427,6 +1457,7 @@ class UserConfig implements IUserConfig { * * @since 31.0.0 */ + #[\Override] public function updateGlobalIndexed(string $app, string $key, bool $indexed): void { $this->assertParams('', $app, $key, allowEmptyUser: true); $this->matchAndApplyLexiconDefinition('', $app, $key); @@ -1473,6 +1504,7 @@ class UserConfig implements IUserConfig { * @return bool TRUE if entry was found in database and an update was necessary * @since 31.0.0 */ + #[\Override] public function updateLazy(string $userId, string $app, string $key, bool $lazy): bool { $this->assertParams($userId, $app, $key); $this->loadConfigAll($userId); @@ -1509,6 +1541,7 @@ class UserConfig implements IUserConfig { * * @since 31.0.0 */ + #[\Override] public function updateGlobalLazy(string $app, string $key, bool $lazy): void { $this->assertParams('', $app, $key, allowEmptyUser: true); $this->matchAndApplyLexiconDefinition('', $app, $key); @@ -1534,6 +1567,7 @@ class UserConfig implements IUserConfig { * @throws UnknownKeyException if config key is not known in database * @since 31.0.0 */ + #[\Override] public function getDetails(string $userId, string $app, string $key): array { $this->assertParams($userId, $app, $key); $this->loadConfigAll($userId); @@ -1584,6 +1618,7 @@ class UserConfig implements IUserConfig { * * @since 31.0.0 */ + #[\Override] public function deleteUserConfig(string $userId, string $app, string $key): void { $this->assertParams($userId, $app, $key); $this->matchAndApplyLexiconDefinition($userId, $app, $key); @@ -1608,6 +1643,7 @@ class UserConfig implements IUserConfig { * * @since 31.0.0 */ + #[\Override] public function deleteKey(string $app, string $key): void { $this->assertParams('', $app, $key, allowEmptyUser: true); $this->matchAndApplyLexiconDefinition('', $app, $key); @@ -1628,6 +1664,7 @@ class UserConfig implements IUserConfig { * * @since 31.0.0 */ + #[\Override] public function deleteApp(string $app): void { $this->assertParams('', $app, allowEmptyUser: true); @@ -1639,6 +1676,7 @@ class UserConfig implements IUserConfig { $this->clearCacheAll(); } + #[\Override] public function deleteAllUserConfig(string $userId): void { $this->assertParams($userId, '', allowEmptyApp: true); $qb = $this->connection->getQueryBuilder(); @@ -1657,6 +1695,7 @@ class UserConfig implements IUserConfig { * * @since 31.0.0 */ + #[\Override] public function clearCache(string $userId, bool $reload = false): void { $this->assertParams($userId, allowEmptyApp: true); $this->lazyLoaded[$userId] = $this->fastLoaded[$userId] = false; @@ -1674,6 +1713,7 @@ class UserConfig implements IUserConfig { * * @since 31.0.0 */ + #[\Override] public function clearCacheAll(): void { $this->lazyLoaded = $this->fastLoaded = []; $this->lazyCache = $this->fastCache = $this->valueDetails = $this->configLexiconDetails = []; diff --git a/lib/private/Console/TimestampFormatter.php b/lib/private/Console/TimestampFormatter.php index 2df34a84c87..44de18263e6 100644 --- a/lib/private/Console/TimestampFormatter.php +++ b/lib/private/Console/TimestampFormatter.php @@ -23,6 +23,7 @@ class TimestampFormatter implements OutputFormatterInterface { * * @param bool $decorated Whether to decorate the messages or not */ + #[\Override] public function setDecorated(bool $decorated): void { $this->formatter->setDecorated($decorated); } @@ -32,6 +33,7 @@ class TimestampFormatter implements OutputFormatterInterface { * * @return bool true if the output will decorate messages, false otherwise */ + #[\Override] public function isDecorated(): bool { return $this->formatter->isDecorated(); } @@ -42,6 +44,7 @@ class TimestampFormatter implements OutputFormatterInterface { * @param string $name The style name * @param OutputFormatterStyleInterface $style The style instance */ + #[\Override] public function setStyle(string $name, OutputFormatterStyleInterface $style): void { $this->formatter->setStyle($name, $style); } @@ -52,6 +55,7 @@ class TimestampFormatter implements OutputFormatterInterface { * @param string $name * @return bool */ + #[\Override] public function hasStyle(string $name): bool { return $this->formatter->hasStyle($name); } @@ -63,6 +67,7 @@ class TimestampFormatter implements OutputFormatterInterface { * @return OutputFormatterStyleInterface * @throws \InvalidArgumentException When style isn't defined */ + #[\Override] public function getStyle(string $name): OutputFormatterStyleInterface { return $this->formatter->getStyle($name); } @@ -74,6 +79,7 @@ class TimestampFormatter implements OutputFormatterInterface { * @return string|null The styled message, prepended with a timestamp using the * log timezone and dateformat, e.g. "2015-06-23T17:24:37+02:00" */ + #[\Override] public function format(?string $message): ?string { if (!$this->formatter->isDecorated()) { // Don't add anything to the output when we shouldn't diff --git a/lib/private/Contacts/ContactsMenu/ActionFactory.php b/lib/private/Contacts/ContactsMenu/ActionFactory.php index 40037598d49..ead893e5745 100644 --- a/lib/private/Contacts/ContactsMenu/ActionFactory.php +++ b/lib/private/Contacts/ContactsMenu/ActionFactory.php @@ -14,6 +14,7 @@ class ActionFactory implements IActionFactory { /** * {@inheritDoc} */ + #[\Override] public function newLinkAction(string $icon, string $name, string $href, string $appId = ''): ILinkAction { $action = new LinkAction(); $action->setName($name); @@ -26,6 +27,7 @@ class ActionFactory implements IActionFactory { /** * {@inheritDoc} */ + #[\Override] public function newEMailAction(string $icon, string $name, string $email, string $appId = ''): ILinkAction { return $this->newLinkAction($icon, $name, 'mailto:' . $email, $appId); } diff --git a/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php b/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php index 020d13996eb..bee6dce5677 100644 --- a/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php +++ b/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php @@ -20,30 +20,37 @@ class LinkAction implements ILinkAction { /** * @param string $icon absolute URI to an icon */ + #[\Override] public function setIcon(string $icon): void { $this->icon = $icon; } + #[\Override] public function setName(string $name): void { $this->name = $name; } + #[\Override] public function getName(): string { return $this->name; } + #[\Override] public function setPriority(int $priority): void { $this->priority = $priority; } + #[\Override] public function getPriority(): int { return $this->priority; } + #[\Override] public function setHref(string $href): void { $this->href = $href; } + #[\Override] public function getHref(): string { return $this->href; } @@ -51,6 +58,7 @@ class LinkAction implements ILinkAction { /** * @since 23.0.0 */ + #[\Override] public function setAppId(string $appId): void { $this->appId = $appId; } @@ -58,6 +66,7 @@ class LinkAction implements ILinkAction { /** * @since 23.0.0 */ + #[\Override] public function getAppId(): string { return $this->appId; } @@ -65,6 +74,7 @@ class LinkAction implements ILinkAction { /** * @return array{title: string, icon: string, hyperlink: string, appId: string} */ + #[\Override] public function jsonSerialize(): array { return [ 'title' => $this->name, diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php index deb03ce37f3..7d3e9b8e470 100644 --- a/lib/private/Contacts/ContactsMenu/ContactsStore.php +++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php @@ -44,6 +44,7 @@ class ContactsStore implements IContactsStore { /** * @return IEntry[] */ + #[\Override] public function getContacts(IUser $user, ?string $filter, ?int $limit = null, ?int $offset = null): array { $options = [ 'enumeration' => $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes', @@ -279,6 +280,7 @@ class ContactsStore implements IContactsStore { })); } + #[\Override] public function findOne(IUser $user, int $shareType, string $shareWith): ?IEntry { switch ($shareType) { case 0: diff --git a/lib/private/Contacts/ContactsMenu/Entry.php b/lib/private/Contacts/ContactsMenu/Entry.php index d4f2dc7bf90..31d871210e4 100644 --- a/lib/private/Contacts/ContactsMenu/Entry.php +++ b/lib/private/Contacts/ContactsMenu/Entry.php @@ -48,6 +48,7 @@ class Entry implements IEntry { $this->fullName = $displayName; } + #[\Override] public function getFullName(): string { return $this->fullName; } @@ -59,6 +60,7 @@ class Entry implements IEntry { /** * @return string[] */ + #[\Override] public function getEMailAddresses(): array { return $this->emailAddresses; } @@ -67,6 +69,7 @@ class Entry implements IEntry { $this->avatar = $avatar; } + #[\Override] public function getAvatar(): ?string { return $this->avatar; } @@ -87,11 +90,13 @@ class Entry implements IEntry { return $this->profileUrl; } + #[\Override] public function addAction(IAction $action): void { $this->actions[] = $action; $this->sortActions(); } + #[\Override] public function setStatus(string $status, ?string $statusMessage = null, ?int $statusMessageTimestamp = null, @@ -138,6 +143,7 @@ class Entry implements IEntry { $this->properties = array_merge($this->properties, $properties); } + #[\Override] public function getProperty(string $key): mixed { if (!isset($this->properties[$key])) { return null; @@ -148,6 +154,7 @@ class Entry implements IEntry { /** * @return array{id: int|string|null, fullName: string, avatar: string|null, topAction: mixed, actions: array, lastMessage: '', emailAddresses: string[], profileTitle: string|null, profileUrl: string|null, status: string|null, statusMessage: null|string, statusMessageTimestamp: null|int, statusIcon: null|string, isUser: bool, uid: mixed} */ + #[\Override] public function jsonSerialize(): array { $topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null; $otherActions = array_map(function (IAction $action) { diff --git a/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php b/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php index 266125f5ed5..75eeb0f5e34 100644 --- a/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php +++ b/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php @@ -18,6 +18,7 @@ class EMailProvider implements IProvider { ) { } + #[\Override] public function process(IEntry $entry): void { $iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/mail.svg')); foreach ($entry->getEMailAddresses() as $address) { diff --git a/lib/private/Contacts/ContactsMenu/Providers/LocalTimeProvider.php b/lib/private/Contacts/ContactsMenu/Providers/LocalTimeProvider.php index f62e989fd64..0f9fe198dac 100644 --- a/lib/private/Contacts/ContactsMenu/Providers/LocalTimeProvider.php +++ b/lib/private/Contacts/ContactsMenu/Providers/LocalTimeProvider.php @@ -33,6 +33,7 @@ class LocalTimeProvider implements IProvider { ) { } + #[\Override] public function process(IEntry $entry): void { $targetUserId = $entry->getProperty('UID'); $targetUser = $this->userManager->get($targetUserId); diff --git a/lib/private/Contacts/ContactsMenu/Providers/ProfileProvider.php b/lib/private/Contacts/ContactsMenu/Providers/ProfileProvider.php index d00573aaa96..3f4af954989 100644 --- a/lib/private/Contacts/ContactsMenu/Providers/ProfileProvider.php +++ b/lib/private/Contacts/ContactsMenu/Providers/ProfileProvider.php @@ -25,6 +25,7 @@ class ProfileProvider implements IProvider { ) { } + #[\Override] public function process(IEntry $entry): void { $targetUserId = $entry->getProperty('UID'); $targetUser = $this->userManager->get($targetUserId); diff --git a/lib/private/ContactsManager.php b/lib/private/ContactsManager.php index 87b341ac36b..e19efb243b8 100644 --- a/lib/private/ContactsManager.php +++ b/lib/private/ContactsManager.php @@ -31,6 +31,7 @@ class ContactsManager implements IManager { * @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, enumeration?: bool, fullmatch?: bool, strict_search?: bool} $options * @return array an array of contacts which are arrays of key-value-pairs */ + #[\Override] public function search($pattern, $searchProperties = [], $options = []) { $this->loadAddressBooks(); $result = []; @@ -78,6 +79,7 @@ class ContactsManager implements IManager { * @param string $addressBookKey identifier of the address book in which the contact shall be deleted * @return bool successful or not */ + #[\Override] public function delete($id, $addressBookKey) { $addressBook = $this->getAddressBook($addressBookKey); if (!$addressBook) { @@ -99,6 +101,7 @@ class ContactsManager implements IManager { * @param string $addressBookKey identifier of the address book in which the contact shall be created or updated * @return ?array representing the contact just created or updated */ + #[\Override] public function createOrUpdate($properties, $addressBookKey) { $addressBook = $this->getAddressBook($addressBookKey); if (!$addressBook) { @@ -117,6 +120,7 @@ class ContactsManager implements IManager { * * @return bool true if enabled, false if not */ + #[\Override] public function isEnabled(): bool { return !empty($this->addressBooks) || !empty($this->addressBookLoaders); } @@ -124,6 +128,7 @@ class ContactsManager implements IManager { /** * @param IAddressBook $addressBook */ + #[\Override] public function registerAddressBook(IAddressBook $addressBook) { $this->addressBooks[$addressBook->getKey()] = $addressBook; } @@ -131,6 +136,7 @@ class ContactsManager implements IManager { /** * @param IAddressBook $addressBook */ + #[\Override] public function unregisterAddressBook(IAddressBook $addressBook) { unset($this->addressBooks[$addressBook->getKey()]); } @@ -141,6 +147,7 @@ class ContactsManager implements IManager { * @return IAddressBook[] * @since 16.0.0 */ + #[\Override] public function getUserAddressBooks(): array { $this->loadAddressBooks(); return $this->addressBooks; @@ -149,6 +156,7 @@ class ContactsManager implements IManager { /** * removes all registered address book instances */ + #[\Override] public function clear() { $this->addressBooks = []; $this->addressBookLoaders = []; @@ -170,6 +178,7 @@ class ContactsManager implements IManager { * * @param \Closure $callable */ + #[\Override] public function register(\Closure $callable) { $this->addressBookLoaders[] = $callable; } diff --git a/lib/private/ContextChat/ContentManager.php b/lib/private/ContextChat/ContentManager.php index 3324ce6c700..24e3dc4de6c 100644 --- a/lib/private/ContextChat/ContentManager.php +++ b/lib/private/ContextChat/ContentManager.php @@ -18,38 +18,47 @@ class ContentManager implements IContentManager { ) { } + #[\Override] public function isContextChatAvailable(): bool { return $this->contentManager !== null; } + #[\Override] public function registerContentProvider(string $appId, string $providerId, string $providerClass): void { $this->contentManager?->registerContentProvider($appId, $providerId, $providerClass); } + #[\Override] public function collectAllContentProviders(): void { $this->contentManager?->collectAllContentProviders(); } + #[\Override] public function submitContent(string $appId, array $items): void { $this->contentManager?->submitContent($appId, $items); } + #[\Override] public function updateAccess(string $appId, string $providerId, string $itemId, string $op, array $userIds): void { $this->contentManager?->updateAccess($appId, $providerId, $itemId, $op, $userIds); } + #[\Override] public function updateAccessProvider(string $appId, string $providerId, string $op, array $userIds): void { $this->contentManager?->updateAccessProvider($appId, $providerId, $op, $userIds); } + #[\Override] public function updateAccessDeclarative(string $appId, string $providerId, string $itemId, array $userIds): void { $this->contentManager?->updateAccessDeclarative($appId, $providerId, $itemId, $op, $userIds); } + #[\Override] public function deleteProvider(string $appId, string $providerId): void { $this->contentManager?->deleteProvider($appId, $providerId); } + #[\Override] public function deleteContent(string $appId, string $providerId, array $itemIds): void { $this->contentManager?->deleteContent($appId, $providerId, $itemIds); } diff --git a/lib/private/DB/AdapterMySQL.php b/lib/private/DB/AdapterMySQL.php index 63c75607379..b50e676249d 100644 --- a/lib/private/DB/AdapterMySQL.php +++ b/lib/private/DB/AdapterMySQL.php @@ -14,14 +14,17 @@ class AdapterMySQL extends Adapter { /** * @param string $tableName */ + #[\Override] public function lockTable($tableName) { $this->conn->executeUpdate('LOCK TABLES `' . $tableName . '` WRITE'); } + #[\Override] public function unlockTable() { $this->conn->executeUpdate('UNLOCK TABLES'); } + #[\Override] public function fixupStatement($statement) { $statement = str_replace(' ILIKE ', ' COLLATE ' . $this->getCollation() . ' LIKE ', $statement); return $statement; @@ -36,6 +39,7 @@ class AdapterMySQL extends Adapter { return $this->collation; } + #[\Override] public function insertIgnoreConflict(string $table, array $values): int { $builder = $this->conn->getQueryBuilder(); $builder->insert($table); diff --git a/lib/private/DB/AdapterOCI8.php b/lib/private/DB/AdapterOCI8.php index 0a509090bca..70fe9290cc5 100644 --- a/lib/private/DB/AdapterOCI8.php +++ b/lib/private/DB/AdapterOCI8.php @@ -8,6 +8,7 @@ namespace OC\DB; class AdapterOCI8 extends Adapter { + #[\Override] public function lastInsertId($table) { if (is_null($table)) { throw new \InvalidArgumentException('Oracle requires a table name to be passed into lastInsertId()'); @@ -21,6 +22,7 @@ class AdapterOCI8 extends Adapter { public const UNIX_TIMESTAMP_REPLACEMENT = "(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400"; + #[\Override] public function fixupStatement($statement) { $statement = preg_replace('/`(\w+)` ILIKE \?/', 'REGEXP_LIKE(`$1`, \'^\' || REPLACE(?, \'%\', \'.*\') || \'$\', \'i\')', $statement); $statement = str_replace('`', '"', $statement); diff --git a/lib/private/DB/AdapterPgSql.php b/lib/private/DB/AdapterPgSql.php index db48c81c2c5..fe7181005df 100644 --- a/lib/private/DB/AdapterPgSql.php +++ b/lib/private/DB/AdapterPgSql.php @@ -9,6 +9,7 @@ namespace OC\DB; class AdapterPgSql extends Adapter { + #[\Override] public function lastInsertId($table) { $result = $this->conn->executeQuery('SELECT lastval()'); $val = $result->fetchOne(); @@ -17,12 +18,14 @@ class AdapterPgSql extends Adapter { } public const UNIX_TIMESTAMP_REPLACEMENT = 'cast(extract(epoch from current_timestamp) as integer)'; + #[\Override] public function fixupStatement($statement) { $statement = str_replace('`', '"', $statement); $statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement); return $statement; } + #[\Override] public function insertIgnoreConflict(string $table, array $values) : int { // "upsert" is only available since PgSQL 9.5, but the generic way // would leave error logs in the DB. diff --git a/lib/private/DB/AdapterSqlite.php b/lib/private/DB/AdapterSqlite.php index aeadf55ecf7..00fff562094 100644 --- a/lib/private/DB/AdapterSqlite.php +++ b/lib/private/DB/AdapterSqlite.php @@ -13,14 +13,17 @@ class AdapterSqlite extends Adapter { /** * @param string $tableName */ + #[\Override] public function lockTable($tableName) { $this->conn->executeUpdate('BEGIN EXCLUSIVE TRANSACTION'); } + #[\Override] public function unlockTable() { $this->conn->executeUpdate('COMMIT TRANSACTION'); } + #[\Override] public function fixupStatement($statement) { $statement = preg_replace('/`(\w+)` ILIKE \?/', 'LOWER($1) LIKE LOWER(?)', $statement); $statement = str_replace('`', '"', $statement); @@ -44,6 +47,7 @@ class AdapterSqlite extends Adapter { * @throws \Doctrine\DBAL\Exception * @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371 */ + #[\Override] public function insertIfNotExist($table, $input, ?array $compare = null) { if (empty($compare)) { $compare = array_keys($input); @@ -77,6 +81,7 @@ class AdapterSqlite extends Adapter { } } + #[\Override] public function insertIgnoreConflict(string $table, array $values): int { $builder = $this->conn->getQueryBuilder(); $builder->insert($table); diff --git a/lib/private/DB/BacktraceDebugStack.php b/lib/private/DB/BacktraceDebugStack.php index 4afd3ce6a13..cd5b53ea824 100644 --- a/lib/private/DB/BacktraceDebugStack.php +++ b/lib/private/DB/BacktraceDebugStack.php @@ -11,6 +11,7 @@ namespace OC\DB; use Doctrine\DBAL\Logging\DebugStack; class BacktraceDebugStack extends DebugStack { + #[\Override] public function startQuery($sql, ?array $params = null, ?array $types = null) { parent::startQuery($sql, $params, $types); $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index 3eef60c6daf..27be1b327e2 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -204,6 +204,7 @@ class Connection extends PrimaryReadReplicaConnection { /** * @throws Exception */ + #[\Override] public function connect($connectionName = null) { try { if ($this->_conn) { @@ -228,6 +229,7 @@ class Connection extends PrimaryReadReplicaConnection { } } + #[\Override] protected function performConnect(?string $connectionName = null): bool { if (($connectionName ?? 'replica') === 'replica' && count($this->params['replica']) === 1 @@ -286,6 +288,7 @@ class Connection extends PrimaryReadReplicaConnection { * @return \Doctrine\DBAL\Query\QueryBuilder * @deprecated 8.0.0 please use $this->getQueryBuilder() instead */ + #[\Override] public function createQueryBuilder() { $backtrace = $this->getCallerBacktrace(); $this->logger->debug('Doctrine QueryBuilder retrieved in {backtrace}', ['app' => 'core', 'backtrace' => $backtrace]); @@ -299,6 +302,7 @@ class Connection extends PrimaryReadReplicaConnection { * @return \Doctrine\DBAL\Query\Expression\ExpressionBuilder * @deprecated 8.0.0 please use $this->getQueryBuilder()->expr() instead */ + #[\Override] public function getExpressionBuilder() { $backtrace = $this->getCallerBacktrace(); $this->logger->debug('Doctrine ExpressionBuilder retrieved in {backtrace}', ['app' => 'core', 'backtrace' => $backtrace]); @@ -337,6 +341,7 @@ class Connection extends PrimaryReadReplicaConnection { * @return Statement The prepared statement. * @throws Exception */ + #[\Override] public function prepare($sql, $limit = null, $offset = null): Statement { if ($limit === -1 || $limit === null) { $limit = null; @@ -370,6 +375,7 @@ class Connection extends PrimaryReadReplicaConnection { * * @throws \Doctrine\DBAL\Exception */ + #[\Override] public function executeQuery(string $sql, array $params = [], $types = [], ?QueryCacheProfile $qcp = null): Result { $tables = $this->getQueriedTables($sql); $now = $this->clock->now()->getTimestamp(); @@ -431,6 +437,7 @@ class Connection extends PrimaryReadReplicaConnection { /** * @throws Exception */ + #[\Override] public function executeUpdate(string $sql, array $params = [], array $types = []): int { return $this->executeStatement($sql, $params, $types); } @@ -449,6 +456,7 @@ class Connection extends PrimaryReadReplicaConnection { * * @throws \Doctrine\DBAL\Exception */ + #[\Override] public function executeStatement($sql, array $params = [], array $types = []): int { $tables = $this->getQueriedTables($sql); foreach ($tables as $table) { @@ -510,6 +518,7 @@ class Connection extends PrimaryReadReplicaConnection { * @return int the last inserted ID. * @throws Exception */ + #[\Override] public function lastInsertId($name = null): int { if ($name) { $name = $this->replaceTablePrefix($name); @@ -827,6 +836,7 @@ class Connection extends PrimaryReadReplicaConnection { } } + #[\Override] public function beginTransaction() { if (!$this->inTransaction()) { $this->transactionBacktrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); @@ -835,6 +845,7 @@ class Connection extends PrimaryReadReplicaConnection { return parent::beginTransaction(); } + #[\Override] public function commit() { $result = parent::commit(); if ($this->getTransactionNestingLevel() === 0) { @@ -861,6 +872,7 @@ class Connection extends PrimaryReadReplicaConnection { return $result; } + #[\Override] public function rollBack() { $result = parent::rollBack(); if ($this->getTransactionNestingLevel() === 0) { diff --git a/lib/private/DB/ConnectionAdapter.php b/lib/private/DB/ConnectionAdapter.php index d9e3e7ec549..0f275c3aae2 100644 --- a/lib/private/DB/ConnectionAdapter.php +++ b/lib/private/DB/ConnectionAdapter.php @@ -29,14 +29,17 @@ class ConnectionAdapter implements IDBConnection { ) { } + #[\Override] public function getQueryBuilder(): IQueryBuilder { return $this->inner->getQueryBuilder(); } + #[\Override] public function getTypedQueryBuilder(): ITypedQueryBuilder { return $this->inner->getTypedQueryBuilder(); } + #[\Override] public function prepare($sql, $limit = null, $offset = null): IPreparedStatement { try { return new PreparedStatement( @@ -47,6 +50,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function executeQuery(string $sql, array $params = [], $types = []): IResult { try { return new ResultAdapter( @@ -57,6 +61,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function executeUpdate(string $sql, array $params = [], array $types = []): int { try { return $this->inner->executeUpdate($sql, $params, $types); @@ -65,6 +70,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function executeStatement($sql, array $params = [], array $types = []): int { try { return $this->inner->executeStatement($sql, $params, $types); @@ -73,6 +79,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function lastInsertId(string $table): int { try { return $this->inner->lastInsertId($table); @@ -81,6 +88,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function insertIfNotExist(string $table, array $input, ?array $compare = null) { try { return $this->inner->insertIfNotExist($table, $input, $compare); @@ -89,6 +97,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function insertIgnoreConflict(string $table, array $values): int { try { return $this->inner->insertIgnoreConflict($table, $values); @@ -97,6 +106,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []): int { try { return $this->inner->setValues($table, $keys, $values, $updatePreconditionValues); @@ -105,6 +115,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function lockTable($tableName): void { try { $this->inner->lockTable($tableName); @@ -113,6 +124,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function unlockTable(): void { try { $this->inner->unlockTable(); @@ -121,6 +133,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function beginTransaction(): void { try { $this->inner->beginTransaction(); @@ -129,10 +142,12 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function inTransaction(): bool { return $this->inner->inTransaction(); } + #[\Override] public function commit(): void { try { $this->inner->commit(); @@ -141,6 +156,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function rollBack(): void { try { $this->inner->rollBack(); @@ -149,18 +165,22 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function getError(): string { return $this->inner->getError(); } + #[\Override] public function errorCode() { return $this->inner->errorCode(); } + #[\Override] public function errorInfo() { return $this->inner->errorInfo(); } + #[\Override] public function connect(): bool { try { return $this->inner->connect(); @@ -169,10 +189,12 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function close(): void { $this->inner->close(); } + #[\Override] public function quote($input, $type = IQueryBuilder::PARAM_STR) { return $this->inner->quote($input, $type); } @@ -180,10 +202,12 @@ class ConnectionAdapter implements IDBConnection { /** * @todo we are leaking a 3rdparty type here */ + #[\Override] public function getDatabasePlatform(): AbstractPlatform { return $this->inner->getDatabasePlatform(); } + #[\Override] public function dropTable(string $table): void { try { $this->inner->dropTable($table); @@ -192,6 +216,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function truncateTable(string $table, bool $cascade): void { try { $this->inner->truncateTable($table, $cascade); @@ -200,6 +225,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function tableExists(string $table): bool { try { return $this->inner->tableExists($table); @@ -208,10 +234,12 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function escapeLikeParameter(string $param): string { return $this->inner->escapeLikeParameter($param); } + #[\Override] public function supports4ByteText(): bool { return $this->inner->supports4ByteText(); } @@ -219,6 +247,7 @@ class ConnectionAdapter implements IDBConnection { /** * @todo leaks a 3rdparty type */ + #[\Override] public function createSchema(): Schema { try { return $this->inner->createSchema(); @@ -227,6 +256,7 @@ class ConnectionAdapter implements IDBConnection { } } + #[\Override] public function migrateToSchema(Schema $toSchema): void { try { $this->inner->migrateToSchema($toSchema); @@ -242,6 +272,7 @@ class ConnectionAdapter implements IDBConnection { /** * @return self::PLATFORM_MYSQL|self::PLATFORM_ORACLE|self::PLATFORM_POSTGRES|self::PLATFORM_SQLITE|self::PLATFORM_MARIADB */ + #[\Override] public function getDatabaseProvider(bool $strict = false): string { return $this->inner->getDatabaseProvider($strict); } @@ -258,10 +289,12 @@ class ConnectionAdapter implements IDBConnection { $this->inner->logDatabaseException($exception); } + #[\Override] public function getShardDefinition(string $name): ?ShardDefinition { return $this->inner->getShardDefinition($name); } + #[\Override] public function getCrossShardMoveHelper(): CrossShardMoveHelper { return $this->inner->getCrossShardMoveHelper(); } diff --git a/lib/private/DB/DbDataCollector.php b/lib/private/DB/DbDataCollector.php index 828674586e0..9a6f45baae1 100644 --- a/lib/private/DB/DbDataCollector.php +++ b/lib/private/DB/DbDataCollector.php @@ -29,6 +29,7 @@ class DbDataCollector extends AbstractDataCollector { /** * @inheritDoc */ + #[\Override] public function collect(Request $request, Response $response, ?\Throwable $exception = null): void { $queries = $this->sanitizeQueries($this->debugStack->queries); @@ -37,6 +38,7 @@ class DbDataCollector extends AbstractDataCollector { ]; } + #[\Override] public function getName(): string { return 'db'; } diff --git a/lib/private/DB/Exceptions/DbalException.php b/lib/private/DB/Exceptions/DbalException.php index a34ebfe651d..483b3d8542f 100644 --- a/lib/private/DB/Exceptions/DbalException.php +++ b/lib/private/DB/Exceptions/DbalException.php @@ -59,6 +59,7 @@ class DbalException extends Exception { return $this->original instanceof RetryableException; } + #[\Override] public function getReason(): ?int { /** * Constraint errors diff --git a/lib/private/DB/OracleConnection.php b/lib/private/DB/OracleConnection.php index c572157d750..6b4efa8ca5a 100644 --- a/lib/private/DB/OracleConnection.php +++ b/lib/private/DB/OracleConnection.php @@ -26,6 +26,7 @@ class OracleConnection extends Connection { return $return; } + #[\Override] public function truncateTable(string $table, bool $cascade) { if ($table[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) { $table = $this->quoteIdentifier($table); @@ -36,6 +37,7 @@ class OracleConnection extends Connection { /** * {@inheritDoc} */ + #[\Override] public function insert($table, array $data, array $types = []) { if ($table[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) { $table = $this->quoteIdentifier($table); @@ -47,6 +49,7 @@ class OracleConnection extends Connection { /** * {@inheritDoc} */ + #[\Override] public function update($table, array $data, array $criteria, array $types = []) { if ($table[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) { $table = $this->quoteIdentifier($table); @@ -59,6 +62,7 @@ class OracleConnection extends Connection { /** * {@inheritDoc} */ + #[\Override] public function delete($table, array $criteria, array $types = []) { if ($table[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) { $table = $this->quoteIdentifier($table); @@ -72,6 +76,7 @@ class OracleConnection extends Connection { * * @param string $table table name without the prefix */ + #[\Override] public function dropTable($table) { $table = $this->tablePrefix . trim($table); $table = $this->quoteIdentifier($table); @@ -87,6 +92,7 @@ class OracleConnection extends Connection { * @param string $table table name without the prefix * @return bool */ + #[\Override] public function tableExists($table) { $table = $this->tablePrefix . trim($table); $table = $this->quoteIdentifier($table); diff --git a/lib/private/DB/OracleMigrator.php b/lib/private/DB/OracleMigrator.php index c5a7646dbb2..30e44af6e95 100644 --- a/lib/private/DB/OracleMigrator.php +++ b/lib/private/DB/OracleMigrator.php @@ -18,6 +18,7 @@ class OracleMigrator extends Migrator { * @return \Doctrine\DBAL\Schema\SchemaDiff * @throws Exception */ + #[\Override] protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection): \Doctrine\DBAL\Schema\SchemaDiff { // oracle forces us to quote the identifiers $quotedSchema = new Schema(); @@ -123,6 +124,7 @@ class OracleMigrator extends Migrator { * @param $statement * @return string */ + #[\Override] protected function convertStatementToScript($statement) { if (str_ends_with($statement, ';')) { return $statement . PHP_EOL . '/' . PHP_EOL; @@ -133,6 +135,7 @@ class OracleMigrator extends Migrator { return $script; } + #[\Override] protected function getFilterExpression() { return '/^"' . preg_quote($this->config->getSystemValueString('dbtableprefix', 'oc_')) . '/'; } diff --git a/lib/private/DB/PreparedStatement.php b/lib/private/DB/PreparedStatement.php index 54561ed96cd..f88ad0edc6c 100644 --- a/lib/private/DB/PreparedStatement.php +++ b/lib/private/DB/PreparedStatement.php @@ -35,40 +35,49 @@ class PreparedStatement implements IPreparedStatement { $this->statement = $statement; } + #[\Override] public function closeCursor(): bool { $this->getResult()->closeCursor(); return true; } + #[\Override] public function fetch(int $fetchMode = PDO::FETCH_ASSOC) { return $this->getResult()->fetch($fetchMode); } + #[\Override] public function fetchAll(int $fetchMode = PDO::FETCH_ASSOC): array { return $this->getResult()->fetchAll($fetchMode); } + #[\Override] public function fetchColumn() { return $this->getResult()->fetchOne(); } + #[\Override] public function fetchOne() { return $this->getResult()->fetchOne(); } + #[\Override] public function bindValue($param, $value, $type = ParameterType::STRING): bool { return $this->statement->bindValue($param, $value, $type); } + #[\Override] public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool { return $this->statement->bindParam($param, $variable, $type, $length); } + #[\Override] public function execute($params = null): IResult { return ($this->result = new ResultAdapter($this->statement->execute($params))); } + #[\Override] public function rowCount(): int { return $this->getResult()->rowCount(); } diff --git a/lib/private/DB/QueryBuilder/CompositeExpression.php b/lib/private/DB/QueryBuilder/CompositeExpression.php index 18adf242c89..6a1d6c3f513 100644 --- a/lib/private/DB/QueryBuilder/CompositeExpression.php +++ b/lib/private/DB/QueryBuilder/CompositeExpression.php @@ -51,6 +51,7 @@ class CompositeExpression implements ICompositeExpression, \Countable { * * @return integer */ + #[\Override] public function count(): int { return count($this->parts); } @@ -60,6 +61,7 @@ class CompositeExpression implements ICompositeExpression, \Countable { * * @return string */ + #[\Override] public function getType(): string { return $this->type; } diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php index 8436fd365a0..3565e97efd1 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php @@ -51,6 +51,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return ICompositeExpression */ + #[\Override] public function andX(...$x): ICompositeExpression { if (empty($x)) { $this->logger->debug('Calling ' . IQueryBuilder::class . '::' . __FUNCTION__ . ' without parameters is deprecated and will throw soon.', ['exception' => new \Exception('No parameters in call to ' . __METHOD__)]); @@ -72,6 +73,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return ICompositeExpression */ + #[\Override] public function orX(...$x): ICompositeExpression { if (empty($x)) { $this->logger->debug('Calling ' . IQueryBuilder::class . '::' . __FUNCTION__ . ' without parameters is deprecated and will throw soon.', ['exception' => new \Exception('No parameters in call to ' . __METHOD__)]); @@ -90,6 +92,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return string */ + #[\Override] public function comparison($x, string $operator, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); @@ -113,6 +116,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return string */ + #[\Override] public function eq($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); @@ -135,6 +139,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return string */ + #[\Override] public function neq($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); @@ -157,6 +162,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return string */ + #[\Override] public function lt($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); @@ -179,6 +185,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return string */ + #[\Override] public function lte($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); @@ -201,6 +208,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return string */ + #[\Override] public function gt($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); @@ -223,6 +231,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return string */ + #[\Override] public function gte($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); @@ -236,6 +245,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return string */ + #[\Override] public function isNull($x): string { $x = $this->helper->quoteColumnName($x); return $this->expressionBuilder->isNull($x); @@ -248,6 +258,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return string */ + #[\Override] public function isNotNull($x): string { $x = $this->helper->quoteColumnName($x); return $this->expressionBuilder->isNotNull($x); @@ -263,6 +274,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return string */ + #[\Override] public function like($x, $y, $type = null): string { $x = $this->helper->quoteColumnName($x); $y = $this->helper->quoteColumnName($y); @@ -280,6 +292,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @return string * @since 9.0.0 */ + #[\Override] public function iLike($x, $y, $type = null): string { return $this->expressionBuilder->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y)); } @@ -294,6 +307,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return string */ + #[\Override] public function notLike($x, $y, $type = null): string { $x = $this->helper->quoteColumnName($x); $y = $this->helper->quoteColumnName($y); @@ -310,6 +324,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return string */ + #[\Override] public function in($x, $y, $type = null): string { $x = $this->helper->quoteColumnName($x); $y = $this->helper->quoteColumnNames($y); @@ -326,6 +341,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return string */ + #[\Override] public function notIn($x, $y, $type = null): string { $x = $this->helper->quoteColumnName($x); $y = $this->helper->quoteColumnNames($y); @@ -339,6 +355,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @return string * @since 13.0.0 */ + #[\Override] public function emptyString($x): string { return $this->eq($x, $this->literal('', IQueryBuilder::PARAM_STR)); } @@ -350,6 +367,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @return string * @since 13.0.0 */ + #[\Override] public function nonEmptyString($x): string { return $this->neq($x, $this->literal('', IQueryBuilder::PARAM_STR)); } @@ -362,6 +380,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @return IQueryFunction * @since 12.0.0 */ + #[\Override] public function bitwiseAnd($x, int $y): IQueryFunction { return new QueryFunction($this->connection->getDatabasePlatform()->getBitAndComparisonExpression( $this->helper->quoteColumnName($x), @@ -377,6 +396,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @return IQueryFunction * @since 12.0.0 */ + #[\Override] public function bitwiseOr($x, int $y): IQueryFunction { return new QueryFunction($this->connection->getDatabasePlatform()->getBitOrComparisonExpression( $this->helper->quoteColumnName($x), @@ -392,6 +412,7 @@ class ExpressionBuilder implements IExpressionBuilder { * * @return ILiteral */ + #[\Override] public function literal($input, $type = IQueryBuilder::PARAM_STR): ILiteral { return new Literal($this->expressionBuilder->literal($input, $type)); } @@ -404,6 +425,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @psalm-param IQueryBuilder::PARAM_* $type * @return IQueryFunction */ + #[\Override] public function castColumn($column, $type): IQueryFunction { return new QueryFunction( $this->helper->quoteColumnName($column) diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php index 0227c3154e3..a604f6957a3 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php @@ -26,6 +26,7 @@ class MySqlExpressionBuilder extends ExpressionBuilder { /** * @inheritdoc */ + #[\Override] public function iLike($x, $y, $type = null): string { $x = $this->helper->quoteColumnName($x); $y = $this->helper->quoteColumnName($y); @@ -40,6 +41,7 @@ class MySqlExpressionBuilder extends ExpressionBuilder { * @psalm-param IQueryBuilder::PARAM_* $type * @return IQueryFunction */ + #[\Override] public function castColumn($column, $type): IQueryFunction { switch ($type) { case IQueryBuilder::PARAM_STR: diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php index 20308b24550..f95cd98921f 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php @@ -19,6 +19,7 @@ class OCIExpressionBuilder extends ExpressionBuilder { * @param mixed|null $type * @return array|IQueryFunction|string */ + #[\Override] protected function prepareColumn($column, $type) { if ($type === IQueryBuilder::PARAM_STR && !is_array($column) && !($column instanceof IParameter) && !($column instanceof ILiteral)) { $column = $this->castColumn($column, $type); @@ -30,6 +31,7 @@ class OCIExpressionBuilder extends ExpressionBuilder { /** * @inheritdoc */ + #[\Override] public function eq($x, $y, $type = null): string { if ($type === IQueryBuilder::PARAM_JSON) { $x = $this->prepareColumn($x, $type); @@ -43,6 +45,7 @@ class OCIExpressionBuilder extends ExpressionBuilder { /** * @inheritdoc */ + #[\Override] public function neq($x, $y, $type = null): string { if ($type === IQueryBuilder::PARAM_JSON) { $x = $this->prepareColumn($x, $type); @@ -56,6 +59,7 @@ class OCIExpressionBuilder extends ExpressionBuilder { /** * @inheritdoc */ + #[\Override] public function in($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); @@ -66,6 +70,7 @@ class OCIExpressionBuilder extends ExpressionBuilder { /** * @inheritdoc */ + #[\Override] public function notIn($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); @@ -80,6 +85,7 @@ class OCIExpressionBuilder extends ExpressionBuilder { * @return string * @since 13.0.0 */ + #[\Override] public function emptyString($x): string { return $this->isNull($x); } @@ -91,6 +97,7 @@ class OCIExpressionBuilder extends ExpressionBuilder { * @return string * @since 13.0.0 */ + #[\Override] public function nonEmptyString($x): string { return $this->isNotNull($x); } @@ -103,6 +110,7 @@ class OCIExpressionBuilder extends ExpressionBuilder { * @psalm-param IQueryBuilder::PARAM_* $type * @return IQueryFunction */ + #[\Override] public function castColumn($column, $type): IQueryFunction { if ($type === IQueryBuilder::PARAM_STR) { $column = $this->helper->quoteColumnName($column); @@ -119,6 +127,7 @@ class OCIExpressionBuilder extends ExpressionBuilder { /** * @inheritdoc */ + #[\Override] public function like($x, $y, $type = null): string { return parent::like($x, $y, $type) . " ESCAPE '\\'"; } @@ -126,6 +135,7 @@ class OCIExpressionBuilder extends ExpressionBuilder { /** * @inheritdoc */ + #[\Override] public function iLike($x, $y, $type = null): string { return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y)); } diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php index f30fccadb1f..e3dd5841a11 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php @@ -22,6 +22,7 @@ class PgSqlExpressionBuilder extends ExpressionBuilder { * @psalm-param IQueryBuilder::PARAM_* $type * @return IQueryFunction */ + #[\Override] public function castColumn($column, $type): IQueryFunction { switch ($type) { case IQueryBuilder::PARAM_INT: @@ -37,6 +38,7 @@ class PgSqlExpressionBuilder extends ExpressionBuilder { /** * @inheritdoc */ + #[\Override] protected function prepareColumn($column, $type) { if ($type === IQueryBuilder::PARAM_JSON && !is_array($column) && !($column instanceof IParameter) && !($column instanceof ILiteral)) { $column = $this->castColumn($column, $type); @@ -48,6 +50,7 @@ class PgSqlExpressionBuilder extends ExpressionBuilder { /** * @inheritdoc */ + #[\Override] public function iLike($x, $y, $type = null): string { $x = $this->helper->quoteColumnName($x); $y = $this->helper->quoteColumnName($y); diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php index 52f82db2232..f1ae4d06536 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php @@ -16,10 +16,12 @@ class SqliteExpressionBuilder extends ExpressionBuilder { /** * @inheritdoc */ + #[\Override] public function like($x, $y, $type = null): string { return parent::like($x, $y, $type) . " ESCAPE '\\'"; } + #[\Override] public function iLike($x, $y, $type = null): string { return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y), $type); } @@ -29,6 +31,7 @@ class SqliteExpressionBuilder extends ExpressionBuilder { * @param mixed|null $type * @return array|IQueryFunction|string */ + #[\Override] protected function prepareColumn($column, $type) { if ($type !== null && !is_array($column) @@ -48,6 +51,7 @@ class SqliteExpressionBuilder extends ExpressionBuilder { * @param mixed $type One of IQueryBuilder::PARAM_* * @return IQueryFunction */ + #[\Override] public function castColumn($column, $type): IQueryFunction { switch ($type) { case IQueryBuilder::PARAM_DATE_MUTABLE: diff --git a/lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php b/lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php index 33901ace1d4..5cc0771c0be 100644 --- a/lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php +++ b/lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php @@ -22,276 +22,336 @@ abstract class ExtendedQueryBuilder extends TypedQueryBuilder { ) { } + #[\Override] public function automaticTablePrefix($enabled) { $this->builder->automaticTablePrefix($enabled); return $this; } + #[\Override] public function expr() { return $this->builder->expr(); } + #[\Override] public function func() { return $this->builder->func(); } + #[\Override] public function getType() { return $this->builder->getType(); } + #[\Override] public function getConnection() { return $this->builder->getConnection(); } + #[\Override] public function getState() { return $this->builder->getState(); } + #[\Override] public function getSQL() { return $this->builder->getSQL(); } + #[\Override] public function setParameter($key, $value, $type = null) { $this->builder->setParameter($key, $value, $type); return $this; } + #[\Override] public function setParameters(array $params, array $types = []) { $this->builder->setParameters($params, $types); return $this; } + #[\Override] public function getParameters() { return $this->builder->getParameters(); } + #[\Override] public function getParameter($key) { return $this->builder->getParameter($key); } + #[\Override] public function getParameterTypes() { return $this->builder->getParameterTypes(); } + #[\Override] public function getParameterType($key) { return $this->builder->getParameterType($key); } + #[\Override] public function setFirstResult($firstResult) { $this->builder->setFirstResult($firstResult); return $this; } + #[\Override] public function getFirstResult() { return $this->builder->getFirstResult(); } + #[\Override] public function setMaxResults($maxResults) { $this->builder->setMaxResults($maxResults); return $this; } + #[\Override] public function getMaxResults() { return $this->builder->getMaxResults(); } + #[\Override] public function select(...$selects) { $this->builder->select(...$selects); return $this; } + #[\Override] public function selectAlias($select, $alias): self { $this->builder->selectAlias($select, $alias); return $this; } + #[\Override] public function selectDistinct($select) { $this->builder->selectDistinct($select); return $this; } + #[\Override] public function addSelect(...$select) { $this->builder->addSelect(...$select); return $this; } + #[\Override] public function delete($delete = null, $alias = null) { $this->builder->delete($delete, $alias); return $this; } + #[\Override] public function update($update = null, $alias = null) { $this->builder->update($update, $alias); return $this; } + #[\Override] public function insert($insert = null) { $this->builder->insert($insert); return $this; } + #[\Override] public function from($from, $alias = null) { $this->builder->from($from, $alias); return $this; } + #[\Override] public function join($fromAlias, $join, $alias, $condition = null) { $this->builder->join($fromAlias, $join, $alias, $condition); return $this; } + #[\Override] public function innerJoin($fromAlias, $join, $alias, $condition = null) { $this->builder->innerJoin($fromAlias, $join, $alias, $condition); return $this; } + #[\Override] public function leftJoin($fromAlias, $join, $alias, $condition = null) { $this->builder->leftJoin($fromAlias, $join, $alias, $condition); return $this; } + #[\Override] public function rightJoin($fromAlias, $join, $alias, $condition = null) { $this->builder->rightJoin($fromAlias, $join, $alias, $condition); return $this; } + #[\Override] public function set($key, $value) { $this->builder->set($key, $value); return $this; } + #[\Override] public function where(...$predicates) { $this->builder->where(...$predicates); return $this; } + #[\Override] public function andWhere(...$where) { $this->builder->andWhere(...$where); return $this; } + #[\Override] public function orWhere(...$where) { $this->builder->orWhere(...$where); return $this; } + #[\Override] public function groupBy(...$groupBys) { $this->builder->groupBy(...$groupBys); return $this; } + #[\Override] public function addGroupBy(...$groupBy) { $this->builder->addGroupBy(...$groupBy); return $this; } + #[\Override] public function setValue($column, $value) { $this->builder->setValue($column, $value); return $this; } + #[\Override] public function values(array $values) { $this->builder->values($values); return $this; } + #[\Override] public function having(...$having) { $this->builder->having(...$having); return $this; } + #[\Override] public function andHaving(...$having) { $this->builder->andHaving(...$having); return $this; } + #[\Override] public function orHaving(...$having) { $this->builder->orHaving(...$having); return $this; } + #[\Override] public function orderBy($sort, $order = null) { $this->builder->orderBy($sort, $order); return $this; } + #[\Override] public function addOrderBy($sort, $order = null) { $this->builder->addOrderBy($sort, $order); return $this; } + #[\Override] public function getQueryPart($queryPartName) { return $this->builder->getQueryPart($queryPartName); } + #[\Override] public function getQueryParts() { return $this->builder->getQueryParts(); } + #[\Override] public function resetQueryParts($queryPartNames = null) { $this->builder->resetQueryParts($queryPartNames); return $this; } + #[\Override] public function resetQueryPart($queryPartName) { $this->builder->resetQueryPart($queryPartName); return $this; } + #[\Override] public function createNamedParameter($value, $type = self::PARAM_STR, $placeHolder = null) { return $this->builder->createNamedParameter($value, $type, $placeHolder); } + #[\Override] public function createPositionalParameter($value, $type = self::PARAM_STR) { return $this->builder->createPositionalParameter($value, $type); } + #[\Override] public function createParameter($name) { return $this->builder->createParameter($name); } + #[\Override] public function createFunction($call) { return $this->builder->createFunction($call); } + #[\Override] public function getLastInsertId(): int { return $this->builder->getLastInsertId(); } + #[\Override] public function getTableName($table) { return $this->builder->getTableName($table); } + #[\Override] public function getColumnName($column, $tableAlias = '') { return $this->builder->getColumnName($column, $tableAlias); } + #[\Override] public function executeQuery(?IDBConnection $connection = null): IResult { return $this->builder->executeQuery($connection); } + #[\Override] public function executeStatement(?IDBConnection $connection = null): int { return $this->builder->executeStatement($connection); } + #[\Override] public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self { $this->builder->hintShardKey($column, $value, $overwrite); return $this; } + #[\Override] public function runAcrossAllShards(): self { $this->builder->runAcrossAllShards(); return $this; } + #[\Override] public function getOutputColumns(): array { return $this->builder->getOutputColumns(); } + #[\Override] public function prefixTableName(string $table): string { return $this->builder->prefixTableName($table); } + #[\Override] public function forUpdate(ConflictResolutionMode $conflictResolutionMode = ConflictResolutionMode::Ordinary): self { $this->builder->forUpdate($conflictResolutionMode); return $this; diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php index c488bb7ff95..acdf19189a7 100644 --- a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php +++ b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php @@ -22,10 +22,12 @@ class FunctionBuilder implements IFunctionBuilder { ) { } + #[\Override] public function md5($input): IQueryFunction { return new QueryFunction('MD5(' . $this->helper->quoteColumnName($input) . ')'); } + #[\Override] public function concat($x, ...$expr): IQueryFunction { $args = func_get_args(); $list = []; @@ -35,11 +37,13 @@ class FunctionBuilder implements IFunctionBuilder { return new QueryFunction(sprintf('CONCAT(%s)', implode(', ', $list))); } + #[\Override] public function groupConcat($expr, ?string $separator = ','): IQueryFunction { $separator = $this->connection->quote($separator); return new QueryFunction('GROUP_CONCAT(' . $this->helper->quoteColumnName($expr) . ' SEPARATOR ' . $separator . ')'); } + #[\Override] public function substring($input, $start, $length = null): IQueryFunction { if ($length) { return new QueryFunction('SUBSTR(' . $this->helper->quoteColumnName($input) . ', ' . $this->helper->quoteColumnName($start) . ', ' . $this->helper->quoteColumnName($length) . ')'); @@ -48,52 +52,63 @@ class FunctionBuilder implements IFunctionBuilder { } } + #[\Override] public function sum($field): IQueryFunction { return new QueryFunction('SUM(' . $this->helper->quoteColumnName($field) . ')'); } + #[\Override] public function lower($field): IQueryFunction { return new QueryFunction('LOWER(' . $this->helper->quoteColumnName($field) . ')'); } + #[\Override] public function add($x, $y): IQueryFunction { return new QueryFunction($this->helper->quoteColumnName($x) . ' + ' . $this->helper->quoteColumnName($y)); } + #[\Override] public function subtract($x, $y): IQueryFunction { return new QueryFunction($this->helper->quoteColumnName($x) . ' - ' . $this->helper->quoteColumnName($y)); } + #[\Override] public function count($count = '', $alias = ''): IQueryFunction { $alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : ''; $quotedName = $count === '' ? '*' : $this->helper->quoteColumnName($count); return new QueryFunction('COUNT(' . $quotedName . ')' . $alias); } + #[\Override] public function octetLength($field, $alias = ''): IQueryFunction { $alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : ''; $quotedName = $this->helper->quoteColumnName($field); return new QueryFunction('OCTET_LENGTH(' . $quotedName . ')' . $alias); } + #[\Override] public function charLength($field, $alias = ''): IQueryFunction { $alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : ''; $quotedName = $this->helper->quoteColumnName($field); return new QueryFunction('CHAR_LENGTH(' . $quotedName . ')' . $alias); } + #[\Override] public function max($field): IQueryFunction { return new QueryFunction('MAX(' . $this->helper->quoteColumnName($field) . ')'); } + #[\Override] public function min($field): IQueryFunction { return new QueryFunction('MIN(' . $this->helper->quoteColumnName($field) . ')'); } + #[\Override] public function greatest($x, $y): IQueryFunction { return new QueryFunction('GREATEST(' . $this->helper->quoteColumnName($x) . ', ' . $this->helper->quoteColumnName($y) . ')'); } + #[\Override] public function least($x, $y): IQueryFunction { return new QueryFunction('LEAST(' . $this->helper->quoteColumnName($x) . ', ' . $this->helper->quoteColumnName($y) . ')'); } diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php index 6959d13b720..606d1e6b288 100644 --- a/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php +++ b/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php @@ -13,6 +13,7 @@ use OCP\DB\QueryBuilder\IParameter; use OCP\DB\QueryBuilder\IQueryFunction; class OCIFunctionBuilder extends FunctionBuilder { + #[\Override] public function md5($input): IQueryFunction { /** @var ConnectionAdapter $co */ $co = $this->connection; @@ -34,6 +35,7 @@ class OCIFunctionBuilder extends FunctionBuilder { * @param string|ILiteral|IParameter|IQueryFunction $y * @return IQueryFunction */ + #[\Override] public function greatest($x, $y): IQueryFunction { if (is_string($y) || $y instanceof IQueryFunction) { return parent::greatest($y, $x); @@ -54,6 +56,7 @@ class OCIFunctionBuilder extends FunctionBuilder { * @param string|ILiteral|IParameter|IQueryFunction $y * @return IQueryFunction */ + #[\Override] public function least($x, $y): IQueryFunction { if (is_string($y) || $y instanceof IQueryFunction) { return parent::least($y, $x); @@ -62,6 +65,7 @@ class OCIFunctionBuilder extends FunctionBuilder { return parent::least($x, $y); } + #[\Override] public function concat($x, ...$expr): IQueryFunction { $args = func_get_args(); $list = []; @@ -71,6 +75,7 @@ class OCIFunctionBuilder extends FunctionBuilder { return new QueryFunction(sprintf('(%s)', implode(' || ', $list))); } + #[\Override] public function groupConcat($expr, ?string $separator = ','): IQueryFunction { $orderByClause = ' WITHIN GROUP(ORDER BY NULL)'; if (is_null($separator)) { @@ -81,12 +86,14 @@ class OCIFunctionBuilder extends FunctionBuilder { return new QueryFunction('LISTAGG(' . $this->helper->quoteColumnName($expr) . ', ' . $separator . ')' . $orderByClause); } + #[\Override] public function octetLength($field, $alias = ''): IQueryFunction { $alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : ''; $quotedName = $this->helper->quoteColumnName($field); return new QueryFunction('COALESCE(LENGTHB(' . $quotedName . '), 0)' . $alias); } + #[\Override] public function charLength($field, $alias = ''): IQueryFunction { $alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : ''; $quotedName = $this->helper->quoteColumnName($field); diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/PgSqlFunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/PgSqlFunctionBuilder.php index 354a2b126d7..c41f9ff1bfd 100644 --- a/lib/private/DB/QueryBuilder/FunctionBuilder/PgSqlFunctionBuilder.php +++ b/lib/private/DB/QueryBuilder/FunctionBuilder/PgSqlFunctionBuilder.php @@ -11,6 +11,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryFunction; class PgSqlFunctionBuilder extends FunctionBuilder { + #[\Override] public function concat($x, ...$expr): IQueryFunction { $args = func_get_args(); $list = []; @@ -20,6 +21,7 @@ class PgSqlFunctionBuilder extends FunctionBuilder { return new QueryFunction(sprintf('(%s)', implode(' || ', $list))); } + #[\Override] public function groupConcat($expr, ?string $separator = ','): IQueryFunction { $castedExpression = $this->queryBuilder->expr()->castColumn($expr, IQueryBuilder::PARAM_STR); diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php index 53aa530054b..b317d9f21b9 100644 --- a/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php +++ b/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php @@ -10,6 +10,7 @@ use OC\DB\QueryBuilder\QueryFunction; use OCP\DB\QueryBuilder\IQueryFunction; class SqliteFunctionBuilder extends FunctionBuilder { + #[\Override] public function concat($x, ...$expr): IQueryFunction { $args = func_get_args(); $list = []; @@ -19,25 +20,30 @@ class SqliteFunctionBuilder extends FunctionBuilder { return new QueryFunction(sprintf('(%s)', implode(' || ', $list))); } + #[\Override] public function groupConcat($expr, ?string $separator = ','): IQueryFunction { $separator = $this->connection->quote($separator); return new QueryFunction('GROUP_CONCAT(' . $this->helper->quoteColumnName($expr) . ', ' . $separator . ')'); } + #[\Override] public function greatest($x, $y): IQueryFunction { return new QueryFunction('MAX(' . $this->helper->quoteColumnName($x) . ', ' . $this->helper->quoteColumnName($y) . ')'); } + #[\Override] public function least($x, $y): IQueryFunction { return new QueryFunction('MIN(' . $this->helper->quoteColumnName($x) . ', ' . $this->helper->quoteColumnName($y) . ')'); } + #[\Override] public function octetLength($field, $alias = ''): IQueryFunction { $alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : ''; $quotedName = $this->helper->quoteColumnName($field); return new QueryFunction('LENGTH(CAST(' . $quotedName . ' as BLOB))' . $alias); } + #[\Override] public function charLength($field, $alias = ''): IQueryFunction { $alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : ''; $quotedName = $this->helper->quoteColumnName($field); diff --git a/lib/private/DB/QueryBuilder/Partitioned/PartitionedQueryBuilder.php b/lib/private/DB/QueryBuilder/Partitioned/PartitionedQueryBuilder.php index 2a9c2eb9124..3e66bab1f4d 100644 --- a/lib/private/DB/QueryBuilder/Partitioned/PartitionedQueryBuilder.php +++ b/lib/private/DB/QueryBuilder/Partitioned/PartitionedQueryBuilder.php @@ -75,6 +75,7 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { } // we need to save selects until we know all the table aliases + #[\Override] public function select(...$selects) { if (count($selects) === 1 && is_array($selects[0])) { $selects = $selects[0]; @@ -84,6 +85,7 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { return $this; } + #[\Override] public function addSelect(...$select) { $select = array_map(function ($select) { return ['select' => $select, 'alias' => null]; @@ -92,6 +94,7 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { return $this; } + #[\Override] public function selectAlias($select, $alias): self { $this->selects[] = ['select' => $select, 'alias' => $alias]; return $this; @@ -190,6 +193,7 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { return null; } + #[\Override] public function from($from, $alias = null) { if (is_string($from) && $partition = $this->getPartition($from)) { $this->mainPartition = $partition; @@ -200,14 +204,17 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { return parent::from($from, $alias); } + #[\Override] public function innerJoin($fromAlias, $join, $alias, $condition = null): self { return $this->join($fromAlias, $join, $alias, $condition); } + #[\Override] public function leftJoin($fromAlias, $join, $alias, $condition = null): self { return $this->join($fromAlias, $join, $alias, $condition, PartitionQuery::JOIN_MODE_LEFT); } + #[\Override] public function join($fromAlias, $join, $alias, $condition = null, $joinMode = PartitionQuery::JOIN_MODE_INNER): self { if ($join instanceof IQueryFunction) { $partition = null; @@ -333,10 +340,12 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { return $partitionPredicates; } + #[\Override] public function where(...$predicates) { return $this->andWhere(...$predicates); } + #[\Override] public function andWhere(...$where) { if ($where) { foreach ($this->splitPredicatesByParts($where) as $alias => $predicates) { @@ -380,18 +389,22 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { return null; } + #[\Override] public function update($update = null, $alias = null) { return parent::update($update, $alias); } + #[\Override] public function insert($insert = null) { return parent::insert($insert); } + #[\Override] public function delete($delete = null, $alias = null) { return parent::delete($delete, $alias); } + #[\Override] public function setMaxResults($maxResults) { if ($maxResults > 0) { $this->limit = (int)$maxResults; @@ -399,6 +412,7 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { return parent::setMaxResults($maxResults); } + #[\Override] public function setFirstResult($firstResult) { if ($firstResult > 0) { $this->offset = (int)$firstResult; @@ -406,6 +420,7 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { return parent::setFirstResult($firstResult); } + #[\Override] public function executeQuery(?IDBConnection $connection = null): IResult { $this->applySelects(); if ($this->splitQueries && $this->hasPositionalParameter) { @@ -437,6 +452,7 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { } } + #[\Override] public function executeStatement(?IDBConnection $connection = null): int { if (count($this->splitQueries)) { throw new InvalidPartitionedQueryException("Partitioning write queries isn't supported"); @@ -444,6 +460,7 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { return parent::executeStatement($connection); } + #[\Override] public function getSQL() { $this->applySelects(); return parent::getSQL(); @@ -453,6 +470,7 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { return count($this->splitQueries) + 1; } + #[\Override] public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self { if (str_contains($column, '.')) { [$alias, $column] = explode('.', $column); diff --git a/lib/private/DB/QueryBuilder/Partitioned/PartitionedResult.php b/lib/private/DB/QueryBuilder/Partitioned/PartitionedResult.php index b3b59e26298..6fd857c5b2f 100644 --- a/lib/private/DB/QueryBuilder/Partitioned/PartitionedResult.php +++ b/lib/private/DB/QueryBuilder/Partitioned/PartitionedResult.php @@ -29,20 +29,24 @@ class PartitionedResult extends ArrayResult { parent::__construct([]); } + #[\Override] public function closeCursor(): bool { return $this->result->closeCursor(); } + #[\Override] public function fetch(int $fetchMode = PDO::FETCH_ASSOC) { $this->fetchRows(); return parent::fetch($fetchMode); } + #[\Override] public function fetchAll(int $fetchMode = PDO::FETCH_ASSOC): array { $this->fetchRows(); return parent::fetchAll($fetchMode); } + #[\Override] public function rowCount(): int { $this->fetchRows(); return parent::rowCount(); diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index 1129970265c..30e85675a75 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -59,6 +59,7 @@ class QueryBuilder extends TypedQueryBuilder { * owncloud database prefix automatically. * @since 8.2.0 */ + #[\Override] public function automaticTablePrefix($enabled) { $this->automaticTablePrefix = (bool)$enabled; } @@ -79,6 +80,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return IExpressionBuilder */ + #[\Override] public function expr() { return match($this->connection->getDatabaseProvider()) { IDBConnection::PLATFORM_ORACLE => new OCIExpressionBuilder($this->connection, $this, $this->logger), @@ -105,6 +107,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return IFunctionBuilder */ + #[\Override] public function func() { return match($this->connection->getDatabaseProvider()) { IDBConnection::PLATFORM_ORACLE => new OCIFunctionBuilder($this->connection, $this, $this->helper), @@ -120,6 +123,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return integer */ + #[\Override] public function getType() { return $this->queryBuilder->getType(); } @@ -129,6 +133,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return IDBConnection */ + #[\Override] public function getConnection() { return $this->connection; } @@ -140,6 +145,7 @@ class QueryBuilder extends TypedQueryBuilder { * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update * and we can not fix this in our wrapper. */ + #[\Override] public function getState() { $this->logger->debug(IQueryBuilder::class . '::' . __FUNCTION__ . ' is deprecated and will be removed soon.', ['exception' => new \Exception('Deprecated call to ' . __METHOD__)]); return $this->queryBuilder->getState(); @@ -241,6 +247,7 @@ class QueryBuilder extends TypedQueryBuilder { } } + #[\Override] public function executeQuery(?IDBConnection $connection = null): IResult { if ($this->getType() !== \Doctrine\DBAL\Query\QueryBuilder::SELECT) { throw new RuntimeException('Invalid query type, expected SELECT query'); @@ -258,6 +265,7 @@ class QueryBuilder extends TypedQueryBuilder { ); } + #[\Override] public function executeStatement(?IDBConnection $connection = null): int { if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::SELECT) { throw new RuntimeException('Invalid query type, expected INSERT, DELETE or UPDATE statement'); @@ -288,6 +296,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return string The SQL query string. */ + #[\Override] public function getSQL() { return $this->queryBuilder->getSQL(); } @@ -309,6 +318,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function setParameter($key, $value, $type = null) { $this->queryBuilder->setParameter($key, $value, $type); @@ -334,6 +344,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function setParameters(array $params, array $types = []) { $this->queryBuilder->setParameters($params, $types); @@ -345,6 +356,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return array The currently defined query parameters indexed by parameter index or name. */ + #[\Override] public function getParameters() { return $this->queryBuilder->getParameters(); } @@ -356,6 +368,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return mixed The value of the bound parameter. */ + #[\Override] public function getParameter($key) { return $this->queryBuilder->getParameter($key); } @@ -365,6 +378,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return array The currently defined query parameter types indexed by parameter index or name. */ + #[\Override] public function getParameterTypes() { return $this->queryBuilder->getParameterTypes(); } @@ -376,6 +390,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return mixed The value of the bound parameter type. */ + #[\Override] public function getParameterType($key) { return $this->queryBuilder->getParameterType($key); } @@ -387,6 +402,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function setFirstResult($firstResult) { $this->queryBuilder->setFirstResult((int)$firstResult); @@ -399,6 +415,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return int The position of the first result. */ + #[\Override] public function getFirstResult() { return $this->queryBuilder->getFirstResult(); } @@ -414,6 +431,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function setMaxResults($maxResults) { if ($maxResults === null) { $this->queryBuilder->setMaxResults($maxResults); @@ -430,6 +448,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return int|null The maximum number of results. */ + #[\Override] public function getMaxResults() { return $this->queryBuilder->getMaxResults(); } @@ -449,6 +468,7 @@ class QueryBuilder extends TypedQueryBuilder { * * '@return $this This QueryBuilder instance. */ + #[\Override] public function select(...$selects) { if (count($selects) === 1 && is_array($selects[0])) { $selects = $selects[0]; @@ -477,6 +497,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function selectAlias($select, $alias): self { $this->queryBuilder->addSelect( $this->helper->quoteColumnName($select) . ' AS ' . $this->helper->quoteColumnName($alias) @@ -499,6 +520,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function selectDistinct($select) { if (!is_array($select)) { $select = [$select]; @@ -529,6 +551,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function addSelect(...$select) { if (count($select) === 1 && is_array($select[0])) { $select = $select[0]; @@ -558,6 +581,7 @@ class QueryBuilder extends TypedQueryBuilder { } } + #[\Override] public function getOutputColumns(): array { return array_unique($this->selectedColumns); } @@ -579,6 +603,7 @@ class QueryBuilder extends TypedQueryBuilder { * @return $this This QueryBuilder instance. * @since 30.0.0 Alias is deprecated and will no longer be used with the next Doctrine/DBAL update */ + #[\Override] public function delete($delete = null, $alias = null) { if ($alias !== null) { $this->logger->debug('DELETE queries with alias are no longer supported and the provided alias is ignored', ['exception' => new \InvalidArgumentException('Table alias provided for DELETE query')]); @@ -609,6 +634,7 @@ class QueryBuilder extends TypedQueryBuilder { * @return $this This QueryBuilder instance. * @since 30.0.0 Alias is deprecated and will no longer be used with the next Doctrine/DBAL update */ + #[\Override] public function update($update = null, $alias = null) { if ($alias !== null) { $this->logger->debug('UPDATE queries with alias are no longer supported and the provided alias is ignored', ['exception' => new \InvalidArgumentException('Table alias provided for UPDATE query')]); @@ -641,6 +667,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function insert($insert = null) { $this->queryBuilder->insert( $this->getTableName($insert) @@ -666,6 +693,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function from($from, $alias = null) { $this->queryBuilder->from( $this->getTableName($from), @@ -692,6 +720,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function join($fromAlias, $join, $alias, $condition = null) { $this->queryBuilder->join( $this->quoteAlias($fromAlias), @@ -720,6 +749,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function innerJoin($fromAlias, $join, $alias, $condition = null) { $this->queryBuilder->innerJoin( $this->quoteAlias($fromAlias), @@ -748,6 +778,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function leftJoin($fromAlias, $join, $alias, $condition = null) { $this->queryBuilder->leftJoin( $this->quoteAlias($fromAlias), @@ -776,6 +807,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function rightJoin($fromAlias, $join, $alias, $condition = null) { $this->queryBuilder->rightJoin( $this->quoteAlias($fromAlias), @@ -802,6 +834,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function set($key, $value) { $this->queryBuilder->set( $this->helper->quoteColumnName($key), @@ -838,6 +871,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function where(...$predicates) { if ($this->nonEmptyWhere && $this->systemConfig->getValue('debug', false)) { // Only logging a warning, not throwing for now. @@ -873,6 +907,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @see where() */ + #[\Override] public function andWhere(...$where) { $this->nonEmptyWhere = true; call_user_func_array( @@ -901,6 +936,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @see where() */ + #[\Override] public function orWhere(...$where) { $this->nonEmptyWhere = true; call_user_func_array( @@ -926,6 +962,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function groupBy(...$groupBys) { if (count($groupBys) === 1 && is_array($groupBys[0])) { $groupBys = $groupBys[0]; @@ -954,6 +991,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function addGroupBy(...$groupBy) { call_user_func_array( [$this->queryBuilder, 'addGroupBy'], @@ -982,6 +1020,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function setValue($column, $value) { $this->queryBuilder->setValue( $this->helper->quoteColumnName($column), @@ -1010,6 +1049,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function values(array $values) { $quotedValues = []; foreach ($values as $key => $value) { @@ -1029,6 +1069,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function having(...$having) { call_user_func_array( [$this->queryBuilder, 'having'], @@ -1046,6 +1087,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function andHaving(...$having) { call_user_func_array( [$this->queryBuilder, 'andHaving'], @@ -1063,6 +1105,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function orHaving(...$having) { call_user_func_array( [$this->queryBuilder, 'orHaving'], @@ -1081,6 +1124,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function orderBy($sort, $order = null) { if ($order !== null && !in_array(strtoupper((string)$order), ['ASC', 'DESC'], true)) { $order = null; @@ -1102,6 +1146,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return $this This QueryBuilder instance. */ + #[\Override] public function addOrderBy($sort, $order = null) { if ($order !== null && !in_array(strtoupper((string)$order), ['ASC', 'DESC'], true)) { $order = null; @@ -1124,6 +1169,7 @@ class QueryBuilder extends TypedQueryBuilder { * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update * and we can not fix this in our wrapper. Please track the details you need, outside the object. */ + #[\Override] public function getQueryPart($queryPartName) { $this->logger->debug(IQueryBuilder::class . '::' . __FUNCTION__ . ' is deprecated and will be removed soon.', ['exception' => new \Exception('Deprecated call to ' . __METHOD__)]); return $this->queryBuilder->getQueryPart($queryPartName); @@ -1136,6 +1182,7 @@ class QueryBuilder extends TypedQueryBuilder { * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update * and we can not fix this in our wrapper. Please track the details you need, outside the object. */ + #[\Override] public function getQueryParts() { $this->logger->debug(IQueryBuilder::class . '::' . __FUNCTION__ . ' is deprecated and will be removed soon.', ['exception' => new \Exception('Deprecated call to ' . __METHOD__)]); return $this->queryBuilder->getQueryParts(); @@ -1150,6 +1197,7 @@ class QueryBuilder extends TypedQueryBuilder { * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update * and we can not fix this in our wrapper. Please create a new IQueryBuilder instead. */ + #[\Override] public function resetQueryParts($queryPartNames = null) { $this->logger->debug(IQueryBuilder::class . '::' . __FUNCTION__ . ' is deprecated and will be removed soon.', ['exception' => new \Exception('Deprecated call to ' . __METHOD__)]); $this->queryBuilder->resetQueryParts($queryPartNames); @@ -1166,6 +1214,7 @@ class QueryBuilder extends TypedQueryBuilder { * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update * and we can not fix this in our wrapper. Please create a new IQueryBuilder instead. */ + #[\Override] public function resetQueryPart($queryPartName) { $this->logger->debug(IQueryBuilder::class . '::' . __FUNCTION__ . ' is deprecated and will be removed soon.', ['exception' => new \Exception('Deprecated call to ' . __METHOD__)]); $this->queryBuilder->resetQueryPart($queryPartName); @@ -1202,6 +1251,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return IParameter the placeholder name used. */ + #[\Override] public function createNamedParameter($value, $type = IQueryBuilder::PARAM_STR, $placeHolder = null) { return new Parameter($this->queryBuilder->createNamedParameter($value, $type, $placeHolder)); } @@ -1228,6 +1278,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return IParameter */ + #[\Override] public function createPositionalParameter($value, $type = IQueryBuilder::PARAM_STR) { return new Parameter($this->queryBuilder->createPositionalParameter($value, $type)); } @@ -1248,6 +1299,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return IParameter */ + #[\Override] public function createParameter($name) { return new Parameter(':' . $name); } @@ -1275,6 +1327,7 @@ class QueryBuilder extends TypedQueryBuilder { * * @return IQueryFunction */ + #[\Override] public function createFunction($call) { return new QueryFunction($call); } @@ -1284,6 +1337,7 @@ class QueryBuilder extends TypedQueryBuilder { * @return int * @throws \BadMethodCallException When being called before an insert query has been run. */ + #[\Override] public function getLastInsertId(): int { if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::INSERT && $this->lastInsertedTable) { // lastInsertId() needs the prefix but no quotes @@ -1300,6 +1354,7 @@ class QueryBuilder extends TypedQueryBuilder { * @param string|IQueryFunction $table * @return string */ + #[\Override] public function getTableName($table) { if ($table instanceof IQueryFunction) { return (string)$table; @@ -1317,6 +1372,7 @@ class QueryBuilder extends TypedQueryBuilder { * @param string $table * @return string */ + #[\Override] public function prefixTableName(string $table): string { if ($this->automaticTablePrefix === false || str_starts_with($table, '*PREFIX*')) { return $table; @@ -1332,6 +1388,7 @@ class QueryBuilder extends TypedQueryBuilder { * @param string $tableAlias * @return string */ + #[\Override] public function getColumnName($column, $tableAlias = '') { if ($tableAlias !== '') { $tableAlias .= '.'; @@ -1358,10 +1415,12 @@ class QueryBuilder extends TypedQueryBuilder { return $this->connection->escapeLikeParameter($parameter); } + #[\Override] public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self { return $this; } + #[\Override] public function runAcrossAllShards(): self { // noop return $this; diff --git a/lib/private/DB/QueryBuilder/Sharded/HashShardMapper.php b/lib/private/DB/QueryBuilder/Sharded/HashShardMapper.php index af778489a2d..dfa230f1473 100644 --- a/lib/private/DB/QueryBuilder/Sharded/HashShardMapper.php +++ b/lib/private/DB/QueryBuilder/Sharded/HashShardMapper.php @@ -14,6 +14,7 @@ use OCP\DB\QueryBuilder\Sharded\IShardMapper; * Map string key to an int-range by hashing the key */ class HashShardMapper implements IShardMapper { + #[\Override] public function getShardForKey(int $key, int $count): int { $int = unpack('L', substr(md5((string)$key, true), 0, 4))[1]; return $int % $count; diff --git a/lib/private/DB/QueryBuilder/Sharded/RoundRobinShardMapper.php b/lib/private/DB/QueryBuilder/Sharded/RoundRobinShardMapper.php index a5694b06507..3f63dd8fbb4 100644 --- a/lib/private/DB/QueryBuilder/Sharded/RoundRobinShardMapper.php +++ b/lib/private/DB/QueryBuilder/Sharded/RoundRobinShardMapper.php @@ -14,6 +14,7 @@ use OCP\DB\QueryBuilder\Sharded\IShardMapper; * Map string key to an int-range by hashing the key */ class RoundRobinShardMapper implements IShardMapper { + #[\Override] public function getShardForKey(int $key, int $count): int { return $key % $count; } diff --git a/lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php b/lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php index 2694a116af4..034abd3ce20 100644 --- a/lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php +++ b/lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php @@ -83,10 +83,12 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { } } + #[\Override] public function where(...$predicates) { return $this->andWhere(...$predicates); } + #[\Override] public function andWhere(...$where) { if ($where) { foreach ($where as $predicate) { @@ -158,6 +160,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return []; } + #[\Override] public function set($key, $value) { if ($this->shardDefinition && $key === $this->shardDefinition->shardKey) { $updateShardKey = $value; @@ -165,6 +168,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return parent::set($key, $value); } + #[\Override] public function setValue($column, $value) { if ($this->shardDefinition) { if ($this->shardDefinition->isKey($column)) { @@ -177,6 +181,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return parent::setValue($column, $value); } + #[\Override] public function values(array $values) { foreach ($values as $column => $value) { $this->setValue($column, $value); @@ -193,6 +198,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { } } + #[\Override] public function from($from, $alias = null) { if (is_string($from) && $from) { $this->actOnTable($from); @@ -200,6 +206,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return parent::from($from, $alias); } + #[\Override] public function update($update = null, $alias = null) { if (is_string($update) && $update) { $this->actOnTable($update); @@ -207,6 +214,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return parent::update($update, $alias); } + #[\Override] public function insert($insert = null) { if (is_string($insert) && $insert) { $this->insertTable = $insert; @@ -215,6 +223,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return parent::insert($insert); } + #[\Override] public function delete($delete = null, $alias = null) { if (is_string($delete) && $delete) { $this->actOnTable($delete); @@ -235,6 +244,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { } } + #[\Override] public function innerJoin($fromAlias, $join, $alias, $condition = null) { if (is_string($join)) { $this->checkJoin($join); @@ -242,6 +252,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return parent::innerJoin($fromAlias, $join, $alias, $condition); } + #[\Override] public function leftJoin($fromAlias, $join, $alias, $condition = null) { if (is_string($join)) { $this->checkJoin($join); @@ -249,6 +260,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return parent::leftJoin($fromAlias, $join, $alias, $condition); } + #[\Override] public function rightJoin($fromAlias, $join, $alias, $condition = null) { if ($this->shardDefinition) { throw new InvalidShardedQueryException("Sharded query on {$this->shardDefinition->table} isn't allowed to right join"); @@ -256,10 +268,12 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return parent::rightJoin($fromAlias, $join, $alias, $condition); } + #[\Override] public function join($fromAlias, $join, $alias, $condition = null) { return $this->innerJoin($fromAlias, $join, $alias, $condition); } + #[\Override] public function setMaxResults($maxResults) { if ($maxResults > 0) { $this->limit = (int)$maxResults; @@ -267,6 +281,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return parent::setMaxResults($maxResults); } + #[\Override] public function setFirstResult($firstResult) { if ($firstResult > 0) { $this->offset = (int)$firstResult; @@ -279,6 +294,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { } } + #[\Override] public function addOrderBy($sort, $order = null) { if ($order !== null && !in_array(strtoupper((string)$order), ['ASC', 'DESC'], true)) { $order = null; @@ -288,6 +304,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return parent::addOrderBy($sort, $order); } + #[\Override] public function orderBy($sort, $order = null) { if ($order !== null && !in_array(strtoupper((string)$order), ['ASC', 'DESC'], true)) { $order = null; @@ -308,6 +325,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { ]; } + #[\Override] public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self { if ($overwrite) { $this->primaryKeys = []; @@ -322,6 +340,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return $this; } + #[\Override] public function runAcrossAllShards(): self { $this->allShards = true; return $this; @@ -364,6 +383,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { } } + #[\Override] public function executeQuery(?IDBConnection $connection = null): IResult { $this->validate(); if ($this->shardDefinition) { @@ -373,6 +393,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return parent::executeQuery($connection); } + #[\Override] public function executeStatement(?IDBConnection $connection = null): int { $this->validate(); if ($this->shardDefinition) { @@ -403,6 +424,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { return parent::executeStatement($connection); } + #[\Override] public function getLastInsertId(): int { if ($this->lastInsertId) { return $this->lastInsertId; diff --git a/lib/private/DB/QueryBuilder/TypedQueryBuilder.php b/lib/private/DB/QueryBuilder/TypedQueryBuilder.php index cd6a060fbab..eb3a81a0c23 100644 --- a/lib/private/DB/QueryBuilder/TypedQueryBuilder.php +++ b/lib/private/DB/QueryBuilder/TypedQueryBuilder.php @@ -22,6 +22,7 @@ abstract class TypedQueryBuilder implements ITypedQueryBuilder { } } + #[\Override] public function selectColumns(string ...$columns): static { foreach ($columns as $column) { $this->validateColumn($column); @@ -30,6 +31,7 @@ abstract class TypedQueryBuilder implements ITypedQueryBuilder { return $this->select(...$columns); } + #[\Override] public function selectColumnsDistinct(string ...$columns): static { foreach ($columns as $column) { $this->validateColumn($column); diff --git a/lib/private/DB/SQLiteMigrator.php b/lib/private/DB/SQLiteMigrator.php index 160a0d6ccd7..0d178506d08 100644 --- a/lib/private/DB/SQLiteMigrator.php +++ b/lib/private/DB/SQLiteMigrator.php @@ -13,6 +13,7 @@ use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaDiff; class SQLiteMigrator extends Migrator { + #[\Override] protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection): SchemaDiff { foreach ($targetSchema->getTables() as $table) { foreach ($table->getColumns() as $column) { diff --git a/lib/private/DB/SQLiteSessionInit.php b/lib/private/DB/SQLiteSessionInit.php index be6daf87b6c..ed3392e9678 100644 --- a/lib/private/DB/SQLiteSessionInit.php +++ b/lib/private/DB/SQLiteSessionInit.php @@ -35,6 +35,7 @@ class SQLiteSessionInit implements EventSubscriber { } } + #[\Override] public function getSubscribedEvents(): array { return [Events::postConnect]; } diff --git a/lib/private/DB/SchemaWrapper.php b/lib/private/DB/SchemaWrapper.php index 57f0caecb8d..342a246ccb2 100644 --- a/lib/private/DB/SchemaWrapper.php +++ b/lib/private/DB/SchemaWrapper.php @@ -50,6 +50,7 @@ class SchemaWrapper implements ISchemaWrapper { * * @return array */ + #[\Override] public function getTableNamesWithoutPrefix() { $tableNames = $this->schema->getTableNames(); return array_map(function ($tableName) { @@ -66,6 +67,7 @@ class SchemaWrapper implements ISchemaWrapper { /** * @return array */ + #[\Override] public function getTableNames() { return $this->schema->getTableNames(); } @@ -76,6 +78,7 @@ class SchemaWrapper implements ISchemaWrapper { * @return \Doctrine\DBAL\Schema\Table * @throws \Doctrine\DBAL\Schema\SchemaException */ + #[\Override] public function getTable($tableName) { return $this->schema->getTable($this->connection->getPrefix() . $tableName); } @@ -87,6 +90,7 @@ class SchemaWrapper implements ISchemaWrapper { * * @return boolean */ + #[\Override] public function hasTable($tableName) { return $this->schema->hasTable($this->connection->getPrefix() . $tableName); } @@ -97,6 +101,7 @@ class SchemaWrapper implements ISchemaWrapper { * @param string $tableName * @return \Doctrine\DBAL\Schema\Table */ + #[\Override] public function createTable($tableName) { unset($this->tablesToDelete[$tableName]); return $this->schema->createTable($this->connection->getPrefix() . $tableName); @@ -108,6 +113,7 @@ class SchemaWrapper implements ISchemaWrapper { * @param string $tableName * @return \Doctrine\DBAL\Schema\Schema */ + #[\Override] public function dropTable($tableName) { $this->tablesToDelete[$tableName] = true; return $this->schema->dropTable($this->connection->getPrefix() . $tableName); @@ -118,6 +124,7 @@ class SchemaWrapper implements ISchemaWrapper { * * @return \Doctrine\DBAL\Schema\Table[] */ + #[\Override] public function getTables() { return $this->schema->getTables(); } @@ -129,10 +136,12 @@ class SchemaWrapper implements ISchemaWrapper { * * @throws Exception */ + #[\Override] public function getDatabasePlatform() { return $this->connection->getDatabasePlatform(); } + #[\Override] public function dropAutoincrementColumn(string $table, string $column): void { $tableObj = $this->schema->getTable($this->connection->getPrefix() . $table); $tableObj->modifyColumn('id', ['autoincrement' => false]); diff --git a/lib/private/DB/SetTransactionIsolationLevel.php b/lib/private/DB/SetTransactionIsolationLevel.php index cd18c4255e3..5e43a32c3bb 100644 --- a/lib/private/DB/SetTransactionIsolationLevel.php +++ b/lib/private/DB/SetTransactionIsolationLevel.php @@ -30,6 +30,7 @@ class SetTransactionIsolationLevel implements EventSubscriber { } } + #[\Override] public function getSubscribedEvents() { return [Events::postConnect]; } diff --git a/lib/private/Dashboard/Manager.php b/lib/private/Dashboard/Manager.php index d6ced08e1bb..4619a4ee5c1 100644 --- a/lib/private/Dashboard/Manager.php +++ b/lib/private/Dashboard/Manager.php @@ -46,6 +46,7 @@ class Manager implements IManager { $this->widgets[$widget->getId()] = $widget; } + #[\Override] public function lazyRegisterWidget(string $widgetClass, string $appId): void { $this->lazyWidgets[] = ['class' => $widgetClass, 'appId' => $appId]; } @@ -125,6 +126,7 @@ class Manager implements IManager { /** * @return array */ + #[\Override] public function getWidgets(): array { $this->loadLazyPanels(); return $this->widgets; diff --git a/lib/private/DateTimeFormatter.php b/lib/private/DateTimeFormatter.php index 2a20c65ada3..91c84baee27 100644 --- a/lib/private/DateTimeFormatter.php +++ b/lib/private/DateTimeFormatter.php @@ -86,6 +86,7 @@ class DateTimeFormatter implements IDateTimeFormatter { * @param IL10N $l The locale to use * @return string Formatted date string */ + #[\Override] public function formatDate($timestamp, $format = 'long', ?\DateTimeZone $timeZone = null, ?IL10N $l = null) { return $this->format($timestamp, 'date', $format, $timeZone, $l); } @@ -105,6 +106,7 @@ class DateTimeFormatter implements IDateTimeFormatter { * @param IL10N $l The locale to use * @return string Formatted relative date string */ + #[\Override] public function formatDateRelativeDay($timestamp, $format = 'long', ?\DateTimeZone $timeZone = null, ?IL10N $l = null) { if (!str_ends_with($format, '^') && !str_ends_with($format, '*')) { $format .= '^'; @@ -125,6 +127,7 @@ class DateTimeFormatter implements IDateTimeFormatter { * < 13 month => last month, n months ago * >= 13 month => last year, n years ago */ + #[\Override] public function formatDateSpan($timestamp, $baseTimestamp = null, ?IL10N $l = null) { $l = $this->getLocale($l); $timestamp = $this->getDateTime($timestamp); @@ -191,6 +194,7 @@ class DateTimeFormatter implements IDateTimeFormatter { * @param IL10N $l The locale to use * @return string Formatted time string */ + #[\Override] public function formatTime($timestamp, $format = 'medium', ?\DateTimeZone $timeZone = null, ?IL10N $l = null) { return $this->format($timestamp, 'time', $format, $timeZone, $l); } @@ -209,6 +213,7 @@ class DateTimeFormatter implements IDateTimeFormatter { * < 13 month => last month, n months ago * >= 13 month => last year, n years ago */ + #[\Override] public function formatTimeSpan($timestamp, $baseTimestamp = null, ?IL10N $l = null) { $l = $this->getLocale($l); $timestamp = $this->getDateTime($timestamp); @@ -252,6 +257,7 @@ class DateTimeFormatter implements IDateTimeFormatter { * @param IL10N $l The locale to use * @return string Formatted date and time string */ + #[\Override] public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', ?\DateTimeZone $timeZone = null, ?IL10N $l = null) { return $this->format($timestamp, 'datetime', $formatDate . '|' . $formatTime, $timeZone, $l); } @@ -267,6 +273,7 @@ class DateTimeFormatter implements IDateTimeFormatter { * @param IL10N $l The locale to use * @return string Formatted relative date and time string */ + #[\Override] public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', ?\DateTimeZone $timeZone = null, ?IL10N $l = null) { if (!str_ends_with($formatDate, '^') && !str_ends_with($formatDate, '*')) { $formatDate .= '^'; diff --git a/lib/private/DateTimeZone.php b/lib/private/DateTimeZone.php index 589d2e0a6a9..2c5e1dbab3e 100644 --- a/lib/private/DateTimeZone.php +++ b/lib/private/DateTimeZone.php @@ -23,6 +23,7 @@ class DateTimeZone implements IDateTimeZone { /** * @inheritdoc */ + #[\Override] public function getTimeZone(int|false $timestamp = false, ?string $userId = null): \DateTimeZone { $uid = $userId ?? $this->session->get('user_id'); $timezoneName = $this->config->getUserValue($uid, 'core', 'timezone', ''); @@ -41,6 +42,7 @@ class DateTimeZone implements IDateTimeZone { } } + #[\Override] public function getDefaultTimeZone(): \DateTimeZone { /** @var non-empty-string */ $timezone = $this->config->getSystemValueString('default_timezone', 'UTC'); diff --git a/lib/private/Diagnostics/Event.php b/lib/private/Diagnostics/Event.php index 956d86b2693..c322f99e306 100644 --- a/lib/private/Diagnostics/Event.php +++ b/lib/private/Diagnostics/Event.php @@ -23,22 +23,27 @@ class Event implements IEvent { $this->end = $time; } + #[\Override] public function getStart(): float { return $this->start; } + #[\Override] public function getId(): string { return $this->id; } + #[\Override] public function getDescription(): string { return $this->description; } + #[\Override] public function getEnd(): float { return $this->end ?? -1; } + #[\Override] public function getDuration(): float { if (!$this->end) { $this->end = microtime(true); diff --git a/lib/private/Diagnostics/EventLogger.php b/lib/private/Diagnostics/EventLogger.php index f61b470e836..996f7165f96 100644 --- a/lib/private/Diagnostics/EventLogger.php +++ b/lib/private/Diagnostics/EventLogger.php @@ -47,6 +47,7 @@ class EventLogger implements IEventLogger { /** * @inheritdoc */ + #[\Override] public function start($id, $description = '') { if ($this->activated) { $this->events[$id] = new Event($id, $description, microtime(true)); @@ -57,6 +58,7 @@ class EventLogger implements IEventLogger { /** * @inheritdoc */ + #[\Override] public function end($id) { if ($this->activated && isset($this->events[$id])) { $timing = $this->events[$id]; @@ -68,6 +70,7 @@ class EventLogger implements IEventLogger { /** * @inheritdoc */ + #[\Override] public function log($id, $description, $start, $end) { if ($this->activated) { $this->events[$id] = new Event($id, $description, $start); @@ -79,6 +82,7 @@ class EventLogger implements IEventLogger { /** * @inheritdoc */ + #[\Override] public function getEvents() { return $this->events; } @@ -86,6 +90,7 @@ class EventLogger implements IEventLogger { /** * @inheritdoc */ + #[\Override] public function activate() { $this->activated = true; } diff --git a/lib/private/Diagnostics/Query.php b/lib/private/Diagnostics/Query.php index fd14b946883..5b687de935f 100644 --- a/lib/private/Diagnostics/Query.php +++ b/lib/private/Diagnostics/Query.php @@ -24,26 +24,32 @@ class Query implements IQuery { $this->end = $time; } + #[\Override] public function getParams(): array { return $this->params; } + #[\Override] public function getSql(): string { return $this->sql; } + #[\Override] public function getStart(): float { return $this->start; } + #[\Override] public function getDuration(): float { return $this->end - $this->start; } + #[\Override] public function getStartTime(): float { return $this->start; } + #[\Override] public function getStacktrace(): array { return $this->stack; } diff --git a/lib/private/Diagnostics/QueryLogger.php b/lib/private/Diagnostics/QueryLogger.php index 5efe99d1a74..ea378d15d11 100644 --- a/lib/private/Diagnostics/QueryLogger.php +++ b/lib/private/Diagnostics/QueryLogger.php @@ -32,6 +32,7 @@ class QueryLogger implements IQueryLogger { /** * @inheritdoc */ + #[\Override] public function startQuery($sql, ?array $params = null, ?array $types = null) { if ($this->activated) { $this->activeQuery = new Query($sql, $params, microtime(true), $this->getStack()); @@ -49,6 +50,7 @@ class QueryLogger implements IQueryLogger { /** * @inheritdoc */ + #[\Override] public function stopQuery() { if ($this->activated && $this->activeQuery) { $this->activeQuery->end(microtime(true)); @@ -61,6 +63,7 @@ class QueryLogger implements IQueryLogger { /** * @inheritdoc */ + #[\Override] public function getQueries() { return $this->queries->getData(); } @@ -68,6 +71,7 @@ class QueryLogger implements IQueryLogger { /** * @inheritdoc */ + #[\Override] public function activate() { $this->activated = true; } diff --git a/lib/private/DirectEditing/Manager.php b/lib/private/DirectEditing/Manager.php index bcb69163dbb..f3a62fc201f 100644 --- a/lib/private/DirectEditing/Manager.php +++ b/lib/private/DirectEditing/Manager.php @@ -58,10 +58,12 @@ class Manager implements IManager { $this->l10n = $l10nFactory->get('lib'); } + #[\Override] public function registerDirectEditor(IEditor $directEditor): void { $this->editors[$directEditor->getId()] = $directEditor; } + #[\Override] public function getEditors(): array { return $this->editors; } @@ -97,6 +99,7 @@ class Manager implements IManager { return $return; } + #[\Override] public function create(string $path, string $editorId, string $creatorId, $templateId = null): string { $userFolder = $this->rootFolder->getUserFolder($this->userId); if ($userFolder->nodeExists($path)) { @@ -160,6 +163,7 @@ class Manager implements IManager { throw new \RuntimeException('No default editor found for files mimetype'); } + #[\Override] public function edit(string $token): Response { try { /** @var IEditor $editor */ @@ -193,6 +197,7 @@ class Manager implements IManager { return $this->editors[$editorId]; } + #[\Override] public function getToken(string $token): IToken { $query = $this->connection->getQueryBuilder(); $query->select('*')->from(self::TABLE_TOKENS) @@ -204,6 +209,7 @@ class Manager implements IManager { throw new \RuntimeException('Failed to validate the token'); } + #[\Override] public function cleanup(): int { $query = $this->connection->getQueryBuilder(); $query->delete(self::TABLE_TOKENS) @@ -282,6 +288,7 @@ class Manager implements IManager { return $file; } + #[\Override] public function isEnabled(): bool { if (!$this->encryptionManager->isEnabled()) { return true; diff --git a/lib/private/DirectEditing/Token.php b/lib/private/DirectEditing/Token.php index a816bf18dcc..ece88c293aa 100644 --- a/lib/private/DirectEditing/Token.php +++ b/lib/private/DirectEditing/Token.php @@ -16,14 +16,17 @@ class Token implements IToken { ) { } + #[\Override] public function extend(): void { $this->manager->refreshToken($this->data['token']); } + #[\Override] public function invalidate(): void { $this->manager->invalidateToken($this->data['token']); } + #[\Override] public function getFile(): File { if ($this->data['share_id'] !== null) { return $this->manager->getShareForToken($this->data['share_id']); @@ -35,18 +38,22 @@ class Token implements IToken { return $this->data['token']; } + #[\Override] public function useTokenScope(): void { $this->manager->invokeTokenScope($this->data['user_id']); } + #[\Override] public function hasBeenAccessed(): bool { return (bool)$this->data['accessed']; } + #[\Override] public function getEditor(): string { return $this->data['editor_id']; } + #[\Override] public function getUser(): string { return $this->data['user_id']; } diff --git a/lib/private/EmojiHelper.php b/lib/private/EmojiHelper.php index d305fc24799..7f1046d6f2d 100644 --- a/lib/private/EmojiHelper.php +++ b/lib/private/EmojiHelper.php @@ -17,11 +17,13 @@ class EmojiHelper implements IEmojiHelper { ) { } + #[\Override] public function doesPlatformSupportEmoji(): bool { return $this->db->supports4ByteText() && \class_exists(\IntlBreakIterator::class); } + #[\Override] public function isValidSingleEmoji(string $emoji): bool { $intlBreakIterator = \IntlBreakIterator::createCharacterInstance(); $intlBreakIterator->setText($emoji); diff --git a/lib/private/Encryption/EncryptionEventListener.php b/lib/private/Encryption/EncryptionEventListener.php index ddd0eaa475c..d60a651a91f 100644 --- a/lib/private/Encryption/EncryptionEventListener.php +++ b/lib/private/Encryption/EncryptionEventListener.php @@ -48,6 +48,7 @@ class EncryptionEventListener implements IEventListener { $dispatcher->addServiceListener(NodeRestoredEvent::class, static::class); } + #[\Override] public function handle(Event $event): void { if (!$this->encryptionManager->isEnabled()) { return; diff --git a/lib/private/Encryption/File.php b/lib/private/Encryption/File.php index 8da0bcfcc0d..6b4b7528bf3 100644 --- a/lib/private/Encryption/File.php +++ b/lib/private/Encryption/File.php @@ -47,6 +47,7 @@ class File implements IFile { * @param string $path to the file * @return array{users: string[], public: bool} */ + #[\Override] public function getAccessList($path) { // Make sure that a share key is generated for the owner too [$owner, $ownerPath] = $this->util->getUidAndFilename($path); diff --git a/lib/private/Encryption/Keys/Storage.php b/lib/private/Encryption/Keys/Storage.php index d1d225cd573..48a5bc1bdc3 100644 --- a/lib/private/Encryption/Keys/Storage.php +++ b/lib/private/Encryption/Keys/Storage.php @@ -42,6 +42,7 @@ class Storage implements IStorage { /** * @inheritdoc */ + #[\Override] public function getUserKey($uid, $keyId, $encryptionModuleId) { $path = $this->constructUserKeyPath($encryptionModuleId, $keyId, $uid); return base64_decode($this->getKeyWithUid($path, $uid)); @@ -50,6 +51,7 @@ class Storage implements IStorage { /** * @inheritdoc */ + #[\Override] public function getFileKey($path, $keyId, $encryptionModuleId) { $realFile = $this->util->stripPartialFileExtension($path); $keyDir = $this->util->getFileKeyDir($encryptionModuleId, $realFile); @@ -69,6 +71,7 @@ class Storage implements IStorage { /** * @inheritdoc */ + #[\Override] public function getSystemUserKey($keyId, $encryptionModuleId) { $path = $this->constructUserKeyPath($encryptionModuleId, $keyId, null); return base64_decode($this->getKeyWithUid($path, null)); @@ -77,6 +80,7 @@ class Storage implements IStorage { /** * @inheritdoc */ + #[\Override] public function setUserKey($uid, $keyId, $key, $encryptionModuleId) { $path = $this->constructUserKeyPath($encryptionModuleId, $keyId, $uid); return $this->setKey($path, [ @@ -88,6 +92,7 @@ class Storage implements IStorage { /** * @inheritdoc */ + #[\Override] public function setFileKey($path, $keyId, $key, $encryptionModuleId) { $keyDir = $this->util->getFileKeyDir($encryptionModuleId, $path); return $this->setKey($keyDir . $keyId, [ @@ -98,6 +103,7 @@ class Storage implements IStorage { /** * @inheritdoc */ + #[\Override] public function setSystemUserKey($keyId, $key, $encryptionModuleId) { $path = $this->constructUserKeyPath($encryptionModuleId, $keyId, null); return $this->setKey($path, [ @@ -109,6 +115,7 @@ class Storage implements IStorage { /** * @inheritdoc */ + #[\Override] public function deleteUserKey($uid, $keyId, $encryptionModuleId) { try { $path = $this->constructUserKeyPath($encryptionModuleId, $keyId, $uid); @@ -130,6 +137,7 @@ class Storage implements IStorage { /** * @inheritdoc */ + #[\Override] public function deleteFileKey($path, $keyId, $encryptionModuleId) { $keyDir = $this->util->getFileKeyDir($encryptionModuleId, $path); return !$this->view->file_exists($keyDir . $keyId) || $this->view->unlink($keyDir . $keyId); @@ -138,6 +146,7 @@ class Storage implements IStorage { /** * @inheritdoc */ + #[\Override] public function deleteAllFileKeys($path) { $keyDir = $this->util->getFileKeyDir('', $path); return !$this->view->file_exists($keyDir) || $this->view->deleteAll($keyDir); @@ -146,6 +155,7 @@ class Storage implements IStorage { /** * @inheritdoc */ + #[\Override] public function deleteSystemUserKey($keyId, $encryptionModuleId) { $path = $this->constructUserKeyPath($encryptionModuleId, $keyId, null); return !$this->view->file_exists($path) || $this->view->unlink($path); @@ -316,6 +326,7 @@ class Storage implements IStorage { * @param string $target * @return boolean */ + #[\Override] public function renameKeys($source, $target) { $sourcePath = $this->getPathToKeys($source); $targetPath = $this->getPathToKeys($target); @@ -338,6 +349,7 @@ class Storage implements IStorage { * @param string $target * @return boolean */ + #[\Override] public function copyKeys($source, $target) { $sourcePath = $this->getPathToKeys($source); $targetPath = $this->getPathToKeys($target); @@ -360,6 +372,7 @@ class Storage implements IStorage { * @return bool * @since 12.0.0 */ + #[\Override] public function backupUserKeys($encryptionModuleId, $purpose, $uid) { $source = $uid . $this->encryption_base_dir . '/' . $encryptionModuleId; $backupDir = $uid . $this->backup_base_dir; diff --git a/lib/private/Encryption/Manager.php b/lib/private/Encryption/Manager.php index a357ae0a150..ac27f0911b8 100644 --- a/lib/private/Encryption/Manager.php +++ b/lib/private/Encryption/Manager.php @@ -41,6 +41,7 @@ class Manager implements IManager { * * @return bool true if enabled, false if not */ + #[\Override] public function isEnabled() { $installed = $this->config->getSystemValueBool('installed', false); if (!$installed) { @@ -92,6 +93,7 @@ class Manager implements IManager { * @param callable $callback * @throws Exceptions\ModuleAlreadyExistsException */ + #[\Override] public function registerEncryptionModule($id, $displayName, callable $callback) { if (isset($this->encryptionModules[$id])) { throw new ModuleAlreadyExistsException($id, $displayName); @@ -115,6 +117,7 @@ class Manager implements IManager { * * @param string $moduleId */ + #[\Override] public function unregisterEncryptionModule($moduleId) { unset($this->encryptionModules[$moduleId]); } @@ -124,6 +127,7 @@ class Manager implements IManager { * * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]] */ + #[\Override] public function getEncryptionModules() { return $this->encryptionModules; } @@ -135,6 +139,7 @@ class Manager implements IManager { * @return IEncryptionModule * @throws Exceptions\ModuleDoesNotExistsException */ + #[\Override] public function getEncryptionModule($moduleId = '') { if (empty($moduleId)) { return $this->getDefaultEncryptionModule(); @@ -172,6 +177,7 @@ class Manager implements IManager { * @param string $moduleId * @return bool */ + #[\Override] public function setDefaultEncryptionModule($moduleId) { try { $this->getEncryptionModule($moduleId); @@ -188,6 +194,7 @@ class Manager implements IManager { * * @return string */ + #[\Override] public function getDefaultEncryptionModuleId() { return $this->config->getAppValue('core', 'default_encryption_module'); } diff --git a/lib/private/EventDispatcher/EventDispatcher.php b/lib/private/EventDispatcher/EventDispatcher.php index 4c87271009a..5bba7747c8a 100644 --- a/lib/private/EventDispatcher/EventDispatcher.php +++ b/lib/private/EventDispatcher/EventDispatcher.php @@ -33,17 +33,20 @@ class EventDispatcher implements IEventDispatcher { } } + #[\Override] public function addListener(string $eventName, callable $listener, int $priority = 0): void { $this->dispatcher->addListener($eventName, $listener, $priority); } + #[\Override] public function removeListener(string $eventName, callable $listener): void { $this->dispatcher->removeListener($eventName, $listener); } + #[\Override] public function addServiceListener(string $eventName, string $className, int $priority = 0): void { @@ -56,6 +59,7 @@ class EventDispatcher implements IEventDispatcher { $this->addListener($eventName, $listener, $priority); } + #[\Override] public function hasListeners(string $eventName): bool { return $this->dispatcher->hasListeners($eventName); } @@ -63,6 +67,7 @@ class EventDispatcher implements IEventDispatcher { /** * @deprecated */ + #[\Override] public function dispatch(string $eventName, Event $event): void { $this->dispatcher->dispatch($event, $eventName); @@ -76,6 +81,7 @@ class EventDispatcher implements IEventDispatcher { } } + #[\Override] public function dispatchTyped(Event $event): void { $this->dispatch(get_class($event), $event); } diff --git a/lib/private/EventSource.php b/lib/private/EventSource.php index 214de5ca6fe..0876a440465 100644 --- a/lib/private/EventSource.php +++ b/lib/private/EventSource.php @@ -46,6 +46,7 @@ class EventSource implements IEventSource { * @throws \BadMethodCallException * @suppress PhanDeprecatedFunction */ + #[\Override] public function send(string $type, mixed $data = null): void { if ($data && !preg_match('/^[A-Za-z0-9_]+$/', $type)) { throw new \BadMethodCallException('Type needs to be alphanumeric (' . $type . ')'); @@ -63,6 +64,7 @@ class EventSource implements IEventSource { flush(); } + #[\Override] public function close(): void { $this->send('__internal__', 'close'); //server side closing can be an issue, let the client do it } diff --git a/lib/private/EventSourceFactory.php b/lib/private/EventSourceFactory.php index 57888b1be4c..2f23466be68 100644 --- a/lib/private/EventSourceFactory.php +++ b/lib/private/EventSourceFactory.php @@ -19,6 +19,7 @@ class EventSourceFactory implements IEventSourceFactory { ) { } + #[\Override] public function create(): IEventSource { return new EventSource($this->request); } diff --git a/lib/private/Federation/CloudFederationFactory.php b/lib/private/Federation/CloudFederationFactory.php index d06de0f2f58..f183fa3e87d 100644 --- a/lib/private/Federation/CloudFederationFactory.php +++ b/lib/private/Federation/CloudFederationFactory.php @@ -29,6 +29,7 @@ class CloudFederationFactory implements ICloudFederationFactory { * * @since 14.0.0 */ + #[\Override] public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $sharedSecret, $shareType, $resourceType) { return new CloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $shareType, $resourceType, $sharedSecret); } @@ -41,6 +42,7 @@ class CloudFederationFactory implements ICloudFederationFactory { * * @since 14.0.0 */ + #[\Override] public function getCloudFederationNotification() { return new CloudFederationNotification(); } diff --git a/lib/private/Federation/CloudFederationNotification.php b/lib/private/Federation/CloudFederationNotification.php index e0694c184af..b5ecd468814 100644 --- a/lib/private/Federation/CloudFederationNotification.php +++ b/lib/private/Federation/CloudFederationNotification.php @@ -30,6 +30,7 @@ class CloudFederationNotification implements ICloudFederationNotification { * * @since 14.0.0 */ + #[\Override] public function setMessage($notificationType, $resourceType, $providerId, array $notification) { $this->message = [ 'notificationType' => $notificationType, @@ -46,6 +47,7 @@ class CloudFederationNotification implements ICloudFederationNotification { * * @since 14.0.0 */ + #[\Override] public function getMessage() { return $this->message; } diff --git a/lib/private/Federation/CloudFederationProviderManager.php b/lib/private/Federation/CloudFederationProviderManager.php index f0dcf8ce411..77d225a49b3 100644 --- a/lib/private/Federation/CloudFederationProviderManager.php +++ b/lib/private/Federation/CloudFederationProviderManager.php @@ -60,6 +60,7 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager * @param string $displayName user facing name of the federated share provider * @param callable $callback */ + #[\Override] public function addCloudFederationProvider($resourceType, $displayName, callable $callback) { $this->cloudFederationProvider[$resourceType] = [ 'resourceType' => $resourceType, @@ -73,6 +74,7 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager * * @param string $providerId */ + #[\Override] public function removeCloudFederationProvider($providerId) { unset($this->cloudFederationProvider[$providerId]); } @@ -82,6 +84,7 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager * * @return array [resourceType => ['resourceType' => $resourceType, 'displayName' => $displayName, 'callback' => callback]] */ + #[\Override] public function getAllCloudFederationProviders() { return $this->cloudFederationProvider; } @@ -93,6 +96,7 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager * @return ICloudFederationProvider * @throws ProviderDoesNotExistsException */ + #[\Override] public function getCloudFederationProvider($resourceType) { if (isset($this->cloudFederationProvider[$resourceType])) { return call_user_func($this->cloudFederationProvider[$resourceType]['callback']); @@ -104,6 +108,7 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager /** * @deprecated 29.0.0 - Use {@see sendCloudShare()} instead and handle errors manually */ + #[\Override] public function sendShare(ICloudFederationShare $share) { $cloudID = $this->cloudIdManager->resolveCloudId($share->getShareWith()); try { @@ -135,6 +140,7 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager * @return IResponse * @throws OCMProviderException */ + #[\Override] public function sendCloudShare(ICloudFederationShare $share): IResponse { $cloudID = $this->cloudIdManager->resolveCloudId($share->getShareWith()); $client = $this->httpClientService->newClient(); @@ -156,6 +162,7 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager * @return array|false * @deprecated 29.0.0 - Use {@see sendCloudNotification()} instead and handle errors manually */ + #[\Override] public function sendNotification($url, ICloudFederationNotification $notification) { try { try { @@ -181,6 +188,7 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager * @return IResponse * @throws OCMProviderException */ + #[\Override] public function sendCloudNotification(string $url, ICloudFederationNotification $notification): IResponse { $client = $this->httpClientService->newClient(); try { @@ -200,6 +208,7 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager * * @return bool */ + #[\Override] public function isReady() { return $this->appManager->isEnabledForUser('cloud_federation_api'); } diff --git a/lib/private/Federation/CloudFederationShare.php b/lib/private/Federation/CloudFederationShare.php index 6bd35cea763..311a0ee7f5b 100644 --- a/lib/private/Federation/CloudFederationShare.php +++ b/lib/private/Federation/CloudFederationShare.php @@ -79,6 +79,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function setShareWith($user) { $this->share['shareWith'] = $user; } @@ -90,6 +91,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function setResourceName($name) { $this->share['name'] = $name; } @@ -101,6 +103,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function setResourceType($resourceType) { $this->share['resourceType'] = $resourceType; } @@ -112,6 +115,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function setDescription($description) { $this->share['description'] = $description; } @@ -123,6 +127,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function setProviderId($providerId) { $this->share['providerId'] = (string)$providerId; } @@ -134,6 +139,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function setOwner($owner) { $this->share['owner'] = $owner; } @@ -145,6 +151,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function setOwnerDisplayName($ownerDisplayName) { $this->share['ownerDisplayName'] = $ownerDisplayName; } @@ -156,6 +163,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function setSharedBy($sharedBy) { $this->share['sharedBy'] = $sharedBy; $this->share['sender'] = $sharedBy; @@ -168,6 +176,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function setSharedByDisplayName($sharedByDisplayName) { $this->share['sharedByDisplayName'] = $sharedByDisplayName; $this->share['senderDisplayName'] = $sharedByDisplayName; @@ -180,6 +189,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function setProtocol(array $protocol) { $this->share['protocol'] = $protocol; } @@ -191,6 +201,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function setShareType($shareType) { if ($shareType === 'group' || $shareType === IShare::TYPE_REMOTE_GROUP) { $this->share['shareType'] = 'group'; @@ -206,6 +217,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function getShare() { return $this->share; } @@ -217,6 +229,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function getShareWith() { return $this->share['shareWith']; } @@ -228,6 +241,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function getResourceName() { return $this->share['name']; } @@ -239,6 +253,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function getResourceType() { return $this->share['resourceType']; } @@ -250,6 +265,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function getDescription() { return $this->share['description']; } @@ -261,6 +277,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function getProviderId() { return $this->share['providerId']; } @@ -272,6 +289,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function getOwner() { return $this->share['owner']; } @@ -283,6 +301,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function getOwnerDisplayName() { return $this->share['ownerDisplayName']; } @@ -294,6 +313,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function getSharedBy() { return $this->share['sharedBy']; } @@ -305,6 +325,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function getSharedByDisplayName() { return $this->share['sharedByDisplayName']; } @@ -316,6 +337,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function getShareType() { return $this->share['shareType']; } @@ -327,6 +349,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function getShareSecret() { return $this->share['protocol']['options']['sharedSecret']; } @@ -338,6 +361,7 @@ class CloudFederationShare implements ICloudFederationShare { * * @since 14.0.0 */ + #[\Override] public function getProtocol() { return $this->share['protocol']; } diff --git a/lib/private/Federation/CloudId.php b/lib/private/Federation/CloudId.php index 643524b3acd..9150d89d4d9 100644 --- a/lib/private/Federation/CloudId.php +++ b/lib/private/Federation/CloudId.php @@ -26,10 +26,12 @@ class CloudId implements ICloudId { * * @return string */ + #[\Override] public function getId(): string { return $this->id; } + #[\Override] public function getDisplayId(): string { if ($this->displayName === null) { /** @var CloudIdManager $cloudIdManager */ @@ -50,6 +52,7 @@ class CloudId implements ICloudId { * * @return string */ + #[\Override] public function getUser(): string { return $this->user; } @@ -59,6 +62,7 @@ class CloudId implements ICloudId { * * @return string */ + #[\Override] public function getRemote(): string { return $this->remote; } diff --git a/lib/private/Federation/CloudIdManager.php b/lib/private/Federation/CloudIdManager.php index b0996d5179c..57217af524e 100644 --- a/lib/private/Federation/CloudIdManager.php +++ b/lib/private/Federation/CloudIdManager.php @@ -71,6 +71,7 @@ class CloudIdManager implements ICloudIdManager { * @return ICloudId * @throws \InvalidArgumentException */ + #[\Override] public function resolveCloudId(string $cloudId): ICloudId { // TODO magic here to get the url and user instead of just splitting on @ @@ -189,6 +190,7 @@ class CloudIdManager implements ICloudIdManager { * @param string|null $remote * @return CloudId */ + #[\Override] public function getCloudId(string $user, ?string $remote): ICloudId { $isLocal = $remote === null; if ($isLocal) { @@ -234,6 +236,7 @@ class CloudIdManager implements ICloudIdManager { * @param string $url * @return string */ + #[\Override] public function removeProtocolFromUrl(string $url, bool $httpsOnly = false): string { if (str_starts_with($url, 'https://')) { return substr($url, 8); @@ -279,6 +282,7 @@ class CloudIdManager implements ICloudIdManager { * @param string $cloudId * @return bool */ + #[\Override] public function isValidCloudId(string $cloudId): bool { foreach ($this->cloudIdResolvers as $resolver) { if ($resolver->isValidCloudId($cloudId)) { @@ -289,14 +293,17 @@ class CloudIdManager implements ICloudIdManager { return strpos($cloudId, '@') !== false; } + #[\Override] public function createCloudId(string $id, string $user, string $remote, ?string $displayName = null): ICloudId { return new CloudId($id, $user, $remote, $displayName); } + #[\Override] public function registerCloudIdResolver(ICloudIdResolver $resolver): void { array_unshift($this->cloudIdResolvers, $resolver); } + #[\Override] public function unregisterCloudIdResolver(ICloudIdResolver $resolver): void { if (($key = array_search($resolver, $this->cloudIdResolvers)) !== false) { array_splice($this->cloudIdResolvers, $key, 1); diff --git a/lib/private/Files/AppData/AppData.php b/lib/private/Files/AppData/AppData.php index 5bea7ec470c..b4e8d51d438 100644 --- a/lib/private/Files/AppData/AppData.php +++ b/lib/private/Files/AppData/AppData.php @@ -85,6 +85,7 @@ class AppData implements IAppData { return $this->folder; } + #[\Override] public function getFolder(string $name): ISimpleFolder { $key = $this->appId . '/' . $name; if ($cachedFolder = $this->folders->get($key)) { @@ -113,6 +114,7 @@ class AppData implements IAppData { return $folder; } + #[\Override] public function newFolder(string $name): ISimpleFolder { $key = $this->appId . '/' . $name; $folder = $this->getAppDataFolder()->newFolder($name); @@ -122,6 +124,7 @@ class AppData implements IAppData { return $simpleFolder; } + #[\Override] public function getDirectoryListing(): array { $listing = $this->getAppDataFolder()->getDirectoryListing(); diff --git a/lib/private/Files/AppData/Factory.php b/lib/private/Files/AppData/Factory.php index 75d20e454e5..cf436b54ea3 100644 --- a/lib/private/Files/AppData/Factory.php +++ b/lib/private/Files/AppData/Factory.php @@ -23,6 +23,7 @@ class Factory implements IAppDataFactory { ) { } + #[\Override] public function get(string $appId): IAppData { if (!isset($this->folders[$appId])) { $this->folders[$appId] = new AppData($this->rootFolder, $this->config, $appId); diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 96b0c413e4d..6676d93a5f8 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -110,6 +110,7 @@ class Cache implements ICache { * * @return int */ + #[\Override] public function getNumericStorageId() { return $this->storageCache->getNumericId(); } @@ -120,6 +121,7 @@ class Cache implements ICache { * @param string|int $file either the path of a file or folder or the file id for a file or folder * @return ICacheEntry|false the cache entry as array or false if the file is not found in the cache */ + #[\Override] public function get($file) { $query = $this->getQueryBuilder(); $query->selectFileCache(); @@ -251,6 +253,7 @@ class Cache implements ICache { * @return int file id * @throws \RuntimeException */ + #[\Override] public function put($file, array $data) { // do not carry over creation_time to file versions, as each new version would otherwise // create a filecache_extended entry with the same creation_time as the original file @@ -275,6 +278,7 @@ class Cache implements ICache { * @return int file id * @throws \RuntimeException|Exception */ + #[\Override] public function insert($file, array $data) { // normalize file $file = $this->normalize($file); @@ -360,6 +364,7 @@ class Cache implements ICache { * @param int $id the fileid of the existing file or folder * @param array $data [$key => $value] the metadata to update, only the fields provided in the array will be updated, non-provided values will remain unchanged */ + #[\Override] public function update($id, array $data) { if (isset($data['path'])) { // normalize path @@ -496,6 +501,7 @@ class Cache implements ICache { * @param string $file * @return int */ + #[\Override] public function getId($file) { // normalize file $file = $this->normalize($file); @@ -519,6 +525,7 @@ class Cache implements ICache { * @param string $file * @return int */ + #[\Override] public function getParentId($file) { if ($file === '') { return -1; @@ -542,6 +549,7 @@ class Cache implements ICache { * @param string $file * @return bool */ + #[\Override] public function inCache($file) { return $this->getId($file) != -1; } @@ -553,6 +561,7 @@ class Cache implements ICache { * * @param string $file */ + #[\Override] public function remove($file) { $entry = $this->get($file); @@ -679,6 +688,7 @@ class Cache implements ICache { * @param string $source * @param string $target */ + #[\Override] public function move($source, $target) { $this->moveFromCache($this, $source, $target); } @@ -713,6 +723,7 @@ class Cache implements ICache { * @throws DatabaseException * @throws \Exception if the given storages have an invalid id */ + #[\Override] public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { if ($sourceCache instanceof Cache) { // normalize source and target @@ -888,6 +899,7 @@ class Cache implements ICache { * * @return int Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE */ + #[\Override] public function getStatus($file) { // normalize file $file = $this->normalize($file); @@ -923,6 +935,7 @@ class Cache implements ICache { * @param string $pattern the search pattern using SQL search syntax (e.g. '%searchstring%') * @return ICacheEntry[] an array of cache entries where the name matches the search pattern */ + #[\Override] public function search($pattern) { $operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', $pattern); return $this->searchQuery(new SearchQuery($operator, 0, 0, [], null)); @@ -935,6 +948,7 @@ class Cache implements ICache { * where it will search for all mimetypes in the group ('image/*') * @return ICacheEntry[] an array of cache entries where the mimetype matches the search */ + #[\Override] public function searchByMime($mimetype) { if (!str_contains($mimetype, '/')) { $operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%'); @@ -944,6 +958,7 @@ class Cache implements ICache { return $this->searchQuery(new SearchQuery($operator, 0, 0, [], null)); } + #[\Override] public function searchQuery(ISearchQuery $query) { return current($this->querySearchHelper->searchInCaches($query, [$this])); } @@ -1129,6 +1144,7 @@ class Cache implements ICache { * * @return string|false the path of the folder or false when no folder matched */ + #[\Override] public function getIncomplete() { $query = $this->getQueryBuilder(); $query->select('path') @@ -1151,6 +1167,7 @@ class Cache implements ICache { * @param int $id the file id of the file or folder to search * @return string|null the path of the file (relative to the storage) or null if a file with the given id does not exists within this cache */ + #[\Override] public function getPathById($id) { $query = $this->getQueryBuilder(); $query->select('path') @@ -1208,6 +1225,7 @@ class Cache implements ICache { * @param string $path * @return string */ + #[\Override] public function normalize($path) { return trim(\OC_Util::normalizeUnicode($path), '/'); } @@ -1220,6 +1238,7 @@ class Cache implements ICache { * @param string $targetPath * @return int fileId of copied entry */ + #[\Override] public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int { if ($sourceEntry->getId() < 0) { throw new \RuntimeException('Invalid source cache entry on copyFromCache'); @@ -1273,10 +1292,12 @@ class Cache implements ICache { return $data; } + #[\Override] public function getQueryFilterForStorage(): ISearchOperator { return new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', $this->getNumericStorageId()); } + #[\Override] public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry { if ($rawEntry->getStorageId() === $this->getNumericStorageId()) { return $rawEntry; diff --git a/lib/private/Files/Cache/CacheEntry.php b/lib/private/Files/Cache/CacheEntry.php index 943f328e845..74af7d0a598 100644 --- a/lib/private/Files/Cache/CacheEntry.php +++ b/lib/private/Files/Cache/CacheEntry.php @@ -18,14 +18,17 @@ class CacheEntry implements ICacheEntry { ) { } + #[\Override] public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } + #[\Override] public function offsetExists($offset): bool { return isset($this->data[$offset]); } + #[\Override] public function offsetUnset($offset): void { unset($this->data[$offset]); } @@ -33,6 +36,7 @@ class CacheEntry implements ICacheEntry { /** * @return mixed */ + #[\Override] #[\ReturnTypeWillChange] public function offsetGet($offset) { if (isset($this->data[$offset])) { @@ -42,70 +46,86 @@ class CacheEntry implements ICacheEntry { } } + #[\Override] public function getId() { return (int)$this->data['fileid']; } + #[\Override] public function getStorageId() { return $this->data['storage']; } + #[\Override] public function getPath() { return (string)$this->data['path']; } + #[\Override] public function getName() { return $this->data['name']; } + #[\Override] public function getMimeType(): string { return $this->data['mimetype'] ?? 'application/octet-stream'; } + #[\Override] public function getMimePart() { return $this->data['mimepart']; } + #[\Override] public function getSize() { return $this->data['size']; } + #[\Override] public function getMTime() { return $this->data['mtime']; } + #[\Override] public function getStorageMTime() { return $this->data['storage_mtime']; } + #[\Override] public function getEtag() { return $this->data['etag']; } + #[\Override] public function getPermissions(): int { return $this->data['permissions']; } + #[\Override] public function isEncrypted() { return isset($this->data['encrypted']) && $this->data['encrypted']; } + #[\Override] public function getMetadataEtag(): ?string { return $this->data['metadata_etag'] ?? null; } + #[\Override] public function getCreationTime(): ?int { return $this->data['creation_time'] ?? null; } + #[\Override] public function getUploadTime(): ?int { return $this->data['upload_time'] ?? null; } + #[\Override] public function getParentId(): int { return $this->data['parent']; } @@ -118,6 +138,7 @@ class CacheEntry implements ICacheEntry { $this->data = array_merge([], $this->data); } + #[\Override] public function getUnencryptedSize(): int { if ($this->data['encrypted'] && isset($this->data['unencrypted_size']) && $this->data['unencrypted_size'] > 0) { return $this->data['unencrypted_size']; diff --git a/lib/private/Files/Cache/FailedCache.php b/lib/private/Files/Cache/FailedCache.php index 82d2dbbd8cf..7db87accc32 100644 --- a/lib/private/Files/Cache/FailedCache.php +++ b/lib/private/Files/Cache/FailedCache.php @@ -26,10 +26,12 @@ class FailedCache implements ICache { ) { } + #[\Override] public function getNumericStorageId(): int { return -1; } + #[\Override] public function get($file): false|ICacheEntry { if ($file === '') { return new CacheEntry([ @@ -45,59 +47,74 @@ class FailedCache implements ICache { } } + #[\Override] public function getFolderContents(string $folder, ?string $mimeTypeFilter = null): array { return []; } + #[\Override] public function getFolderContentsById(int $fileId, ?string $mimeTypeFilter = null): array { return []; } + #[\Override] public function put($file, array $data) { } + #[\Override] public function insert($file, array $data) { } + #[\Override] public function update($id, array $data) { } + #[\Override] public function getId($file): int { return -1; } + #[\Override] public function getParentId($file): int { return -1; } + #[\Override] public function inCache($file): bool { return false; } + #[\Override] public function remove($file) { } + #[\Override] public function move($source, $target) { } + #[\Override] public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { } public function clear() { } + #[\Override] public function getStatus($file) { return ICache::NOT_FOUND; } + #[\Override] public function search($pattern) { return []; } + #[\Override] public function searchByMime($mimetype) { return []; } + #[\Override] public function searchQuery(ISearchQuery $query) { return []; } @@ -106,26 +123,32 @@ class FailedCache implements ICache { return []; } + #[\Override] public function getIncomplete() { return []; } + #[\Override] public function getPathById($id) { return null; } + #[\Override] public function normalize($path) { return $path; } + #[\Override] public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int { throw new \Exception('Invalid cache'); } + #[\Override] public function getQueryFilterForStorage(): ISearchOperator { return new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', -1); } + #[\Override] public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry { return null; } diff --git a/lib/private/Files/Cache/FileAccess.php b/lib/private/Files/Cache/FileAccess.php index ee92c4fdc7a..b7357dfe0bc 100644 --- a/lib/private/Files/Cache/FileAccess.php +++ b/lib/private/Files/Cache/FileAccess.php @@ -39,11 +39,13 @@ class FileAccess implements IFileAccess { ); } + #[\Override] public function getByFileIdInStorage(int $fileId, int $storageId): ?CacheEntry { $items = array_values($this->getByFileIdsInStorage([$fileId], $storageId)); return $items[0] ?? null; } + #[\Override] public function getByPathInStorage(string $path, int $storageId): ?CacheEntry { $query = $this->getQuery()->selectFileCache(); $query->andWhere($query->expr()->eq('filecache.path_hash', $query->createNamedParameter(md5($path)))); @@ -53,6 +55,7 @@ class FileAccess implements IFileAccess { return $row ? Cache::cacheEntryFromData($row, $this->mimeTypeLoader) : null; } + #[\Override] public function getByFileId(int $fileId): ?CacheEntry { $items = array_values($this->getByFileIds([$fileId])); return $items[0] ?? null; @@ -75,6 +78,7 @@ class FileAccess implements IFileAccess { * @param int[] $fileIds * @return array */ + #[\Override] public function getByFileIds(array $fileIds): array { $query = $this->getQuery()->selectFileCache(); $query->andWhere($query->expr()->in('filecache.fileid', $query->createNamedParameter($fileIds, IQueryBuilder::PARAM_INT_ARRAY))); @@ -88,6 +92,7 @@ class FileAccess implements IFileAccess { * @param int $storageId * @return array */ + #[\Override] public function getByFileIdsInStorage(array $fileIds, int $storageId): array { $fileIds = array_values($fileIds); $query = $this->getQuery()->selectFileCache(); @@ -98,6 +103,7 @@ class FileAccess implements IFileAccess { return $this->rowsToEntries($rows); } + #[\Override] public function getByAncestorInStorage(int $storageId, int $folderId, int $fileIdCursor = 0, int $maxResults = 100, array $mimeTypeIds = [], bool $endToEndEncrypted = true, bool $serverSideEncrypted = true): \Generator { $qb = $this->getQuery(); $qb->select('path') @@ -189,6 +195,7 @@ class FileAccess implements IFileAccess { $files->closeCursor(); } + #[\Override] public function getDistinctMounts(array $mountProviders = [], bool $onlyUserFilesMounts = true): \Generator { $qb = $this->connection->getQueryBuilder(); $qb->selectDistinct(['root_id', 'storage_id', 'mount_provider_class']) diff --git a/lib/private/Files/Cache/HomeCache.php b/lib/private/Files/Cache/HomeCache.php index 0fad90c60db..a0b4754ff97 100644 --- a/lib/private/Files/Cache/HomeCache.php +++ b/lib/private/Files/Cache/HomeCache.php @@ -17,6 +17,7 @@ class HomeCache extends Cache { * @param array|null|ICacheEntry $entry (optional) meta data of the folder * @return int|float */ + #[\Override] public function calculateFolderSize($path, $entry = null) { if ($path !== '/' && $path !== '' && $path !== 'files' && $path !== 'files_trashbin' && $path !== 'files_versions') { return parent::calculateFolderSize($path, $entry); @@ -32,6 +33,7 @@ class HomeCache extends Cache { * @param string $file * @return ICacheEntry */ + #[\Override] public function get($file) { $data = parent::get($file); if ($file === '' || $file === '/') { diff --git a/lib/private/Files/Cache/NullWatcher.php b/lib/private/Files/Cache/NullWatcher.php index e3659214849..e6973e8d266 100644 --- a/lib/private/Files/Cache/NullWatcher.php +++ b/lib/private/Files/Cache/NullWatcher.php @@ -14,25 +14,31 @@ class NullWatcher extends Watcher { public function __construct() { } + #[\Override] public function setPolicy($policy) { $this->policy = $policy; } + #[\Override] public function getPolicy() { return $this->policy; } + #[\Override] public function checkUpdate($path, $cachedEntry = null) { return false; } + #[\Override] public function update($path, $cachedData) { } + #[\Override] public function needsUpdate($path, $cachedData) { return false; } + #[\Override] public function cleanFolder($path) { } } diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 140f840ba1f..36c8c02a8bf 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -99,6 +99,7 @@ class Scanner extends BasicEmitter implements IScanner { * @return array|null an array of metadata of the scanned file * @throws LockedException */ + #[\Override] public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) { if ($file !== '') { try { @@ -291,6 +292,7 @@ class Scanner extends BasicEmitter implements IScanner { * @param bool $lock set to false to disable getting an additional read lock during scanning * @return array|null an array of the meta data of the scanned file or folder */ + #[\Override] public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) { if ($reuse === -1) { $reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG; @@ -536,6 +538,7 @@ class Scanner extends BasicEmitter implements IScanner { * @param string $file * @return boolean */ + #[\Override] public static function isPartialFile($file) { if (pathinfo($file, PATHINFO_EXTENSION) === 'part') { return true; @@ -550,6 +553,7 @@ class Scanner extends BasicEmitter implements IScanner { /** * walk over any folders that are not fully scanned yet and scan them */ + #[\Override] public function backgroundScan() { if ($this->storage->instanceOfStorage(Jail::class)) { // for jail storage wrappers (shares, groupfolders) we run the background scan on the source storage diff --git a/lib/private/Files/Cache/Storage.php b/lib/private/Files/Cache/Storage.php index 5417095f44b..8eea54b5840 100644 --- a/lib/private/Files/Cache/Storage.php +++ b/lib/private/Files/Cache/Storage.php @@ -26,6 +26,7 @@ use Psr\Log\LoggerInterface; * A mapping between the two storage ids is stored in the database and accessible through this class * * @package OC\Files\Cache + * @psalm-api */ class Storage { private string $storageId; diff --git a/lib/private/Files/Cache/StorageGlobal.php b/lib/private/Files/Cache/StorageGlobal.php index 336f136509d..8835dbf9f8c 100644 --- a/lib/private/Files/Cache/StorageGlobal.php +++ b/lib/private/Files/Cache/StorageGlobal.php @@ -21,6 +21,7 @@ use OCP\IDBConnection; * A mapping between the two storage ids is stored in the database and accessible through this class * * @package OC\Files\Cache + * @psalm-api */ class StorageGlobal { /** @var array */ diff --git a/lib/private/Files/Cache/Watcher.php b/lib/private/Files/Cache/Watcher.php index c4734bce0d9..48c5e323514 100644 --- a/lib/private/Files/Cache/Watcher.php +++ b/lib/private/Files/Cache/Watcher.php @@ -37,10 +37,12 @@ class Watcher implements IWatcher { /** * @param int $policy either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS */ + #[\Override] public function setPolicy($policy) { $this->watchPolicy = $policy; } + #[\Override] public function setCheckFilter(?string $filter): void { $this->checkFilter = $filter; } @@ -48,6 +50,7 @@ class Watcher implements IWatcher { /** * @return int either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS */ + #[\Override] public function getPolicy() { return $this->watchPolicy; } @@ -59,6 +62,7 @@ class Watcher implements IWatcher { * @param ICacheEntry|null $cachedEntry * @return boolean true if path was updated */ + #[\Override] public function checkUpdate($path, $cachedEntry = null) { if (is_null($cachedEntry)) { $cachedEntry = $this->cache->get($path); @@ -84,6 +88,7 @@ class Watcher implements IWatcher { * @param string $path * @param ICacheEntry $cachedData */ + #[\Override] public function update($path, $cachedData) { if ($this->storage->is_dir($path)) { $this->scanner->scan($path, Scanner::SCAN_SHALLOW); @@ -108,6 +113,7 @@ class Watcher implements IWatcher { * @param ICacheEntry $cachedData * @return bool */ + #[\Override] public function needsUpdate($path, $cachedData) { if ($this->checkFilter !== null) { if (!preg_match($this->checkFilter, $path)) { @@ -127,6 +133,7 @@ class Watcher implements IWatcher { * * @param string $path */ + #[\Override] public function cleanFolder($path) { $cachedContent = $this->cache->getFolderContents($path); foreach ($cachedContent as $entry) { @@ -139,6 +146,7 @@ class Watcher implements IWatcher { /** * register a callback to be called whenever the watcher triggers and update */ + #[\Override] public function onUpdate(callable $callback): void { $this->onUpdate[] = $callback; } diff --git a/lib/private/Files/Cache/Wrapper/CacheDirPermissionsMask.php b/lib/private/Files/Cache/Wrapper/CacheDirPermissionsMask.php index 38fe5a88c41..e5a1b648a2f 100644 --- a/lib/private/Files/Cache/Wrapper/CacheDirPermissionsMask.php +++ b/lib/private/Files/Cache/Wrapper/CacheDirPermissionsMask.php @@ -25,6 +25,7 @@ class CacheDirPermissionsMask extends CachePermissionsMask { parent::__construct($cache, $mask); } + #[\Override] protected function formatCacheEntry($entry): ICacheEntry|false { $checkPath = $this->checkPath; if ($checkPath($entry['path'])) { diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index 59d0faf0078..477d85c6933 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -98,6 +98,7 @@ class CacheJail extends CacheWrapper { } } + #[\Override] protected function formatCacheEntry($entry) { if (isset($entry['path'])) { $entry['path'] = $this->getJailedPath($entry['path']); @@ -111,6 +112,7 @@ class CacheJail extends CacheWrapper { * @param string|int $file * @return ICacheEntry|false */ + #[\Override] public function get($file) { if (is_string($file) || $file === '') { $file = $this->getSourcePath($file); @@ -127,6 +129,7 @@ class CacheJail extends CacheWrapper { * @return int file id * @throws \RuntimeException */ + #[\Override] public function insert($file, array $data) { return $this->getCache()->insert($this->getSourcePath($file), $data); } @@ -137,6 +140,7 @@ class CacheJail extends CacheWrapper { * @param int $id * @param array $data */ + #[\Override] public function update($id, array $data) { $this->getCache()->update($id, $data); } @@ -147,6 +151,7 @@ class CacheJail extends CacheWrapper { * @param string $file * @return int */ + #[\Override] public function getId($file) { return $this->getCache()->getId($this->getSourcePath($file)); } @@ -157,6 +162,7 @@ class CacheJail extends CacheWrapper { * @param string $file * @return int */ + #[\Override] public function getParentId($file) { return $this->getCache()->getParentId($this->getSourcePath($file)); } @@ -167,6 +173,7 @@ class CacheJail extends CacheWrapper { * @param string $file * @return bool */ + #[\Override] public function inCache($file) { return $this->getCache()->inCache($this->getSourcePath($file)); } @@ -176,6 +183,7 @@ class CacheJail extends CacheWrapper { * * @param string $file */ + #[\Override] public function remove($file) { $this->getCache()->remove($this->getSourcePath($file)); } @@ -186,6 +194,7 @@ class CacheJail extends CacheWrapper { * @param string $source * @param string $target */ + #[\Override] public function move($source, $target) { $this->getCache()->move($this->getSourcePath($source), $this->getSourcePath($target)); } @@ -196,6 +205,7 @@ class CacheJail extends CacheWrapper { * @param string $path * @return array [$storageId, $internalPath] */ + #[\Override] protected function getMoveInfo($path) { return [$this->getNumericStorageId(), $this->getUnjailedSourcePath($path)]; } @@ -203,6 +213,7 @@ class CacheJail extends CacheWrapper { /** * remove all entries for files that are stored on the storage from the cache */ + #[\Override] public function clear() { $this->getCache()->remove($this->getRoot()); } @@ -212,6 +223,7 @@ class CacheJail extends CacheWrapper { * * @return int Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE */ + #[\Override] public function getStatus($file) { return $this->getCache()->getStatus($this->getSourcePath($file)); } @@ -221,6 +233,7 @@ class CacheJail extends CacheWrapper { * * @param array|ICacheEntry|null $data (optional) meta data of the folder */ + #[\Override] public function correctFolderSize(string $path, $data = null, bool $isBackgroundScan = false): void { $cache = $this->getCache(); if ($cache instanceof Cache) { @@ -235,6 +248,7 @@ class CacheJail extends CacheWrapper { * @param array|null|ICacheEntry $entry (optional) meta data of the folder * @return int|float */ + #[\Override] public function calculateFolderSize($path, $entry = null) { $cache = $this->getCache(); if ($cache instanceof Cache) { @@ -249,6 +263,7 @@ class CacheJail extends CacheWrapper { * * @return int[] */ + #[\Override] public function getAll() { // not supported return []; @@ -263,6 +278,7 @@ class CacheJail extends CacheWrapper { * * @return string|false the path of the folder or false when no folder matched */ + #[\Override] public function getIncomplete() { // not supported return false; @@ -274,6 +290,7 @@ class CacheJail extends CacheWrapper { * @param int $id * @return string|null */ + #[\Override] public function getPathById($id) { $path = $this->getCache()->getPathById($id); if ($path === null) { @@ -291,6 +308,7 @@ class CacheJail extends CacheWrapper { * @param string $sourcePath * @param string $targetPath */ + #[\Override] public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { if ($sourceCache === $this) { return $this->move($sourcePath, $targetPath); @@ -298,6 +316,7 @@ class CacheJail extends CacheWrapper { return $this->getCache()->moveFromCache($sourceCache, $sourcePath, $this->getSourcePath($targetPath)); } + #[\Override] public function getQueryFilterForStorage(): ISearchOperator { return $this->addJailFilterQuery($this->getCache()->getQueryFilterForStorage()); } @@ -320,6 +339,7 @@ class CacheJail extends CacheWrapper { } } + #[\Override] public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry { if ($this->getGetUnjailedRoot() === '' || str_starts_with($rawEntry->getPath(), $this->getGetUnjailedRoot())) { $rawEntry = $this->getCache()->getCacheEntryFromSearchResult($rawEntry); diff --git a/lib/private/Files/Cache/Wrapper/CachePermissionsMask.php b/lib/private/Files/Cache/Wrapper/CachePermissionsMask.php index 905b418cdf4..56e661b3c02 100644 --- a/lib/private/Files/Cache/Wrapper/CachePermissionsMask.php +++ b/lib/private/Files/Cache/Wrapper/CachePermissionsMask.php @@ -19,6 +19,7 @@ class CachePermissionsMask extends CacheWrapper { parent::__construct($cache); } + #[\Override] protected function formatCacheEntry($entry) { if (isset($entry['permissions'])) { $entry['scan_permissions'] ??= $entry['permissions']; diff --git a/lib/private/Files/Cache/Wrapper/CacheWrapper.php b/lib/private/Files/Cache/Wrapper/CacheWrapper.php index 38becfeefce..c08a703a08a 100644 --- a/lib/private/Files/Cache/Wrapper/CacheWrapper.php +++ b/lib/private/Files/Cache/Wrapper/CacheWrapper.php @@ -41,6 +41,7 @@ class CacheWrapper extends Cache { return $this->cache; } + #[\Override] protected function hasEncryptionWrapper(): bool { $cache = $this->getCache(); if ($cache instanceof Cache) { @@ -50,6 +51,7 @@ class CacheWrapper extends Cache { } } + #[\Override] protected function shouldEncrypt(string $targetPath): bool { $cache = $this->getCache(); if ($cache instanceof Cache) { @@ -75,6 +77,7 @@ class CacheWrapper extends Cache { * @param string|int $file * @return ICacheEntry|false */ + #[\Override] public function get($file) { $result = $this->getCache()->get($file); if ($result instanceof ICacheEntry) { @@ -89,6 +92,7 @@ class CacheWrapper extends Cache { * @param string $folder * @return ICacheEntry[] */ + #[\Override] public function getFolderContents(string $folder, ?string $mimeTypeFilter = null): array { // can't do a simple $this->getCache()->.... call here since getFolderContentsById needs to be called on this // and not the wrapped cache @@ -102,6 +106,7 @@ class CacheWrapper extends Cache { * @param int $fileId the file id of the folder * @return ICacheEntry[] */ + #[\Override] public function getFolderContentsById(int $fileId, ?string $mimeTypeFilter = null) { $results = $this->getCache()->getFolderContentsById($fileId, $mimeTypeFilter); return array_filter(array_map($this->formatCacheEntry(...), $results)); @@ -116,6 +121,7 @@ class CacheWrapper extends Cache { * @return int file id * @throws \RuntimeException */ + #[\Override] public function put($file, array $data) { if (($id = $this->getId($file)) > -1) { $this->update($id, $data); @@ -134,6 +140,7 @@ class CacheWrapper extends Cache { * @return int file id * @throws \RuntimeException */ + #[\Override] public function insert($file, array $data) { return $this->getCache()->insert($file, $data); } @@ -144,6 +151,7 @@ class CacheWrapper extends Cache { * @param int $id * @param array $data */ + #[\Override] public function update($id, array $data) { $this->getCache()->update($id, $data); } @@ -154,6 +162,7 @@ class CacheWrapper extends Cache { * @param string $file * @return int */ + #[\Override] public function getId($file) { return $this->getCache()->getId($file); } @@ -164,6 +173,7 @@ class CacheWrapper extends Cache { * @param string $file * @return int */ + #[\Override] public function getParentId($file) { return $this->getCache()->getParentId($file); } @@ -174,6 +184,7 @@ class CacheWrapper extends Cache { * @param string $file * @return bool */ + #[\Override] public function inCache($file) { return $this->getCache()->inCache($file); } @@ -183,6 +194,7 @@ class CacheWrapper extends Cache { * * @param string $file */ + #[\Override] public function remove($file) { $this->getCache()->remove($file); } @@ -193,16 +205,19 @@ class CacheWrapper extends Cache { * @param string $source * @param string $target */ + #[\Override] public function move($source, $target) { $this->getCache()->move($source, $target); } + #[\Override] protected function getMoveInfo($path) { /** @var Cache|CacheJail $cache */ $cache = $this->getCache(); return $cache->getMoveInfo($path); } + #[\Override] public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { $this->getCache()->moveFromCache($sourceCache, $sourcePath, $targetPath); } @@ -210,6 +225,7 @@ class CacheWrapper extends Cache { /** * remove all entries for files that are stored on the storage from the cache */ + #[\Override] public function clear() { $cache = $this->getCache(); if ($cache instanceof Cache) { @@ -224,10 +240,12 @@ class CacheWrapper extends Cache { * * @return int Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE */ + #[\Override] public function getStatus($file) { return $this->getCache()->getStatus($file); } + #[\Override] public function searchQuery(ISearchQuery $query) { return current($this->querySearchHelper->searchInCaches($query, [$this])); } @@ -237,6 +255,7 @@ class CacheWrapper extends Cache { * * @param array|ICacheEntry|null $data (optional) meta data of the folder */ + #[\Override] public function correctFolderSize(string $path, $data = null, bool $isBackgroundScan = false): void { $cache = $this->getCache(); if ($cache instanceof Cache) { @@ -251,6 +270,7 @@ class CacheWrapper extends Cache { * @param array|null|ICacheEntry $entry (optional) meta data of the folder * @return int|float */ + #[\Override] public function calculateFolderSize($path, $entry = null) { $cache = $this->getCache(); if ($cache instanceof Cache) { @@ -265,6 +285,7 @@ class CacheWrapper extends Cache { * * @return int[] */ + #[\Override] public function getAll() { /** @var Cache $cache */ $cache = $this->getCache(); @@ -280,6 +301,7 @@ class CacheWrapper extends Cache { * * @return string|false the path of the folder or false when no folder matched */ + #[\Override] public function getIncomplete() { return $this->getCache()->getIncomplete(); } @@ -290,6 +312,7 @@ class CacheWrapper extends Cache { * @param int $id * @return string|null */ + #[\Override] public function getPathById($id) { return $this->getCache()->getPathById($id); } @@ -299,6 +322,7 @@ class CacheWrapper extends Cache { * * @return int */ + #[\Override] public function getNumericStorageId() { return $this->getCache()->getNumericStorageId(); } @@ -311,14 +335,17 @@ class CacheWrapper extends Cache { * @param int $id * @return array first element holding the storage id, second the path */ + #[\Override] public static function getById($id) { return parent::getById($id); } + #[\Override] public function getQueryFilterForStorage(): ISearchOperator { return $this->getCache()->getQueryFilterForStorage(); } + #[\Override] public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry { $rawEntry = $this->getCache()->getCacheEntryFromSearchResult($rawEntry); if ($rawEntry) { diff --git a/lib/private/Files/Cache/Wrapper/JailWatcher.php b/lib/private/Files/Cache/Wrapper/JailWatcher.php index 18a1c22495c..d066d069d15 100644 --- a/lib/private/Files/Cache/Wrapper/JailWatcher.php +++ b/lib/private/Files/Cache/Wrapper/JailWatcher.php @@ -28,31 +28,38 @@ class JailWatcher extends Watcher { } } + #[\Override] public function setPolicy($policy) { $this->watcher->setPolicy($policy); } + #[\Override] public function getPolicy() { return $this->watcher->getPolicy(); } + #[\Override] public function checkUpdate($path, $cachedEntry = null) { return $this->watcher->checkUpdate($this->getSourcePath($path), $cachedEntry); } + #[\Override] public function update($path, $cachedData) { $this->watcher->update($this->getSourcePath($path), $cachedData); } + #[\Override] public function needsUpdate($path, $cachedData) { return $this->watcher->needsUpdate($this->getSourcePath($path), $cachedData); } + #[\Override] public function cleanFolder($path) { $this->watcher->cleanFolder($this->getSourcePath($path)); } + #[\Override] public function onUpdate(callable $callback): void { $this->watcher->onUpdate($callback); } diff --git a/lib/private/Files/Config/CachedMountFileInfo.php b/lib/private/Files/Config/CachedMountFileInfo.php index ae27b1e762d..29636e5c665 100644 --- a/lib/private/Files/Config/CachedMountFileInfo.php +++ b/lib/private/Files/Config/CachedMountFileInfo.php @@ -25,6 +25,7 @@ class CachedMountFileInfo extends CachedMountInfo implements ICachedMountFileInf parent::__construct($user, $storageId, $rootId, $mountPoint, $mountProvider, $mountId, $rootInternalPath); } + #[\Override] public function getInternalPath(): string { if ($this->getRootInternalPath()) { return substr($this->internalPath, strlen($this->getRootInternalPath()) + 1); @@ -33,6 +34,7 @@ class CachedMountFileInfo extends CachedMountInfo implements ICachedMountFileInf } } + #[\Override] public function getPath(): string { return $this->getMountPoint() . $this->getInternalPath(); } diff --git a/lib/private/Files/Config/CachedMountInfo.php b/lib/private/Files/Config/CachedMountInfo.php index 7d67f38421e..ffe06c25b16 100644 --- a/lib/private/Files/Config/CachedMountInfo.php +++ b/lib/private/Files/Config/CachedMountInfo.php @@ -30,6 +30,7 @@ class CachedMountInfo implements ICachedMountInfo { $this->key = $this->rootId . '::' . $this->mountPoint; } + #[\Override] public function getUser(): IUser { return $this->user; } @@ -37,6 +38,7 @@ class CachedMountInfo implements ICachedMountInfo { /** * @return int the numeric storage id of the mount */ + #[\Override] public function getStorageId(): int { return $this->storageId; } @@ -44,6 +46,7 @@ class CachedMountInfo implements ICachedMountInfo { /** * @return int the fileid of the root of the mount */ + #[\Override] public function getRootId(): int { return $this->rootId; } @@ -51,6 +54,7 @@ class CachedMountInfo implements ICachedMountInfo { /** * @return Node|null the root node of the mount */ + #[\Override] public function getMountPointNode(): ?Node { // TODO injection etc Filesystem::initMountPoints($this->getUser()->getUID()); @@ -61,6 +65,7 @@ class CachedMountInfo implements ICachedMountInfo { /** * @return string the mount point of the mount for the user */ + #[\Override] public function getMountPoint(): string { return $this->mountPoint; } @@ -71,6 +76,7 @@ class CachedMountInfo implements ICachedMountInfo { * @return int|null mount id or null if not applicable * @since 9.1.0 */ + #[\Override] public function getMountId(): ?int { return $this->mountId; } @@ -80,14 +86,17 @@ class CachedMountInfo implements ICachedMountInfo { * * @return string */ + #[\Override] public function getRootInternalPath(): string { return $this->rootInternalPath; } + #[\Override] public function getMountProvider(): string { return $this->mountProvider; } + #[\Override] public function getKey(): string { return $this->key; } diff --git a/lib/private/Files/Config/LazyPathCachedMountInfo.php b/lib/private/Files/Config/LazyPathCachedMountInfo.php index d2396109b1a..699f3e4bd55 100644 --- a/lib/private/Files/Config/LazyPathCachedMountInfo.php +++ b/lib/private/Files/Config/LazyPathCachedMountInfo.php @@ -39,6 +39,7 @@ class LazyPathCachedMountInfo extends CachedMountInfo { $this->rootInternalPathCallback = $rootInternalPathCallback; } + #[\Override] public function getRootInternalPath(): string { if ($this->rootInternalPath === self::PATH_PLACEHOLDER) { $this->rootInternalPath = ($this->rootInternalPathCallback)($this); diff --git a/lib/private/Files/Config/LazyStorageMountInfo.php b/lib/private/Files/Config/LazyStorageMountInfo.php index 186e354aa34..8c992f7a162 100644 --- a/lib/private/Files/Config/LazyStorageMountInfo.php +++ b/lib/private/Files/Config/LazyStorageMountInfo.php @@ -22,6 +22,7 @@ class LazyStorageMountInfo extends CachedMountInfo { /** * @return int the numeric storage id of the mount */ + #[\Override] public function getStorageId(): int { if (!$this->storageId) { $this->storageId = $this->mount->getNumericStorageId(); @@ -32,6 +33,7 @@ class LazyStorageMountInfo extends CachedMountInfo { /** * @return int the fileid of the root of the mount */ + #[\Override] public function getRootId(): int { if (!$this->rootId) { $this->rootId = $this->mount->getStorageRootId(); @@ -42,6 +44,7 @@ class LazyStorageMountInfo extends CachedMountInfo { /** * @return string the mount point of the mount for the user */ + #[\Override] public function getMountPoint(): string { if (!$this->mountPoint) { $this->mountPoint = $this->mount->getMountPoint(); @@ -49,6 +52,7 @@ class LazyStorageMountInfo extends CachedMountInfo { return parent::getMountPoint(); } + #[\Override] public function getMountId(): ?int { return $this->mount->getMountId(); } @@ -58,14 +62,17 @@ class LazyStorageMountInfo extends CachedMountInfo { * * @return string */ + #[\Override] public function getRootInternalPath(): string { return $this->mount->getInternalPath($this->mount->getMountPoint()); } + #[\Override] public function getMountProvider(): string { return $this->mount->getMountProvider(); } + #[\Override] public function getKey(): string { if (!$this->key) { $this->key = $this->getRootId() . '::' . $this->getMountPoint(); diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php index 338c26350ea..d6a33e675b3 100644 --- a/lib/private/Files/Config/MountProviderCollection.php +++ b/lib/private/Files/Config/MountProviderCollection.php @@ -79,6 +79,7 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { /** * @return list */ + #[\Override] public function getMountsForUser(IUser $user): array { return $this->getUserMountsForProviders($user, array_values($this->providers)); } @@ -138,6 +139,7 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { * * @return list */ + #[\Override] public function getUserMountsForProviderClasses(IUser $user, array $mountProviderClasses): array { $providers = array_filter( $this->providers, @@ -196,6 +198,7 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { * * @since 9.1.0 */ + #[\Override] public function getHomeMountForUser(IUser $user): IMountPoint { $providers = array_reverse($this->homeProviders); // call the latest registered provider first to give apps an opportunity to overwrite builtin foreach ($providers as $homeProvider) { @@ -210,12 +213,14 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { /** * Add a provider for mount points */ + #[\Override] public function registerProvider(IMountProvider $provider): void { $this->providers[get_class($provider)] = $provider; $this->emit('\OC\Files\Config', 'registerMountProvider', [$provider]); } + #[\Override] public function registerMountFilter(callable $filter): void { $this->mountFilters[] = $filter; } @@ -241,6 +246,7 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { * @param IHomeMountProvider $provider * @since 9.1.0 */ + #[\Override] public function registerHomeProvider(IHomeMountProvider $provider) { $this->homeProviders[] = $provider; $this->emit('\OC\Files\Config', 'registerHomeMountProvider', [$provider]); @@ -249,6 +255,7 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { /** * Get the mount cache which can be used to search for mounts without setting up the filesystem */ + #[\Override] public function getMountCache(): IUserMountCache { return $this->mountCache; } @@ -263,6 +270,7 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { * @return list * @since 20.0.0 */ + #[\Override] public function getRootMounts(): array { $loader = $this->loader; $mounts = array_map(function (IRootMountProvider $provider) use ($loader) { diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php index 5e0653b1c63..c2a1d88ef12 100644 --- a/lib/private/Files/Config/UserMountCache.php +++ b/lib/private/Files/Config/UserMountCache.php @@ -62,6 +62,7 @@ class UserMountCache implements IUserMountCache { $this->mountsForUsers = new CappedMemoryCache(); } + #[\Override] public function registerMounts(IUser $user, array $mounts, ?array $mountProviderClasses = null) { $this->eventLogger->start('fs:setup:user:register', 'Registering mounts for user'); /** @var array $newMounts */ @@ -249,6 +250,7 @@ class UserMountCache implements IUserMountCache { * @param IUser $user * @return ICachedMountInfo[] */ + #[\Override] public function getMountsForUser(IUser $user) { $userUID = $user->getUID(); if (!$this->userManager->userExists($userUID)) { @@ -294,6 +296,7 @@ class UserMountCache implements IUserMountCache { * @param string|null $user limit the results to a single user * @return CachedMountInfo[] */ + #[\Override] public function getMountsForStorageId($numericStorageId, $user = null) { $builder = $this->connection->getQueryBuilder(); $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class') @@ -316,6 +319,7 @@ class UserMountCache implements IUserMountCache { * @param int $rootFileId * @return CachedMountInfo[] */ + #[\Override] public function getMountsForRootId($rootFileId) { $builder = $this->connection->getQueryBuilder(); $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class') @@ -365,6 +369,7 @@ class UserMountCache implements IUserMountCache { * @return ICachedMountFileInfo[] * @since 9.0.0 */ + #[\Override] public function getMountsForFileId($fileId, $user = null) { try { [$storageId, $internalPath] = $this->getCacheInfoFromFileId($fileId); @@ -427,6 +432,7 @@ class UserMountCache implements IUserMountCache { * * @param IUser $user */ + #[\Override] public function removeUserMounts(IUser $user) { $builder = $this->connection->getQueryBuilder(); @@ -435,6 +441,7 @@ class UserMountCache implements IUserMountCache { $query->executeStatement(); } + #[\Override] public function removeUserStorageMount($storageId, $userId) { $builder = $this->connection->getQueryBuilder(); @@ -444,6 +451,7 @@ class UserMountCache implements IUserMountCache { $query->executeStatement(); } + #[\Override] public function remoteStorageMounts($storageId) { $builder = $this->connection->getQueryBuilder(); @@ -456,6 +464,7 @@ class UserMountCache implements IUserMountCache { * @param array $users * @return array */ + #[\Override] public function getUsedSpaceForUsers(array $users) { $builder = $this->connection->getQueryBuilder(); @@ -482,11 +491,13 @@ class UserMountCache implements IUserMountCache { return $results; } + #[\Override] public function clear(): void { $this->cacheInfoCache = new CappedMemoryCache(); $this->mountsForUsers = new CappedMemoryCache(); } + #[\Override] public function getMountForPath(IUser $user, string $path): ICachedMountInfo { $searchPaths = []; $current = rtrim($path, '/'); @@ -533,6 +544,7 @@ class UserMountCache implements IUserMountCache { throw new NotFoundException('No cached mount for path ' . $path); } + #[\Override] public function getMountsInPath(IUser $user, string $path): array { $path = rtrim($path, '/') . '/'; $result = []; @@ -545,6 +557,7 @@ class UserMountCache implements IUserMountCache { return $result; } + #[\Override] public function removeMount(string $mountPoint, ?IUser $user = null): void { $query = $this->connection->getQueryBuilder(); $query->delete('mounts') @@ -561,6 +574,7 @@ class UserMountCache implements IUserMountCache { } } + #[\Override] public function addMount( IUser $user, string $mountPoint, @@ -599,6 +613,7 @@ class UserMountCache implements IUserMountCache { $this->mountsForUsers = new CappedMemoryCache(); } + #[\Override] public function getMountAtPath(IUser $user, string $mountPoint): ?ICachedMountInfo { if (isset($this->mountsForUsers[$user->getUID()])) { foreach ($this->mountsForUsers[$user->getUID()] as $mount) { diff --git a/lib/private/Files/Conversion/ConversionManager.php b/lib/private/Files/Conversion/ConversionManager.php index 2c98a4c6404..24a4b8cb635 100644 --- a/lib/private/Files/Conversion/ConversionManager.php +++ b/lib/private/Files/Conversion/ConversionManager.php @@ -53,11 +53,13 @@ class ConversionManager implements IConversionManager { $this->l10n = $l10nFactory->get('files'); } + #[\Override] public function hasProviders(): bool { $context = $this->coordinator->getRegistrationContext(); return !empty($context->getFileConversionProviders()); } + #[\Override] public function getProviders(): array { $providers = []; foreach ($this->getRegisteredProviders() as $provider) { @@ -66,6 +68,7 @@ class ConversionManager implements IConversionManager { return $providers; } + #[\Override] public function convert(File $file, string $targetMimeType, ?string $destination = null): string { if (!$this->hasProviders()) { throw new PreConditionNotMetException($this->l10n->t('No file conversion providers available')); diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index 81e56345e3b..65280b0f315 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -65,6 +65,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { } } + #[\Override] public function offsetSet($offset, $value): void { if (is_null($offset)) { throw new \TypeError('Null offset not supported'); @@ -72,14 +73,17 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { $this->data[$offset] = $value; } + #[\Override] public function offsetExists($offset): bool { return isset($this->data[$offset]); } + #[\Override] public function offsetUnset($offset): void { unset($this->data[$offset]); } + #[\Override] public function offsetGet(mixed $offset): mixed { return match ($offset) { 'path' => $this->getPath(), @@ -95,10 +99,12 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @return string */ + #[\Override] public function getPath() { return $this->path; } + #[\Override] public function getStorage() { return $this->storage; } @@ -106,6 +112,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @return string */ + #[\Override] public function getInternalPath() { return $this->internalPath; } @@ -115,10 +122,12 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * * @return int|null */ + #[\Override] public function getId() { return isset($this->data['fileid']) ? (int)$this->data['fileid'] : null; } + #[\Override] public function getMimetype(): string { return $this->data['mimetype'] ?? 'application/octet-stream'; } @@ -126,6 +135,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @return string */ + #[\Override] public function getMimePart() { return $this->data['mimepart']; } @@ -133,6 +143,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @return string */ + #[\Override] public function getName() { return empty($this->data['name']) ? basename($this->getPath()) @@ -142,6 +153,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @return string */ + #[\Override] public function getEtag() { $this->updateEntryFromSubMounts(); if (count($this->childEtags) > 0) { @@ -156,6 +168,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * @param bool $includeMounts * @return int|float */ + #[\Override] public function getSize($includeMounts = true) { if ($includeMounts) { $this->updateEntryFromSubMounts(); @@ -173,6 +186,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @return int */ + #[\Override] public function getMTime() { $this->updateEntryFromSubMounts(); return (int)$this->data['mtime']; @@ -181,6 +195,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @return bool */ + #[\Override] public function isEncrypted() { return $this->data['encrypted'] ?? false; } @@ -195,6 +210,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @return int */ + #[\Override] public function getPermissions() { return (int)$this->data['permissions']; } @@ -202,6 +218,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER */ + #[\Override] public function getType() { if (!isset($this->data['type'])) { $this->data['type'] = ($this->getMimetype() === self::MIMETYPE_FOLDER) ? self::TYPE_FOLDER : self::TYPE_FILE; @@ -209,6 +226,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { return $this->data['type']; } + #[\Override] public function getData(): ICacheEntry { if ($this->data instanceof ICacheEntry) { return $this->data; @@ -228,6 +246,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @return bool */ + #[\Override] public function isReadable() { return $this->checkPermissions(Constants::PERMISSION_READ); } @@ -235,6 +254,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @return bool */ + #[\Override] public function isUpdateable() { return $this->checkPermissions(Constants::PERMISSION_UPDATE); } @@ -244,6 +264,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * * @return bool */ + #[\Override] public function isCreatable() { return $this->checkPermissions(Constants::PERMISSION_CREATE); } @@ -251,6 +272,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @return bool */ + #[\Override] public function isDeletable() { return $this->checkPermissions(Constants::PERMISSION_DELETE); } @@ -258,6 +280,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @return bool */ + #[\Override] public function isShareable() { return $this->checkPermissions(Constants::PERMISSION_SHARE); } @@ -267,10 +290,12 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * * @return bool */ + #[\Override] public function isShared() { return $this->mount instanceof ISharedMountPoint; } + #[\Override] public function isMounted() { $isHome = $this->mount instanceof HomeMountPoint; return !$isHome && !$this->isShared(); @@ -281,6 +306,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * * @return \OCP\Files\Mount\IMountPoint */ + #[\Override] public function getMountPoint() { return $this->mount; } @@ -290,6 +316,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * * @return ?IUser */ + #[\Override] public function getOwner() { return $this->owner; } @@ -353,26 +380,32 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { /** * @inheritdoc */ + #[\Override] public function getChecksum() { return $this->data['checksum']; } + #[\Override] public function getExtension(): string { return pathinfo($this->getName(), PATHINFO_EXTENSION); } + #[\Override] public function getCreationTime(): int { return (int)$this->data['creation_time']; } + #[\Override] public function getUploadTime(): int { return (int)$this->data['upload_time']; } + #[\Override] public function getLastActivity(): int { return max($this->getUploadTime(), $this->getMTime()); } + #[\Override] public function getParentId(): int { return $this->data['parent'] ?? -1; } @@ -381,6 +414,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * @inheritDoc * @return array */ + #[\Override] public function getMetadata(): array { return $this->data['metadata'] ?? []; } diff --git a/lib/private/Files/FilenameValidator.php b/lib/private/Files/FilenameValidator.php index 987575292d7..1610b09da22 100644 --- a/lib/private/Files/FilenameValidator.php +++ b/lib/private/Files/FilenameValidator.php @@ -157,6 +157,7 @@ class FilenameValidator implements IFilenameValidator { /** * @inheritdoc */ + #[\Override] public function isFilenameValid(string $filename): bool { try { $this->validateFilename($filename); @@ -169,6 +170,7 @@ class FilenameValidator implements IFilenameValidator { /** * @inheritdoc */ + #[\Override] public function validateFilename(string $filename): void { $trimmed = trim($filename); if ($trimmed === '') { @@ -229,6 +231,7 @@ class FilenameValidator implements IFilenameValidator { return false; } + #[\Override] public function sanitizeFilename(string $name, ?string $charReplacement = null): string { $forbiddenCharacters = $this->getForbiddenCharacters(); diff --git a/lib/private/Files/Lock/LockManager.php b/lib/private/Files/Lock/LockManager.php index 4c7e1427d02..ae2613fc9dd 100644 --- a/lib/private/Files/Lock/LockManager.php +++ b/lib/private/Files/Lock/LockManager.php @@ -20,6 +20,7 @@ class LockManager implements ILockManager { private ?ILockProvider $lockProvider = null; private ?LockContext $lockInScope = null; + #[\Override] public function registerLockProvider(ILockProvider $lockProvider): void { if ($this->lockProvider) { throw new PreConditionNotMetException('There is already a registered lock provider'); @@ -28,6 +29,7 @@ class LockManager implements ILockManager { $this->lockProvider = $lockProvider; } + #[\Override] public function registerLazyLockProvider(string $lockProviderClass): void { if ($this->lockProviderClass || $this->lockProvider) { throw new PreConditionNotMetException('There is already a registered lock provider'); @@ -50,10 +52,12 @@ class LockManager implements ILockManager { return $this->lockProvider; } + #[\Override] public function isLockProviderAvailable(): bool { return $this->getLockProvider() !== null; } + #[\Override] public function runInScope(LockContext $lock, callable $callback): void { if (!$this->getLockProvider()) { $callback(); @@ -72,10 +76,12 @@ class LockManager implements ILockManager { } } + #[\Override] public function getLockInScope(): ?LockContext { return $this->lockInScope; } + #[\Override] public function getLocks(int $fileId): array { if (!$this->getLockProvider()) { throw new PreConditionNotMetException('No lock provider available'); @@ -84,6 +90,7 @@ class LockManager implements ILockManager { return $this->getLockProvider()->getLocks($fileId); } + #[\Override] public function lock(LockContext $lockInfo): ILock { if (!$this->getLockProvider()) { throw new PreConditionNotMetException('No lock provider available'); @@ -92,6 +99,7 @@ class LockManager implements ILockManager { return $this->getLockProvider()->lock($lockInfo); } + #[\Override] public function unlock(LockContext $lockInfo): void { if (!$this->getLockProvider()) { throw new PreConditionNotMetException('No lock provider available'); diff --git a/lib/private/Files/Mount/LocalHomeMountProvider.php b/lib/private/Files/Mount/LocalHomeMountProvider.php index 92b44eac151..0b867436300 100644 --- a/lib/private/Files/Mount/LocalHomeMountProvider.php +++ b/lib/private/Files/Mount/LocalHomeMountProvider.php @@ -25,6 +25,7 @@ class LocalHomeMountProvider implements IHomeMountProvider { * @param IStorageFactory $loader * @return IMountPoint|null */ + #[\Override] public function getHomeMountForUser(IUser $user, IStorageFactory $loader) { $arguments = ['user' => $user]; return new HomeMountPoint($user, '\OC\Files\Storage\Home', '/' . $user->getUID(), $arguments, $loader, null, null, self::class); diff --git a/lib/private/Files/Mount/Manager.php b/lib/private/Files/Mount/Manager.php index 9a29752229d..3ec0fa5d125 100644 --- a/lib/private/Files/Mount/Manager.php +++ b/lib/private/Files/Mount/Manager.php @@ -36,6 +36,7 @@ class Manager implements IMountManager { $this->setupManager = $setupManagerFactory->create($this); } + #[\Override] public function addMount(IMountPoint $mount): void { $mountPoint = $mount->getMountPoint(); $mountProvider = $mount->getMountProvider(); @@ -47,6 +48,7 @@ class Manager implements IMountManager { $this->areMountsSorted = false; } + #[\Override] public function removeMount(string $mountPoint): void { $mountPoint = Filesystem::normalizePath($mountPoint); if (\strlen($mountPoint) > 1) { @@ -58,6 +60,7 @@ class Manager implements IMountManager { $this->areMountsSorted = false; } + #[\Override] public function moveMount(string $mountPoint, string $target): void { if ($mountPoint !== $target) { $this->mounts[$target] = $this->mounts[$mountPoint]; @@ -72,6 +75,7 @@ class Manager implements IMountManager { /** * Find the mount for $path */ + #[\Override] public function find(string $path): IMountPoint { $this->setupManager->setupForPath($path); $path = Filesystem::normalizePath($path); @@ -111,6 +115,7 @@ class Manager implements IMountManager { * * @return IMountPoint[] */ + #[\Override] public function findIn(string $path): array { $this->setupManager->setupForPath($path, true); $path = $this->formatPath($path); @@ -173,6 +178,7 @@ class Manager implements IMountManager { return $result; } + #[\Override] public function clear(): void { $this->mounts = []; $this->mountsByProvider = []; @@ -186,6 +192,7 @@ class Manager implements IMountManager { * @param string $id * @return IMountPoint[] */ + #[\Override] public function findByStorageId(string $id): array { if (\strlen($id) > 64) { $id = md5($id); @@ -202,6 +209,7 @@ class Manager implements IMountManager { /** * @return IMountPoint[] */ + #[\Override] public function getAll(): array { return $this->mounts; } @@ -212,6 +220,7 @@ class Manager implements IMountManager { * @param int $id * @return IMountPoint[] */ + #[\Override] public function findByNumericId(int $id): array { $result = []; foreach ($this->mounts as $mount) { @@ -266,6 +275,7 @@ class Manager implements IMountManager { * * @return IMountPoint|null */ + #[\Override] public function getMountFromMountInfo(ICachedMountInfo $info): ?IMountPoint { $this->setupManager->setupForPath($info->getMountPoint()); foreach ($this->mounts as $mount) { diff --git a/lib/private/Files/Mount/MountPoint.php b/lib/private/Files/Mount/MountPoint.php index 3538a1386c5..96009d58d09 100644 --- a/lib/private/Files/Mount/MountPoint.php +++ b/lib/private/Files/Mount/MountPoint.php @@ -99,6 +99,7 @@ class MountPoint implements IMountPoint { * * @return string */ + #[\Override] public function getMountPoint() { return $this->mountPoint; } @@ -108,6 +109,7 @@ class MountPoint implements IMountPoint { * * @param string $mountPoint new mount point */ + #[\Override] public function setMountPoint($mountPoint) { $this->mountPoint = $this->formatPath($mountPoint); } @@ -147,6 +149,7 @@ class MountPoint implements IMountPoint { /** * @return IStorage|null */ + #[\Override] public function getStorage() { if (is_null($this->storage)) { $this->createStorage(); @@ -157,6 +160,7 @@ class MountPoint implements IMountPoint { /** * @return string|null */ + #[\Override] public function getStorageId() { if (!$this->storageId) { $storage = $this->getStorage(); @@ -174,6 +178,7 @@ class MountPoint implements IMountPoint { /** * @return int */ + #[\Override] public function getNumericStorageId() { if (is_null($this->numericStorageId)) { $storage = $this->getStorage(); @@ -189,6 +194,7 @@ class MountPoint implements IMountPoint { * @param string $path * @return string */ + #[\Override] public function getInternalPath($path) { $path = Filesystem::normalizePath($path, true, false, true); if ($this->mountPoint === $path || $this->mountPoint . '/' === $path) { @@ -215,6 +221,7 @@ class MountPoint implements IMountPoint { /** * @param callable $wrapper */ + #[\Override] public function wrapStorage($wrapper) { $storage = $this->getStorage(); // storage can be null if it couldn't be initialized @@ -230,6 +237,7 @@ class MountPoint implements IMountPoint { * @param mixed $default Default value for the mount option * @return mixed */ + #[\Override] public function getOption($name, $default) { return $this->mountOptions[$name] ?? $default; } @@ -239,6 +247,7 @@ class MountPoint implements IMountPoint { * * @return array */ + #[\Override] public function getOptions() { return $this->mountOptions; } @@ -248,6 +257,7 @@ class MountPoint implements IMountPoint { * * @return int */ + #[\Override] public function getStorageRootId() { if (is_null($this->rootId) || $this->rootId === -1) { $storage = $this->getStorage(); @@ -261,14 +271,17 @@ class MountPoint implements IMountPoint { return $this->rootId; } + #[\Override] public function getMountId() { return $this->mountId; } + #[\Override] public function getMountType() { return ''; } + #[\Override] public function getMountProvider(): string { return $this->mountProvider; } diff --git a/lib/private/Files/Mount/ObjectHomeMountProvider.php b/lib/private/Files/Mount/ObjectHomeMountProvider.php index 4b088f2c808..574a5594f87 100644 --- a/lib/private/Files/Mount/ObjectHomeMountProvider.php +++ b/lib/private/Files/Mount/ObjectHomeMountProvider.php @@ -30,6 +30,7 @@ class ObjectHomeMountProvider implements IHomeMountProvider { * @param IStorageFactory $loader * @return ?IMountPoint */ + #[\Override] public function getHomeMountForUser(IUser $user, IStorageFactory $loader): ?IMountPoint { $objectStoreConfig = $this->objectStoreConfig->getObjectStoreConfigForUser($user); if ($objectStoreConfig === null) { diff --git a/lib/private/Files/Mount/RootMountProvider.php b/lib/private/Files/Mount/RootMountProvider.php index a1ab474ba28..83d0ebef0a0 100644 --- a/lib/private/Files/Mount/RootMountProvider.php +++ b/lib/private/Files/Mount/RootMountProvider.php @@ -23,6 +23,7 @@ class RootMountProvider implements IRootMountProvider { ) { } + #[\Override] public function getRootMounts(IStorageFactory $loader): array { $objectStoreConfig = $this->objectStoreConfig->getObjectStoreConfigForRoot(); diff --git a/lib/private/Files/Node/File.php b/lib/private/Files/Node/File.php index 4e8aad1cfb1..de22ccc9f75 100644 --- a/lib/private/Files/Node/File.php +++ b/lib/private/Files/Node/File.php @@ -19,6 +19,7 @@ class File extends Node implements \OCP\Files\File { * @param string $path path * @return NonExistingFile non-existing node */ + #[\Override] protected function createNonExistingNode($path) { return new NonExistingFile($this->root, $this->view, $path); } @@ -29,6 +30,7 @@ class File extends Node implements \OCP\Files\File { * @throws GenericFileException * @throws LockedException */ + #[\Override] public function getContent() { if ($this->checkPermissions(Constants::PERMISSION_READ)) { $content = $this->view->file_get_contents($this->path); @@ -47,6 +49,7 @@ class File extends Node implements \OCP\Files\File { * @throws GenericFileException * @throws LockedException */ + #[\Override] public function putContent($data) { if ($this->checkPermissions(Constants::PERMISSION_UPDATE)) { $this->sendHooks(['preWrite']); @@ -66,6 +69,7 @@ class File extends Node implements \OCP\Files\File { * @throws NotPermittedException * @throws LockedException */ + #[\Override] public function fopen($mode) { $preHooks = []; $postHooks = []; @@ -106,6 +110,7 @@ class File extends Node implements \OCP\Files\File { * @throws \OCP\Files\InvalidPathException * @throws \OCP\Files\NotFoundException */ + #[\Override] public function delete() { if ($this->checkPermissions(Constants::PERMISSION_DELETE)) { $this->sendHooks(['preDelete']); @@ -124,6 +129,7 @@ class File extends Node implements \OCP\Files\File { * @param bool $raw * @return string */ + #[\Override] public function hash($type, $raw = false) { return $this->view->hash($type, $this->path, $raw); } @@ -131,10 +137,12 @@ class File extends Node implements \OCP\Files\File { /** * @inheritdoc */ + #[\Override] public function getChecksum() { return $this->getFileInfo()->getChecksum(); } + #[\Override] public function getExtension(): string { return $this->getFileInfo()->getExtension(); } diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php index f103a34c9e9..37de7abfbe5 100644 --- a/lib/private/Files/Node/Folder.php +++ b/lib/private/Files/Node/Folder.php @@ -44,6 +44,7 @@ class Folder extends Node implements IFolder { * @param string $path path * @return NonExistingFolder non-existing node */ + #[\Override] protected function createNonExistingNode($path) { return new NonExistingFolder($this->root, $this->view, $path); } @@ -53,6 +54,7 @@ class Folder extends Node implements IFolder { * @return string * @throws \OCP\Files\NotPermittedException */ + #[\Override] public function getFullPath($path) { $path = $this->normalizePath($path); if (!$this->isValidPath($path)) { @@ -65,6 +67,7 @@ class Folder extends Node implements IFolder { * @param string $path * @return string|null */ + #[\Override] public function getRelativePath($path) { return PathHelper::getRelativePath($this->getPath(), $path); } @@ -75,6 +78,7 @@ class Folder extends Node implements IFolder { * @param \OC\Files\Node\Node $node * @return bool */ + #[\Override] public function isSubNode($node) { return str_starts_with($node->getPath(), $this->path . '/'); } @@ -106,10 +110,12 @@ class Folder extends Node implements IFolder { } } + #[\Override] public function get($path) { return $this->root->get($this->getFullPath($path)); } + #[\Override] public function nodeExists($path) { try { $this->get($path); @@ -124,6 +130,7 @@ class Folder extends Node implements IFolder { * @return \OC\Files\Node\Folder * @throws \OCP\Files\NotPermittedException */ + #[\Override] public function newFolder($path) { if ($this->checkPermissions(Constants::PERMISSION_CREATE)) { $fullPath = $this->getFullPath($path); @@ -160,6 +167,7 @@ class Folder extends Node implements IFolder { * @return File * @throws \OCP\Files\NotPermittedException */ + #[\Override] public function newFile($path, $content = null) { if ($path === '') { throw new NotPermittedException('Could not create as provided path is empty'); @@ -202,6 +210,7 @@ class Folder extends Node implements IFolder { * @param string|ISearchQuery $query * @return \OC\Files\Node\Node[] */ + #[\Override] public function search($query) { if (is_string($query)) { $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%' . $query . '%')); @@ -284,6 +293,7 @@ class Folder extends Node implements IFolder { * @param string $mimetype * @return Node[] */ + #[\Override] public function searchByMime($mimetype) { if (!str_contains($mimetype, '/')) { $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%')); @@ -300,11 +310,13 @@ class Folder extends Node implements IFolder { * @param string $userId owner of the tags * @return Node[] */ + #[\Override] public function searchByTag($tag, $userId) { $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'tagname', $tag), $userId); return $this->search($query); } + #[\Override] public function searchBySystemTag(string $tagName, string $userId, int $limit = 0, int $offset = 0): array { $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'systemtag', $tagName), $userId, $limit, $offset); return $this->search($query); @@ -314,10 +326,12 @@ class Folder extends Node implements IFolder { * @param int $id * @return \OCP\Files\Node[] */ + #[\Override] public function getById($id) { return $this->root->getByIdInPath((int)$id, $this->getPath()); } + #[\Override] public function getFirstNodeById(int $id): ?INode { return $this->root->getFirstNodeByIdInPath($id, $this->getPath()); } @@ -370,10 +384,12 @@ class Folder extends Node implements IFolder { ))]; } + #[\Override] public function getFreeSpace() { return $this->view->free_space($this->path); } + #[\Override] public function delete() { if ($this->checkPermissions(Constants::PERMISSION_DELETE)) { $this->sendHooks(['preDelete']); @@ -394,6 +410,7 @@ class Folder extends Node implements IFolder { * @return string * @throws NotPermittedException */ + #[\Override] public function getNonExistingName($filename) { $path = $this->getPath(); if ($path === '/') { @@ -441,6 +458,7 @@ class Folder extends Node implements IFolder { * @param int $offset * @return INode[] */ + #[\Override] public function getRecent($limit, $offset = 0) { $filterOutNonEmptyFolder = new SearchBinaryOperator( // filter out non empty folders @@ -504,6 +522,7 @@ class Folder extends Node implements IFolder { return $this->search($query); } + #[\Override] public function verifyPath($fileName, $readonly = false): void { $this->view->verifyPath( $this->getPath(), diff --git a/lib/private/Files/Node/LazyFolder.php b/lib/private/Files/Node/LazyFolder.php index 1bc663f76b6..cd67de7c33a 100644 --- a/lib/private/Files/Node/LazyFolder.php +++ b/lib/private/Files/Node/LazyFolder.php @@ -136,6 +136,7 @@ class LazyFolder implements Folder { $this->__call(__FUNCTION__, func_get_args()); } + #[\Override] public function get($path) { return $this->getRootFolder()->get($this->getFullPath($path)); } @@ -155,6 +156,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function delete() { return $this->__call(__FUNCTION__, func_get_args()); } @@ -162,6 +164,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function copy($targetPath) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -169,6 +172,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function touch($mtime = null) { $this->__call(__FUNCTION__, func_get_args()); } @@ -176,6 +180,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getStorage() { return $this->__call(__FUNCTION__, func_get_args()); } @@ -183,6 +188,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getPath() { if (isset($this->data['path'])) { return $this->data['path']; @@ -193,6 +199,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getInternalPath() { return $this->__call(__FUNCTION__, func_get_args()); } @@ -200,6 +207,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getId() { if (isset($this->data['fileid'])) { return $this->data['fileid']; @@ -210,6 +218,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function stat() { return $this->__call(__FUNCTION__, func_get_args()); } @@ -217,6 +226,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getMTime() { if (isset($this->data['mtime'])) { return $this->data['mtime']; @@ -227,6 +237,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getSize($includeMounts = true): int|float { if (isset($this->data['size'])) { return $this->data['size']; @@ -237,6 +248,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getEtag() { if (isset($this->data['etag'])) { return $this->data['etag']; @@ -247,6 +259,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getPermissions() { if (isset($this->data['permissions'])) { return $this->data['permissions']; @@ -257,6 +270,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function isReadable() { if (isset($this->data['permissions'])) { return ($this->data['permissions'] & Constants::PERMISSION_READ) === Constants::PERMISSION_READ; @@ -267,6 +281,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function isUpdateable() { if (isset($this->data['permissions'])) { return ($this->data['permissions'] & Constants::PERMISSION_UPDATE) === Constants::PERMISSION_UPDATE; @@ -277,6 +292,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function isDeletable() { if (isset($this->data['permissions'])) { return ($this->data['permissions'] & Constants::PERMISSION_DELETE) === Constants::PERMISSION_DELETE; @@ -287,6 +303,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function isShareable() { if (isset($this->data['permissions'])) { return ($this->data['permissions'] & Constants::PERMISSION_SHARE) === Constants::PERMISSION_SHARE; @@ -297,6 +314,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getParent() { return $this->__call(__FUNCTION__, func_get_args()); } @@ -304,6 +322,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getName() { if (isset($this->data['path'])) { return basename($this->data['path']); @@ -321,6 +340,7 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } + #[\Override] public function getMimetype(): string { if (isset($this->data['mimetype'])) { return $this->data['mimetype']; @@ -331,6 +351,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getMimePart() { if (isset($this->data['mimetype'])) { [$part,] = explode('/', $this->data['mimetype']); @@ -342,6 +363,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function isEncrypted() { return $this->__call(__FUNCTION__, func_get_args()); } @@ -349,6 +371,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getType() { if (isset($this->data['type'])) { return $this->data['type']; @@ -359,6 +382,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function isShared() { return $this->__call(__FUNCTION__, func_get_args()); } @@ -366,6 +390,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function isMounted() { return $this->__call(__FUNCTION__, func_get_args()); } @@ -373,6 +398,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getMountPoint() { return $this->__call(__FUNCTION__, func_get_args()); } @@ -380,6 +406,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getOwner() { return $this->__call(__FUNCTION__, func_get_args()); } @@ -387,10 +414,12 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getChecksum() { return $this->__call(__FUNCTION__, func_get_args()); } + #[\Override] public function getExtension(): string { return $this->__call(__FUNCTION__, func_get_args()); } @@ -398,6 +427,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getFullPath($path) { if (isset($this->data['path'])) { $path = PathHelper::normalizePath($path); @@ -412,6 +442,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function isSubNode($node) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -421,6 +452,7 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } + #[\Override] public function nodeExists($path) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -428,6 +460,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function newFolder($path) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -435,6 +468,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function newFile($path, $content = null) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -442,6 +476,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function search($query) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -449,6 +484,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function searchByMime($mimetype) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -456,10 +492,12 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function searchByTag($tag, $userId) { return $this->__call(__FUNCTION__, func_get_args()); } + #[\Override] public function searchBySystemTag(string $tagName, string $userId, int $limit = 0, int $offset = 0) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -467,10 +505,12 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getById($id) { return $this->getRootFolder()->getByIdInPath((int)$id, $this->getPath()); } + #[\Override] public function getFirstNodeById(int $id): ?Node { return $this->getRootFolder()->getFirstNodeByIdInPath($id, $this->getPath()); } @@ -478,6 +518,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getFreeSpace() { return $this->__call(__FUNCTION__, func_get_args()); } @@ -485,6 +526,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function isCreatable() { return $this->__call(__FUNCTION__, func_get_args()); } @@ -492,6 +534,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getNonExistingName($filename) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -499,6 +542,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function move($targetPath) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -506,6 +550,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function lock($type) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -513,6 +558,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function changeLock($targetType) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -520,6 +566,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function unlock($type) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -527,6 +574,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getRecent($limit, $offset = 0) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -534,6 +582,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getCreationTime(): int { return $this->__call(__FUNCTION__, func_get_args()); } @@ -541,6 +590,7 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getUploadTime(): int { return $this->__call(__FUNCTION__, func_get_args()); } @@ -548,14 +598,17 @@ class LazyFolder implements Folder { /** * @inheritDoc */ + #[\Override] public function getLastActivity(): int { return $this->__call(__FUNCTION__, func_get_args()); } + #[\Override] public function getRelativePath($path) { return PathHelper::getRelativePath($this->getPath(), $path); } + #[\Override] public function getParentId(): int { if (isset($this->data['parent'])) { return $this->data['parent']; @@ -567,14 +620,17 @@ class LazyFolder implements Folder { * @inheritDoc * @return array */ + #[\Override] public function getMetadata(): array { return $this->data['metadata'] ?? $this->__call(__FUNCTION__, func_get_args()); } + #[\Override] public function getData(): ICacheEntry { return $this->__call(__FUNCTION__, func_get_args()); } + #[\Override] public function verifyPath($fileName, $readonly = false): void { $this->__call(__FUNCTION__, func_get_args()); } diff --git a/lib/private/Files/Node/LazyRoot.php b/lib/private/Files/Node/LazyRoot.php index 8920a2f68f6..cf1cd90245b 100644 --- a/lib/private/Files/Node/LazyRoot.php +++ b/lib/private/Files/Node/LazyRoot.php @@ -25,6 +25,7 @@ class LazyRoot extends LazyFolder implements IRootFolder { parent::__construct($this, $folderClosure, $data); } + #[\Override] protected function getRootFolder(): IRootFolder { $folder = $this->getRealFolder(); if (!$folder instanceof IRootFolder) { @@ -33,22 +34,27 @@ class LazyRoot extends LazyFolder implements IRootFolder { return $folder; } + #[\Override] public function getUserFolder($userId) { return $this->__call(__FUNCTION__, func_get_args()); } + #[\Override] public function getByIdInPath(int $id, string $path) { return $this->__call(__FUNCTION__, func_get_args()); } + #[\Override] public function getFirstNodeByIdInPath(int $id, string $path): ?INode { return $this->__call(__FUNCTION__, func_get_args()); } + #[\Override] public function getNodeFromCacheEntryAndMount(ICacheEntry $cacheEntry, IMountPoint $mountPoint): INode { return $this->getRootFolder()->getNodeFromCacheEntryAndMount($cacheEntry, $mountPoint); } + #[\Override] public function getAppDataDirectoryName(): string { return $this->__call(__FUNCTION__, func_get_args()); } diff --git a/lib/private/Files/Node/LazyUserFolder.php b/lib/private/Files/Node/LazyUserFolder.php index a75dd24391a..496d2be81a7 100644 --- a/lib/private/Files/Node/LazyUserFolder.php +++ b/lib/private/Files/Node/LazyUserFolder.php @@ -66,6 +66,7 @@ class LazyUserFolder extends LazyFolder { ); } + #[\Override] public function getMountPoint() { if ($this->folder !== null) { return $this->folder->getMountPoint(); diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php index 72050e97872..63e275d1f47 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -126,6 +126,7 @@ class Node implements INode { return ($this->getPermissions() & $permissions) === $permissions; } + #[\Override] public function delete() { } @@ -135,6 +136,7 @@ class Node implements INode { * @throws NotFoundException * @throws NotPermittedException */ + #[\Override] public function touch($mtime = null) { if ($this->checkPermissions(Constants::PERMISSION_UPDATE)) { $this->sendHooks(['preTouch']); @@ -151,6 +153,7 @@ class Node implements INode { } } + #[\Override] public function getStorage() { $storage = $this->getMountPoint()->getStorage(); if (!$storage) { @@ -162,6 +165,7 @@ class Node implements INode { /** * @return string */ + #[\Override] public function getPath() { return $this->path; } @@ -169,6 +173,7 @@ class Node implements INode { /** * @return string */ + #[\Override] public function getInternalPath() { return $this->getFileInfo(false)->getInternalPath(); } @@ -178,6 +183,7 @@ class Node implements INode { * @throws InvalidPathException * @throws NotFoundException */ + #[\Override] public function getId() { return $this->getFileInfo(false)->getId() ?? -1; } @@ -185,6 +191,7 @@ class Node implements INode { /** * @return array */ + #[\Override] public function stat() { return $this->view->stat($this->path); } @@ -194,6 +201,7 @@ class Node implements INode { * @throws InvalidPathException * @throws NotFoundException */ + #[\Override] public function getMTime() { return $this->getFileInfo()->getMTime(); } @@ -204,6 +212,7 @@ class Node implements INode { * @throws InvalidPathException * @throws NotFoundException */ + #[\Override] public function getSize($includeMounts = true): int|float { return $this->getFileInfo()->getSize($includeMounts); } @@ -213,6 +222,7 @@ class Node implements INode { * @throws InvalidPathException * @throws NotFoundException */ + #[\Override] public function getEtag() { return $this->getFileInfo()->getEtag(); } @@ -222,6 +232,7 @@ class Node implements INode { * @throws InvalidPathException * @throws NotFoundException */ + #[\Override] public function getPermissions() { return $this->getFileInfo(false)->getPermissions(); } @@ -231,6 +242,7 @@ class Node implements INode { * @throws InvalidPathException * @throws NotFoundException */ + #[\Override] public function isReadable() { return $this->getFileInfo(false)->isReadable(); } @@ -240,6 +252,7 @@ class Node implements INode { * @throws InvalidPathException * @throws NotFoundException */ + #[\Override] public function isUpdateable() { return $this->getFileInfo(false)->isUpdateable(); } @@ -249,6 +262,7 @@ class Node implements INode { * @throws InvalidPathException * @throws NotFoundException */ + #[\Override] public function isDeletable() { return $this->getFileInfo(false)->isDeletable(); } @@ -258,6 +272,7 @@ class Node implements INode { * @throws InvalidPathException * @throws NotFoundException */ + #[\Override] public function isShareable() { return $this->getFileInfo(false)->isShareable(); } @@ -267,10 +282,12 @@ class Node implements INode { * @throws InvalidPathException * @throws NotFoundException */ + #[\Override] public function isCreatable() { return $this->getFileInfo(false)->isCreatable(); } + #[\Override] public function getParent(): INode|IRootFolder { if ($this->parent === null) { $newPath = dirname($this->path); @@ -305,6 +322,7 @@ class Node implements INode { /** * @return string */ + #[\Override] public function getName() { return basename($this->path); } @@ -327,41 +345,51 @@ class Node implements INode { return Filesystem::isValidPath($path); } + #[\Override] public function isMounted() { return $this->getFileInfo(false)->isMounted(); } + #[\Override] public function isShared() { return $this->getFileInfo(false)->isShared(); } + #[\Override] public function getMimeType(): string { return $this->getFileInfo(false)->getMimetype(); } + #[\Override] public function getMimePart() { return $this->getFileInfo(false)->getMimePart(); } + #[\Override] public function getType() { return $this->getFileInfo(false)->getType(); } + #[\Override] public function isEncrypted() { return $this->getFileInfo(false)->isEncrypted(); } + #[\Override] public function getMountPoint() { return $this->getFileInfo(false)->getMountPoint(); } + #[\Override] public function getOwner() { return $this->getFileInfo(false)->getOwner(); } + #[\Override] public function getChecksum() { } + #[\Override] public function getExtension(): string { return $this->getFileInfo(false)->getExtension(); } @@ -370,6 +398,7 @@ class Node implements INode { * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE * @throws LockedException */ + #[\Override] public function lock($type) { $this->view->lockFile($this->path, $type); } @@ -378,6 +407,7 @@ class Node implements INode { * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE * @throws LockedException */ + #[\Override] public function changeLock($type) { $this->view->changeLock($this->path, $type); } @@ -386,6 +416,7 @@ class Node implements INode { * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE * @throws LockedException */ + #[\Override] public function unlock($type) { $this->view->unlockFile($this->path, $type); } @@ -397,6 +428,7 @@ class Node implements INode { * @throws NotFoundException * @throws NotPermittedException if copy not allowed or failed */ + #[\Override] public function copy($targetPath) { $targetPath = $this->normalizePath($targetPath); $parent = $this->root->get(dirname($targetPath)); @@ -424,6 +456,7 @@ class Node implements INode { * @throws NotPermittedException if move not allowed or failed * @throws LockedException */ + #[\Override] public function move($targetPath) { $targetPath = $this->normalizePath($targetPath); $parent = $this->root->get(dirname($targetPath)); @@ -463,18 +496,22 @@ class Node implements INode { } } + #[\Override] public function getCreationTime(): int { return $this->getFileInfo()->getCreationTime(); } + #[\Override] public function getUploadTime(): int { return $this->getFileInfo()->getUploadTime(); } + #[\Override] public function getLastActivity(): int { return $this->getFileInfo()->getLastActivity(); } + #[\Override] public function getParentId(): int { return $this->fileInfo->getParentId(); } @@ -483,10 +520,12 @@ class Node implements INode { * @inheritDoc * @return array */ + #[\Override] public function getMetadata(): array { return $this->fileInfo->getMetadata(); } + #[\Override] public function getData(): ICacheEntry { return $this->fileInfo->getData(); } diff --git a/lib/private/Files/Node/NonExistingFile.php b/lib/private/Files/Node/NonExistingFile.php index 7fb375b941a..356ba5e4785 100644 --- a/lib/private/Files/Node/NonExistingFile.php +++ b/lib/private/Files/Node/NonExistingFile.php @@ -18,18 +18,22 @@ class NonExistingFile extends File { throw new NotFoundException(); } + #[\Override] public function delete() { throw new NotFoundException(); } + #[\Override] public function copy($targetPath) { throw new NotFoundException(); } + #[\Override] public function touch($mtime = null) { throw new NotFoundException(); } + #[\Override] public function getId() { if ($this->fileInfo) { return parent::getId(); @@ -38,6 +42,7 @@ class NonExistingFile extends File { } } + #[\Override] public function getInternalPath() { if ($this->fileInfo) { return parent::getInternalPath(); @@ -46,10 +51,12 @@ class NonExistingFile extends File { } } + #[\Override] public function stat() { throw new NotFoundException(); } + #[\Override] public function getMTime() { if ($this->fileInfo) { return parent::getMTime(); @@ -58,6 +65,7 @@ class NonExistingFile extends File { } } + #[\Override] public function getSize($includeMounts = true): int|float { if ($this->fileInfo) { return parent::getSize($includeMounts); @@ -66,6 +74,7 @@ class NonExistingFile extends File { } } + #[\Override] public function getEtag() { if ($this->fileInfo) { return parent::getEtag(); @@ -74,6 +83,7 @@ class NonExistingFile extends File { } } + #[\Override] public function getPermissions() { if ($this->fileInfo) { return parent::getPermissions(); @@ -82,6 +92,7 @@ class NonExistingFile extends File { } } + #[\Override] public function isReadable() { if ($this->fileInfo) { return parent::isReadable(); @@ -90,6 +101,7 @@ class NonExistingFile extends File { } } + #[\Override] public function isUpdateable() { if ($this->fileInfo) { return parent::isUpdateable(); @@ -98,6 +110,7 @@ class NonExistingFile extends File { } } + #[\Override] public function isDeletable() { if ($this->fileInfo) { return parent::isDeletable(); @@ -106,6 +119,7 @@ class NonExistingFile extends File { } } + #[\Override] public function isShareable() { if ($this->fileInfo) { return parent::isShareable(); @@ -114,14 +128,17 @@ class NonExistingFile extends File { } } + #[\Override] public function getContent() { throw new NotFoundException(); } + #[\Override] public function putContent($data) { throw new NotFoundException(); } + #[\Override] public function getMimeType(): string { if ($this->fileInfo) { return parent::getMimeType(); @@ -130,6 +147,7 @@ class NonExistingFile extends File { } } + #[\Override] public function fopen($mode) { throw new NotFoundException(); } diff --git a/lib/private/Files/Node/NonExistingFolder.php b/lib/private/Files/Node/NonExistingFolder.php index 9e6638376cd..487170c98fa 100644 --- a/lib/private/Files/Node/NonExistingFolder.php +++ b/lib/private/Files/Node/NonExistingFolder.php @@ -20,18 +20,22 @@ class NonExistingFolder extends Folder { throw new NotFoundException(); } + #[\Override] public function delete() { throw new NotFoundException(); } + #[\Override] public function copy($targetPath) { throw new NotFoundException(); } + #[\Override] public function touch($mtime = null) { throw new NotFoundException(); } + #[\Override] public function getId() { if ($this->fileInfo) { return parent::getId(); @@ -40,6 +44,7 @@ class NonExistingFolder extends Folder { } } + #[\Override] public function getInternalPath() { if ($this->fileInfo) { return parent::getInternalPath(); @@ -48,10 +53,12 @@ class NonExistingFolder extends Folder { } } + #[\Override] public function stat() { throw new NotFoundException(); } + #[\Override] public function getMTime() { if ($this->fileInfo) { return parent::getMTime(); @@ -60,6 +67,7 @@ class NonExistingFolder extends Folder { } } + #[\Override] public function getSize($includeMounts = true): int|float { if ($this->fileInfo) { return parent::getSize($includeMounts); @@ -68,6 +76,7 @@ class NonExistingFolder extends Folder { } } + #[\Override] public function getEtag() { if ($this->fileInfo) { return parent::getEtag(); @@ -76,6 +85,7 @@ class NonExistingFolder extends Folder { } } + #[\Override] public function getPermissions() { if ($this->fileInfo) { return parent::getPermissions(); @@ -84,6 +94,7 @@ class NonExistingFolder extends Folder { } } + #[\Override] public function isReadable() { if ($this->fileInfo) { return parent::isReadable(); @@ -92,6 +103,7 @@ class NonExistingFolder extends Folder { } } + #[\Override] public function isUpdateable() { if ($this->fileInfo) { return parent::isUpdateable(); @@ -100,6 +112,7 @@ class NonExistingFolder extends Folder { } } + #[\Override] public function isDeletable() { if ($this->fileInfo) { return parent::isDeletable(); @@ -108,6 +121,7 @@ class NonExistingFolder extends Folder { } } + #[\Override] public function isShareable() { if ($this->fileInfo) { return parent::isShareable(); @@ -116,6 +130,7 @@ class NonExistingFolder extends Folder { } } + #[\Override] public function get($path) { throw new NotFoundException(); } @@ -125,46 +140,57 @@ class NonExistingFolder extends Folder { throw new NotFoundException(); } + #[\Override] public function nodeExists($path) { return false; } + #[\Override] public function newFolder($path) { throw new NotFoundException(); } + #[\Override] public function newFile($path, $content = null) { throw new NotFoundException(); } + #[\Override] public function search($query) { throw new NotFoundException(); } + #[\Override] public function searchByMime($mimetype) { throw new NotFoundException(); } + #[\Override] public function searchByTag($tag, $userId) { throw new NotFoundException(); } + #[\Override] public function searchBySystemTag(string $tagName, string $userId, int $limit = 0, int $offset = 0): array { throw new NotFoundException(); } + #[\Override] public function getById($id) { throw new NotFoundException(); } + #[\Override] public function getFirstNodeById(int $id): ?Node { throw new NotFoundException(); } + #[\Override] public function getFreeSpace() { throw new NotFoundException(); } + #[\Override] public function isCreatable() { if ($this->fileInfo) { return parent::isCreatable(); diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php index 0c121dc8b05..095db425ed6 100644 --- a/lib/private/Files/Node/Root.php +++ b/lib/private/Files/Node/Root.php @@ -97,6 +97,7 @@ class Root extends Folder implements IRootFolder { * @param string $method * @param callable $callback */ + #[\Override] public function listen($scope, $method, callable $callback) { $this->emitter->listen($scope, $method, $callback); } @@ -106,6 +107,7 @@ class Root extends Folder implements IRootFolder { * @param string $method optional * @param callable $callback optional */ + #[\Override] public function removeListener($scope = null, $method = null, ?callable $callback = null) { $this->emitter->removeListener($scope, $method, $callback); } @@ -129,6 +131,7 @@ class Root extends Folder implements IRootFolder { $this->mountManager->addMount($mount); } + #[\Override] public function getMount(string $mountPoint): IMountPoint { return $this->mountManager->find($mountPoint); } @@ -137,10 +140,12 @@ class Root extends Folder implements IRootFolder { * @param string $mountPoint * @return IMountPoint[] */ + #[\Override] public function getMountsIn(string $mountPoint): array { return $this->mountManager->findIn($mountPoint); } + #[\Override] public function get($path) { $path = $this->normalizePath($path); if ($this->isValidPath($path)) { @@ -167,6 +172,7 @@ class Root extends Folder implements IRootFolder { throw new NotPermittedException(); } + #[\Override] public function delete() { throw new NotPermittedException(); } @@ -176,6 +182,7 @@ class Root extends Folder implements IRootFolder { * @return Node * @throws \OCP\Files\NotPermittedException */ + #[\Override] public function copy($targetPath) { throw new NotPermittedException(); } @@ -184,6 +191,7 @@ class Root extends Folder implements IRootFolder { * @param int $mtime * @throws \OCP\Files\NotPermittedException */ + #[\Override] public function touch($mtime = null) { throw new NotPermittedException(); } @@ -192,6 +200,7 @@ class Root extends Folder implements IRootFolder { * @return Storage * @throws \OCP\Files\NotFoundException */ + #[\Override] public function getStorage() { throw new NotFoundException(); } @@ -199,6 +208,7 @@ class Root extends Folder implements IRootFolder { /** * @return string */ + #[\Override] public function getPath() { return '/'; } @@ -206,6 +216,7 @@ class Root extends Folder implements IRootFolder { /** * @return string */ + #[\Override] public function getInternalPath() { return ''; } @@ -213,6 +224,7 @@ class Root extends Folder implements IRootFolder { /** * @return int */ + #[\Override] public function getId() { return 0; } @@ -220,6 +232,7 @@ class Root extends Folder implements IRootFolder { /** * @return array */ + #[\Override] public function stat() { return []; } @@ -227,6 +240,7 @@ class Root extends Folder implements IRootFolder { /** * @return int */ + #[\Override] public function getMTime() { return 0; } @@ -235,6 +249,7 @@ class Root extends Folder implements IRootFolder { * @param bool $includeMounts * @return int|float */ + #[\Override] public function getSize($includeMounts = true): int|float { return 0; } @@ -242,6 +257,7 @@ class Root extends Folder implements IRootFolder { /** * @return string */ + #[\Override] public function getEtag() { return ''; } @@ -249,6 +265,7 @@ class Root extends Folder implements IRootFolder { /** * @return int */ + #[\Override] public function getPermissions() { return Constants::PERMISSION_CREATE; } @@ -256,6 +273,7 @@ class Root extends Folder implements IRootFolder { /** * @return bool */ + #[\Override] public function isReadable() { return false; } @@ -263,6 +281,7 @@ class Root extends Folder implements IRootFolder { /** * @return bool */ + #[\Override] public function isUpdateable() { return false; } @@ -270,6 +289,7 @@ class Root extends Folder implements IRootFolder { /** * @return bool */ + #[\Override] public function isDeletable() { return false; } @@ -277,6 +297,7 @@ class Root extends Folder implements IRootFolder { /** * @return bool */ + #[\Override] public function isShareable() { return false; } @@ -284,6 +305,7 @@ class Root extends Folder implements IRootFolder { /** * @throws \OCP\Files\NotFoundException */ + #[\Override] public function getParent(): INode|IRootFolder { throw new NotFoundException(); } @@ -291,6 +313,7 @@ class Root extends Folder implements IRootFolder { /** * @return string */ + #[\Override] public function getName() { return ''; } @@ -303,6 +326,7 @@ class Root extends Folder implements IRootFolder { * @throws NoUserException * @throws NotPermittedException */ + #[\Override] public function getUserFolder($userId) { $userObject = $this->userManager->get($userId); @@ -350,6 +374,7 @@ class Root extends Folder implements IRootFolder { return $this->userMountCache; } + #[\Override] public function getFirstNodeByIdInPath(int $id, string $path): ?INode { // scope the cache by user, so we don't return nodes for different users if ($this->user) { @@ -382,6 +407,7 @@ class Root extends Folder implements IRootFolder { /** * @return INode[] */ + #[\Override] public function getByIdInPath(int $id, string $path): array { $mountCache = $this->getUserMountCache(); $setupManager = $this->mountManager->getSetupManager(); @@ -492,6 +518,7 @@ class Root extends Folder implements IRootFolder { return $folders; } + #[\Override] public function getNodeFromCacheEntryAndMount(ICacheEntry $cacheEntry, IMountPoint $mountPoint): INode { $path = $cacheEntry->getPath(); $fullPath = $mountPoint->getMountPoint() . $path; diff --git a/lib/private/Files/Notify/Change.php b/lib/private/Files/Notify/Change.php index 445b978746a..422b39356e0 100644 --- a/lib/private/Files/Notify/Change.php +++ b/lib/private/Files/Notify/Change.php @@ -25,6 +25,7 @@ class Change implements IChange { * * @return IChange::ADDED|IChange::REMOVED|IChange::MODIFIED|IChange::RENAMED */ + #[\Override] public function getType(): int { return $this->type; } @@ -34,6 +35,7 @@ class Change implements IChange { * * Note, for rename changes this path is the old path for the file */ + #[\Override] public function getPath(): string { return $this->path; } diff --git a/lib/private/Files/Notify/RenameChange.php b/lib/private/Files/Notify/RenameChange.php index bb5c17d7cbc..d7dfde93118 100644 --- a/lib/private/Files/Notify/RenameChange.php +++ b/lib/private/Files/Notify/RenameChange.php @@ -26,6 +26,7 @@ class RenameChange extends Change implements IRenameChange { /** * Get the new path of the renamed file relative to the storage root */ + #[\Override] public function getTargetPath(): string { return $this->targetPath; } diff --git a/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php b/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php index aaaee044bac..090c81cfe62 100644 --- a/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php @@ -23,6 +23,7 @@ class AppdataPreviewObjectStoreStorage extends ObjectStoreStorage { parent::__construct($parameters); } + #[\Override] public function getId(): string { return 'object::appdata::preview:' . $this->internalId; } diff --git a/lib/private/Files/ObjectStore/Azure.php b/lib/private/Files/ObjectStore/Azure.php index 4e7b0c51678..75add59f4ee 100644 --- a/lib/private/Files/ObjectStore/Azure.php +++ b/lib/private/Files/ObjectStore/Azure.php @@ -70,6 +70,7 @@ class Azure implements IObjectStore { /** * @return string the container or bucket name where objects are stored */ + #[\Override] public function getStorageId() { return 'azure::blob::' . $this->containerName; } @@ -79,11 +80,13 @@ class Azure implements IObjectStore { * @return resource stream with the read data * @throws \Exception when something goes wrong, message will be logged */ + #[\Override] public function readObject($urn) { $blob = $this->getBlobClient()->getBlob($this->containerName, $urn); return $blob->getContentStream(); } + #[\Override] public function writeObject($urn, $stream, ?string $mimetype = null) { $options = new CreateBlockBlobOptions(); if ($mimetype) { @@ -97,10 +100,12 @@ class Azure implements IObjectStore { * @return void * @throws \Exception when something goes wrong, message will be logged */ + #[\Override] public function deleteObject($urn) { $this->getBlobClient()->deleteBlob($this->containerName, $urn); } + #[\Override] public function objectExists($urn) { try { $this->getBlobClient()->getBlobMetadata($this->containerName, $urn); @@ -114,10 +119,12 @@ class Azure implements IObjectStore { } } + #[\Override] public function copyObject($from, $to) { $this->getBlobClient()->copyBlob($this->containerName, $to, $this->containerName, $from); } + #[\Override] public function preSignedUrl(string $urn, \DateTimeInterface $expiration): ?string { return null; } diff --git a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php index 4e2d10705fe..d157f86f5ae 100644 --- a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php @@ -28,14 +28,17 @@ class HomeObjectStoreStorage extends ObjectStoreStorage implements IHomeStorage parent::__construct($parameters); } + #[\Override] public function getId(): string { return 'object::user:' . $this->user->getUID(); } + #[\Override] public function getOwner(string $path): string|false { return $this->user->getUID(); } + #[\Override] public function getUser(): IUser { return $this->user; } diff --git a/lib/private/Files/ObjectStore/ObjectStoreScanner.php b/lib/private/Files/ObjectStore/ObjectStoreScanner.php index a31947ec8ae..19ac35de3ce 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreScanner.php +++ b/lib/private/Files/ObjectStore/ObjectStoreScanner.php @@ -12,18 +12,22 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\FileInfo; class ObjectStoreScanner extends Scanner { + #[\Override] public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) { return null; } + #[\Override] public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) { return null; } + #[\Override] protected function scanChildren(string $path, $recursive, int $reuse, int $folderId, bool $lock, int|float $oldSize, &$etagChanged = false) { return 0; } + #[\Override] public function backgroundScan() { $lastPath = null; // find any path marked as unscanned and run the scanner until no more paths are unscanned (or we get stuck) diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 943e6d39ffb..bd69fa7926e 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -76,6 +76,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { $this->logger = Server::get(LoggerInterface::class); } + #[\Override] public function mkdir(string $path, bool $force = false, array $metadata = []): bool { $path = $this->normalizePath($path); if (!$force && $this->file_exists($path)) { @@ -138,6 +139,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { * Object Stores use a NoopScanner because metadata is directly stored in * the file cache and cannot really scan the filesystem. The storage passed in is not used anywhere. */ + #[\Override] public function getScanner(string $path = '', ?IStorage $storage = null): IScanner { if (!$storage) { $storage = $this; @@ -149,10 +151,12 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { return $this->scanner; } + #[\Override] public function getId(): string { return $this->id; } + #[\Override] public function rmdir(string $path): bool { $path = $this->normalizePath($path); $entry = $this->getCache()->get($path); @@ -185,6 +189,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { return true; } + #[\Override] public function unlink(string $path): bool { $path = $this->normalizePath($path); $entry = $this->getCache()->get($path); @@ -221,6 +226,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { return true; } + #[\Override] public function stat(string $path): array|false { $path = $this->normalizePath($path); $cacheEntry = $this->getCache()->get($path); @@ -238,6 +244,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { } } + #[\Override] public function getPermissions(string $path): int { $stat = $this->stat($path); @@ -259,6 +266,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { return $this->objectPrefix . $fileId; } + #[\Override] public function opendir(string $path) { $path = $this->normalizePath($path); @@ -276,6 +284,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { } } + #[\Override] public function filetype(string $path): string|false { $path = $this->normalizePath($path); $stat = $this->stat($path); @@ -289,6 +298,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { } } + #[\Override] public function fopen(string $path, string $mode) { $path = $this->normalizePath($path); @@ -381,11 +391,13 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { return false; } + #[\Override] public function file_exists(string $path): bool { $path = $this->normalizePath($path); return (bool)$this->stat($path); } + #[\Override] public function rename(string $source, string $target): bool { $source = $this->normalizePath($source); $target = $this->normalizePath($target); @@ -395,11 +407,13 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { return true; } + #[\Override] public function getMimeType(string $path): string|false { $path = $this->normalizePath($path); return parent::getMimeType($path); } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { if (is_null($mtime)) { $mtime = time(); @@ -441,14 +455,17 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { $this->writeStream($path, fopen($tmpFile, 'r'), $size); } + #[\Override] public function hasUpdated(string $path, int $time): bool { return false; } + #[\Override] public function needsPartFile(): bool { return false; } + #[\Override] public function file_put_contents(string $path, mixed $data): int { $fh = fopen('php://temp', 'w+'); fwrite($fh, $data); @@ -456,6 +473,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { return $this->writeStream($path, $fh, strlen($data)); } + #[\Override] public function writeStream(string $path, $stream, ?int $size = null): int { if ($size === null) { $stats = fstat($stream); @@ -575,6 +593,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { return $this->objectStore; } + #[\Override] public function copyFromStorage( IStorage $sourceStorage, string $sourceInternalPath, @@ -601,6 +620,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { return parent::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } + #[\Override] public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, ?ICacheEntry $sourceCacheEntry = null): bool { $sourceCache = $sourceStorage->getCache(); if ( @@ -684,6 +704,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { } } + #[\Override] public function copy(string $source, string $target): bool { $source = $this->normalizePath($source); $target = $this->normalizePath($target); @@ -738,6 +759,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { } } + #[\Override] public function startChunkedWrite(string $targetPath): string { if (!$this->objectStore instanceof IObjectStoreMultiPartUpload) { throw new GenericFileException('Object store does not support multipart upload'); @@ -750,6 +772,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { /** * @throws GenericFileException */ + #[\Override] public function putChunkedWritePart( string $targetPath, string $writeToken, @@ -773,6 +796,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { return $parts[$chunkId]; } + #[\Override] public function completeChunkedWrite(string $targetPath, string $writeToken): int { if (!$this->objectStore instanceof IObjectStoreMultiPartUpload) { throw new GenericFileException('Object store does not support multipart upload'); @@ -806,6 +830,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { return $size; } + #[\Override] public function cancelChunkedWrite(string $targetPath, string $writeToken): void { if (!$this->objectStore instanceof IObjectStoreMultiPartUpload) { throw new GenericFileException('Object store does not support multipart upload'); @@ -819,6 +844,7 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { $this->preserveCacheItemsOnDelete = $preserve; } + #[\Override] public function free_space(string $path): int|float|false { if ($this->totalSizeLimit === null) { return FileInfo::SPACE_UNLIMITED; diff --git a/lib/private/Files/ObjectStore/S3.php b/lib/private/Files/ObjectStore/S3.php index 80eee35f395..eeacfa3fca6 100644 --- a/lib/private/Files/ObjectStore/S3.php +++ b/lib/private/Files/ObjectStore/S3.php @@ -26,10 +26,12 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload, IObjectStoreMetaD * @return string the container or bucket name where objects are stored * @since 7.0.0 */ + #[\Override] public function getStorageId() { return $this->id; } + #[\Override] public function initiateMultipartUpload(string $urn): string { $upload = $this->getConnection()->createMultipartUpload([ 'Bucket' => $this->bucket, @@ -42,6 +44,7 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload, IObjectStoreMetaD return (string)$uploadId; } + #[\Override] public function uploadMultipartPart(string $urn, string $uploadId, int $partId, $stream, $size): Result { return $this->getConnection()->uploadPart([ 'Body' => $stream, @@ -53,6 +56,7 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload, IObjectStoreMetaD ] + $this->getServerSideEncryptionParameters()); } + #[\Override] public function getMultipartUploads(string $urn, string $uploadId): array { $parts = []; $isTruncated = true; @@ -74,6 +78,7 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload, IObjectStoreMetaD return $parts; } + #[\Override] public function completeMultipartUpload(string $urn, string $uploadId, array $result): int { $this->getConnection()->completeMultipartUpload([ 'Bucket' => $this->bucket, @@ -88,6 +93,7 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload, IObjectStoreMetaD return (int)$stat->get('ContentLength'); } + #[\Override] public function abortMultipartUpload($urn, $uploadId): void { $this->getConnection()->abortMultipartUpload([ 'Bucket' => $this->bucket, @@ -109,6 +115,7 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload, IObjectStoreMetaD return $result; } + #[\Override] public function getObjectMetaData(string $urn): array { $object = $this->getConnection()->headObject([ 'Bucket' => $this->bucket, @@ -121,6 +128,7 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload, IObjectStoreMetaD ] + $this->parseS3Metadata($object['Metadata'] ?? []); } + #[\Override] public function listObjects(string $prefix = ''): \Iterator { $results = $this->getConnection()->getPaginator('ListObjectsV2', [ 'Bucket' => $this->bucket, diff --git a/lib/private/Files/ObjectStore/S3Signature.php b/lib/private/Files/ObjectStore/S3Signature.php index b80382ff67d..47b3cf8e7f5 100644 --- a/lib/private/Files/ObjectStore/S3Signature.php +++ b/lib/private/Files/ObjectStore/S3Signature.php @@ -40,6 +40,7 @@ class S3Signature implements SignatureInterface { sort($this->signableQueryString); } + #[\Override] public function signRequest( RequestInterface $request, CredentialsInterface $credentials, @@ -53,6 +54,7 @@ class S3Signature implements SignatureInterface { return $request->withHeader('Authorization', $auth); } + #[\Override] public function presign( RequestInterface $request, CredentialsInterface $credentials, diff --git a/lib/private/Files/ObjectStore/StorageObjectStore.php b/lib/private/Files/ObjectStore/StorageObjectStore.php index f170116a3a6..0e8b54a6843 100644 --- a/lib/private/Files/ObjectStore/StorageObjectStore.php +++ b/lib/private/Files/ObjectStore/StorageObjectStore.php @@ -23,6 +23,7 @@ class StorageObjectStore implements IObjectStore { * @return string the container or bucket name where objects are stored * @since 7.0.0 */ + #[\Override] public function getStorageId(): string { return $this->storage->getId(); } @@ -33,6 +34,7 @@ class StorageObjectStore implements IObjectStore { * @throws \Exception when something goes wrong, message will be logged * @since 7.0.0 */ + #[\Override] public function readObject($urn) { $handle = $this->storage->fopen($urn, 'r'); if (is_resource($handle)) { @@ -42,6 +44,7 @@ class StorageObjectStore implements IObjectStore { throw new \Exception(); } + #[\Override] public function writeObject($urn, $stream, ?string $mimetype = null) { $handle = $this->storage->fopen($urn, 'w'); if ($handle) { @@ -58,18 +61,22 @@ class StorageObjectStore implements IObjectStore { * @throws \Exception when something goes wrong, message will be logged * @since 7.0.0 */ + #[\Override] public function deleteObject($urn) { $this->storage->unlink($urn); } + #[\Override] public function objectExists($urn) { return $this->storage->file_exists($urn); } + #[\Override] public function copyObject($from, $to) { $this->storage->copy($from, $to); } + #[\Override] public function preSignedUrl(string $urn, \DateTimeInterface $expiration): ?string { return null; } diff --git a/lib/private/Files/ObjectStore/Swift.php b/lib/private/Files/ObjectStore/Swift.php index b1fb7e520db..288af35bbaf 100644 --- a/lib/private/Files/ObjectStore/Swift.php +++ b/lib/private/Files/ObjectStore/Swift.php @@ -52,6 +52,7 @@ class Swift implements IObjectStore { /** * @return string the container name where objects are stored */ + #[\Override] public function getStorageId() { if (isset($this->params['bucket'])) { return $this->params['bucket']; @@ -60,6 +61,7 @@ class Swift implements IObjectStore { return $this->params['container']; } + #[\Override] public function writeObject($urn, $stream, ?string $mimetype = null) { $tmpFile = Server::get(ITempManager::class)->getTemporaryFile('swiftwrite'); file_put_contents($tmpFile, $stream); @@ -87,6 +89,7 @@ class Swift implements IObjectStore { * @throws \Exception from openstack or GuzzleHttp libs when something goes wrong * @throws NotFoundException if file does not exist */ + #[\Override] public function readObject($urn) { try { $publicUri = $this->getContainer()->getObject($urn)->getPublicUri(); @@ -117,6 +120,7 @@ class Swift implements IObjectStore { * @return void * @throws \Exception from openstack lib when something goes wrong */ + #[\Override] public function deleteObject($urn) { $this->getContainer()->getObject($urn)->delete(); } @@ -129,15 +133,18 @@ class Swift implements IObjectStore { $this->getContainer()->delete(); } + #[\Override] public function objectExists($urn) { return $this->getContainer()->objectExists($urn); } + #[\Override] public function copyObject($from, $to) { $this->getContainer()->getObject($from)->copy([ 'destination' => $this->getContainer()->name . '/' . $to ]); } + #[\Override] public function preSignedUrl(string $urn, \DateTimeInterface $expiration): ?string { return null; } diff --git a/lib/private/Files/ObjectStore/SwiftV2CachingAuthService.php b/lib/private/Files/ObjectStore/SwiftV2CachingAuthService.php index 266781af142..7ffd728a922 100644 --- a/lib/private/Files/ObjectStore/SwiftV2CachingAuthService.php +++ b/lib/private/Files/ObjectStore/SwiftV2CachingAuthService.php @@ -12,6 +12,7 @@ use OpenStack\Common\Auth\Token; use OpenStack\Identity\v2\Service; class SwiftV2CachingAuthService extends Service { + #[\Override] public function authenticate(array $options = []): array { if (isset($options['v2cachedToken'], $options['v2serviceUrl']) && $options['v2cachedToken'] instanceof Token diff --git a/lib/private/Files/Search/QueryOptimizer/FlattenNestedBool.php b/lib/private/Files/Search/QueryOptimizer/FlattenNestedBool.php index bb7bef2ed63..b4f3258709f 100644 --- a/lib/private/Files/Search/QueryOptimizer/FlattenNestedBool.php +++ b/lib/private/Files/Search/QueryOptimizer/FlattenNestedBool.php @@ -11,6 +11,7 @@ use OCP\Files\Search\ISearchBinaryOperator; use OCP\Files\Search\ISearchOperator; class FlattenNestedBool extends QueryOptimizerStep { + #[\Override] public function processOperator(ISearchOperator &$operator) { if ( $operator instanceof SearchBinaryOperator && ( diff --git a/lib/private/Files/Search/QueryOptimizer/FlattenSingleArgumentBinaryOperation.php b/lib/private/Files/Search/QueryOptimizer/FlattenSingleArgumentBinaryOperation.php index 7e99c04f197..6c2e443f232 100644 --- a/lib/private/Files/Search/QueryOptimizer/FlattenSingleArgumentBinaryOperation.php +++ b/lib/private/Files/Search/QueryOptimizer/FlattenSingleArgumentBinaryOperation.php @@ -13,6 +13,7 @@ use OCP\Files\Search\ISearchOperator; * replace single argument AND and OR operations with their single argument */ class FlattenSingleArgumentBinaryOperation extends ReplacingOptimizerStep { + #[\Override] public function processOperator(ISearchOperator &$operator): bool { parent::processOperator($operator); if ( diff --git a/lib/private/Files/Search/QueryOptimizer/MergeDistributiveOperations.php b/lib/private/Files/Search/QueryOptimizer/MergeDistributiveOperations.php index 4949ca7396b..74ce9fea93a 100644 --- a/lib/private/Files/Search/QueryOptimizer/MergeDistributiveOperations.php +++ b/lib/private/Files/Search/QueryOptimizer/MergeDistributiveOperations.php @@ -21,6 +21,7 @@ use OCP\Files\Search\ISearchOperator; * [1]: https://en.wikipedia.org/wiki/Distributive_property */ class MergeDistributiveOperations extends ReplacingOptimizerStep { + #[\Override] public function processOperator(ISearchOperator &$operator): bool { if ($operator instanceof SearchBinaryOperator) { // either 'AND' or 'OR' diff --git a/lib/private/Files/Search/QueryOptimizer/OrEqualsToIn.php b/lib/private/Files/Search/QueryOptimizer/OrEqualsToIn.php index 6df35c9c9a2..6fbada1d5a1 100644 --- a/lib/private/Files/Search/QueryOptimizer/OrEqualsToIn.php +++ b/lib/private/Files/Search/QueryOptimizer/OrEqualsToIn.php @@ -16,6 +16,7 @@ use OCP\Files\Search\ISearchOperator; * transform (field == A OR field == B ...) into field IN (A, B, ...) */ class OrEqualsToIn extends ReplacingOptimizerStep { + #[\Override] public function processOperator(ISearchOperator &$operator): bool { if ( $operator instanceof ISearchBinaryOperator diff --git a/lib/private/Files/Search/QueryOptimizer/PathPrefixOptimizer.php b/lib/private/Files/Search/QueryOptimizer/PathPrefixOptimizer.php index 5e874aa159f..84022c2f71a 100644 --- a/lib/private/Files/Search/QueryOptimizer/PathPrefixOptimizer.php +++ b/lib/private/Files/Search/QueryOptimizer/PathPrefixOptimizer.php @@ -15,6 +15,7 @@ use OCP\Files\Search\ISearchOperator; class PathPrefixOptimizer extends QueryOptimizerStep { private bool $useHashEq = true; + #[\Override] public function inspectOperator(ISearchOperator $operator): void { // normally any `path = "$path"` search filter would be generated as an `path_hash = md5($path)` sql query // since the `path_hash` sql column usually provides much faster querying that selecting on the `path` sql column @@ -31,6 +32,7 @@ class PathPrefixOptimizer extends QueryOptimizerStep { parent::inspectOperator($operator); } + #[\Override] public function processOperator(ISearchOperator &$operator) { if (!$this->useHashEq && $operator instanceof ISearchComparison && !$operator->getExtra() && $operator->getField() === 'path' && $operator->getType() === ISearchComparison::COMPARE_EQUAL) { $operator->setQueryHint(ISearchComparison::HINT_PATH_EQ_HASH, false); diff --git a/lib/private/Files/Search/QueryOptimizer/ReplacingOptimizerStep.php b/lib/private/Files/Search/QueryOptimizer/ReplacingOptimizerStep.php index a9c9ba876bc..562ed4aa915 100644 --- a/lib/private/Files/Search/QueryOptimizer/ReplacingOptimizerStep.php +++ b/lib/private/Files/Search/QueryOptimizer/ReplacingOptimizerStep.php @@ -19,6 +19,7 @@ class ReplacingOptimizerStep extends QueryOptimizerStep { * * Returns true if the reference $operator points to a new value */ + #[\Override] public function processOperator(ISearchOperator &$operator): bool { if ($operator instanceof SearchBinaryOperator) { $modified = false; diff --git a/lib/private/Files/Search/QueryOptimizer/SplitLargeIn.php b/lib/private/Files/Search/QueryOptimizer/SplitLargeIn.php index 8aee1975708..660138f9d83 100644 --- a/lib/private/Files/Search/QueryOptimizer/SplitLargeIn.php +++ b/lib/private/Files/Search/QueryOptimizer/SplitLargeIn.php @@ -16,6 +16,7 @@ use OCP\Files\Search\ISearchOperator; * transform IN (1000+ element) into (IN (1000 elements) OR IN(...)) */ class SplitLargeIn extends ReplacingOptimizerStep { + #[\Override] public function processOperator(ISearchOperator &$operator): bool { if ( $operator instanceof ISearchComparison diff --git a/lib/private/Files/Search/SearchBinaryOperator.php b/lib/private/Files/Search/SearchBinaryOperator.php index ba8caa10cb8..95d222474d7 100644 --- a/lib/private/Files/Search/SearchBinaryOperator.php +++ b/lib/private/Files/Search/SearchBinaryOperator.php @@ -29,6 +29,7 @@ class SearchBinaryOperator implements ISearchBinaryOperator { /** * @return string */ + #[\Override] public function getType() { return $this->type; } @@ -36,6 +37,7 @@ class SearchBinaryOperator implements ISearchBinaryOperator { /** * @return ISearchOperator[] */ + #[\Override] public function getArguments() { return $this->arguments; } @@ -48,10 +50,12 @@ class SearchBinaryOperator implements ISearchBinaryOperator { $this->arguments = $arguments; } + #[\Override] public function getQueryHint(string $name, $default) { return $this->hints[$name] ?? $default; } + #[\Override] public function setQueryHint(string $name, $value): void { $this->hints[$name] = $value; } diff --git a/lib/private/Files/Search/SearchComparison.php b/lib/private/Files/Search/SearchComparison.php index c1f0176afd9..f3ebfa64858 100644 --- a/lib/private/Files/Search/SearchComparison.php +++ b/lib/private/Files/Search/SearchComparison.php @@ -27,6 +27,7 @@ class SearchComparison implements ISearchComparison { /** * @return string */ + #[\Override] public function getType(): string { return $this->type; } @@ -34,10 +35,12 @@ class SearchComparison implements ISearchComparison { /** * @return string */ + #[\Override] public function getField(): string { return $this->field; } + #[\Override] public function getValue(): string|int|bool|\DateTime|array { return $this->value; } @@ -46,14 +49,17 @@ class SearchComparison implements ISearchComparison { * @return string * @since 28.0.0 */ + #[\Override] public function getExtra(): string { return $this->extra; } + #[\Override] public function getQueryHint(string $name, $default) { return $this->hints[$name] ?? $default; } + #[\Override] public function setQueryHint(string $name, $value): void { $this->hints[$name] = $value; } diff --git a/lib/private/Files/Search/SearchOrder.php b/lib/private/Files/Search/SearchOrder.php index ce4a3211416..3c79e641512 100644 --- a/lib/private/Files/Search/SearchOrder.php +++ b/lib/private/Files/Search/SearchOrder.php @@ -22,6 +22,7 @@ class SearchOrder implements ISearchOrder { /** * @return string */ + #[\Override] public function getDirection(): string { return $this->direction; } @@ -29,6 +30,7 @@ class SearchOrder implements ISearchOrder { /** * @return string */ + #[\Override] public function getField(): string { return $this->field; } @@ -37,10 +39,12 @@ class SearchOrder implements ISearchOrder { * @return string * @since 28.0.0 */ + #[\Override] public function getExtra(): string { return $this->extra; } + #[\Override] public function sortFileInfo(FileInfo $a, FileInfo $b): int { $cmp = $this->sortFileInfoNoDirection($a, $b); return $cmp * ($this->direction === ISearchOrder::DIRECTION_ASCENDING ? 1 : -1); diff --git a/lib/private/Files/Search/SearchQuery.php b/lib/private/Files/Search/SearchQuery.php index 1c38c1ef162..ecefe02205a 100644 --- a/lib/private/Files/Search/SearchQuery.php +++ b/lib/private/Files/Search/SearchQuery.php @@ -27,14 +27,17 @@ class SearchQuery implements ISearchQuery { ) { } + #[\Override] public function getSearchOperation(): ISearchOperator { return $this->searchOperation; } + #[\Override] public function getLimit(): int { return $this->limit; } + #[\Override] public function getOffset(): int { return $this->offset; } @@ -42,14 +45,17 @@ class SearchQuery implements ISearchQuery { /** * @return ISearchOrder[] */ + #[\Override] public function getOrder(): array { return $this->order; } + #[\Override] public function getUser(): ?IUser { return $this->user; } + #[\Override] public function limitToHome(): bool { return $this->limitToHome; } diff --git a/lib/private/Files/SimpleFS/NewSimpleFile.php b/lib/private/Files/SimpleFS/NewSimpleFile.php index fbbe8a3902c..5f331e648d9 100644 --- a/lib/private/Files/SimpleFS/NewSimpleFile.php +++ b/lib/private/Files/SimpleFS/NewSimpleFile.php @@ -27,6 +27,7 @@ class NewSimpleFile implements ISimpleFile { /** * Get the name */ + #[\Override] public function getName(): string { return $this->name; } @@ -34,6 +35,7 @@ class NewSimpleFile implements ISimpleFile { /** * Get the size in bytes */ + #[\Override] public function getSize(): int|float { if ($this->file) { return $this->file->getSize(); @@ -45,6 +47,7 @@ class NewSimpleFile implements ISimpleFile { /** * Get the ETag */ + #[\Override] public function getETag(): string { if ($this->file) { return $this->file->getEtag(); @@ -56,6 +59,7 @@ class NewSimpleFile implements ISimpleFile { /** * Get the last modification time */ + #[\Override] public function getMTime(): int { if ($this->file) { return $this->file->getMTime(); @@ -70,6 +74,7 @@ class NewSimpleFile implements ISimpleFile { * @throws NotFoundException * @throws NotPermittedException */ + #[\Override] public function getContent(): string { if ($this->file) { $result = $this->file->getContent(); @@ -91,6 +96,7 @@ class NewSimpleFile implements ISimpleFile { * @throws NotPermittedException * @throws NotFoundException */ + #[\Override] public function putContent($data): void { try { if ($this->file) { @@ -141,6 +147,7 @@ class NewSimpleFile implements ISimpleFile { * * @throws NotPermittedException */ + #[\Override] public function delete(): void { if ($this->file) { $this->file->delete(); @@ -152,6 +159,7 @@ class NewSimpleFile implements ISimpleFile { * * @return string */ + #[\Override] public function getMimeType(): string { if ($this->file) { return $this->file->getMimeType(); @@ -163,6 +171,7 @@ class NewSimpleFile implements ISimpleFile { /** * {@inheritDoc} */ + #[\Override] public function getExtension(): string { if ($this->file) { return $this->file->getExtension(); @@ -178,6 +187,7 @@ class NewSimpleFile implements ISimpleFile { * @throws NotPermittedException * @since 14.0.0 */ + #[\Override] public function read() { if ($this->file) { return $this->file->fopen('r'); @@ -193,6 +203,7 @@ class NewSimpleFile implements ISimpleFile { * @throws NotPermittedException * @since 14.0.0 */ + #[\Override] public function write() { if ($this->file) { return $this->file->fopen('w'); diff --git a/lib/private/Files/SimpleFS/SimpleFile.php b/lib/private/Files/SimpleFS/SimpleFile.php index 4f9911a9ce9..b28a415f57e 100644 --- a/lib/private/Files/SimpleFS/SimpleFile.php +++ b/lib/private/Files/SimpleFS/SimpleFile.php @@ -22,6 +22,7 @@ class SimpleFile implements ISimpleFile { /** * Get the name */ + #[\Override] public function getName(): string { return $this->file->getName(); } @@ -29,6 +30,7 @@ class SimpleFile implements ISimpleFile { /** * Get the size in bytes */ + #[\Override] public function getSize(): int|float { return $this->file->getSize(); } @@ -36,6 +38,7 @@ class SimpleFile implements ISimpleFile { /** * Get the ETag */ + #[\Override] public function getETag(): string { return $this->file->getEtag(); } @@ -43,6 +46,7 @@ class SimpleFile implements ISimpleFile { /** * Get the last modification time */ + #[\Override] public function getMTime(): int { return $this->file->getMTime(); } @@ -55,6 +59,7 @@ class SimpleFile implements ISimpleFile { * @throws NotFoundException * @throws NotPermittedException */ + #[\Override] public function getContent(): string { $result = $this->file->getContent(); @@ -74,6 +79,7 @@ class SimpleFile implements ISimpleFile { * @throws NotFoundException * @throws NotPermittedException */ + #[\Override] public function putContent($data): void { try { $this->file->putContent($data); @@ -116,6 +122,7 @@ class SimpleFile implements ISimpleFile { * * @throws NotPermittedException */ + #[\Override] public function delete(): void { $this->file->delete(); } @@ -123,6 +130,7 @@ class SimpleFile implements ISimpleFile { /** * Get the MimeType */ + #[\Override] public function getMimeType(): string { return $this->file->getMimeType(); } @@ -130,6 +138,7 @@ class SimpleFile implements ISimpleFile { /** * {@inheritDoc} */ + #[\Override] public function getExtension(): string { return $this->file->getExtension(); } @@ -141,6 +150,7 @@ class SimpleFile implements ISimpleFile { * @throws NotPermittedException * @since 14.0.0 */ + #[\Override] public function read() { return $this->file->fopen('r'); } @@ -152,6 +162,7 @@ class SimpleFile implements ISimpleFile { * @throws NotPermittedException * @since 14.0.0 */ + #[\Override] public function write() { return $this->file->fopen('w'); } diff --git a/lib/private/Files/SimpleFS/SimpleFolder.php b/lib/private/Files/SimpleFS/SimpleFolder.php index 2f983700698..2124302823c 100644 --- a/lib/private/Files/SimpleFS/SimpleFolder.php +++ b/lib/private/Files/SimpleFS/SimpleFolder.php @@ -19,10 +19,12 @@ class SimpleFolder implements ISimpleFolder { ) { } + #[\Override] public function getName(): string { return $this->folder->getName(); } + #[\Override] public function getDirectoryListing(): array { $listing = $this->folder->getDirectoryListing(); @@ -38,14 +40,17 @@ class SimpleFolder implements ISimpleFolder { return array_values($fileListing); } + #[\Override] public function delete(): void { $this->folder->delete(); } + #[\Override] public function fileExists(string $name): bool { return $this->folder->nodeExists($name); } + #[\Override] public function getFile(string $name): ISimpleFile { $file = $this->folder->get($name); @@ -56,6 +61,7 @@ class SimpleFolder implements ISimpleFolder { return new SimpleFile($file); } + #[\Override] public function newFile(string $name, $content = null): ISimpleFile { if ($content === null) { // delay creating the file until it's written to @@ -66,6 +72,7 @@ class SimpleFolder implements ISimpleFolder { } } + #[\Override] public function getFolder(string $name): ISimpleFolder { $folder = $this->folder->get($name); @@ -76,6 +83,7 @@ class SimpleFolder implements ISimpleFolder { return new SimpleFolder($folder); } + #[\Override] public function newFolder(string $path): ISimpleFolder { $folder = $this->folder->newFolder($path); return new SimpleFolder($folder); diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index bb6848bc4fb..dbb98eda9b7 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -90,14 +90,17 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return false; } + #[\Override] public function is_dir(string $path): bool { return $this->filetype($path) === 'dir'; } + #[\Override] public function is_file(string $path): bool { return $this->filetype($path) === 'file'; } + #[\Override] public function filesize(string $path): int|float|false { $type = $this->filetype($path); if ($type === false) { @@ -111,12 +114,14 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, } } + #[\Override] public function isReadable(string $path): bool { // at least check whether it exists // subclasses might want to implement this more thoroughly return $this->file_exists($path); } + #[\Override] public function isUpdatable(string $path): bool { // at least check whether it exists // subclasses might want to implement this more thoroughly @@ -124,6 +129,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $this->file_exists($path); } + #[\Override] public function isCreatable(string $path): bool { if ($this->is_dir($path) && $this->isUpdatable($path)) { return true; @@ -131,6 +137,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return false; } + #[\Override] public function isDeletable(string $path): bool { if ($path === '' || $path === '/') { return $this->isUpdatable($path); @@ -139,10 +146,12 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $this->isUpdatable($parent) && $this->isUpdatable($path); } + #[\Override] public function isSharable(string $path): bool { return $this->isReadable($path); } + #[\Override] public function getPermissions(string $path): int { $permissions = 0; if ($this->isCreatable($path)) { @@ -163,6 +172,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $permissions; } + #[\Override] public function filemtime(string $path): int|false { $stat = $this->stat($path); if (isset($stat['mtime']) && $stat['mtime'] > 0) { @@ -172,6 +182,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, } } + #[\Override] public function file_get_contents(string $path): string|false { $handle = $this->fopen($path, 'r'); if (!$handle) { @@ -182,6 +193,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $data; } + #[\Override] public function file_put_contents(string $path, mixed $data): int|float|false { $handle = $this->fopen($path, 'w'); if (!$handle) { @@ -193,6 +205,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $count; } + #[\Override] public function rename(string $source, string $target): bool { $this->remove($target); @@ -200,6 +213,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $this->copy($source, $target) && $this->remove($source); } + #[\Override] public function copy(string $source, string $target): bool { if ($this->is_dir($source)) { $this->remove($target); @@ -230,6 +244,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, } } + #[\Override] public function getMimeType(string $path): string|false { if ($this->is_dir($path)) { return 'httpd/unix-directory'; @@ -240,6 +255,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, } } + #[\Override] public function hash(string $type, string $path, bool $raw = false): string|false { $fh = $this->fopen($path, 'rb'); if (!$fh) { @@ -251,6 +267,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return hash_final($ctx, $raw); } + #[\Override] public function getLocalFile(string $path): string|false { return $this->getCachedFile($path); } @@ -301,6 +318,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, * exclusive access to the backend and will not pick up files that have been added in a way that circumvents * Nextcloud filesystem. */ + #[\Override] public function hasUpdated(string $path, int $time): bool { return $this->filemtime($path) > $time; } @@ -312,6 +330,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $this->cacheDependencies; } + #[\Override] public function getCache(string $path = '', ?IStorage $storage = null): ICache { if (!$storage) { $storage = $this; @@ -323,6 +342,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $storage->cache; } + #[\Override] public function getScanner(string $path = '', ?IStorage $storage = null): IScanner { if (!$storage) { $storage = $this; @@ -336,6 +356,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $storage->scanner; } + #[\Override] public function getWatcher(string $path = '', ?IStorage $storage = null): IWatcher { if (!$storage) { $storage = $this; @@ -349,6 +370,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $this->watcher; } + #[\Override] public function getPropagator(?IStorage $storage = null): IPropagator { if (!$storage) { $storage = $this; @@ -364,6 +386,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $storage->propagator; } + #[\Override] public function getUpdater(?IStorage $storage = null): IUpdater { if (!$storage) { $storage = $this; @@ -378,12 +401,14 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $storage->updater; } + #[\Override] public function getStorageCache(?IStorage $storage = null): \OC\Files\Cache\Storage { /** @var Cache $cache */ $cache = $this->getCache(storage: $storage); return $cache->getStorageCache(); } + #[\Override] public function getOwner(string $path): string|false { if ($this->owner === null) { $this->owner = \OC_User::getUser(); @@ -392,6 +417,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $this->owner; } + #[\Override] public function getETag(string $path): string|false { return uniqid(); } @@ -423,6 +449,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, /** * Test a storage for availability */ + #[\Override] public function test(): bool { try { if ($this->stat('')) { @@ -439,10 +466,12 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, } } + #[\Override] public function free_space(string $path): int|float|false { return FileInfo::SPACE_UNKNOWN; } + #[\Override] public function isLocal(): bool { // the common implementation returns a temporary file by // default, which is not local @@ -452,6 +481,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, /** * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class */ + #[\Override] public function instanceOfStorage(string $class): bool { if (ltrim($class, '\\') === 'OC\Files\Storage\Shared') { // FIXME Temporary fix to keep existing checks working @@ -470,6 +500,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return false; } + #[\Override] public function verifyPath(string $path, string $fileName): void { $this->getFilenameValidator() ->validateFilename($fileName); @@ -507,6 +538,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $this->mountOptions[$name] ?? $default; } + #[\Override] public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, bool $preserveMtime = false): bool { if ($sourceStorage === $this) { return $this->copy($sourceInternalPath, $targetInternalPath); @@ -564,6 +596,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $storage === $this; } + #[\Override] public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { if ( !$sourceStorage->instanceOfStorage(Encryption::class) @@ -607,6 +640,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $result; } + #[\Override] public function getMetaData(string $path): ?array { if (Filesystem::isFileBlacklisted($path)) { throw new ForbiddenException('Invalid path: ' . $path, false); @@ -637,6 +671,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $data; } + #[\Override] public function acquireLock(string $path, int $type, ILockingProvider $provider): void { $logger = $this->getLockLogger(); if ($logger) { @@ -664,6 +699,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, } } + #[\Override] public function releaseLock(string $path, int $type, ILockingProvider $provider): void { $logger = $this->getLockLogger(); if ($logger) { @@ -691,6 +727,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, } } + #[\Override] public function changeLock(string $path, int $type, ILockingProvider $provider): void { $logger = $this->getLockLogger(); if ($logger) { @@ -729,22 +766,27 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, /** * @return array{available: bool, last_checked: int} */ + #[\Override] public function getAvailability(): array { return $this->getStorageCache()->getAvailability(); } + #[\Override] public function setAvailability(bool $isAvailable): void { $this->getStorageCache()->setAvailability($isAvailable); } + #[\Override] public function setOwner(?string $user): void { $this->owner = $user; } + #[\Override] public function needsPartFile(): bool { return true; } + #[\Override] public function writeStream(string $path, $stream, ?int $size = null): int { $target = $this->fopen($path, 'w'); if (!$target) { @@ -762,6 +804,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, return $count; } + #[\Override] public function getDirectoryContent(string $directory): \Traversable { $dh = $this->opendir($directory); diff --git a/lib/private/Files/Storage/CommonTest.php b/lib/private/Files/Storage/CommonTest.php index b1a939cc00b..bcd73ad7cfc 100644 --- a/lib/private/Files/Storage/CommonTest.php +++ b/lib/private/Files/Storage/CommonTest.php @@ -19,42 +19,55 @@ class CommonTest extends Common { $this->storage = new Local($parameters); } + #[\Override] public function getId(): string { return 'test::' . $this->storage->getId(); } + #[\Override] public function mkdir(string $path): bool { return $this->storage->mkdir($path); } + #[\Override] public function rmdir(string $path): bool { return $this->storage->rmdir($path); } + #[\Override] public function opendir(string $path) { return $this->storage->opendir($path); } + #[\Override] public function stat(string $path): array|false { return $this->storage->stat($path); } + #[\Override] public function filetype(string $path): string|false { return @$this->storage->filetype($path); } + #[\Override] public function isReadable(string $path): bool { return $this->storage->isReadable($path); } + #[\Override] public function isUpdatable(string $path): bool { return $this->storage->isUpdatable($path); } + #[\Override] public function file_exists(string $path): bool { return $this->storage->file_exists($path); } + #[\Override] public function unlink(string $path): bool { return $this->storage->unlink($path); } + #[\Override] public function fopen(string $path, string $mode) { return $this->storage->fopen($path, $mode); } + #[\Override] public function free_space(string $path): int|float|false { return $this->storage->free_space($path); } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { return $this->storage->touch($path, $mtime); } diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index 8ccfe305136..0c74abdfee1 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -192,6 +192,7 @@ class DAV extends Common { $this->statCache->clear(); } + #[\Override] public function getId(): string { return 'webdav::' . $this->user . '@' . $this->host . '/' . $this->root; } @@ -205,6 +206,7 @@ class DAV extends Common { return $baseUri; } + #[\Override] public function mkdir(string $path): bool { $this->init(); $path = $this->cleanPath($path); @@ -215,6 +217,7 @@ class DAV extends Common { return $result; } + #[\Override] public function rmdir(string $path): bool { $this->init(); $path = $this->cleanPath($path); @@ -226,6 +229,7 @@ class DAV extends Common { return $result; } + #[\Override] public function opendir(string $path) { $this->init(); $path = $this->cleanPath($path); @@ -311,6 +315,7 @@ class DAV extends Common { return $response; } + #[\Override] public function filetype(string $path): string|false { try { $response = $this->propfind($path); @@ -329,6 +334,7 @@ class DAV extends Common { return false; } + #[\Override] public function file_exists(string $path): bool { try { $path = $this->cleanPath($path); @@ -347,6 +353,7 @@ class DAV extends Common { return false; } + #[\Override] public function unlink(string $path): bool { $this->init(); $path = $this->cleanPath($path); @@ -356,6 +363,7 @@ class DAV extends Common { return $result; } + #[\Override] public function fopen(string $path, string $mode) { $this->init(); $path = $this->cleanPath($path); @@ -444,6 +452,7 @@ class DAV extends Common { unlink($tmpFile); } + #[\Override] public function free_space(string $path): int|float|false { $this->init(); $path = $this->cleanPath($path); @@ -462,6 +471,7 @@ class DAV extends Common { } } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { $this->init(); if (is_null($mtime)) { @@ -499,6 +509,7 @@ class DAV extends Common { return true; } + #[\Override] public function file_put_contents(string $path, mixed $data): int|float|false { $path = $this->cleanPath($path); $result = parent::file_put_contents($path, $data); @@ -527,6 +538,7 @@ class DAV extends Common { $this->removeCachedFile($target); } + #[\Override] public function rename(string $source, string $target): bool { $this->init(); $source = $this->cleanPath($source); @@ -558,6 +570,7 @@ class DAV extends Common { return false; } + #[\Override] public function copy(string $source, string $target): bool { $this->init(); $source = $this->cleanPath($source); @@ -586,6 +599,7 @@ class DAV extends Common { return false; } + #[\Override] public function getMetaData(string $path): ?array { if (Filesystem::isFileBlacklisted($path)) { throw new ForbiddenException('Invalid path: ' . $path, false); @@ -648,17 +662,20 @@ class DAV extends Common { ]; } + #[\Override] public function stat(string $path): array|false { $meta = $this->getMetaData($path); return $meta ?: false; } + #[\Override] public function getMimeType(string $path): string|false { $meta = $this->getMetaData($path); return $meta ? $meta['mimetype'] : false; } + #[\Override] public function cleanPath(string $path): string { if ($path === '') { return $path; @@ -710,27 +727,33 @@ class DAV extends Common { return true; } + #[\Override] public function isUpdatable(string $path): bool { return (bool)($this->getPermissions($path) & Constants::PERMISSION_UPDATE); } + #[\Override] public function isCreatable(string $path): bool { return (bool)($this->getPermissions($path) & Constants::PERMISSION_CREATE); } + #[\Override] public function isSharable(string $path): bool { return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE); } + #[\Override] public function isDeletable(string $path): bool { return (bool)($this->getPermissions($path) & Constants::PERMISSION_DELETE); } + #[\Override] public function getPermissions(string $path): int { $stat = $this->getMetaData($path); return $stat ? $stat['permissions'] : 0; } + #[\Override] public function getETag(string $path): string|false { $meta = $this->getMetaData($path); return $meta ? $meta['etag'] : false; @@ -754,6 +777,7 @@ class DAV extends Common { return $permissions; } + #[\Override] public function hasUpdated(string $path, int $time): bool { $this->init(); $path = $this->cleanPath($path); @@ -852,6 +876,7 @@ class DAV extends Common { // TODO: only log for now, but in the future need to wrap/rethrow exception } + #[\Override] public function getDirectoryContent(string $directory): \Traversable { $this->init(); $directory = $this->cleanPath($directory); diff --git a/lib/private/Files/Storage/FailedStorage.php b/lib/private/Files/Storage/FailedStorage.php index 1b1123921aa..e85982cb6ec 100644 --- a/lib/private/Files/Storage/FailedStorage.php +++ b/lib/private/Files/Storage/FailedStorage.php @@ -29,166 +29,207 @@ class FailedStorage extends Common { } } + #[\Override] public function getId(): string { // we can't return anything sane here return 'failedstorage'; } + #[\Override] public function mkdir(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function rmdir(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function opendir(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function is_dir(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function is_file(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function stat(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function filetype(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function filesize(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function isCreatable(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function isReadable(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function isUpdatable(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function isDeletable(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function isSharable(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function getPermissions(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function file_exists(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function filemtime(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function file_get_contents(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function file_put_contents(string $path, mixed $data): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function unlink(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function rename(string $source, string $target): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function copy(string $source, string $target): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function fopen(string $path, string $mode): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function getMimeType(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function hash(string $type, string $path, bool $raw = false): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function free_space(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function touch(string $path, ?int $mtime = null): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function getLocalFile(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function hasUpdated(string $path, int $time): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function getETag(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function getDirectDownload(string $path): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function getDirectDownloadById(string $fileId): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function verifyPath(string $path, string $fileName): void { } + #[\Override] public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, bool $preserveMtime = false): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function acquireLock(string $path, int $type, ILockingProvider $provider): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function releaseLock(string $path, int $type, ILockingProvider $provider): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function changeLock(string $path, int $type, ILockingProvider $provider): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function getAvailability(): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function setAvailability(bool $isAvailable): never { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } + #[\Override] public function getCache(string $path = '', ?IStorage $storage = null): FailedCache { return new FailedCache(); } diff --git a/lib/private/Files/Storage/Home.php b/lib/private/Files/Storage/Home.php index 6627437c0ec..ab3a8c8806a 100644 --- a/lib/private/Files/Storage/Home.php +++ b/lib/private/Files/Storage/Home.php @@ -39,10 +39,12 @@ class Home extends Local implements IHomeStorage { parent::__construct(['datadir' => $datadir]); } + #[\Override] public function getId(): string { return $this->id; } + #[\Override] public function getCache(string $path = '', ?IStorage $storage = null): ICache { if (!$storage) { $storage = $this; @@ -53,6 +55,7 @@ class Home extends Local implements IHomeStorage { return $this->cache; } + #[\Override] public function getPropagator(?IStorage $storage = null): IPropagator { if (!$storage) { $storage = $this; @@ -64,10 +67,12 @@ class Home extends Local implements IHomeStorage { } + #[\Override] public function getUser(): IUser { return $this->user; } + #[\Override] public function getOwner(string $path): string|false { return $this->user->getUID(); } diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index e3afc6bd017..e5806f855bc 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -78,10 +78,12 @@ class Local extends Common { public function __destruct() { } + #[\Override] public function getId(): string { return 'local::' . $this->datadir; } + #[\Override] public function mkdir(string $path): bool { $sourcePath = $this->getSourcePath($path); $oldMask = umask($this->defUMask); @@ -90,6 +92,7 @@ class Local extends Common { return $result; } + #[\Override] public function rmdir(string $path): bool { if (!$this->isDeletable($path)) { return false; @@ -129,10 +132,12 @@ class Local extends Common { } } + #[\Override] public function opendir(string $path) { return opendir($this->getSourcePath($path)); } + #[\Override] public function is_dir(string $path): bool { if ($this->caseInsensitive && !$this->file_exists($path)) { return false; @@ -143,6 +148,7 @@ class Local extends Common { return is_dir($this->getSourcePath($path)); } + #[\Override] public function is_file(string $path): bool { if ($this->caseInsensitive && !$this->file_exists($path)) { return false; @@ -150,6 +156,7 @@ class Local extends Common { return is_file($this->getSourcePath($path)); } + #[\Override] public function stat(string $path): array|false { $fullPath = $this->getSourcePath($path); clearstatcache(true, $fullPath); @@ -168,6 +175,7 @@ class Local extends Common { return $statResult; } + #[\Override] public function getMetaData(string $path): ?array { try { $stat = $this->stat($path); @@ -217,6 +225,7 @@ class Local extends Common { return $data; } + #[\Override] public function filetype(string $path): string|false { $filetype = @filetype($this->getSourcePath($path)); if ($filetype === 'link') { @@ -225,6 +234,7 @@ class Local extends Common { return $filetype; } + #[\Override] public function filesize(string $path): int|float|false { $type = $this->filetype($path); if ($type === false) { @@ -241,14 +251,17 @@ class Local extends Common { return filesize($fullPath); } + #[\Override] public function isReadable(string $path): bool { return is_readable($this->getSourcePath($path)); } + #[\Override] public function isUpdatable(string $path): bool { return is_writable($this->getSourcePath($path)); } + #[\Override] public function file_exists(string $path): bool { if ($this->caseInsensitive) { $fullPath = $this->getSourcePath($path); @@ -263,6 +276,7 @@ class Local extends Common { } } + #[\Override] public function filemtime(string $path): int|false { $fullPath = $this->getSourcePath($path); clearstatcache(true, $fullPath); @@ -276,6 +290,7 @@ class Local extends Common { return filemtime($fullPath); } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { // sets the modification time of the file to the given value. // If mtime is nil the current time is set. @@ -297,10 +312,12 @@ class Local extends Common { return $result; } + #[\Override] public function file_get_contents(string $path): string|false { return file_get_contents($this->getSourcePath($path)); } + #[\Override] public function file_put_contents(string $path, mixed $data): int|float|false { $oldMask = umask($this->defUMask); if ($this->unlinkOnTruncate) { @@ -311,6 +328,7 @@ class Local extends Common { return $result; } + #[\Override] public function unlink(string $path): bool { if ($this->is_dir($path)) { return $this->rmdir($path); @@ -331,6 +349,7 @@ class Local extends Common { } } + #[\Override] public function rename(string $source, string $target): bool { $srcParent = dirname($source); $dstParent = dirname($target); @@ -374,6 +393,7 @@ class Local extends Common { return $this->copy($source, $target) && $this->unlink($source); } + #[\Override] public function copy(string $source, string $target): bool { if ($this->is_dir($source)) { return parent::copy($source, $target); @@ -393,6 +413,7 @@ class Local extends Common { } } + #[\Override] public function fopen(string $path, string $mode) { $sourcePath = $this->getSourcePath($path); if (!file_exists($sourcePath) && $mode === 'r') { @@ -407,10 +428,12 @@ class Local extends Common { return $result; } + #[\Override] public function hash(string $type, string $path, bool $raw = false): string|false { return hash_file($type, $this->getSourcePath($path), $raw); } + #[\Override] public function free_space(string $path): int|float|false { $sourcePath = $this->getSourcePath($path); // using !is_dir because $sourcePath might be a part file or @@ -431,10 +454,12 @@ class Local extends Common { return $this->searchInDir($query); } + #[\Override] public function getLocalFile(string $path): string|false { return $this->getSourcePath($path); } + #[\Override] protected function searchInDir(string $query, string $dir = ''): array { $files = []; $physicalDir = $this->getSourcePath($dir); @@ -454,6 +479,7 @@ class Local extends Common { return $files; } + #[\Override] public function hasUpdated(string $path, int $time): bool { if ($this->file_exists($path)) { return $this->filemtime($path) > $time; @@ -499,10 +525,12 @@ class Local extends Common { throw new ForbiddenException('Following symlinks is not allowed', false); } + #[\Override] public function isLocal(): bool { return true; } + #[\Override] public function getETag(string $path): string|false { return $this->calculateEtag($path, $this->stat($path)); } @@ -546,6 +574,7 @@ class Local extends Common { && !$sourceStorage->instanceOfStorage(Encryption::class); } + #[\Override] public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, bool $preserveMtime = false): bool { if ($this->canDoCrossStorageMove($sourceStorage)) { // resolve any jailed paths @@ -566,6 +595,7 @@ class Local extends Common { } } + #[\Override] public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { if ($this->canDoCrossStorageMove($sourceStorage)) { // resolve any jailed paths @@ -586,6 +616,7 @@ class Local extends Common { } } + #[\Override] public function writeStream(string $path, $stream, ?int $size = null): int { /** @var int|false $result We consider here that returned size will never be a float because we write less than 4GB */ $result = $this->file_put_contents($path, $stream); diff --git a/lib/private/Files/Storage/LocalRootStorage.php b/lib/private/Files/Storage/LocalRootStorage.php index d8d0fc2c75c..4086b481051 100644 --- a/lib/private/Files/Storage/LocalRootStorage.php +++ b/lib/private/Files/Storage/LocalRootStorage.php @@ -13,6 +13,7 @@ use OCP\Files\Cache\IScanner; use OCP\Files\Storage\IStorage; class LocalRootStorage extends Local { + #[\Override] public function getScanner(string $path = '', ?IStorage $storage = null): IScanner { if (!$storage) { $storage = $this; diff --git a/lib/private/Files/Storage/Storage.php b/lib/private/Files/Storage/Storage.php index 938d676471b..88383350152 100644 --- a/lib/private/Files/Storage/Storage.php +++ b/lib/private/Files/Storage/Storage.php @@ -23,14 +23,19 @@ use OCP\Files\Storage\IStorage; * All paths passed to the storage are relative to the storage and should NOT have a leading slash. */ interface Storage extends IStorage, ILockingStorage { + #[\Override] public function getCache(string $path = '', ?IStorage $storage = null): ICache; + #[\Override] public function getScanner(string $path = '', ?IStorage $storage = null): IScanner; + #[\Override] public function getWatcher(string $path = '', ?IStorage $storage = null): IWatcher; + #[\Override] public function getPropagator(?IStorage $storage = null): IPropagator; + #[\Override] public function getUpdater(?IStorage $storage = null): IUpdater; public function getStorageCache(): \OC\Files\Cache\Storage; diff --git a/lib/private/Files/Storage/StorageFactory.php b/lib/private/Files/Storage/StorageFactory.php index 24efd3ecc1c..e590c44ed55 100644 --- a/lib/private/Files/Storage/StorageFactory.php +++ b/lib/private/Files/Storage/StorageFactory.php @@ -20,6 +20,7 @@ class StorageFactory implements IStorageFactory { */ private $storageWrappers = []; + #[\Override] public function addStorageWrapper(string $wrapperName, callable $callback, int $priority = 50, array $existingMounts = []): bool { if (isset($this->storageWrappers[$wrapperName])) { return false; @@ -47,6 +48,7 @@ class StorageFactory implements IStorageFactory { /** * Create an instance of a storage and apply the registered storage wrappers */ + #[\Override] public function getInstance(IMountPoint $mountPoint, string $class, array $arguments): IStorage { if (!is_a($class, IConstructableStorage::class, true)) { Server::get(LoggerInterface::class)->warning('Building a storage not implementing IConstructableStorage is deprecated since 31.0.0', ['class' => $class]); diff --git a/lib/private/Files/Storage/Temporary.php b/lib/private/Files/Storage/Temporary.php index ecf8a1315a9..bb46d7100a1 100644 --- a/lib/private/Files/Storage/Temporary.php +++ b/lib/private/Files/Storage/Temporary.php @@ -23,6 +23,7 @@ class Temporary extends Local { Files::rmdirr($this->datadir); } + #[\Override] public function __destruct() { parent::__destruct(); $this->cleanUp(); diff --git a/lib/private/Files/Storage/Wrapper/Availability.php b/lib/private/Files/Storage/Wrapper/Availability.php index 7ae6bbe08be..924567e1afe 100644 --- a/lib/private/Files/Storage/Wrapper/Availability.php +++ b/lib/private/Files/Storage/Wrapper/Availability.php @@ -88,62 +88,77 @@ class Availability extends Wrapper { } } + #[\Override] public function mkdir(string $path): bool { return $this->handleAvailability('mkdir', $path); } + #[\Override] public function rmdir(string $path): bool { return $this->handleAvailability('rmdir', $path); } + #[\Override] public function opendir(string $path) { return $this->handleAvailability('opendir', $path); } + #[\Override] public function is_dir(string $path): bool { return $this->handleAvailability('is_dir', $path); } + #[\Override] public function is_file(string $path): bool { return $this->handleAvailability('is_file', $path); } + #[\Override] public function stat(string $path): array|false { return $this->handleAvailability('stat', $path); } + #[\Override] public function filetype(string $path): string|false { return $this->handleAvailability('filetype', $path); } + #[\Override] public function filesize(string $path): int|float|false { return $this->handleAvailability('filesize', $path); } + #[\Override] public function isCreatable(string $path): bool { return $this->handleAvailability('isCreatable', $path); } + #[\Override] public function isReadable(string $path): bool { return $this->handleAvailability('isReadable', $path); } + #[\Override] public function isUpdatable(string $path): bool { return $this->handleAvailability('isUpdatable', $path); } + #[\Override] public function isDeletable(string $path): bool { return $this->handleAvailability('isDeletable', $path); } + #[\Override] public function isSharable(string $path): bool { return $this->handleAvailability('isSharable', $path); } + #[\Override] public function getPermissions(string $path): int { return $this->handleAvailability('getPermissions', $path); } + #[\Override] public function file_exists(string $path): bool { if ($path === '') { return true; @@ -151,54 +166,67 @@ class Availability extends Wrapper { return $this->handleAvailability('file_exists', $path); } + #[\Override] public function filemtime(string $path): int|false { return $this->handleAvailability('filemtime', $path); } + #[\Override] public function file_get_contents(string $path): string|false { return $this->handleAvailability('file_get_contents', $path); } + #[\Override] public function file_put_contents(string $path, mixed $data): int|float|false { return $this->handleAvailability('file_put_contents', $path, $data); } + #[\Override] public function unlink(string $path): bool { return $this->handleAvailability('unlink', $path); } + #[\Override] public function rename(string $source, string $target): bool { return $this->handleAvailability('rename', $source, $target); } + #[\Override] public function copy(string $source, string $target): bool { return $this->handleAvailability('copy', $source, $target); } + #[\Override] public function fopen(string $path, string $mode) { return $this->handleAvailability('fopen', $path, $mode); } + #[\Override] public function getMimeType(string $path): string|false { return $this->handleAvailability('getMimeType', $path); } + #[\Override] public function hash(string $type, string $path, bool $raw = false): string|false { return $this->handleAvailability('hash', $type, $path, $raw); } + #[\Override] public function free_space(string $path): int|float|false { return $this->handleAvailability('free_space', $path); } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { return $this->handleAvailability('touch', $path, $mtime); } + #[\Override] public function getLocalFile(string $path): string|false { return $this->handleAvailability('getLocalFile', $path); } + #[\Override] public function hasUpdated(string $path, int $time): bool { if (!$this->isAvailable()) { return false; @@ -212,6 +240,7 @@ class Availability extends Wrapper { } } + #[\Override] public function getOwner(string $path): string|false { try { return parent::getOwner($path); @@ -221,26 +250,32 @@ class Availability extends Wrapper { } } + #[\Override] public function getETag(string $path): string|false { return $this->handleAvailability('getETag', $path); } + #[\Override] public function getDirectDownload(string $path): array|false { return $this->handleAvailability('getDirectDownload', $path); } + #[\Override] public function getDirectDownloadById(string $fileId): array|false { return $this->handleAvailability('getDirectDownloadById', $fileId); } + #[\Override] public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { return $this->handleAvailability('copyFromStorage', $sourceStorage, $sourceInternalPath, $targetInternalPath); } + #[\Override] public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { return $this->handleAvailability('moveFromStorage', $sourceStorage, $sourceInternalPath, $targetInternalPath); } + #[\Override] public function getMetaData(string $path): ?array { $this->checkAvailability(); try { @@ -275,6 +310,7 @@ class Availability extends Wrapper { + #[\Override] public function getDirectoryContent(string $directory): \Traversable { $this->checkAvailability(); try { diff --git a/lib/private/Files/Storage/Wrapper/DirPermissionsMask.php b/lib/private/Files/Storage/Wrapper/DirPermissionsMask.php index 14b6441f98b..0ad4fc127b8 100644 --- a/lib/private/Files/Storage/Wrapper/DirPermissionsMask.php +++ b/lib/private/Files/Storage/Wrapper/DirPermissionsMask.php @@ -47,6 +47,7 @@ class DirPermissionsMask extends PermissionsMask { return $path === $this->path || substr($path, 0, $this->pathLength + 1) === $this->path . '/'; } + #[\Override] public function isUpdatable($path): bool { if ($this->checkPath($path)) { return parent::isUpdatable($path); @@ -55,6 +56,7 @@ class DirPermissionsMask extends PermissionsMask { return $this->storage->isUpdatable($path); } + #[\Override] public function isCreatable($path): bool { if ($this->checkPath($path)) { return parent::isCreatable($path); @@ -63,6 +65,7 @@ class DirPermissionsMask extends PermissionsMask { return $this->storage->isCreatable($path); } + #[\Override] public function isDeletable($path): bool { if ($this->checkPath($path)) { return parent::isDeletable($path); @@ -71,6 +74,7 @@ class DirPermissionsMask extends PermissionsMask { return $this->storage->isDeletable($path); } + #[\Override] public function isSharable($path): bool { if ($this->checkPath($path)) { return parent::isSharable($path); @@ -79,6 +83,7 @@ class DirPermissionsMask extends PermissionsMask { return $this->storage->isSharable($path); } + #[\Override] public function getPermissions($path): int { if ($this->checkPath($path)) { return parent::getPermissions($path); @@ -87,6 +92,7 @@ class DirPermissionsMask extends PermissionsMask { return $this->storage->getPermissions($path); } + #[\Override] public function rename($source, $target): bool { if (!$this->isUpdatable($source)) { return false; @@ -110,6 +116,7 @@ class DirPermissionsMask extends PermissionsMask { return false; } + #[\Override] public function copy($source, $target): bool { if (!$this->isReadable($source)) { return false; @@ -133,6 +140,7 @@ class DirPermissionsMask extends PermissionsMask { return false; } + #[\Override] public function touch($path, $mtime = null): bool { if ($this->checkPath($path)) { return parent::touch($path); @@ -141,6 +149,7 @@ class DirPermissionsMask extends PermissionsMask { return $this->storage->touch($path); } + #[\Override] public function mkdir($path): bool { // Always allow creating the path of the dir mask. if ($path !== $this->path && $this->checkPath($path)) { @@ -150,6 +159,7 @@ class DirPermissionsMask extends PermissionsMask { return $this->storage->mkdir($path); } + #[\Override] public function rmdir($path): bool { if ($this->checkPath($path)) { return parent::rmdir($path); @@ -158,6 +168,7 @@ class DirPermissionsMask extends PermissionsMask { return $this->storage->rmdir($path); } + #[\Override] public function unlink($path): bool { if ($this->checkPath($path)) { return parent::unlink($path); @@ -166,6 +177,7 @@ class DirPermissionsMask extends PermissionsMask { return $this->storage->unlink($path); } + #[\Override] public function file_put_contents($path, $data): int|float|false { if ($this->checkPath($path)) { return parent::file_put_contents($path, $data); @@ -174,6 +186,7 @@ class DirPermissionsMask extends PermissionsMask { return $this->storage->file_put_contents($path, $data); } + #[\Override] public function fopen($path, $mode) { if ($this->checkPath($path)) { return parent::fopen($path, $mode); @@ -182,6 +195,7 @@ class DirPermissionsMask extends PermissionsMask { return $this->storage->fopen($path, $mode); } + #[\Override] public function getCache($path = '', $storage = null): ICache { if (!$storage) { $storage = $this; diff --git a/lib/private/Files/Storage/Wrapper/Encoding.php b/lib/private/Files/Storage/Wrapper/Encoding.php index 854a28efc2c..e8c01f0a018 100644 --- a/lib/private/Files/Storage/Wrapper/Encoding.php +++ b/lib/private/Files/Storage/Wrapper/Encoding.php @@ -96,6 +96,7 @@ class Encoding extends Wrapper { return null; } + #[\Override] public function mkdir(string $path): bool { // note: no conversion here, method should not be called with non-NFC names! $result = $this->getWrapperStorage()->mkdir($path); @@ -105,6 +106,7 @@ class Encoding extends Wrapper { return $result; } + #[\Override] public function rmdir(string $path): bool { $result = $this->getWrapperStorage()->rmdir($this->findPathToUse($path)); if ($result) { @@ -113,71 +115,88 @@ class Encoding extends Wrapper { return $result; } + #[\Override] public function opendir(string $path) { $handle = $this->getWrapperStorage()->opendir($this->findPathToUse($path)); return EncodingDirectoryWrapper::wrap($handle); } + #[\Override] public function is_dir(string $path): bool { return $this->getWrapperStorage()->is_dir($this->findPathToUse($path)); } + #[\Override] public function is_file(string $path): bool { return $this->getWrapperStorage()->is_file($this->findPathToUse($path)); } + #[\Override] public function stat(string $path): array|false { return $this->getWrapperStorage()->stat($this->findPathToUse($path)); } + #[\Override] public function filetype(string $path): string|false { return $this->getWrapperStorage()->filetype($this->findPathToUse($path)); } + #[\Override] public function filesize(string $path): int|float|false { return $this->getWrapperStorage()->filesize($this->findPathToUse($path)); } + #[\Override] public function isCreatable(string $path): bool { return $this->getWrapperStorage()->isCreatable($this->findPathToUse($path)); } + #[\Override] public function isReadable(string $path): bool { return $this->getWrapperStorage()->isReadable($this->findPathToUse($path)); } + #[\Override] public function isUpdatable(string $path): bool { return $this->getWrapperStorage()->isUpdatable($this->findPathToUse($path)); } + #[\Override] public function isDeletable(string $path): bool { return $this->getWrapperStorage()->isDeletable($this->findPathToUse($path)); } + #[\Override] public function isSharable(string $path): bool { return $this->getWrapperStorage()->isSharable($this->findPathToUse($path)); } + #[\Override] public function getPermissions(string $path): int { return $this->getWrapperStorage()->getPermissions($this->findPathToUse($path)); } + #[\Override] public function file_exists(string $path): bool { return $this->getWrapperStorage()->file_exists($this->findPathToUse($path)); } + #[\Override] public function filemtime(string $path): int|false { return $this->getWrapperStorage()->filemtime($this->findPathToUse($path)); } + #[\Override] public function file_get_contents(string $path): string|false { return $this->getWrapperStorage()->file_get_contents($this->findPathToUse($path)); } + #[\Override] public function file_put_contents(string $path, mixed $data): int|float|false { return $this->getWrapperStorage()->file_put_contents($this->findPathToUse($path), $data); } + #[\Override] public function unlink(string $path): bool { $result = $this->getWrapperStorage()->unlink($this->findPathToUse($path)); if ($result) { @@ -186,15 +205,18 @@ class Encoding extends Wrapper { return $result; } + #[\Override] public function rename(string $source, string $target): bool { // second name always NFC return $this->getWrapperStorage()->rename($this->findPathToUse($source), $this->findPathToUse($target)); } + #[\Override] public function copy(string $source, string $target): bool { return $this->getWrapperStorage()->copy($this->findPathToUse($source), $this->findPathToUse($target)); } + #[\Override] public function fopen(string $path, string $mode) { $result = $this->getWrapperStorage()->fopen($this->findPathToUse($path), $mode); if ($result && $mode !== 'r' && $mode !== 'rb') { @@ -203,30 +225,37 @@ class Encoding extends Wrapper { return $result; } + #[\Override] public function getMimeType(string $path): string|false { return $this->getWrapperStorage()->getMimeType($this->findPathToUse($path)); } + #[\Override] public function hash(string $type, string $path, bool $raw = false): string|false { return $this->getWrapperStorage()->hash($type, $this->findPathToUse($path), $raw); } + #[\Override] public function free_space(string $path): int|float|false { return $this->getWrapperStorage()->free_space($this->findPathToUse($path)); } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { return $this->getWrapperStorage()->touch($this->findPathToUse($path), $mtime); } + #[\Override] public function getLocalFile(string $path): string|false { return $this->getWrapperStorage()->getLocalFile($this->findPathToUse($path)); } + #[\Override] public function hasUpdated(string $path, int $time): bool { return $this->getWrapperStorage()->hasUpdated($this->findPathToUse($path), $time); } + #[\Override] public function getCache(string $path = '', ?IStorage $storage = null): ICache { if (!$storage) { $storage = $this; @@ -234,6 +263,7 @@ class Encoding extends Wrapper { return $this->getWrapperStorage()->getCache($this->findPathToUse($path), $storage); } + #[\Override] public function getScanner(string $path = '', ?IStorage $storage = null): IScanner { if (!$storage) { $storage = $this; @@ -241,10 +271,12 @@ class Encoding extends Wrapper { return $this->getWrapperStorage()->getScanner($this->findPathToUse($path), $storage); } + #[\Override] public function getETag(string $path): string|false { return $this->getWrapperStorage()->getETag($this->findPathToUse($path)); } + #[\Override] public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { if ($sourceStorage === $this) { return $this->copy($sourceInternalPath, $this->findPathToUse($targetInternalPath)); @@ -257,6 +289,7 @@ class Encoding extends Wrapper { return $result; } + #[\Override] public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { if ($sourceStorage === $this) { $result = $this->rename($sourceInternalPath, $this->findPathToUse($targetInternalPath)); @@ -275,6 +308,7 @@ class Encoding extends Wrapper { return $result; } + #[\Override] public function getMetaData(string $path): ?array { $entry = $this->getWrapperStorage()->getMetaData($this->findPathToUse($path)); if ($entry !== null) { @@ -283,6 +317,7 @@ class Encoding extends Wrapper { return $entry; } + #[\Override] public function getDirectoryContent(string $directory): \Traversable { $entries = $this->getWrapperStorage()->getDirectoryContent($this->findPathToUse($directory)); foreach ($entries as $entry) { diff --git a/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php b/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php index 0a90b49f0f1..3f07d690a50 100644 --- a/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php +++ b/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php @@ -13,6 +13,7 @@ use OC\Files\Filesystem; * Normalize file names while reading directory entries */ class EncodingDirectoryWrapper extends DirectoryWrapper { + #[\Override] public function dir_readdir(): string|false { $file = readdir($this->source); if ($file !== false && $file !== '.' && $file !== '..') { diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 194c57a4191..8edf25e9a51 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -61,6 +61,7 @@ class Encryption extends Wrapper { parent::__construct($parameters); } + #[\Override] public function filesize(string $path): int|float|false { $fullPath = $this->getFullPath($path); @@ -128,6 +129,7 @@ class Encryption extends Wrapper { return $data; } + #[\Override] public function getMetaData(string $path): ?array { $data = $this->getWrapperStorage()->getMetaData($path); if (is_null($data)) { @@ -136,6 +138,7 @@ class Encryption extends Wrapper { return $this->modifyMetaData($path, $data); } + #[\Override] public function getDirectoryContent(string $directory): \Traversable { $parent = rtrim($directory, '/'); foreach ($this->getWrapperStorage()->getDirectoryContent($directory) as $data) { @@ -143,6 +146,7 @@ class Encryption extends Wrapper { } } + #[\Override] public function file_get_contents(string $path): string|false { $encryptionModule = $this->getEncryptionModule($path); @@ -158,6 +162,7 @@ class Encryption extends Wrapper { return $this->getWrapperStorage()->file_get_contents($path); } + #[\Override] public function file_put_contents(string $path, mixed $data): int|float|false { // file put content will always be translated to a stream write $handle = $this->fopen($path, 'w'); @@ -170,6 +175,7 @@ class Encryption extends Wrapper { return false; } + #[\Override] public function unlink(string $path): bool { $fullPath = $this->getFullPath($path); if ($this->util->isExcluded($fullPath)) { @@ -184,6 +190,7 @@ class Encryption extends Wrapper { return $this->getWrapperStorage()->unlink($path); } + #[\Override] public function rename(string $source, string $target): bool { $result = $this->getWrapperStorage()->rename($source, $target); @@ -209,6 +216,7 @@ class Encryption extends Wrapper { return $result; } + #[\Override] public function rmdir(string $path): bool { $result = $this->getWrapperStorage()->rmdir($path); $fullPath = $this->getFullPath($path); @@ -222,6 +230,7 @@ class Encryption extends Wrapper { return $result; } + #[\Override] public function isReadable(string $path): bool { $isReadable = true; @@ -239,6 +248,7 @@ class Encryption extends Wrapper { return $this->getWrapperStorage()->isReadable($path) && $isReadable; } + #[\Override] public function copy(string $source, string $target): bool { $sourcePath = $this->getFullPath($source); @@ -252,6 +262,7 @@ class Encryption extends Wrapper { return $this->copyFromStorage($this, $source, $target); } + #[\Override] public function fopen(string $path, string $mode) { // check if the file is stored in the array cache, this means that we // copy a file over to the versions folder, in this case we don't want to @@ -518,6 +529,7 @@ class Encryption extends Wrapper { return $data; } + #[\Override] public function moveFromStorage( Storage\IStorage $sourceStorage, string $sourceInternalPath, @@ -561,6 +573,7 @@ class Encryption extends Wrapper { return $result; } + #[\Override] public function copyFromStorage( Storage\IStorage $sourceStorage, string $sourceInternalPath, @@ -721,6 +734,7 @@ class Encryption extends Wrapper { return $result; } + #[\Override] public function getLocalFile(string $path): string|false { if ($this->encryptionManager->isEnabled()) { $cachedFile = $this->getCachedFile($path); @@ -731,6 +745,7 @@ class Encryption extends Wrapper { return $this->getWrapperStorage()->getLocalFile($path); } + #[\Override] public function isLocal(): bool { if ($this->encryptionManager->isEnabled()) { return false; @@ -738,6 +753,7 @@ class Encryption extends Wrapper { return $this->getWrapperStorage()->isLocal(); } + #[\Override] public function stat(string $path): array|false { $stat = $this->getWrapperStorage()->stat($path); if (!$stat) { @@ -750,6 +766,7 @@ class Encryption extends Wrapper { return $stat; } + #[\Override] public function hash(string $type, string $path, bool $raw = false): string|false { $fh = $this->fopen($path, 'rb'); if ($fh === false) { @@ -912,6 +929,7 @@ class Encryption extends Wrapper { return $encryptionModule->shouldEncrypt($fullPath); } + #[\Override] public function writeStream(string $path, $stream, ?int $size = null): int { // always fall back to fopen $target = $this->fopen($path, 'w'); diff --git a/lib/private/Files/Storage/Wrapper/Jail.php b/lib/private/Files/Storage/Wrapper/Jail.php index 1d5dfc7153a..7d1a5814e93 100644 --- a/lib/private/Files/Storage/Wrapper/Jail.php +++ b/lib/private/Files/Storage/Wrapper/Jail.php @@ -74,152 +74,189 @@ class Jail extends Wrapper { } } + #[\Override] public function getId(): string { return parent::getId(); } + #[\Override] public function mkdir(string $path): bool { return $this->getWrapperStorage()->mkdir($this->getUnjailedPath($path)); } + #[\Override] public function rmdir(string $path): bool { return $this->getWrapperStorage()->rmdir($this->getUnjailedPath($path)); } + #[\Override] public function opendir(string $path) { return $this->getWrapperStorage()->opendir($this->getUnjailedPath($path)); } + #[\Override] public function is_dir(string $path): bool { return $this->getWrapperStorage()->is_dir($this->getUnjailedPath($path)); } + #[\Override] public function is_file(string $path): bool { return $this->getWrapperStorage()->is_file($this->getUnjailedPath($path)); } + #[\Override] public function stat(string $path): array|false { return $this->getWrapperStorage()->stat($this->getUnjailedPath($path)); } + #[\Override] public function filetype(string $path): string|false { return $this->getWrapperStorage()->filetype($this->getUnjailedPath($path)); } + #[\Override] public function filesize(string $path): int|float|false { return $this->getWrapperStorage()->filesize($this->getUnjailedPath($path)); } + #[\Override] public function isCreatable(string $path): bool { return $this->getWrapperStorage()->isCreatable($this->getUnjailedPath($path)); } + #[\Override] public function isReadable(string $path): bool { return $this->getWrapperStorage()->isReadable($this->getUnjailedPath($path)); } + #[\Override] public function isUpdatable(string $path): bool { return $this->getWrapperStorage()->isUpdatable($this->getUnjailedPath($path)); } + #[\Override] public function isDeletable(string $path): bool { return $this->getWrapperStorage()->isDeletable($this->getUnjailedPath($path)); } + #[\Override] public function isSharable(string $path): bool { return $this->getWrapperStorage()->isSharable($this->getUnjailedPath($path)); } + #[\Override] public function getPermissions(string $path): int { return $this->getWrapperStorage()->getPermissions($this->getUnjailedPath($path)); } + #[\Override] public function file_exists(string $path): bool { return $this->getWrapperStorage()->file_exists($this->getUnjailedPath($path)); } + #[\Override] public function filemtime(string $path): int|false { return $this->getWrapperStorage()->filemtime($this->getUnjailedPath($path)); } + #[\Override] public function file_get_contents(string $path): string|false { return $this->getWrapperStorage()->file_get_contents($this->getUnjailedPath($path)); } + #[\Override] public function file_put_contents(string $path, mixed $data): int|float|false { return $this->getWrapperStorage()->file_put_contents($this->getUnjailedPath($path), $data); } + #[\Override] public function unlink(string $path): bool { return $this->getWrapperStorage()->unlink($this->getUnjailedPath($path)); } + #[\Override] public function rename(string $source, string $target): bool { return $this->getWrapperStorage()->rename($this->getUnjailedPath($source), $this->getUnjailedPath($target)); } + #[\Override] public function copy(string $source, string $target): bool { return $this->getWrapperStorage()->copy($this->getUnjailedPath($source), $this->getUnjailedPath($target)); } + #[\Override] public function fopen(string $path, string $mode) { return $this->getWrapperStorage()->fopen($this->getUnjailedPath($path), $mode); } + #[\Override] public function getMimeType(string $path): string|false { return $this->getWrapperStorage()->getMimeType($this->getUnjailedPath($path)); } + #[\Override] public function hash(string $type, string $path, bool $raw = false): string|false { return $this->getWrapperStorage()->hash($type, $this->getUnjailedPath($path), $raw); } + #[\Override] public function free_space(string $path): int|float|false { return $this->getWrapperStorage()->free_space($this->getUnjailedPath($path)); } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { return $this->getWrapperStorage()->touch($this->getUnjailedPath($path), $mtime); } + #[\Override] public function getLocalFile(string $path): string|false { return $this->getWrapperStorage()->getLocalFile($this->getUnjailedPath($path)); } + #[\Override] public function hasUpdated(string $path, int $time): bool { return $this->getWrapperStorage()->hasUpdated($this->getUnjailedPath($path), $time); } + #[\Override] public function getCache(string $path = '', ?IStorage $storage = null): ICache { $sourceCache = $this->getWrapperStorage()->getCache($this->getUnjailedPath($path)); return new CacheJail($sourceCache, $this->rootPath); } + #[\Override] public function getOwner(string $path): string|false { return $this->getWrapperStorage()->getOwner($this->getUnjailedPath($path)); } + #[\Override] public function getWatcher(string $path = '', ?IStorage $storage = null): IWatcher { $sourceWatcher = $this->getWrapperStorage()->getWatcher($this->getUnjailedPath($path), $this->getWrapperStorage()); return new JailWatcher($sourceWatcher, $this->rootPath); } + #[\Override] public function getETag(string $path): string|false { return $this->getWrapperStorage()->getETag($this->getUnjailedPath($path)); } + #[\Override] public function getMetaData(string $path): ?array { return $this->getWrapperStorage()->getMetaData($this->getUnjailedPath($path)); } + #[\Override] public function acquireLock(string $path, int $type, ILockingProvider $provider): void { $this->getWrapperStorage()->acquireLock($this->getUnjailedPath($path), $type, $provider); } + #[\Override] public function releaseLock(string $path, int $type, ILockingProvider $provider): void { $this->getWrapperStorage()->releaseLock($this->getUnjailedPath($path), $type, $provider); } + #[\Override] public function changeLock(string $path, int $type, ILockingProvider $provider): void { $this->getWrapperStorage()->changeLock($this->getUnjailedPath($path), $type, $provider); } @@ -233,6 +270,7 @@ class Jail extends Wrapper { return [$this->getWrapperStorage(), $this->getUnjailedPath($path)]; } + #[\Override] public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { if ($sourceStorage === $this) { return $this->copy($sourceInternalPath, $targetInternalPath); @@ -240,6 +278,7 @@ class Jail extends Wrapper { return $this->getWrapperStorage()->copyFromStorage($sourceStorage, $sourceInternalPath, $this->getUnjailedPath($targetInternalPath)); } + #[\Override] public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { if ($sourceStorage === $this) { return $this->rename($sourceInternalPath, $targetInternalPath); @@ -247,6 +286,7 @@ class Jail extends Wrapper { return $this->getWrapperStorage()->moveFromStorage($sourceStorage, $sourceInternalPath, $this->getUnjailedPath($targetInternalPath)); } + #[\Override] public function getPropagator(?IStorage $storage = null): IPropagator { if (isset($this->propagator)) { return $this->propagator; @@ -259,6 +299,7 @@ class Jail extends Wrapper { return $this->propagator; } + #[\Override] public function writeStream(string $path, $stream, ?int $size = null): int { $storage = $this->getWrapperStorage(); if ($storage->instanceOfStorage(IWriteStreamStorage::class)) { @@ -277,6 +318,7 @@ class Jail extends Wrapper { } } + #[\Override] public function getDirectoryContent(string $directory): \Traversable { return $this->getWrapperStorage()->getDirectoryContent($this->getUnjailedPath($directory)); } diff --git a/lib/private/Files/Storage/Wrapper/KnownMtime.php b/lib/private/Files/Storage/Wrapper/KnownMtime.php index 657c6c9250c..da10e940753 100644 --- a/lib/private/Files/Storage/Wrapper/KnownMtime.php +++ b/lib/private/Files/Storage/Wrapper/KnownMtime.php @@ -26,6 +26,7 @@ class KnownMtime extends Wrapper { $this->clock = $parameters['clock']; } + #[\Override] public function file_put_contents(string $path, mixed $data): int|float|false { $result = parent::file_put_contents($path, $data); if ($result) { @@ -35,6 +36,7 @@ class KnownMtime extends Wrapper { return $result; } + #[\Override] public function stat(string $path): array|false { $stat = parent::stat($path); if ($stat) { @@ -43,6 +45,7 @@ class KnownMtime extends Wrapper { return $stat; } + #[\Override] public function getMetaData(string $path): ?array { $stat = parent::getMetaData($path); if ($stat) { @@ -58,11 +61,13 @@ class KnownMtime extends Wrapper { } } + #[\Override] public function filemtime(string $path): int|false { $knownMtime = $this->knowMtimes->get($path) ?? 0; return max(parent::filemtime($path), $knownMtime); } + #[\Override] public function mkdir(string $path): bool { $result = parent::mkdir($path); if ($result) { @@ -71,6 +76,7 @@ class KnownMtime extends Wrapper { return $result; } + #[\Override] public function rmdir(string $path): bool { $result = parent::rmdir($path); if ($result) { @@ -79,6 +85,7 @@ class KnownMtime extends Wrapper { return $result; } + #[\Override] public function unlink(string $path): bool { $result = parent::unlink($path); if ($result) { @@ -87,6 +94,7 @@ class KnownMtime extends Wrapper { return $result; } + #[\Override] public function rename(string $source, string $target): bool { $result = parent::rename($source, $target); if ($result) { @@ -96,6 +104,7 @@ class KnownMtime extends Wrapper { return $result; } + #[\Override] public function copy(string $source, string $target): bool { $result = parent::copy($source, $target); if ($result) { @@ -104,6 +113,7 @@ class KnownMtime extends Wrapper { return $result; } + #[\Override] public function fopen(string $path, string $mode) { $result = parent::fopen($path, $mode); if ($result && $mode === 'w') { @@ -112,6 +122,7 @@ class KnownMtime extends Wrapper { return $result; } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { $result = parent::touch($path, $mtime); if ($result) { @@ -120,6 +131,7 @@ class KnownMtime extends Wrapper { return $result; } + #[\Override] public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { $result = parent::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); if ($result) { @@ -128,6 +140,7 @@ class KnownMtime extends Wrapper { return $result; } + #[\Override] public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { $result = parent::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); if ($result) { @@ -136,6 +149,7 @@ class KnownMtime extends Wrapper { return $result; } + #[\Override] public function writeStream(string $path, $stream, ?int $size = null): int { $result = parent::writeStream($path, $stream, $size); if ($result) { diff --git a/lib/private/Files/Storage/Wrapper/PermissionsMask.php b/lib/private/Files/Storage/Wrapper/PermissionsMask.php index e67885b4397..15061b7c023 100644 --- a/lib/private/Files/Storage/Wrapper/PermissionsMask.php +++ b/lib/private/Files/Storage/Wrapper/PermissionsMask.php @@ -42,26 +42,32 @@ class PermissionsMask extends Wrapper { return ($this->mask & $permissions) === $permissions; } + #[\Override] public function isUpdatable(string $path): bool { return $this->checkMask(Constants::PERMISSION_UPDATE) && parent::isUpdatable($path); } + #[\Override] public function isCreatable(string $path): bool { return $this->checkMask(Constants::PERMISSION_CREATE) && parent::isCreatable($path); } + #[\Override] public function isDeletable(string $path): bool { return $this->checkMask(Constants::PERMISSION_DELETE) && parent::isDeletable($path); } + #[\Override] public function isSharable(string $path): bool { return $this->checkMask(Constants::PERMISSION_SHARE) && parent::isSharable($path); } + #[\Override] public function getPermissions(string $path): int { return $this->getWrapperStorage()->getPermissions($path) & $this->mask; } + #[\Override] public function rename(string $source, string $target): bool { //This is a rename of the transfer file to the original file if (dirname($source) === dirname($target) && strpos($source, '.ocTransferId') > 0) { @@ -70,32 +76,39 @@ class PermissionsMask extends Wrapper { return $this->checkMask(Constants::PERMISSION_UPDATE) && parent::rename($source, $target); } + #[\Override] public function copy(string $source, string $target): bool { return $this->checkMask(Constants::PERMISSION_CREATE) && parent::copy($source, $target); } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { $permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE; return $this->checkMask($permissions) && parent::touch($path, $mtime); } + #[\Override] public function mkdir(string $path): bool { return $this->checkMask(Constants::PERMISSION_CREATE) && parent::mkdir($path); } + #[\Override] public function rmdir(string $path): bool { return $this->checkMask(Constants::PERMISSION_DELETE) && parent::rmdir($path); } + #[\Override] public function unlink(string $path): bool { return $this->checkMask(Constants::PERMISSION_DELETE) && parent::unlink($path); } + #[\Override] public function file_put_contents(string $path, mixed $data): int|float|false { $permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE; return $this->checkMask($permissions) ? parent::file_put_contents($path, $data) : false; } + #[\Override] public function fopen(string $path, string $mode) { if ($mode === 'r' || $mode === 'rb') { return parent::fopen($path, $mode); @@ -105,6 +118,7 @@ class PermissionsMask extends Wrapper { } } + #[\Override] public function getCache(string $path = '', ?IStorage $storage = null): ICache { if (!$storage) { $storage = $this; @@ -113,6 +127,7 @@ class PermissionsMask extends Wrapper { return new CachePermissionsMask($sourceCache, $this->mask); } + #[\Override] public function getMetaData(string $path): ?array { $data = parent::getMetaData($path); @@ -123,6 +138,7 @@ class PermissionsMask extends Wrapper { return $data; } + #[\Override] public function getScanner(string $path = '', ?IStorage $storage = null): IScanner { if (!$storage) { $storage = $this->getWrapperStorage(); @@ -130,6 +146,7 @@ class PermissionsMask extends Wrapper { return parent::getScanner($path, $storage); } + #[\Override] public function getDirectoryContent(string $directory): \Traversable { foreach ($this->getWrapperStorage()->getDirectoryContent($directory) as $data) { $data['scan_permissions'] ??= $data['permissions']; diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php index ce0de5bb711..e0c3366146e 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -71,6 +71,7 @@ class Quota extends Wrapper { } } + #[\Override] public function free_space(string $path): int|float|false { if (!$this->hasQuota()) { return $this->getWrapperStorage()->free_space($path); @@ -91,6 +92,7 @@ class Quota extends Wrapper { } } + #[\Override] public function file_put_contents(string $path, mixed $data): int|float|false { if (!$this->hasQuota()) { return $this->getWrapperStorage()->file_put_contents($path, $data); @@ -103,6 +105,7 @@ class Quota extends Wrapper { } } + #[\Override] public function copy(string $source, string $target): bool { if (!$this->hasQuota()) { return $this->getWrapperStorage()->copy($source, $target); @@ -115,6 +118,7 @@ class Quota extends Wrapper { } } + #[\Override] public function fopen(string $path, string $mode) { if (!$this->hasQuota()) { return $this->getWrapperStorage()->fopen($path, $mode); @@ -154,6 +158,7 @@ class Quota extends Wrapper { return str_starts_with(ltrim($path, '/'), 'files/'); } + #[\Override] public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { if (!$this->hasQuota()) { return $this->getWrapperStorage()->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); @@ -166,6 +171,7 @@ class Quota extends Wrapper { } } + #[\Override] public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { if (!$this->hasQuota()) { return $this->getWrapperStorage()->moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); @@ -178,6 +184,7 @@ class Quota extends Wrapper { } } + #[\Override] public function mkdir(string $path): bool { if (!$this->hasQuota()) { return $this->getWrapperStorage()->mkdir($path); @@ -190,6 +197,7 @@ class Quota extends Wrapper { return parent::mkdir($path); } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { if (!$this->hasQuota()) { return $this->getWrapperStorage()->touch($path, $mtime); diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index d9928626ed1..ff43e75d6ec 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -55,122 +55,152 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { return $this->storage; } + #[\Override] public function getId(): string { return $this->getWrapperStorage()->getId(); } + #[\Override] public function mkdir(string $path): bool { return $this->getWrapperStorage()->mkdir($path); } + #[\Override] public function rmdir(string $path): bool { return $this->getWrapperStorage()->rmdir($path); } + #[\Override] public function opendir(string $path) { return $this->getWrapperStorage()->opendir($path); } + #[\Override] public function is_dir(string $path): bool { return $this->getWrapperStorage()->is_dir($path); } + #[\Override] public function is_file(string $path): bool { return $this->getWrapperStorage()->is_file($path); } + #[\Override] public function stat(string $path): array|false { return $this->getWrapperStorage()->stat($path); } + #[\Override] public function filetype(string $path): string|false { return $this->getWrapperStorage()->filetype($path); } + #[\Override] public function filesize(string $path): int|float|false { return $this->getWrapperStorage()->filesize($path); } + #[\Override] public function isCreatable(string $path): bool { return $this->getWrapperStorage()->isCreatable($path); } + #[\Override] public function isReadable(string $path): bool { return $this->getWrapperStorage()->isReadable($path); } + #[\Override] public function isUpdatable(string $path): bool { return $this->getWrapperStorage()->isUpdatable($path); } + #[\Override] public function isDeletable(string $path): bool { return $this->getWrapperStorage()->isDeletable($path); } + #[\Override] public function isSharable(string $path): bool { return $this->getWrapperStorage()->isSharable($path); } + #[\Override] public function getPermissions(string $path): int { return $this->getWrapperStorage()->getPermissions($path); } + #[\Override] public function file_exists(string $path): bool { return $this->getWrapperStorage()->file_exists($path); } + #[\Override] public function filemtime(string $path): int|false { return $this->getWrapperStorage()->filemtime($path); } + #[\Override] public function file_get_contents(string $path): string|false { return $this->getWrapperStorage()->file_get_contents($path); } + #[\Override] public function file_put_contents(string $path, mixed $data): int|float|false { return $this->getWrapperStorage()->file_put_contents($path, $data); } + #[\Override] public function unlink(string $path): bool { return $this->getWrapperStorage()->unlink($path); } + #[\Override] public function rename(string $source, string $target): bool { return $this->getWrapperStorage()->rename($source, $target); } + #[\Override] public function copy(string $source, string $target): bool { return $this->getWrapperStorage()->copy($source, $target); } + #[\Override] public function fopen(string $path, string $mode) { return $this->getWrapperStorage()->fopen($path, $mode); } + #[\Override] public function getMimeType(string $path): string|false { return $this->getWrapperStorage()->getMimeType($path); } + #[\Override] public function hash(string $type, string $path, bool $raw = false): string|false { return $this->getWrapperStorage()->hash($type, $path, $raw); } + #[\Override] public function free_space(string $path): int|float|false { return $this->getWrapperStorage()->free_space($path); } + #[\Override] public function touch(string $path, ?int $mtime = null): bool { return $this->getWrapperStorage()->touch($path, $mtime); } + #[\Override] public function getLocalFile(string $path): string|false { return $this->getWrapperStorage()->getLocalFile($path); } + #[\Override] public function hasUpdated(string $path, int $time): bool { return $this->getWrapperStorage()->hasUpdated($path, $time); } + #[\Override] public function getCache(string $path = '', ?IStorage $storage = null): ICache { if (!$storage instanceof IStorage) { $storage = $this; @@ -179,6 +209,7 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { return $this->getWrapperStorage()->getCache($path, $storage); } + #[\Override] public function getScanner(string $path = '', ?IStorage $storage = null): IScanner { if (!$storage instanceof IStorage) { $storage = $this; @@ -187,10 +218,12 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { return $this->getWrapperStorage()->getScanner($path, $storage); } + #[\Override] public function getOwner(string $path): string|false { return $this->getWrapperStorage()->getOwner($path); } + #[\Override] public function getWatcher(string $path = '', ?IStorage $storage = null): IWatcher { if (!$storage instanceof IStorage) { $storage = $this; @@ -199,6 +232,7 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { return $this->getWrapperStorage()->getWatcher($path, $storage); } + #[\Override] public function getPropagator(?IStorage $storage = null): IPropagator { if (!$storage instanceof IStorage) { $storage = $this; @@ -207,6 +241,7 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { return $this->getWrapperStorage()->getPropagator($storage); } + #[\Override] public function getUpdater(?IStorage $storage = null): IUpdater { if (!$storage instanceof IStorage) { $storage = $this; @@ -215,22 +250,27 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { return $this->getWrapperStorage()->getUpdater($storage); } + #[\Override] public function getStorageCache(): \OC\Files\Cache\Storage { return $this->getWrapperStorage()->getStorageCache(); } + #[\Override] public function getETag(string $path): string|false { return $this->getWrapperStorage()->getETag($path); } + #[\Override] public function test(): bool { return $this->getWrapperStorage()->test(); } + #[\Override] public function isLocal(): bool { return $this->getWrapperStorage()->isLocal(); } + #[\Override] public function instanceOfStorage(string $class): bool { return is_a($this, $class) || $this->getWrapperStorage()->instanceOfStorage($class); } @@ -277,18 +317,22 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { return $this->getWrapperStorage()->getDirectDownloadById($fileId); } + #[\Override] public function getAvailability(): array { return $this->getWrapperStorage()->getAvailability(); } + #[\Override] public function setAvailability(bool $isAvailable): void { $this->getWrapperStorage()->setAvailability($isAvailable); } + #[\Override] public function verifyPath(string $path, string $fileName): void { $this->getWrapperStorage()->verifyPath($path, $fileName); } + #[\Override] public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { if ($sourceStorage === $this) { return $this->copy($sourceInternalPath, $targetInternalPath); @@ -297,6 +341,7 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { return $this->getWrapperStorage()->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } + #[\Override] public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { if ($sourceStorage === $this) { return $this->rename($sourceInternalPath, $targetInternalPath); @@ -305,10 +350,12 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { return $this->getWrapperStorage()->moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } + #[\Override] public function getMetaData(string $path): ?array { return $this->getWrapperStorage()->getMetaData($path); } + #[\Override] public function acquireLock(string $path, int $type, ILockingProvider $provider): void { $storage = $this->getWrapperStorage(); if ($storage->instanceOfStorage(ILockingStorage::class)) { @@ -316,6 +363,7 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { } } + #[\Override] public function releaseLock(string $path, int $type, ILockingProvider $provider): void { $storage = $this->getWrapperStorage(); if ($storage->instanceOfStorage(ILockingStorage::class)) { @@ -323,6 +371,7 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { } } + #[\Override] public function changeLock(string $path, int $type, ILockingProvider $provider): void { $storage = $this->getWrapperStorage(); if ($storage->instanceOfStorage(ILockingStorage::class)) { @@ -330,10 +379,12 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { } } + #[\Override] public function needsPartFile(): bool { return $this->getWrapperStorage()->needsPartFile(); } + #[\Override] public function writeStream(string $path, $stream, ?int $size = null): int { $storage = $this->getWrapperStorage(); if ($storage->instanceOfStorage(IWriteStreamStorage::class)) { @@ -356,6 +407,7 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { return $count; } + #[\Override] public function getDirectoryContent(string $directory): \Traversable { return $this->getWrapperStorage()->getDirectoryContent($directory); } @@ -373,6 +425,7 @@ class Wrapper implements Storage, ILockingStorage, IWriteStreamStorage { return false; } + #[\Override] public function setOwner(?string $user): void { $this->getWrapperStorage()->setOwner($user); } diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php index ef147ec421f..1c662aa023c 100644 --- a/lib/private/Files/Stream/Encryption.php +++ b/lib/private/Files/Stream/Encryption.php @@ -142,6 +142,7 @@ class Encryption extends Wrapper { * @return resource * @throws \BadMethodCallException */ + #[\Override] protected static function wrapSource($source, $context = [], $protocol = null, $class = null, $mode = 'r+') { try { if ($protocol === null) { @@ -182,6 +183,7 @@ class Encryption extends Wrapper { * @return array * @throws \BadMethodCallException */ + #[\Override] protected function loadContext($name = null) { $context = parent::loadContext($name); @@ -195,6 +197,7 @@ class Encryption extends Wrapper { return $context; } + #[\Override] public function stream_open($path, $mode, $options, &$opened_path) { $this->loadContext('ocencryption'); @@ -246,10 +249,12 @@ class Encryption extends Wrapper { return true; } + #[\Override] public function stream_eof() { return $this->position >= $this->unencryptedSize; } + #[\Override] public function stream_read($count) { $result = ''; @@ -301,6 +306,7 @@ class Encryption extends Wrapper { return $data; } + #[\Override] public function stream_write($data) { $length = 0; // loop over $data to fit it in 6126 sized unencrypted blocks @@ -351,10 +357,12 @@ class Encryption extends Wrapper { return $length; } + #[\Override] public function stream_tell() { return $this->position; } + #[\Override] public function stream_seek($offset, $whence = SEEK_SET) { $return = false; @@ -390,6 +398,7 @@ class Encryption extends Wrapper { return $return; } + #[\Override] public function stream_close() { $this->flush('end'); $position = (int)floor($this->position / $this->unencryptedBlockSize); @@ -496,6 +505,7 @@ class Encryption extends Wrapper { * @param array $options * @return bool */ + #[\Override] public function dir_opendir($path, $options) { return false; } diff --git a/lib/private/Files/Stream/HashWrapper.php b/lib/private/Files/Stream/HashWrapper.php index 5956ad92549..16206e56c4a 100644 --- a/lib/private/Files/Stream/HashWrapper.php +++ b/lib/private/Files/Stream/HashWrapper.php @@ -34,20 +34,24 @@ class HashWrapper extends Wrapper { return true; } + #[\Override] public function dir_opendir($path, $options) { return $this->open(); } + #[\Override] public function stream_open($path, $mode, $options, &$opened_path) { return $this->open(); } + #[\Override] public function stream_read($count) { $result = parent::stream_read($count); hash_update($this->hash, $result); return $result; } + #[\Override] public function stream_close() { if (is_callable($this->callback)) { // if the stream is closed as a result of the end-of-request GC, the hash context might be cleaned up before this stream diff --git a/lib/private/Files/Stream/Quota.php b/lib/private/Files/Stream/Quota.php index 3c7e09c633b..755d9b428d6 100644 --- a/lib/private/Files/Stream/Quota.php +++ b/lib/private/Files/Stream/Quota.php @@ -35,6 +35,7 @@ class Quota extends Wrapper { return Wrapper::wrapSource($stream, $context, 'quota', self::class); } + #[\Override] public function stream_open($path, $mode, $options, &$opened_path) { $context = $this->loadContext('quota'); $this->source = $context['source']; @@ -43,10 +44,12 @@ class Quota extends Wrapper { return true; } + #[\Override] public function dir_opendir($path, $options) { return false; } + #[\Override] public function stream_seek($offset, $whence = SEEK_SET) { if ($whence === SEEK_END) { // go to the end to find out last position's offset @@ -67,11 +70,13 @@ class Quota extends Wrapper { return fseek($this->source, $offset, $whence) === 0; } + #[\Override] public function stream_read($count) { $this->limit -= $count; return fread($this->source, $count); } + #[\Override] public function stream_write($data) { $size = strlen($data); if ($size > $this->limit) { diff --git a/lib/private/Files/Stream/SeekableHttpStream.php b/lib/private/Files/Stream/SeekableHttpStream.php index 6ce0a880e8d..cefa8ced1db 100644 --- a/lib/private/Files/Stream/SeekableHttpStream.php +++ b/lib/private/Files/Stream/SeekableHttpStream.php @@ -144,6 +144,7 @@ class SeekableHttpStream implements File { return is_resource($this->current); } + #[\Override] public function stream_open($path, $mode, $options, &$opened_path) { $options = stream_context_get_options($this->context)[self::PROTOCOL]; $this->openCallback = $options['callback']; @@ -151,6 +152,7 @@ class SeekableHttpStream implements File { return $this->reconnect(0); } + #[\Override] public function stream_read($count) { if (!$this->getCurrent()) { return false; @@ -160,6 +162,7 @@ class SeekableHttpStream implements File { return $ret; } + #[\Override] public function stream_seek($offset, $whence = SEEK_SET) { switch ($whence) { case SEEK_SET: @@ -195,10 +198,12 @@ class SeekableHttpStream implements File { return true; } + #[\Override] public function stream_tell() { return $this->offset; } + #[\Override] public function stream_stat() { if ($this->getCurrent()) { $stat = fstat($this->getCurrent()); @@ -211,6 +216,7 @@ class SeekableHttpStream implements File { } } + #[\Override] public function stream_eof() { if ($this->getCurrent()) { return feof($this->getCurrent()); @@ -219,6 +225,7 @@ class SeekableHttpStream implements File { } } + #[\Override] public function stream_close() { if ($this->hasOpenStream()) { fclose($this->current); @@ -226,22 +233,27 @@ class SeekableHttpStream implements File { $this->current = null; } + #[\Override] public function stream_write($data) { return false; } + #[\Override] public function stream_set_option($option, $arg1, $arg2) { return false; } + #[\Override] public function stream_truncate($size) { return false; } + #[\Override] public function stream_lock($operation) { return false; } + #[\Override] public function stream_flush() { return; //noop because readonly stream } diff --git a/lib/private/Files/Template/TemplateManager.php b/lib/private/Files/Template/TemplateManager.php index d965a41957a..54c082c006f 100644 --- a/lib/private/Files/Template/TemplateManager.php +++ b/lib/private/Files/Template/TemplateManager.php @@ -295,6 +295,7 @@ class TemplateManager implements ITemplateManager { ]; } + #[\Override] public function hasTemplateDirectory(): bool { try { $this->getTemplateFolder(); diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index f056c5bdd58..67a65cdf0e0 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -121,6 +121,7 @@ class Detection implements IMimeTypeDetector { /** * @return array */ + #[\Override] public function getAllAliases(): array { $this->loadAliases(); return $this->mimeTypeAlias; @@ -149,6 +150,7 @@ class Detection implements IMimeTypeDetector { /** * @return array */ + #[\Override] public function getAllMappings(): array { $this->loadMappings(); return $this->mimeTypes; @@ -168,6 +170,7 @@ class Detection implements IMimeTypeDetector { /** * @return array */ + #[\Override] public function getAllNamings(): array { $this->loadNamings(); return $this->mimeTypesNames; @@ -179,6 +182,7 @@ class Detection implements IMimeTypeDetector { * @param string $path * @return string */ + #[\Override] public function detectPath($path): string { $this->loadMappings(); @@ -211,6 +215,7 @@ class Detection implements IMimeTypeDetector { * @return string * @since 18.0.0 */ + #[\Override] public function detectContent(string $path): string { $this->loadMappings(); @@ -274,6 +279,7 @@ class Detection implements IMimeTypeDetector { * @param string $path * @return string */ + #[\Override] public function detect($path): string { $mimeType = $this->detectPath($path); @@ -290,6 +296,7 @@ class Detection implements IMimeTypeDetector { * @param string $data * @return string */ + #[\Override] public function detectString($data): string { if (class_exists(finfo::class)) { $finfo = new finfo(FILEINFO_MIME_TYPE); @@ -314,6 +321,7 @@ class Detection implements IMimeTypeDetector { * @param string $mimeType * @return string */ + #[\Override] public function getSecureMimeType($mimeType): string { $this->loadMappings(); @@ -325,6 +333,7 @@ class Detection implements IMimeTypeDetector { * @param string $mimeType the MIME type * @return string the url */ + #[\Override] public function mimeTypeIcon($mimeType): string { $this->loadAliases(); diff --git a/lib/private/Files/Type/Loader.php b/lib/private/Files/Type/Loader.php index 5fbe4139759..48a62bc2858 100644 --- a/lib/private/Files/Type/Loader.php +++ b/lib/private/Files/Type/Loader.php @@ -40,6 +40,7 @@ class Loader implements IMimeTypeLoader { /** * Get a mimetype from its ID */ + #[\Override] public function getMimetypeById(int $id): ?string { if (!$this->mimetypes) { $this->loadMimetypes(); @@ -53,6 +54,7 @@ class Loader implements IMimeTypeLoader { /** * Get a mimetype ID, adding the mimetype to the DB if it does not exist */ + #[\Override] public function getId(string $mimetype): int { if (!$this->mimetypeIds) { $this->loadMimetypes(); @@ -66,6 +68,7 @@ class Loader implements IMimeTypeLoader { /** * Test if a mimetype exists in the database */ + #[\Override] public function exists(string $mimetype): bool { if (!$this->mimetypeIds) { $this->loadMimetypes(); @@ -76,6 +79,7 @@ class Loader implements IMimeTypeLoader { /** * Clear all loaded mimetypes, allow for re-loading */ + #[\Override] public function reset(): void { $this->mimetypes = []; $this->mimetypeIds = []; @@ -145,6 +149,7 @@ class Loader implements IMimeTypeLoader { * * @return int number of changed rows */ + #[\Override] public function updateFilecache(string $ext, int $mimeTypeId): int { $folderMimeTypeId = $this->getId('httpd/unix-directory'); $update = $this->dbConnection->getQueryBuilder(); diff --git a/lib/private/FilesMetadata/FilesMetadataManager.php b/lib/private/FilesMetadata/FilesMetadataManager.php index 9282513109b..b6077f1f271 100644 --- a/lib/private/FilesMetadata/FilesMetadataManager.php +++ b/lib/private/FilesMetadata/FilesMetadataManager.php @@ -72,6 +72,7 @@ class FilesMetadataManager implements IFilesMetadataManager { * @see self::PROCESS_LIVE * @since 28.0.0 */ + #[\Override] public function refreshMetadata( Node $node, int $process = self::PROCESS_LIVE, @@ -122,6 +123,7 @@ class FilesMetadataManager implements IFilesMetadataManager { * @throws FilesMetadataNotFoundException if not found * @since 28.0.0 */ + #[\Override] public function getMetadata(int $fileId, bool $generate = false): IFilesMetadata { try { return $this->metadataRequestService->getMetadataFromFileId($fileId); @@ -143,6 +145,7 @@ class FilesMetadataManager implements IFilesMetadataManager { * @psalm-return array * @since 28.0.0 */ + #[\Override] public function getMetadataForFiles(array $fileIds): array { return $this->metadataRequestService->getMetadataFromFileIds($fileIds); } @@ -154,6 +157,7 @@ class FilesMetadataManager implements IFilesMetadataManager { * @throws FilesMetadataException if metadata seems malformed * @since 28.0.0 */ + #[\Override] public function saveMetadata(IFilesMetadata $filesMetadata): void { if ($filesMetadata->getFileId() === 0 || !$filesMetadata->updated()) { return; @@ -200,6 +204,7 @@ class FilesMetadataManager implements IFilesMetadataManager { * @inheritDoc * @since 28.0.0 */ + #[\Override] public function deleteMetadata(int $fileId): void { try { $this->metadataRequestService->dropMetadata($fileId); @@ -214,6 +219,7 @@ class FilesMetadataManager implements IFilesMetadataManager { } } + #[\Override] public function deleteMetadataForFiles(int $storage, array $fileIds): void { try { $this->metadataRequestService->dropMetadataForFiles($storage, $fileIds); @@ -238,6 +244,7 @@ class FilesMetadataManager implements IFilesMetadataManager { * @see IMetadataQuery * @since 28.0.0 */ + #[\Override] public function getMetadataQuery( IQueryBuilder $qb, string $fileTableAlias, @@ -251,6 +258,7 @@ class FilesMetadataManager implements IFilesMetadataManager { * @return IFilesMetadata * @since 28.0.0 */ + #[\Override] public function getKnownMetadata(): IFilesMetadata { if ($this->all !== null) { return $this->all; @@ -286,6 +294,7 @@ class FilesMetadataManager implements IFilesMetadataManager { * @see IMetadataValueWrapper::EDIT_REQ_WRITE_PERMISSION * @see IMetadataValueWrapper::EDIT_REQ_READ_PERMISSION */ + #[\Override] public function initMetadata( string $key, string $type, diff --git a/lib/private/FilesMetadata/Job/UpdateSingleMetadata.php b/lib/private/FilesMetadata/Job/UpdateSingleMetadata.php index 5746493ddef..2a01fd665cd 100644 --- a/lib/private/FilesMetadata/Job/UpdateSingleMetadata.php +++ b/lib/private/FilesMetadata/Job/UpdateSingleMetadata.php @@ -34,6 +34,7 @@ class UpdateSingleMetadata extends QueuedJob { parent::__construct($time); } + #[\Override] protected function run($argument) { [$userId, $fileId] = $argument; diff --git a/lib/private/FilesMetadata/Listener/MetadataDelete.php b/lib/private/FilesMetadata/Listener/MetadataDelete.php index 5a404614df0..018706cdcd0 100644 --- a/lib/private/FilesMetadata/Listener/MetadataDelete.php +++ b/lib/private/FilesMetadata/Listener/MetadataDelete.php @@ -27,6 +27,7 @@ class MetadataDelete implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof CacheEntriesRemovedEvent)) { return; diff --git a/lib/private/FilesMetadata/Listener/MetadataUpdate.php b/lib/private/FilesMetadata/Listener/MetadataUpdate.php index 4c5c913c740..057021535d7 100644 --- a/lib/private/FilesMetadata/Listener/MetadataUpdate.php +++ b/lib/private/FilesMetadata/Listener/MetadataUpdate.php @@ -33,6 +33,7 @@ class MetadataUpdate implements IEventListener { /** * @param Event $event */ + #[\Override] public function handle(Event $event): void { if (!($event instanceof NodeWrittenEvent)) { return; diff --git a/lib/private/FilesMetadata/MetadataQuery.php b/lib/private/FilesMetadata/MetadataQuery.php index 19495c38e5e..34d06779610 100644 --- a/lib/private/FilesMetadata/MetadataQuery.php +++ b/lib/private/FilesMetadata/MetadataQuery.php @@ -53,6 +53,7 @@ class MetadataQuery implements IMetadataQuery { * @see self::extractMetadata() * @since 28.0.0 */ + #[\Override] public function retrieveMetadata(): void { $this->queryBuilder->selectAlias($this->alias . '.json', 'meta_json'); $this->queryBuilder->selectAlias($this->alias . '.sync_token', 'meta_sync_token'); @@ -70,6 +71,7 @@ class MetadataQuery implements IMetadataQuery { * @see self::retrieveMetadata() * @since 28.0.0 */ + #[\Override] public function extractMetadata(array $row): IFilesMetadata { $fileId = (array_key_exists($this->fileIdField, $row)) ? $row[$this->fileIdField] : 0; $metadata = new FilesMetadata((int)$fileId); @@ -89,6 +91,7 @@ class MetadataQuery implements IMetadataQuery { * @inheritDoc * @since 28.0.0 */ + #[\Override] public function joinIndex(string $metadataKey, bool $enforce = false): string { if (array_key_exists($metadataKey, $this->knownJoinedIndex)) { return $this->knownJoinedIndex[$metadataKey]; @@ -140,6 +143,7 @@ class MetadataQuery implements IMetadataQuery { * @throws FilesMetadataNotFoundException * @since 28.0.0 */ + #[\Override] public function getMetadataKeyField(string $metadataKey): string { return $this->joinedTableAlias($metadataKey) . '.meta_key'; } @@ -154,6 +158,7 @@ class MetadataQuery implements IMetadataQuery { * @throws FilesMetadataTypeException is metadataKey is not set as indexed * @since 28.0.0 */ + #[\Override] public function getMetadataValueField(string $metadataKey): string { if ($this->manager instanceof IFilesMetadataManager) { /** diff --git a/lib/private/FilesMetadata/Model/FilesMetadata.php b/lib/private/FilesMetadata/Model/FilesMetadata.php index b66e1fe3711..85774b82027 100644 --- a/lib/private/FilesMetadata/Model/FilesMetadata.php +++ b/lib/private/FilesMetadata/Model/FilesMetadata.php @@ -39,6 +39,7 @@ class FilesMetadata implements IFilesMetadata { * @return int related file id * @since 28.0.0 */ + #[\Override] public function getFileId(): int { return $this->fileId; } @@ -64,6 +65,7 @@ class FilesMetadata implements IFilesMetadata { * @return int timestamp * @since 28.0.0 */ + #[\Override] public function lastUpdateTimestamp(): int { return $this->lastUpdate; } @@ -73,6 +75,7 @@ class FilesMetadata implements IFilesMetadata { * @return string token * @since 28.0.0 */ + #[\Override] public function getSyncToken(): string { return $this->syncToken; } @@ -82,6 +85,7 @@ class FilesMetadata implements IFilesMetadata { * @return string[] list of keys * @since 28.0.0 */ + #[\Override] public function getKeys(): array { return array_keys($this->metadata); } @@ -93,6 +97,7 @@ class FilesMetadata implements IFilesMetadata { * @return bool TRUE if key exist * @since 28.0.0 */ + #[\Override] public function hasKey(string $needle): bool { return (in_array($needle, $this->getKeys())); } @@ -102,6 +107,7 @@ class FilesMetadata implements IFilesMetadata { * @return string[] list of indexes * @since 28.0.0 */ + #[\Override] public function getIndexes(): array { $indexes = []; foreach ($this->getKeys() as $key) { @@ -120,6 +126,7 @@ class FilesMetadata implements IFilesMetadata { * @return bool TRUE if key exists and is set as indexed * @since 28.0.0 */ + #[\Override] public function isIndex(string $key): bool { return $this->metadata[$key]?->isIndexed() ?? false; } @@ -132,6 +139,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataNotFoundException * @since 28.0.0 */ + #[\Override] public function getEditPermission(string $key): int { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -148,6 +156,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataNotFoundException * @since 28.0.0 */ + #[\Override] public function setEditPermission(string $key, int $permission): void { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -157,6 +166,7 @@ class FilesMetadata implements IFilesMetadata { } + #[\Override] public function getEtag(string $key): string { if (!array_key_exists($key, $this->metadata)) { return ''; @@ -165,6 +175,7 @@ class FilesMetadata implements IFilesMetadata { return $this->metadata[$key]->getEtag(); } + #[\Override] public function setEtag(string $key, string $etag): void { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -182,6 +193,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataTypeException * @since 28.0.0 */ + #[\Override] public function getString(string $key): string { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -199,6 +211,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataTypeException * @since 28.0.0 */ + #[\Override] public function getInt(string $key): int { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -216,6 +229,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataTypeException * @since 28.0.0 */ + #[\Override] public function getFloat(string $key): float { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -233,6 +247,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataTypeException * @since 28.0.0 */ + #[\Override] public function getBool(string $key): bool { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -250,6 +265,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataTypeException * @since 28.0.0 */ + #[\Override] public function getArray(string $key): array { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -267,6 +283,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataTypeException * @since 28.0.0 */ + #[\Override] public function getStringList(string $key): array { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -284,6 +301,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataTypeException * @since 28.0.0 */ + #[\Override] public function getIntList(string $key): array { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -307,6 +325,7 @@ class FilesMetadata implements IFilesMetadata { * @see IMetadataValueWrapper::TYPE_INT_LIST * @since 28.0.0 */ + #[\Override] public function getType(string $key): string { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -325,6 +344,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataKeyFormatException * @since 28.0.0 */ + #[\Override] public function setString(string $key, string $value, bool $index = false): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -352,6 +372,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataKeyFormatException * @since 28.0.0 */ + #[\Override] public function setInt(string $key, int $value, bool $index = false): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -378,6 +399,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataKeyFormatException * @since 28.0.0 */ + #[\Override] public function setFloat(string $key, float $value, bool $index = false): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -406,6 +428,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataKeyFormatException * @since 28.0.0 */ + #[\Override] public function setBool(string $key, bool $value, bool $index = false): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -433,6 +456,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataKeyFormatException * @since 28.0.0 */ + #[\Override] public function setArray(string $key, array $value): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -460,6 +484,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataKeyFormatException * @since 28.0.0 */ + #[\Override] public function setStringList(string $key, array $value, bool $index = false): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -487,6 +512,7 @@ class FilesMetadata implements IFilesMetadata { * @throws FilesMetadataKeyFormatException * @since 28.0.0 */ + #[\Override] public function setIntList(string $key, array $value, bool $index = false): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -511,6 +537,7 @@ class FilesMetadata implements IFilesMetadata { * @return self * @since 28.0.0 */ + #[\Override] public function unset(string $key): IFilesMetadata { if (!array_key_exists($key, $this->metadata)) { return $this; @@ -529,6 +556,7 @@ class FilesMetadata implements IFilesMetadata { * @return self * @since 28.0.0 */ + #[\Override] public function removeStartsWith(string $keyPrefix): IFilesMetadata { if ($keyPrefix === '') { return $this; @@ -563,10 +591,12 @@ class FilesMetadata implements IFilesMetadata { * @return bool TRUE if metadata have been modified * @since 28.0.0 */ + #[\Override] public function updated(): bool { return $this->updated; } + #[\Override] public function jsonSerialize(bool $emptyValues = false): array { $data = []; foreach ($this->metadata as $metaKey => $metaValueWrapper) { @@ -579,6 +609,7 @@ class FilesMetadata implements IFilesMetadata { /** * @return array */ + #[\Override] public function asArray(): array { $data = []; foreach ($this->metadata as $metaKey => $metaValueWrapper) { @@ -599,6 +630,7 @@ class FilesMetadata implements IFilesMetadata { * @return IFilesMetadata * @since 28.0.0 */ + #[\Override] public function import(array $data): IFilesMetadata { foreach ($data as $k => $v) { $valueWrapper = new MetadataValueWrapper(); diff --git a/lib/private/FilesMetadata/Model/MetadataValueWrapper.php b/lib/private/FilesMetadata/Model/MetadataValueWrapper.php index 606f3b5acec..b6547c6ba2e 100644 --- a/lib/private/FilesMetadata/Model/MetadataValueWrapper.php +++ b/lib/private/FilesMetadata/Model/MetadataValueWrapper.php @@ -54,6 +54,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @see self::TYPE_STRING * @since 28.0.0 */ + #[\Override] public function getType(): string { return $this->type; } @@ -72,6 +73,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @see self::TYPE_STRING * @since 28.0.0 */ + #[\Override] public function isType(string $type): bool { return (strtolower($type) === strtolower($this->type)); } @@ -91,6 +93,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @see self::TYPE_FLOAT * @since 28.0.0 */ + #[\Override] public function assertType(string $type): self { if (!$this->isType($type)) { throw new FilesMetadataTypeException('type is \'' . $this->getType() . '\', expecting \'' . $type . '\''); @@ -107,6 +110,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataTypeException if wrapper was not set to store a string * @since 28.0.0 */ + #[\Override] public function setValueString(string $value): self { $this->assertType(self::TYPE_STRING); $this->value = $value; @@ -122,6 +126,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataTypeException if wrapper was not set to store an int * @since 28.0.0 */ + #[\Override] public function setValueInt(int $value): self { $this->assertType(self::TYPE_INT); $this->value = $value; @@ -137,6 +142,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataTypeException if wrapper was not set to store a float * @since 28.0.0 */ + #[\Override] public function setValueFloat(float $value): self { $this->assertType(self::TYPE_FLOAT); $this->value = $value; @@ -152,6 +158,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataTypeException if wrapper was not set to store a bool * @since 28.0.0 */ + #[\Override] public function setValueBool(bool $value): self { $this->assertType(self::TYPE_BOOL); $this->value = $value; @@ -168,6 +175,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataTypeException if wrapper was not set to store an array * @since 28.0.0 */ + #[\Override] public function setValueArray(array $value): self { $this->assertType(self::TYPE_ARRAY); $this->value = $value; @@ -183,6 +191,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataTypeException if wrapper was not set to store a string list * @since 28.0.0 */ + #[\Override] public function setValueStringList(array $value): self { $this->assertType(self::TYPE_STRING_LIST); // TODO confirm value is an array or string ? @@ -199,6 +208,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataTypeException if wrapper was not set to store an int list * @since 28.0.0 */ + #[\Override] public function setValueIntList(array $value): self { $this->assertType(self::TYPE_INT_LIST); // TODO confirm value is an array of int ? @@ -215,6 +225,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataNotFoundException if value is not set * @since 28.0.0 */ + #[\Override] public function getValueString(): string { $this->assertType(self::TYPE_STRING); if ($this->value === null) { @@ -231,6 +242,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataNotFoundException if value is not set * @since 28.0.0 */ + #[\Override] public function getValueInt(): int { $this->assertType(self::TYPE_INT); if ($this->value === null) { @@ -247,6 +259,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataNotFoundException if value is not set * @since 28.0.0 */ + #[\Override] public function getValueFloat(): float { $this->assertType(self::TYPE_FLOAT); if ($this->value === null) { @@ -263,6 +276,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataNotFoundException if value is not set * @since 28.0.0 */ + #[\Override] public function getValueBool(): bool { $this->assertType(self::TYPE_BOOL); if ($this->value === null) { @@ -279,6 +293,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataNotFoundException if value is not set * @since 28.0.0 */ + #[\Override] public function getValueArray(): array { $this->assertType(self::TYPE_ARRAY); if ($this->value === null) { @@ -295,6 +310,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataNotFoundException if value is not set * @since 28.0.0 */ + #[\Override] public function getValueStringList(): array { $this->assertType(self::TYPE_STRING_LIST); if ($this->value === null) { @@ -311,6 +327,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataNotFoundException if value is not set * @since 28.0.0 */ + #[\Override] public function getValueIntList(): array { $this->assertType(self::TYPE_INT_LIST); if ($this->value === null) { @@ -326,6 +343,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @throws FilesMetadataNotFoundException if value is not set * @since 28.0.0 */ + #[\Override] public function getValueAny(): mixed { if ($this->value === null) { throw new FilesMetadataNotFoundException('value is not set'); @@ -339,6 +357,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @return string stored etag * @since 29.0.0 */ + #[\Override] public function getEtag(): string { return $this->etag; } @@ -350,6 +369,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @return self * @since 29.0.0 */ + #[\Override] public function setEtag(string $etag): self { $this->etag = $etag; return $this; @@ -362,6 +382,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @return self * @since 28.0.0 */ + #[\Override] public function setIndexed(bool $indexed): self { $this->indexed = $indexed; @@ -373,6 +394,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @return bool TRUE if value is an indexed value * @since 28.0.0 */ + #[\Override] public function isIndexed(): bool { return $this->indexed; } @@ -384,6 +406,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @return self * @since 28.0.0 */ + #[\Override] public function setEditPermission(int $permission): self { $this->editPermission = $permission; @@ -395,6 +418,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @return int edit permission * @since 28.0.0 */ + #[\Override] public function getEditPermission(): int { return $this->editPermission; } @@ -407,6 +431,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { * @see jsonSerialize * @since 28.0.0 */ + #[\Override] public function import(array $data): self { $this->value = $data['value'] ?? null; $this->type = $data['type'] ?? ''; @@ -416,6 +441,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return $this; } + #[\Override] public function jsonSerialize(bool $emptyValues = false): array { return [ 'value' => ($emptyValues) ? null : $this->value, diff --git a/lib/private/FullTextSearch/FullTextSearchManager.php b/lib/private/FullTextSearch/FullTextSearchManager.php index 989da8d6bae..67f9b88b7e8 100644 --- a/lib/private/FullTextSearch/FullTextSearchManager.php +++ b/lib/private/FullTextSearch/FullTextSearchManager.php @@ -31,6 +31,7 @@ class FullTextSearchManager implements IFullTextSearchManager { /** * @since 15.0.0 */ + #[\Override] public function registerProviderService(IProviderService $providerService): void { $this->providerService = $providerService; } @@ -38,6 +39,7 @@ class FullTextSearchManager implements IFullTextSearchManager { /** * @since 15.0.0 */ + #[\Override] public function registerIndexService(IIndexService $indexService): void { $this->indexService = $indexService; } @@ -45,6 +47,7 @@ class FullTextSearchManager implements IFullTextSearchManager { /** * @since 15.0.0 */ + #[\Override] public function registerSearchService(ISearchService $searchService): void { $this->searchService = $searchService; } @@ -52,6 +55,7 @@ class FullTextSearchManager implements IFullTextSearchManager { /** * @since 16.0.0 */ + #[\Override] public function isAvailable(): bool { if ($this->indexService === null || $this->providerService === null @@ -102,6 +106,7 @@ class FullTextSearchManager implements IFullTextSearchManager { /** * @throws FullTextSearchAppNotAvailableException */ + #[\Override] public function addJavascriptAPI(): void { $this->getProviderService()->addJavascriptAPI(); } @@ -110,6 +115,7 @@ class FullTextSearchManager implements IFullTextSearchManager { /** * @throws FullTextSearchAppNotAvailableException */ + #[\Override] public function isProviderIndexed(string $providerId): bool { return $this->getProviderService()->isProviderIndexed($providerId); } @@ -118,6 +124,7 @@ class FullTextSearchManager implements IFullTextSearchManager { /** * @throws FullTextSearchAppNotAvailableException */ + #[\Override] public function getIndex(string $providerId, string $documentId): IIndex { return $this->getIndexService()->getIndex($providerId, $documentId); } @@ -127,6 +134,7 @@ class FullTextSearchManager implements IFullTextSearchManager { * * @throws FullTextSearchAppNotAvailableException */ + #[\Override] public function createIndex( string $providerId, string $documentId, @@ -142,6 +150,7 @@ class FullTextSearchManager implements IFullTextSearchManager { * * @throws FullTextSearchAppNotAvailableException */ + #[\Override] public function updateIndexStatus( string $providerId, string $documentId, @@ -156,6 +165,7 @@ class FullTextSearchManager implements IFullTextSearchManager { * * @throws FullTextSearchAppNotAvailableException */ + #[\Override] public function updateIndexesStatus( string $providerId, array $documentIds, @@ -171,6 +181,7 @@ class FullTextSearchManager implements IFullTextSearchManager { * * @throws FullTextSearchAppNotAvailableException */ + #[\Override] public function updateIndexes(array $indexes): void { $this->getIndexService()->updateIndexes($indexes); } @@ -180,6 +191,7 @@ class FullTextSearchManager implements IFullTextSearchManager { * @return ISearchResult[] * @throws FullTextSearchAppNotAvailableException */ + #[\Override] public function search(array $request, string $userId = ''): array { $searchRequest = $this->getSearchService()->generateSearchRequest($request); diff --git a/lib/private/FullTextSearch/Model/DocumentAccess.php b/lib/private/FullTextSearch/Model/DocumentAccess.php index 9efffeaee88..10adb4bb5a0 100644 --- a/lib/private/FullTextSearch/Model/DocumentAccess.php +++ b/lib/private/FullTextSearch/Model/DocumentAccess.php @@ -61,6 +61,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function setOwnerId(string $ownerId): IDocumentAccess { $this->ownerId = $ownerId; @@ -72,6 +73,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function getOwnerId(): string { return $this->ownerId; } @@ -82,6 +84,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function setViewerId(string $viewerId): IDocumentAccess { $this->viewerId = $viewerId; @@ -93,6 +96,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function getViewerId(): string { return $this->viewerId; } @@ -103,6 +107,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function setUsers(array $users): IDocumentAccess { $this->users = $users; @@ -114,6 +119,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function addUser(string $user): IDocumentAccess { $this->users[] = $user; @@ -126,6 +132,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function addUsers($users): IDocumentAccess { $this->users = array_merge($this->users, $users); @@ -137,6 +144,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function getUsers(): array { return $this->users; } @@ -147,6 +155,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function setGroups(array $groups): IDocumentAccess { $this->groups = $groups; @@ -158,6 +167,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function addGroup(string $group): IDocumentAccess { $this->groups[] = $group; @@ -170,6 +180,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function addGroups(array $groups): IDocumentAccess { $this->groups = array_merge($this->groups, $groups); @@ -181,6 +192,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function getGroups(): array { return $this->groups; } @@ -191,6 +203,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function setCircles(array $circles): IDocumentAccess { $this->circles = $circles; @@ -202,6 +215,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function addCircle(string $circle): IDocumentAccess { $this->circles[] = $circle; @@ -214,6 +228,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function addCircles(array $circles): IDocumentAccess { $this->circles = array_merge($this->circles, $circles); @@ -225,6 +240,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function getCircles(): array { return $this->circles; } @@ -235,6 +251,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function setLinks(array $links): IDocumentAccess { $this->links = $links; @@ -246,6 +263,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { * * @since 16.0.0 */ + #[\Override] public function getLinks(): array { return $this->links; } @@ -254,6 +272,7 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { /** * @since 16.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'ownerId' => $this->getOwnerId(), diff --git a/lib/private/FullTextSearch/Model/IndexDocument.php b/lib/private/FullTextSearch/Model/IndexDocument.php index 2a46c7bee57..ec6f2f0ee1e 100644 --- a/lib/private/FullTextSearch/Model/IndexDocument.php +++ b/lib/private/FullTextSearch/Model/IndexDocument.php @@ -85,6 +85,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getId(): string { return $this->id; } @@ -95,6 +96,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getProviderId(): string { return $this->providerId; } @@ -107,6 +109,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setIndex(IIndex $index): IIndexDocument { $this->index = $index; @@ -119,6 +122,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * @throws FullTextSearchIndexNotAvailableException * @since 15.0.0 */ + #[\Override] final public function getIndex(): IIndex { if ($this->index === null) { throw new FullTextSearchIndexNotAvailableException('No IIndex generated'); @@ -132,6 +136,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 16.0.0 */ + #[\Override] final public function hasIndex(): bool { return $this->index !== null; } @@ -141,6 +146,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setModifiedTime(int $modifiedTime): IIndexDocument { $this->modifiedTime = $modifiedTime; @@ -152,6 +158,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getModifiedTime(): int { return $this->modifiedTime; } @@ -161,6 +168,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function isOlderThan(int $time): bool { return ($this->modifiedTime < $time); } @@ -173,6 +181,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setAccess(IDocumentAccess $access): IIndexDocument { $this->access = $access; @@ -184,6 +193,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getAccess(): IDocumentAccess { return $this->access; } @@ -194,6 +204,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function addTag(string $tag): IIndexDocument { $this->tags[] = $tag; @@ -205,6 +216,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setTags(array $tags): IIndexDocument { $this->tags = $tags; @@ -216,6 +228,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getTags(): array { return $this->tags; } @@ -226,6 +239,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function addMetaTag(string $tag): IIndexDocument { $this->metaTags[] = $tag; @@ -237,6 +251,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setMetaTags(array $tags): IIndexDocument { $this->metaTags = $tags; @@ -248,6 +263,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getMetaTags(): array { return $this->metaTags; } @@ -258,6 +274,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function addSubTag(string $sub, string $tag): IIndexDocument { if (!array_key_exists($sub, $this->subTags)) { $this->subTags[$sub] = []; @@ -274,6 +291,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setSubTags(array $tags): IIndexDocument { $this->subTags = $tags; @@ -287,6 +305,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getSubTags(bool $formatted = false): array { if ($formatted === false) { return $this->subTags; @@ -310,6 +329,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setSource(string $source): IIndexDocument { $this->source = $source; @@ -321,6 +341,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getSource(): string { return $this->source; } @@ -331,6 +352,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setTitle(string $title): IIndexDocument { $this->title = $title; @@ -342,6 +364,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getTitle(): string { return $this->title; } @@ -354,6 +377,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setContent(string $content, int $encoded = 0): IIndexDocument { $this->content = $content; $this->contentEncoded = $encoded; @@ -366,6 +390,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getContent(): string { return $this->content; } @@ -375,6 +400,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function isContentEncoded(): int { return $this->contentEncoded; } @@ -384,6 +410,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getContentSize(): int { return strlen($this->getContent()); } @@ -394,6 +421,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function initHash(): IIndexDocument { if ($this->getContent() === '' || is_null($this->getContent())) { return $this; @@ -409,6 +437,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setHash(string $hash): IIndexDocument { $this->hash = $hash; @@ -420,6 +449,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getHash(): string { return $this->hash; } @@ -433,6 +463,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function addPart(string $part, string $content): IIndexDocument { $this->parts[$part] = $content; @@ -444,6 +475,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setParts(array $parts): IIndexDocument { $this->parts = $parts; @@ -455,6 +487,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getParts(): array { return $this->parts; } @@ -465,6 +498,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setLink(string $link): IIndexDocument { $this->link = $link; @@ -476,6 +510,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getLink(): string { return $this->link; } @@ -486,6 +521,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setMore(array $more): IIndexDocument { $this->more = $more; @@ -497,6 +533,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getMore(): array { return $this->more; } @@ -508,6 +545,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 16.0.0 */ + #[\Override] final public function addExcerpt(string $source, string $excerpt): IIndexDocument { $this->excerpts[] = [ @@ -524,6 +562,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 16.0.0 */ + #[\Override] final public function setExcerpts(array $excerpts): IIndexDocument { $new = []; foreach ($excerpts as $entry) { @@ -543,6 +582,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getExcerpts(): array { return $this->excerpts; } @@ -570,6 +610,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setScore(string $score): IIndexDocument { $this->score = $score; @@ -581,6 +622,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getScore(): string { return $this->score; } @@ -595,6 +637,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setInfo(string $info, string $value): IIndexDocument { $this->info[$info] = $value; @@ -606,6 +649,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getInfo(string $info, string $default = ''): string { if (!key_exists($info, $this->info)) { return $default; @@ -623,6 +667,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setInfoArray(string $info, array $value): IIndexDocument { $this->info[$info] = $value; @@ -634,6 +679,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getInfoArray(string $info, array $default = []): array { if (!key_exists($info, $this->info)) { return $default; @@ -651,6 +697,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setInfoInt(string $info, int $value): IIndexDocument { $this->info[$info] = $value; @@ -662,6 +709,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getInfoInt(string $info, int $default = 0): int { if (!key_exists($info, $this->info)) { return $default; @@ -679,6 +727,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function setInfoBool(string $info, bool $value): IIndexDocument { $this->info[$info] = $value; @@ -690,6 +739,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getInfoBool(string $info, bool $default = false): bool { if (!key_exists($info, $this->info)) { return $default; @@ -703,6 +753,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * * @since 15.0.0 */ + #[\Override] final public function getInfoAll(): array { $info = []; foreach ($this->info as $k => $v) { @@ -747,6 +798,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { /** * @since 15.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'id' => $this->getId(), diff --git a/lib/private/FullTextSearch/Model/SearchOption.php b/lib/private/FullTextSearch/Model/SearchOption.php index c7769a62138..5329b78421f 100644 --- a/lib/private/FullTextSearch/Model/SearchOption.php +++ b/lib/private/FullTextSearch/Model/SearchOption.php @@ -93,6 +93,7 @@ final class SearchOption implements ISearchOption, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function setName(string $name): ISearchOption { $this->name = $name; @@ -104,6 +105,7 @@ final class SearchOption implements ISearchOption, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function getName(): string { return $this->name; } @@ -114,6 +116,7 @@ final class SearchOption implements ISearchOption, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function setTitle(string $title): ISearchOption { $this->title = $title; @@ -125,6 +128,7 @@ final class SearchOption implements ISearchOption, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function getTitle(): string { return $this->title; } @@ -136,6 +140,7 @@ final class SearchOption implements ISearchOption, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function setType(string $type): ISearchOption { $this->type = $type; @@ -147,6 +152,7 @@ final class SearchOption implements ISearchOption, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function getType(): string { return $this->type; } @@ -158,6 +164,7 @@ final class SearchOption implements ISearchOption, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function setSize(string $size): ISearchOption { $this->size = $size; @@ -169,6 +176,7 @@ final class SearchOption implements ISearchOption, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function getSize(): string { return $this->size; } @@ -179,6 +187,7 @@ final class SearchOption implements ISearchOption, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function setPlaceholder(string $placeholder): ISearchOption { $this->placeholder = $placeholder; @@ -190,6 +199,7 @@ final class SearchOption implements ISearchOption, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function getPlaceholder(): string { return $this->placeholder; } @@ -197,6 +207,7 @@ final class SearchOption implements ISearchOption, JsonSerializable { /** * @since 15.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'name' => $this->getName(), diff --git a/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php b/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php index 5b075daf7e6..2ab47c04eb2 100644 --- a/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php +++ b/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php @@ -38,6 +38,7 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS * * @since 17.0.0 */ + #[\Override] public function getType(): int { return $this->type; } @@ -48,6 +49,7 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS * * @since 17.0.0 */ + #[\Override] public function getField(): string { return $this->field; } @@ -57,6 +59,7 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS * * @since 17.0.0 */ + #[\Override] public function setField(string $field): ISearchRequestSimpleQuery { $this->field = $field; @@ -69,6 +72,7 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS * * @since 17.0.0 */ + #[\Override] public function getValues(): array { return $this->values; } @@ -79,6 +83,7 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS * * @since 17.0.0 */ + #[\Override] public function addValue(string $value): ISearchRequestSimpleQuery { $this->values[] = $value; @@ -90,6 +95,7 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS * * @since 17.0.0 */ + #[\Override] public function addValueInt(int $value): ISearchRequestSimpleQuery { $this->values[] = $value; @@ -101,6 +107,7 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS * * @since 17.0.0 */ + #[\Override] public function addValueArray(array $value): ISearchRequestSimpleQuery { $this->values[] = $value; @@ -112,6 +119,7 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS * * @since 17.0.0 */ + #[\Override] public function addValueBool(bool $value): ISearchRequestSimpleQuery { $this->values[] = $value; @@ -122,6 +130,7 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS /** * @since 17.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'type' => $this->getType(), diff --git a/lib/private/FullTextSearch/Model/SearchTemplate.php b/lib/private/FullTextSearch/Model/SearchTemplate.php index 6f9a04a911e..e54c3c88da7 100644 --- a/lib/private/FullTextSearch/Model/SearchTemplate.php +++ b/lib/private/FullTextSearch/Model/SearchTemplate.php @@ -68,6 +68,7 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function setIcon(string $class): ISearchTemplate { $this->icon = $class; @@ -77,6 +78,7 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable { /** * Get the class of the icon. */ + #[\Override] public function getIcon(): string { return $this->icon; } @@ -87,6 +89,7 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function setCss(string $css): ISearchTemplate { $this->css = $css; @@ -98,6 +101,7 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function getCss(): string { return $this->css; } @@ -111,6 +115,7 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function setTemplate(string $template): ISearchTemplate { $this->template = $template; @@ -122,6 +127,7 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function getTemplate(): string { return $this->template; } @@ -135,6 +141,7 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function addPanelOption(ISearchOption $option): ISearchTemplate { $this->panelOptions[] = $option; @@ -148,6 +155,7 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable { * * @return SearchOption[] */ + #[\Override] public function getPanelOptions(): array { return $this->panelOptions; } @@ -160,6 +168,7 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function addNavigationOption(ISearchOption $option): ISearchTemplate { $this->navigationOptions[] = $option; @@ -171,6 +180,7 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable { * * @since 15.0.0 */ + #[\Override] public function getNavigationOptions(): array { return $this->navigationOptions; } @@ -179,6 +189,7 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable { /** * @since 15.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'icon' => $this->getIcon(), diff --git a/lib/private/Group/Backend.php b/lib/private/Group/Backend.php index 011ff986143..b9c295c34ff 100644 --- a/lib/private/Group/Backend.php +++ b/lib/private/Group/Backend.php @@ -54,6 +54,7 @@ abstract class Backend implements GroupInterface { * Returns the supported actions as int to be * compared with \OC\Group\Backend::CREATE_GROUP etc. */ + #[\Override] public function implementsActions($actions) { return (bool)($this->getSupportedActions() & $actions); } @@ -66,6 +67,7 @@ abstract class Backend implements GroupInterface { * * Checks whether the user is member of a group or not. */ + #[\Override] public function inGroup($uid, $gid) { return in_array($gid, $this->getUserGroups($uid)); } @@ -78,6 +80,7 @@ abstract class Backend implements GroupInterface { * This function fetches all groups a user belongs to. It does not check * if the user exists at all. */ + #[\Override] public function getUserGroups($uid) { return []; } @@ -92,6 +95,7 @@ abstract class Backend implements GroupInterface { * Returns a list with all groups */ + #[\Override] public function getGroups($search = '', $limit = -1, $offset = 0) { return []; } @@ -101,6 +105,7 @@ abstract class Backend implements GroupInterface { * @param string $gid * @return bool */ + #[\Override] public function groupExists($gid) { return in_array($gid, $this->getGroups($gid, 1)); } @@ -113,6 +118,7 @@ abstract class Backend implements GroupInterface { * @param int $offset * @return array an array of user ids */ + #[\Override] public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { return []; } diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php index 190eb37348b..fff9cef31f7 100644 --- a/lib/private/Group/Database.php +++ b/lib/private/Group/Database.php @@ -65,6 +65,7 @@ class Database extends ABackend implements } } + #[\Override] public function createGroup(string $name): ?string { $this->fixDI(); @@ -100,6 +101,7 @@ class Database extends ABackend implements * * Deletes a group and removes it from the group_user-table */ + #[\Override] public function deleteGroup(string $gid): bool { $this->fixDI(); @@ -135,6 +137,7 @@ class Database extends ABackend implements * * Checks whether the user is member of a group or not. */ + #[\Override] public function inGroup($uid, $gid) { $this->fixDI(); @@ -160,6 +163,7 @@ class Database extends ABackend implements * * Adds a user to a group. */ + #[\Override] public function addToGroup(string $uid, string $gid): bool { $this->fixDI(); @@ -184,6 +188,7 @@ class Database extends ABackend implements * * removes the user from a group. */ + #[\Override] public function removeFromGroup(string $uid, string $gid): bool { $this->fixDI(); @@ -204,6 +209,7 @@ class Database extends ABackend implements * This function fetches all groups a user belongs to. It does not check * if the user exists at all. */ + #[\Override] public function getUserGroups($uid) { //guests has empty or null $uid if ($uid === null || $uid === '') { @@ -242,6 +248,7 @@ class Database extends ABackend implements * * Returns a list with all groups */ + #[\Override] public function getGroups(string $search = '', int $limit = -1, int $offset = 0) { $this->fixDI(); @@ -285,6 +292,7 @@ class Database extends ABackend implements * @param string $gid * @return bool */ + #[\Override] public function groupExists($gid) { $this->fixDI(); @@ -314,6 +322,7 @@ class Database extends ABackend implements /** * {@inheritdoc} */ + #[\Override] public function groupsExists(array $gids): array { $notFoundGids = []; $existingGroups = []; @@ -356,10 +365,12 @@ class Database extends ABackend implements * @param int $offset * @return array an array of user ids */ + #[\Override] public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0): array { return array_values(array_map(fn ($user) => $user->getUid(), $this->searchInGroup($gid, $search, $limit, $offset))); } + #[\Override] public function searchInGroup(string $gid, string $search = '', int $limit = -1, int $offset = 0): array { $this->fixDI(); @@ -427,6 +438,7 @@ class Database extends ABackend implements * @param string $search * @return int */ + #[\Override] public function countUsersInGroup(string $gid, string $search = ''): int { $this->fixDI(); @@ -461,6 +473,7 @@ class Database extends ABackend implements * * @return int */ + #[\Override] public function countDisabledInGroup(string $gid): int { $this->fixDI(); @@ -486,6 +499,7 @@ class Database extends ABackend implements return $count; } + #[\Override] public function getDisplayName(string $gid): string { if (isset($this->groupCache[$gid])) { $displayName = $this->groupCache[$gid]['displayname']; @@ -509,6 +523,7 @@ class Database extends ABackend implements return (string)$displayName; } + #[\Override] public function getGroupDetails(string $gid): array { $displayName = $this->getDisplayName($gid); if ($displayName !== '') { @@ -521,6 +536,7 @@ class Database extends ABackend implements /** * {@inheritdoc} */ + #[\Override] public function getGroupsDetails(array $gids): array { $notFoundGids = []; $details = []; @@ -557,6 +573,7 @@ class Database extends ABackend implements return $details; } + #[\Override] public function setDisplayName(string $gid, string $displayName): bool { if (!$this->groupExists($gid)) { return false; @@ -583,6 +600,7 @@ class Database extends ABackend implements * @return string the name of the backend to be shown * @since 21.0.0 */ + #[\Override] public function getBackendName(): string { return 'Database'; } diff --git a/lib/private/Group/DisplayNameCache.php b/lib/private/Group/DisplayNameCache.php index 8108b359726..cfd39897015 100644 --- a/lib/private/Group/DisplayNameCache.php +++ b/lib/private/Group/DisplayNameCache.php @@ -61,6 +61,7 @@ class DisplayNameCache implements IEventListener { $this->memCache->clear(); } + #[\Override] public function handle(Event $event): void { if ($event instanceof GroupChangedEvent && $event->getFeature() === 'displayName') { $groupId = $event->getGroup()->getGID(); diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php index ffb42458ecc..7b7ca00a88f 100644 --- a/lib/private/Group/Group.php +++ b/lib/private/Group/Group.php @@ -51,10 +51,12 @@ class Group implements IGroup { ) { } + #[\Override] public function getGID(): string { return $this->gid; } + #[\Override] public function getDisplayName(): string { if (is_null($this->displayName)) { foreach ($this->backends as $backend) { @@ -71,6 +73,7 @@ class Group implements IGroup { return $this->displayName; } + #[\Override] public function setDisplayName(string $displayName): bool { $displayName = trim($displayName); if ($displayName !== '') { @@ -93,6 +96,7 @@ class Group implements IGroup { * * @return array */ + #[\Override] public function getUsers(): array { if ($this->usersLoaded) { return $this->users; @@ -120,6 +124,7 @@ class Group implements IGroup { * @param IUser $user * @return bool */ + #[\Override] public function inGroup(IUser $user): bool { if (isset($this->users[$user->getUID()])) { return true; @@ -138,6 +143,7 @@ class Group implements IGroup { * * @param IUser $user */ + #[\Override] public function addUser(IUser $user): void { if ($this->inGroup($user)) { return; @@ -167,6 +173,7 @@ class Group implements IGroup { /** * remove a user from the group */ + #[\Override] public function removeUser(IUser $user): void { $result = false; $this->dispatcher->dispatchTyped(new BeforeUserRemovedEvent($this, $user)); @@ -200,6 +207,7 @@ class Group implements IGroup { * Search for users in the group by userid or display name * @return IUser[] */ + #[\Override] public function searchUsers(string $search, ?int $limit = null, ?int $offset = null): array { $users = []; foreach ($this->backends as $backend) { @@ -227,6 +235,7 @@ class Group implements IGroup { * @param string $search * @return int|bool */ + #[\Override] public function count($search = ''): int|bool { $users = false; foreach ($this->backends as $backend) { @@ -248,6 +257,7 @@ class Group implements IGroup { * * @return int|bool */ + #[\Override] public function countDisabled(): int|bool { $users = false; foreach ($this->backends as $backend) { @@ -272,6 +282,7 @@ class Group implements IGroup { * @return IUser[] * @deprecated 27.0.0 Use searchUsers instead (same implementation) */ + #[\Override] public function searchDisplayName(string $search, ?int $limit = null, ?int $offset = null): array { return $this->searchUsers($search, $limit, $offset); } @@ -281,6 +292,7 @@ class Group implements IGroup { * * @return string[] */ + #[\Override] public function getBackendNames(): array { $backends = []; foreach ($this->backends as $backend) { @@ -299,6 +311,7 @@ class Group implements IGroup { * * @return bool */ + #[\Override] public function delete(): bool { // Prevent users from deleting group admin if ($this->getGID() === 'admin') { @@ -345,6 +358,7 @@ class Group implements IGroup { * @return bool * @since 14.0.0 */ + #[\Override] public function canRemoveUser(): bool { foreach ($this->backends as $backend) { if ($backend->implementsActions(GroupInterface::REMOVE_FROM_GOUP)) { @@ -358,6 +372,7 @@ class Group implements IGroup { * @return bool * @since 14.0.0 */ + #[\Override] public function canAddUser(): bool { foreach ($this->backends as $backend) { if ($backend->implementsActions(GroupInterface::ADD_TO_GROUP)) { @@ -371,6 +386,7 @@ class Group implements IGroup { * @return bool * @since 16.0.0 */ + #[\Override] public function hideFromCollaboration(): bool { return array_reduce($this->backends, function (bool $hide, GroupInterface $backend) { return $hide || ($backend instanceof IHideFromCollaborationBackend && $backend->hideGroup($this->gid)); diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php index 6b57897ee79..028dffd2273 100644 --- a/lib/private/Group/Manager.php +++ b/lib/private/Group/Manager.php @@ -81,6 +81,7 @@ class Manager extends PublicEmitter implements IGroupManager { * @param string $backendClass Full classname including complete namespace * @return bool */ + #[\Override] public function isBackendUsed($backendClass) { $backendClass = strtolower(ltrim($backendClass, '\\')); @@ -96,11 +97,13 @@ class Manager extends PublicEmitter implements IGroupManager { /** * @param GroupInterface $backend */ + #[\Override] public function addBackend($backend) { $this->backends[] = $backend; $this->clearCaches(); } + #[\Override] public function clearBackends() { $this->backends = []; $this->clearCaches(); @@ -111,6 +114,7 @@ class Manager extends PublicEmitter implements IGroupManager { * * @return GroupInterface[] */ + #[\Override] public function getBackends() { return $this->backends; } @@ -125,6 +129,7 @@ class Manager extends PublicEmitter implements IGroupManager { * @param string $gid * @return IGroup|null */ + #[\Override] public function get($gid) { if (isset($this->cachedGroups[$gid])) { return $this->cachedGroups[$gid]; @@ -222,6 +227,7 @@ class Manager extends PublicEmitter implements IGroupManager { * @param string $gid * @return bool */ + #[\Override] public function groupExists($gid) { return $this->get($gid) instanceof IGroup; } @@ -230,6 +236,7 @@ class Manager extends PublicEmitter implements IGroupManager { * @param string $gid * @return IGroup|null */ + #[\Override] public function createGroup($gid) { if ($gid === '' || $gid === null) { return null; @@ -262,6 +269,7 @@ class Manager extends PublicEmitter implements IGroupManager { } } + #[\Override] public function search(string $search, ?int $limit = null, ?int $offset = 0) { $groups = []; foreach ($this->backends as $backend) { @@ -281,6 +289,7 @@ class Manager extends PublicEmitter implements IGroupManager { * @param IUser|null $user * @return array */ + #[\Override] public function getUserGroups(?IUser $user = null): array { if (!$user instanceof IUser) { return []; @@ -313,6 +322,7 @@ class Manager extends PublicEmitter implements IGroupManager { * @param string $userId * @return bool if admin */ + #[\Override] public function isAdmin($userId) { if (!$this->remoteAddress->allowsAdminActions()) { return false; @@ -326,6 +336,7 @@ class Manager extends PublicEmitter implements IGroupManager { return $this->isInGroup($userId, 'admin'); } + #[\Override] public function isDelegatedAdmin(string $userId): bool { if (!$this->remoteAddress->allowsAdminActions()) { return false; @@ -345,10 +356,12 @@ class Manager extends PublicEmitter implements IGroupManager { * @param string $group * @return bool if in group */ + #[\Override] public function isInGroup($userId, $group) { return in_array($group, $this->getUserIdGroupIds($userId)); } + #[\Override] public function getUserGroupIds(IUser $user): array { return $this->getUserIdGroupIds($user->getUID()); } @@ -375,6 +388,7 @@ class Manager extends PublicEmitter implements IGroupManager { * @param string $groupId * @return ?string */ + #[\Override] public function getDisplayName(string $groupId): ?string { return $this->displayNameCache->getDisplayName($groupId); } @@ -391,6 +405,7 @@ class Manager extends PublicEmitter implements IGroupManager { }, $this->getUserGroups($user)); } + #[\Override] public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) { $group = $this->get($gid); if (is_null($group)) { diff --git a/lib/private/Hooks/PublicEmitter.php b/lib/private/Hooks/PublicEmitter.php index 77cb2bf30dd..e6cb97e93d7 100644 --- a/lib/private/Hooks/PublicEmitter.php +++ b/lib/private/Hooks/PublicEmitter.php @@ -19,6 +19,7 @@ class PublicEmitter extends BasicEmitter { * * @suppress PhanAccessMethodProtected */ + #[\Override] public function emit($scope, $method, array $arguments = []) { parent::emit($scope, $method, $arguments); } diff --git a/lib/private/Http/Client/Client.php b/lib/private/Http/Client/Client.php index f1b81df3964..0a42ace17c0 100644 --- a/lib/private/Http/Client/Client.php +++ b/lib/private/Http/Client/Client.php @@ -208,6 +208,7 @@ class Client implements IClient { * @return IResponse * @throws \Exception If the request could not get completed */ + #[\Override] public function get(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request('get', $uri, $this->buildRequestOptions($options)); @@ -239,6 +240,7 @@ class Client implements IClient { * @return IResponse * @throws \Exception If the request could not get completed */ + #[\Override] public function head(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request('head', $uri, $this->buildRequestOptions($options)); @@ -274,6 +276,7 @@ class Client implements IClient { * @return IResponse * @throws \Exception If the request could not get completed */ + #[\Override] public function post(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); @@ -315,6 +318,7 @@ class Client implements IClient { * @return IResponse * @throws \Exception If the request could not get completed */ + #[\Override] public function put(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request('put', $uri, $this->buildRequestOptions($options)); @@ -350,6 +354,7 @@ class Client implements IClient { * @return IResponse * @throws \Exception If the request could not get completed */ + #[\Override] public function patch(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request('patch', $uri, $this->buildRequestOptions($options)); @@ -385,6 +390,7 @@ class Client implements IClient { * @return IResponse * @throws \Exception If the request could not get completed */ + #[\Override] public function delete(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request('delete', $uri, $this->buildRequestOptions($options)); @@ -420,6 +426,7 @@ class Client implements IClient { * @return IResponse * @throws \Exception If the request could not get completed */ + #[\Override] public function options(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request('options', $uri, $this->buildRequestOptions($options)); @@ -434,6 +441,7 @@ class Client implements IClient { * @throws \Throwable When $e did not have a response * @since 29.0.0 */ + #[\Override] public function getResponseFromThrowable(\Throwable $e): IResponse { if (method_exists($e, 'hasResponse') && method_exists($e, 'getResponse') && $e->hasResponse()) { return new Response($e->getResponse()); @@ -472,6 +480,7 @@ class Client implements IClient { * @return IResponse * @throws \Exception If the request could not get completed */ + #[\Override] public function request(string $method, string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request($method, $uri, $this->buildRequestOptions($options)); @@ -479,6 +488,7 @@ class Client implements IClient { return new Response($response, $isStream); } + #[\Override] public function sendRequest(RequestInterface $request): ResponseInterface { $this->preventLocalAddress((string)$request->getUri(), []); return $this->client->send($request, $this->buildRequestOptions([])); @@ -519,6 +529,7 @@ class Client implements IClient { * 'timeout' => 5, * @return IPromise */ + #[\Override] public function getAsync(string $uri, array $options = []): IPromise { $this->preventLocalAddress($uri, $options); $response = $this->client->requestAsync('get', $uri, $this->buildRequestOptions($options)); @@ -548,6 +559,7 @@ class Client implements IClient { * 'timeout' => 5, * @return IPromise */ + #[\Override] public function headAsync(string $uri, array $options = []): IPromise { $this->preventLocalAddress($uri, $options); $response = $this->client->requestAsync('head', $uri, $this->buildRequestOptions($options)); @@ -582,6 +594,7 @@ class Client implements IClient { * 'timeout' => 5, * @return IPromise */ + #[\Override] public function postAsync(string $uri, array $options = []): IPromise { $this->preventLocalAddress($uri, $options); @@ -621,6 +634,7 @@ class Client implements IClient { * 'timeout' => 5, * @return IPromise */ + #[\Override] public function putAsync(string $uri, array $options = []): IPromise { $this->preventLocalAddress($uri, $options); $response = $this->client->requestAsync('put', $uri, $this->buildRequestOptions($options)); @@ -655,6 +669,7 @@ class Client implements IClient { * 'timeout' => 5, * @return IPromise */ + #[\Override] public function deleteAsync(string $uri, array $options = []): IPromise { $this->preventLocalAddress($uri, $options); $response = $this->client->requestAsync('delete', $uri, $this->buildRequestOptions($options)); @@ -689,6 +704,7 @@ class Client implements IClient { * 'timeout' => 5, * @return IPromise */ + #[\Override] public function optionsAsync(string $uri, array $options = []): IPromise { $this->preventLocalAddress($uri, $options); $response = $this->client->requestAsync('options', $uri, $this->buildRequestOptions($options)); diff --git a/lib/private/Http/Client/ClientService.php b/lib/private/Http/Client/ClientService.php index 1e40ef31bc1..12d633a962b 100644 --- a/lib/private/Http/Client/ClientService.php +++ b/lib/private/Http/Client/ClientService.php @@ -39,6 +39,7 @@ class ClientService implements IClientService { ) { } + #[\Override] public function newClient(): IClient { $handler = new CurlHandler(); $stack = HandlerStack::create($handler); diff --git a/lib/private/Http/Client/GuzzlePromiseAdapter.php b/lib/private/Http/Client/GuzzlePromiseAdapter.php index 7d1e1e19112..796071d1eeb 100644 --- a/lib/private/Http/Client/GuzzlePromiseAdapter.php +++ b/lib/private/Http/Client/GuzzlePromiseAdapter.php @@ -41,6 +41,7 @@ class GuzzlePromiseAdapter implements IPromise { * @return IPromise * @since 28.0.0 */ + #[\Override] public function then( ?callable $onFulfilled = null, ?callable $onRejected = null, @@ -74,6 +75,7 @@ class GuzzlePromiseAdapter implements IPromise { * @return IPromise::STATE_* * @since 28.0.0 */ + #[\Override] public function getState(): string { $state = $this->promise->getState(); if ($state === PromiseInterface::FULFILLED) { @@ -98,6 +100,7 @@ class GuzzlePromiseAdapter implements IPromise { * @link https://github.com/promises-aplus/cancellation-spec/issues/7 * @since 28.0.0 */ + #[\Override] public function cancel(): void { $this->promise->cancel(); } @@ -118,6 +121,7 @@ class GuzzlePromiseAdapter implements IPromise { * promise does not settle after waiting. * @since 28.0.0 */ + #[\Override] public function wait(bool $unwrap = true): mixed { return $this->promise->wait($unwrap); } diff --git a/lib/private/Http/Client/Response.php b/lib/private/Http/Client/Response.php index 460b5251a52..f005347067c 100644 --- a/lib/private/Http/Client/Response.php +++ b/lib/private/Http/Client/Response.php @@ -18,16 +18,19 @@ class Response implements IResponse { ) { } + #[\Override] public function getBody() { return $this->stream ? $this->response->getBody()->detach() :$this->response->getBody()->getContents(); } + #[\Override] public function getStatusCode(): int { return $this->response->getStatusCode(); } + #[\Override] public function getHeader(string $key): string { $headers = $this->response->getHeader($key); @@ -38,6 +41,7 @@ class Response implements IResponse { return $headers[0]; } + #[\Override] public function getHeaders(): array { return $this->response->getHeaders(); } diff --git a/lib/private/Http/WellKnown/RequestManager.php b/lib/private/Http/WellKnown/RequestManager.php index 11d5d388f35..a79974089e7 100644 --- a/lib/private/Http/WellKnown/RequestManager.php +++ b/lib/private/Http/WellKnown/RequestManager.php @@ -37,6 +37,7 @@ class RequestManager { ) { } + #[\Override] public function getHttpRequest(): IRequest { return $this->request; } diff --git a/lib/private/Image.php b/lib/private/Image.php index 7e6a7621dcf..2ab199e69c6 100644 --- a/lib/private/Image.php +++ b/lib/private/Image.php @@ -67,6 +67,7 @@ class Image implements IImage { * @psalm-assert-if-true \GdImage $this->resource * @return bool */ + #[\Override] public function valid(): bool { if (is_object($this->resource) && get_class($this->resource) === \GdImage::class) { return true; @@ -80,6 +81,7 @@ class Image implements IImage { * * @return string */ + #[\Override] public function mimeType(): ?string { return $this->valid() ? $this->mimeType : null; } @@ -89,6 +91,7 @@ class Image implements IImage { * * @return int */ + #[\Override] public function width(): int { if ($this->valid()) { return imagesx($this->resource); @@ -101,6 +104,7 @@ class Image implements IImage { * * @return int */ + #[\Override] public function height(): int { if ($this->valid()) { return imagesy($this->resource); @@ -113,6 +117,7 @@ class Image implements IImage { * * @return int */ + #[\Override] public function widthTopLeft(): int { $o = $this->getOrientation(); $this->logger->debug('Image->widthTopLeft() Orientation: ' . $o, ['app' => 'core']); @@ -137,6 +142,7 @@ class Image implements IImage { * * @return int */ + #[\Override] public function heightTopLeft(): int { $o = $this->getOrientation(); $this->logger->debug('Image->heightTopLeft() Orientation: ' . $o, ['app' => 'core']); @@ -162,6 +168,7 @@ class Image implements IImage { * @param string $mimeType * @return bool */ + #[\Override] public function show(?string $mimeType = null): bool { if ($mimeType === null) { $mimeType = $this->mimeType(); @@ -180,6 +187,7 @@ class Image implements IImage { * @return bool */ + #[\Override] public function save(?string $filePath = null, ?string $mimeType = null): bool { if ($mimeType === null) { $mimeType = $this->mimeType(); @@ -296,6 +304,7 @@ class Image implements IImage { /** * @return false|\GdImage Returns the image resource if any */ + #[\Override] public function resource() { return $this->resource; } @@ -303,6 +312,7 @@ class Image implements IImage { /** * @return string Returns the mimetype of the data. Returns null if the data is not valid. */ + #[\Override] public function dataMimeType(): ?string { if (!$this->valid()) { return null; @@ -322,6 +332,7 @@ class Image implements IImage { /** * @return null|string Returns the raw image data. */ + #[\Override] public function data(): ?string { if (!$this->valid()) { return null; @@ -393,6 +404,7 @@ class Image implements IImage { * * @return int The orientation or -1 if no EXIF data is available. */ + #[\Override] public function getOrientation(): int { if ($this->exif !== null) { return $this->exif['Orientation']; @@ -422,6 +434,7 @@ class Image implements IImage { return (int)$exif['Orientation']; } + #[\Override] public function readExif(string $data): void { if (!is_callable('exif_read_data')) { $this->logger->debug('Image->fixOrientation() Exif module not enabled.', ['app' => 'core']); @@ -445,6 +458,7 @@ class Image implements IImage { * * @return bool */ + #[\Override] public function fixOrientation(): bool { if (!$this->valid()) { $this->logger->debug(__METHOD__ . '(): No image loaded', ['app' => 'core']); @@ -781,6 +795,7 @@ class Image implements IImage { /** * @inheritDoc */ + #[\Override] public function loadFromData(string $str): GdImage|false { if (!$this->checkImageDataSize($str)) { return false; @@ -833,6 +848,7 @@ class Image implements IImage { * @param int $maxSize The maximum size of either the width or height. * @return bool */ + #[\Override] public function resize(int $maxSize): bool { if (!$this->valid()) { $this->logger->debug(__METHOD__ . '(): No image loaded', ['app' => 'core']); @@ -868,6 +884,7 @@ class Image implements IImage { * @param int $height * @return bool */ + #[\Override] public function preciseResize(int $width, int $height): bool { if (!$this->valid()) { $this->logger->debug(__METHOD__ . '(): No image loaded', ['app' => 'core']); @@ -921,6 +938,7 @@ class Image implements IImage { * @param int $size maximum size for the result (optional) * @return bool for success or failure */ + #[\Override] public function centerCrop(int $size = 0): bool { if (!$this->valid()) { $this->logger->debug('Image->centerCrop, No image loaded', ['app' => 'core']); @@ -984,6 +1002,7 @@ class Image implements IImage { * @param int $h Height * @return bool for success or failure */ + #[\Override] public function crop(int $x, int $y, int $w, int $h): bool { if (!$this->valid()) { $this->logger->debug(__METHOD__ . '(): No image loaded', ['app' => 'core']); @@ -1043,6 +1062,7 @@ class Image implements IImage { * @param int $maxHeight * @return bool */ + #[\Override] public function fitIn(int $maxWidth, int $maxHeight): bool { if (!$this->valid()) { $this->logger->debug(__METHOD__ . '(): No image loaded', ['app' => 'core']); @@ -1066,6 +1086,7 @@ class Image implements IImage { * @param int $maxHeight * @return bool */ + #[\Override] public function scaleDownToFit(int $maxWidth, int $maxHeight): bool { if (!$this->valid()) { $this->logger->debug(__METHOD__ . '(): No image loaded', ['app' => 'core']); @@ -1081,6 +1102,7 @@ class Image implements IImage { return false; } + #[\Override] public function copy(): IImage { $image = new self($this->logger, $this->appConfig, $this->config); if (!$this->valid()) { @@ -1106,6 +1128,7 @@ class Image implements IImage { return $image; } + #[\Override] public function cropCopy(int $x, int $y, int $w, int $h): IImage { $image = new self($this->logger, $this->appConfig, $this->config); $image->imageType = $this->imageType; @@ -1115,6 +1138,7 @@ class Image implements IImage { return $image; } + #[\Override] public function preciseResizeCopy(int $width, int $height): IImage { $image = new self($this->logger, $this->appConfig, $this->config); $image->imageType = $this->imageType; @@ -1124,6 +1148,7 @@ class Image implements IImage { return $image; } + #[\Override] public function resizeCopy(int $maxSize): IImage { $image = new self($this->logger, $this->appConfig, $this->config); $image->imageType = $this->imageType; diff --git a/lib/private/InitialStateService.php b/lib/private/InitialStateService.php index 300aa238397..f7798f3cdaa 100644 --- a/lib/private/InitialStateService.php +++ b/lib/private/InitialStateService.php @@ -32,6 +32,7 @@ class InitialStateService implements IInitialStateService { ) { } + #[\Override] public function provideInitialState(string $appName, string $key, $data): void { // Scalars and JsonSerializable are fine if (is_scalar($data) || $data instanceof \JsonSerializable || is_array($data)) { @@ -49,6 +50,7 @@ class InitialStateService implements IInitialStateService { $this->logger->warning('Invalid ' . $key . ' data provided to provideInitialState by ' . $appName); } + #[\Override] public function provideLazyInitialState(string $appName, string $key, Closure $closure): void { if (!isset($this->lazyStates[$appName])) { $this->lazyStates[$appName] = []; diff --git a/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php b/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php index d28eae2740b..7a63a080529 100644 --- a/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php +++ b/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php @@ -42,6 +42,7 @@ class ExcludeFileByNameFilterIterator extends \RecursiveFilterIterator { '/^\.webapp-nextcloud-(\d+\.){2}(\d+)(-r\d+)?$/', // Gentoo/Funtoo & derivatives use a tool known as webapp-config to manage wep-apps. ]; + #[\Override] public function accept(): bool { /** @var \SplFileInfo $current */ $current = $this->current(); diff --git a/lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php b/lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php index 1d44ed2ebc0..52ccbec082c 100644 --- a/lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php +++ b/lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php @@ -43,6 +43,7 @@ class ExcludeFoldersByPathFilterIterator extends \RecursiveFilterIterator { $this->excludedFolders = array_merge($excludedFolders, $appFolders); } + #[\Override] public function accept(): bool { return !\in_array( $this->current()->getPathName(), diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index 4c9b32c97d1..635c5d65589 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -92,6 +92,7 @@ class Factory implements IFactory { * @param string|null $locale * @return IL10N */ + #[\Override] public function get($app, $lang = null, $locale = null) { return new LazyL10N(function () use ($app, $lang, $locale) { $app = $this->appManager->cleanAppId($app); @@ -179,6 +180,7 @@ class Factory implements IFactory { * * @return string language If nothing works it returns 'en' */ + #[\Override] public function findLanguage(?string $appId = null): string { // Step 1: Forced language always has precedence over anything else $forceLang = $this->cleanLanguage($this->request->getParam('forceLanguage')) ?? $this->config->getSystemValue('force_language', false); @@ -236,6 +238,7 @@ class Factory implements IFactory { return 'en'; } + #[\Override] public function findGenericLanguage(?string $appId = null): string { // Step 1: Forced language always has precedence over anything else $forcedLanguage = $this->cleanLanguage($this->request->getParam('forceLanguage')) ?? $this->config->getSystemValue('force_language', false); @@ -259,6 +262,7 @@ class Factory implements IFactory { * @param string $lang * @return null|string */ + #[\Override] public function findLocale($lang = null) { $forceLocale = $this->config->getSystemValue('force_locale', false); if (is_string($forceLocale) && $this->localeExists($forceLocale)) { @@ -302,6 +306,7 @@ class Factory implements IFactory { * @param string $locale * @return null|string */ + #[\Override] public function findLanguageFromLocale(string $app = 'core', ?string $locale = null) { if ($this->languageExists($app, $locale)) { return $locale; @@ -320,6 +325,7 @@ class Factory implements IFactory { * @param string|null $app App id or null for core * @return string[] an array of available languages */ + #[\Override] public function findAvailableLanguages($app = null): array { $key = $app; if ($key === null) { @@ -373,6 +379,7 @@ class Factory implements IFactory { /** * @return array|mixed */ + #[\Override] public function findAvailableLocales() { if (!empty($this->availableLocales)) { return $this->availableLocales; @@ -389,6 +396,7 @@ class Factory implements IFactory { * @param string $lang * @return bool */ + #[\Override] public function languageExists($app, $lang) { if ($lang === 'en') { //english is always available return true; @@ -398,6 +406,7 @@ class Factory implements IFactory { return in_array($lang, $languages); } + #[\Override] public function getLanguageDirection(string $language): string { if (in_array($language, self::RTL_LANGUAGES, true)) { return 'rtl'; @@ -406,6 +415,7 @@ class Factory implements IFactory { return 'ltr'; } + #[\Override] public function getLanguageIterator(?IUser $user = null): ILanguageIterator { $user = $user ?? $this->userSession->getUser(); if ($user === null) { @@ -421,6 +431,7 @@ class Factory implements IFactory { * @return string * @since 20.0.0 */ + #[\Override] public function getUserLanguage(?IUser $user = null): string { $language = $this->config->getSystemValue('force_language', false); if ($language !== false) { @@ -455,6 +466,7 @@ class Factory implements IFactory { * @param string $locale * @return bool */ + #[\Override] public function localeExists($locale) { if ($locale === 'en') { //english is always available return true; @@ -607,6 +619,7 @@ class Factory implements IFactory { /** * @inheritDoc */ + #[\Override] public function getLanguages(): array { $forceLanguage = $this->config->getSystemValue('force_language', false); if ($forceLanguage !== false) { diff --git a/lib/private/L10N/L10N.php b/lib/private/L10N/L10N.php index 9011183926f..07a392d5226 100644 --- a/lib/private/L10N/L10N.php +++ b/lib/private/L10N/L10N.php @@ -41,6 +41,7 @@ class L10N implements IL10N { * * @return string language */ + #[\Override] public function getLanguageCode(): string { return $this->lang; } @@ -50,6 +51,7 @@ class L10N implements IL10N { * * @return string locale */ + #[\Override] public function getLocaleCode(): string { return $this->locale ?? ''; } @@ -63,6 +65,7 @@ class L10N implements IL10N { * Returns the translation. If no translation is found, $text will be * returned. */ + #[\Override] public function t(string $text, $parameters = []): string { if (!\is_array($parameters)) { $parameters = [$parameters]; @@ -86,6 +89,7 @@ class L10N implements IL10N { * provided by the po file. * */ + #[\Override] public function n(string $text_singular, string $text_plural, int $count, array $parameters = []): string { $identifier = "_{$text_singular}_::_{$text_plural}_"; if (isset($this->translations[$identifier])) { @@ -121,6 +125,7 @@ class L10N implements IL10N { * - firstday: Returns the first day of the week (0 sunday - 6 saturday) * - jsdate: Returns the short JS date format */ + #[\Override] public function l(string $type, $data = null, array $options = []) { if ($this->locale === null) { // Use the language of the instance diff --git a/lib/private/L10N/L10NString.php b/lib/private/L10N/L10NString.php index 2bd4f123025..88bdb125b79 100644 --- a/lib/private/L10N/L10NString.php +++ b/lib/private/L10N/L10NString.php @@ -54,6 +54,7 @@ class L10NString implements \JsonSerializable { return vsprintf($text, $this->parameters); } + #[\Override] public function jsonSerialize(): string { return $this->__toString(); } diff --git a/lib/private/L10N/LanguageIterator.php b/lib/private/L10N/LanguageIterator.php index 195de54ae4b..0055180f2a2 100644 --- a/lib/private/L10N/LanguageIterator.php +++ b/lib/private/L10N/LanguageIterator.php @@ -24,6 +24,7 @@ class LanguageIterator implements ILanguageIterator { /** * Rewind the Iterator to the first element */ + #[\Override] public function rewind(): void { $this->i = 0; } @@ -33,6 +34,7 @@ class LanguageIterator implements ILanguageIterator { * * @since 14.0.0 */ + #[\Override] public function current(): string { switch ($this->i) { /** @noinspection PhpMissingBreakStatementInspection */ @@ -91,6 +93,7 @@ class LanguageIterator implements ILanguageIterator { * * @since 14.0.0 */ + #[\Override] public function next(): void { ++$this->i; } @@ -100,6 +103,7 @@ class LanguageIterator implements ILanguageIterator { * * @since 14.0.0 */ + #[\Override] public function key(): int { return $this->i; } @@ -109,6 +113,7 @@ class LanguageIterator implements ILanguageIterator { * * @since 14.0.0 */ + #[\Override] public function valid(): bool { return $this->i <= 6; } diff --git a/lib/private/L10N/LazyL10N.php b/lib/private/L10N/LazyL10N.php index b93e0596b79..bb499045d3e 100644 --- a/lib/private/L10N/LazyL10N.php +++ b/lib/private/L10N/LazyL10N.php @@ -26,22 +26,27 @@ class LazyL10N implements IL10N { return $this->l; } + #[\Override] public function t(string $text, $parameters = []): string { return $this->getL()->t($text, $parameters); } + #[\Override] public function n(string $text_singular, string $text_plural, int $count, array $parameters = []): string { return $this->getL()->n($text_singular, $text_plural, $count, $parameters); } + #[\Override] public function l(string $type, $data, array $options = []) { return $this->getL()->l($type, $data, $options); } + #[\Override] public function getLanguageCode(): string { return $this->getL()->getLanguageCode(); } + #[\Override] public function getLocaleCode(): string { return $this->getL()->getLocaleCode(); } diff --git a/lib/private/LDAP/NullLDAPProviderFactory.php b/lib/private/LDAP/NullLDAPProviderFactory.php index 34556cbc1ad..5960e69a458 100644 --- a/lib/private/LDAP/NullLDAPProviderFactory.php +++ b/lib/private/LDAP/NullLDAPProviderFactory.php @@ -15,10 +15,12 @@ class NullLDAPProviderFactory implements ILDAPProviderFactory { public function __construct(IServerContainer $serverContainer) { } + #[\Override] public function getLDAPProvider(): never { throw new \Exception('No LDAP provider is available'); } + #[\Override] public function isAvailable(): bool { return false; } diff --git a/lib/private/Lock/AbstractLockingProvider.php b/lib/private/Lock/AbstractLockingProvider.php index 4afd5d32c59..c8612ff3ba5 100644 --- a/lib/private/Lock/AbstractLockingProvider.php +++ b/lib/private/Lock/AbstractLockingProvider.php @@ -79,6 +79,7 @@ abstract class AbstractLockingProvider implements ILockingProvider { } /** @inheritDoc */ + #[\Override] public function releaseAll(): void { foreach ($this->acquiredLocks['shared'] as $path => $count) { for ($i = 0; $i < $count; $i++) { diff --git a/lib/private/Lock/DBLockingProvider.php b/lib/private/Lock/DBLockingProvider.php index cb7f5cff350..ec5d84a5384 100644 --- a/lib/private/Lock/DBLockingProvider.php +++ b/lib/private/Lock/DBLockingProvider.php @@ -37,6 +37,7 @@ class DBLockingProvider extends AbstractLockingProvider { } /** @inheritDoc */ + #[\Override] protected function markAcquire(string $path, int $targetType): void { parent::markAcquire($path, $targetType); if ($this->cacheSharedLocks) { @@ -49,6 +50,7 @@ class DBLockingProvider extends AbstractLockingProvider { /** * Change the type of an existing tracked lock */ + #[\Override] protected function markChange(string $path, int $targetType): void { parent::markChange($path, $targetType); if ($this->cacheSharedLocks) { @@ -77,6 +79,7 @@ class DBLockingProvider extends AbstractLockingProvider { } /** @inheritDoc */ + #[\Override] public function isLocked(string $path, int $type): bool { if ($this->hasAcquiredLock($path, $type)) { return true; @@ -102,6 +105,7 @@ class DBLockingProvider extends AbstractLockingProvider { } /** @inheritDoc */ + #[\Override] public function acquireLock(string $path, int $type, ?string $readablePath = null): void { $expire = $this->getExpireTime(); if ($type === self::LOCK_SHARED) { @@ -142,6 +146,7 @@ class DBLockingProvider extends AbstractLockingProvider { } /** @inheritDoc */ + #[\Override] public function releaseLock(string $path, int $type): void { $this->markRelease($path, $type); @@ -164,6 +169,7 @@ class DBLockingProvider extends AbstractLockingProvider { } /** @inheritDoc */ + #[\Override] public function changeLock(string $path, int $targetType): void { $expire = $this->getExpireTime(); if ($targetType === self::LOCK_SHARED) { @@ -212,6 +218,7 @@ class DBLockingProvider extends AbstractLockingProvider { } /** @inheritDoc */ + #[\Override] public function releaseAll(): void { parent::releaseAll(); diff --git a/lib/private/Lock/MemcacheLockingProvider.php b/lib/private/Lock/MemcacheLockingProvider.php index 8cc0c27bbf9..77c61bcfe88 100644 --- a/lib/private/Lock/MemcacheLockingProvider.php +++ b/lib/private/Lock/MemcacheLockingProvider.php @@ -47,6 +47,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider { } } + #[\Override] public function isLocked(string $path, int $type): bool { $lockValue = $this->memcache->get($path); if ($type === self::LOCK_SHARED) { @@ -58,6 +59,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider { } } + #[\Override] public function acquireLock(string $path, int $type, ?string $readablePath = null): void { if ($type === self::LOCK_SHARED) { // save the old TTL to for `restoreTTL` @@ -81,6 +83,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider { $this->markAcquire($path, $type); } + #[\Override] public function releaseLock(string $path, int $type): void { if ($type === self::LOCK_SHARED) { $ownSharedLockCount = $this->getOwnSharedLockCount($path); @@ -114,6 +117,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider { $this->markRelease($path, $type); } + #[\Override] public function changeLock(string $path, int $targetType): void { if ($targetType === self::LOCK_SHARED) { if (!$this->memcache->cas($path, 'exclusive', 1)) { diff --git a/lib/private/Lock/NoopLockingProvider.php b/lib/private/Lock/NoopLockingProvider.php index 42f1f9ae5ec..f5cadbf045f 100644 --- a/lib/private/Lock/NoopLockingProvider.php +++ b/lib/private/Lock/NoopLockingProvider.php @@ -19,6 +19,7 @@ class NoopLockingProvider implements ILockingProvider { /** * {@inheritdoc} */ + #[\Override] public function isLocked(string $path, int $type): bool { return false; } @@ -26,6 +27,7 @@ class NoopLockingProvider implements ILockingProvider { /** * {@inheritdoc} */ + #[\Override] public function acquireLock(string $path, int $type, ?string $readablePath = null): void { // do nothing } @@ -33,6 +35,7 @@ class NoopLockingProvider implements ILockingProvider { /** * {@inheritdoc} */ + #[\Override] public function releaseLock(string $path, int $type): void { // do nothing } @@ -40,6 +43,7 @@ class NoopLockingProvider implements ILockingProvider { /**1 * {@inheritdoc} */ + #[\Override] public function releaseAll(): void { // do nothing } @@ -47,6 +51,7 @@ class NoopLockingProvider implements ILockingProvider { /** * {@inheritdoc} */ + #[\Override] public function changeLock(string $path, int $targetType): void { // do nothing } diff --git a/lib/private/Lockdown/Filesystem/NullCache.php b/lib/private/Lockdown/Filesystem/NullCache.php index b722d719d6a..d5508ae877d 100644 --- a/lib/private/Lockdown/Filesystem/NullCache.php +++ b/lib/private/Lockdown/Filesystem/NullCache.php @@ -20,10 +20,12 @@ use OCP\Files\Search\ISearchOperator; use OCP\Files\Search\ISearchQuery; class NullCache implements ICache { + #[\Override] public function getNumericStorageId(): int { return -1; } + #[\Override] public function get($file): false|ICacheEntry { if ($file !== '') { return false; @@ -44,86 +46,107 @@ class NullCache implements ICache { ]); } + #[\Override] public function getFolderContents(string $folder, ?string $mimeTypeFilter = null): array { return []; } + #[\Override] public function getFolderContentsById(int $fileId, ?string $mimeTypeFilter = null): array { return []; } + #[\Override] public function put($file, array $data): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function insert($file, array $data): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function update($id, array $data): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function getId($file) { return -1; } + #[\Override] public function getParentId($file) { return -1; } + #[\Override] public function inCache($file) { return $file === ''; } + #[\Override] public function remove($file) { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function move($source, $target) { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function getStatus($file) { return ICache::COMPLETE; } + #[\Override] public function search($pattern) { return []; } + #[\Override] public function searchByMime($mimetype) { return []; } + #[\Override] public function searchQuery(ISearchQuery $query) { return []; } + #[\Override] public function getIncomplete() { return []; } + #[\Override] public function getPathById($id) { return ''; } + #[\Override] public function normalize($path) { return $path; } + #[\Override] public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function getQueryFilterForStorage(): ISearchOperator { return new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', -1); } + #[\Override] public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry { return null; } diff --git a/lib/private/Lockdown/Filesystem/NullStorage.php b/lib/private/Lockdown/Filesystem/NullStorage.php index 727259319ed..5cf32f125d4 100644 --- a/lib/private/Lockdown/Filesystem/NullStorage.php +++ b/lib/private/Lockdown/Filesystem/NullStorage.php @@ -18,154 +18,192 @@ class NullStorage extends Common { parent::__construct($parameters); } + #[\Override] public function getId(): string { return 'null'; } + #[\Override] public function mkdir(string $path): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function rmdir(string $path): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function opendir(string $path): IteratorDirectory { return new IteratorDirectory(); } + #[\Override] public function is_dir(string $path): bool { return $path === ''; } + #[\Override] public function is_file(string $path): bool { return false; } + #[\Override] public function stat(string $path): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function filetype(string $path): string|false { return ($path === '') ? 'dir' : false; } + #[\Override] public function filesize(string $path): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function isCreatable(string $path): bool { return false; } + #[\Override] public function isReadable(string $path): bool { return $path === ''; } + #[\Override] public function isUpdatable(string $path): bool { return false; } + #[\Override] public function isDeletable(string $path): bool { return false; } + #[\Override] public function isSharable(string $path): bool { return false; } + #[\Override] public function getPermissions(string $path): int { return 0; } + #[\Override] public function file_exists(string $path): bool { return $path === ''; } + #[\Override] public function filemtime(string $path): int|false { return ($path === '') ? time() : false; } + #[\Override] public function file_get_contents(string $path): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function file_put_contents(string $path, mixed $data): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function unlink(string $path): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function rename(string $source, string $target): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function copy(string $source, string $target): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function fopen(string $path, string $mode): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function getMimeType(string $path): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function hash(string $type, string $path, bool $raw = false): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function free_space(string $path): int { return FileInfo::SPACE_UNKNOWN; } + #[\Override] public function touch(string $path, ?int $mtime = null): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function getLocalFile(string $path): string|false { return false; } + #[\Override] public function hasUpdated(string $path, int $time): bool { return false; } + #[\Override] public function getETag(string $path): string { return ''; } + #[\Override] public function isLocal(): bool { return false; } + #[\Override] public function getDirectDownload(string $path): array|false { return false; } + #[\Override] public function getDirectDownloadById(string $fileId): array|false { return false; } + #[\Override] public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, bool $preserveMtime = false): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): never { throw new ForbiddenException('This request is not allowed to access the filesystem'); } + #[\Override] public function test(): bool { return true; } + #[\Override] public function getOwner(string $path): string|false { return false; } + #[\Override] public function getCache(string $path = '', ?IStorage $storage = null): ICache { return new NullCache(); } diff --git a/lib/private/Lockdown/LockdownManager.php b/lib/private/Lockdown/LockdownManager.php index 4f351812bad..9fa4892b548 100644 --- a/lib/private/Lockdown/LockdownManager.php +++ b/lib/private/Lockdown/LockdownManager.php @@ -29,6 +29,7 @@ class LockdownManager implements ILockdownManager { } + #[\Override] public function enable() { $this->enabled = true; } @@ -52,6 +53,7 @@ class LockdownManager implements ILockdownManager { return $this->scope; } + #[\Override] public function setToken(IToken $token) { $this->scope = $token->getScopeAsArray(); $session = $this->getSession(); @@ -59,6 +61,7 @@ class LockdownManager implements ILockdownManager { $this->enable(); } + #[\Override] public function canAccessFilesystem() { $scope = $this->getScopeAsArray(); return !$scope || $scope[IToken::SCOPE_FILESYSTEM]; diff --git a/lib/private/Log.php b/lib/private/Log.php index 8fb376ebb1b..a7b1a5fba0b 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -367,6 +367,7 @@ class Log implements ILogger, IDataLogger { } } + #[\Override] public function logData(string $message, array $data, array $context = []): void { $app = $context['app'] ?? 'no app in context'; $level = $context['level'] ?? ILogger::ERROR; diff --git a/lib/private/Log/Errorlog.php b/lib/private/Log/Errorlog.php index 6188bb70fd5..0a0fa530cb3 100644 --- a/lib/private/Log/Errorlog.php +++ b/lib/private/Log/Errorlog.php @@ -25,6 +25,7 @@ class Errorlog extends LogDetails implements IWriter { * * @param string|array $message */ + #[\Override] public function write(string $app, $message, int $level): void { error_log('[' . $this->tag . '][' . $app . '][' . $level . '] ' . $this->logDetailsAsJSON($app, $message, $level)); } diff --git a/lib/private/Log/File.php b/lib/private/Log/File.php index 580656ee55a..1ad360784d2 100644 --- a/lib/private/Log/File.php +++ b/lib/private/Log/File.php @@ -45,6 +45,7 @@ class File extends LogDetails implements IWriter, IFileBased { * write a message in the log * @param string|array $message */ + #[\Override] public function write(string $app, $message, int $level): void { $entry = $this->logDetailsAsJSON($app, $message, $level); $handle = @fopen($this->logFile, 'a'); @@ -69,6 +70,7 @@ class File extends LogDetails implements IWriter, IFileBased { /** * get entries from the log in reverse chronological order */ + #[\Override] public function getEntries(int $limit = 50, int $offset = 0): array { $minLevel = $this->config->getValue('loglevel', ILogger::WARN); $entries = []; @@ -111,6 +113,7 @@ class File extends LogDetails implements IWriter, IFileBased { return $entries; } + #[\Override] public function getLogFilePath():string { return $this->logFile; } diff --git a/lib/private/Log/LogFactory.php b/lib/private/Log/LogFactory.php index 58c4f433ca6..2c995f46e59 100644 --- a/lib/private/Log/LogFactory.php +++ b/lib/private/Log/LogFactory.php @@ -24,6 +24,7 @@ class LogFactory implements ILogFactory { /** * @throws QueryException */ + #[\Override] public function get(string $type):IWriter { return match (strtolower($type)) { 'errorlog' => new Errorlog($this->systemConfig), @@ -43,6 +44,7 @@ class LogFactory implements ILogFactory { }; } + #[\Override] public function getCustomPsrLogger(string $path, string $type = 'file', string $tag = 'Nextcloud'): LoggerInterface { $log = $this->createNewLogger($type, $tag, $path); return new PsrLoggerAdapter( diff --git a/lib/private/Log/PsrLoggerAdapter.php b/lib/private/Log/PsrLoggerAdapter.php index 888a482b92c..de5b4df5e15 100644 --- a/lib/private/Log/PsrLoggerAdapter.php +++ b/lib/private/Log/PsrLoggerAdapter.php @@ -53,6 +53,7 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * * @param mixed[] $context */ + #[\Override] public function emergency(string|Stringable $message, array $context = []): void { $this->log(LogLevel::EMERGENCY, (string)$message, $context); } @@ -65,6 +66,7 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * * @param mixed[] $context */ + #[\Override] public function alert(string|Stringable $message, array $context = []): void { $this->log(LogLevel::ALERT, (string)$message, $context); } @@ -76,6 +78,7 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * * @param mixed[] $context */ + #[\Override] public function critical(string|Stringable $message, array $context = []): void { $this->log(LogLevel::CRITICAL, (string)$message, $context); } @@ -86,6 +89,7 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * * @param mixed[] $context */ + #[\Override] public function error(string|Stringable $message, array $context = []): void { $this->log(LogLevel::ERROR, (string)$message, $context); } @@ -98,6 +102,7 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * * @param mixed[] $context */ + #[\Override] public function warning(string|Stringable $message, array $context = []): void { $this->log(LogLevel::WARNING, (string)$message, $context); } @@ -107,6 +112,7 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * * @param mixed[] $context */ + #[\Override] public function notice(string|Stringable $message, array $context = []): void { $this->log(LogLevel::NOTICE, (string)$message, $context); } @@ -118,6 +124,7 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * * @param mixed[] $context */ + #[\Override] public function info(string|Stringable $message, array $context = []): void { $this->log(LogLevel::INFO, (string)$message, $context); } @@ -127,6 +134,7 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * * @param mixed[] $context */ + #[\Override] public function debug(string|Stringable $message, array $context = []): void { $this->log(LogLevel::DEBUG, (string)$message, $context); } @@ -139,6 +147,7 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * * @throws InvalidArgumentException */ + #[\Override] public function log($level, $message, array $context = []): void { if (is_string($level)) { $level = self::logLevelToInt($level); @@ -162,6 +171,7 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { } } + #[\Override] public function logData(string $message, array $data, array $context = []): void { $this->logger->logData($message, $data, $context); } diff --git a/lib/private/Log/Rotate.php b/lib/private/Log/Rotate.php index b433d302ccc..1d2f37b1dba 100644 --- a/lib/private/Log/Rotate.php +++ b/lib/private/Log/Rotate.php @@ -29,6 +29,7 @@ class Rotate extends TimedJob { $this->setInterval(3600); } + #[\Override] public function run($argument): void { $config = Server::get(IConfig::class); $this->filePath = $config->getSystemValueString('logfile', $config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log'); diff --git a/lib/private/Log/Syslog.php b/lib/private/Log/Syslog.php index 46214599eb8..92305edc17d 100644 --- a/lib/private/Log/Syslog.php +++ b/lib/private/Log/Syslog.php @@ -42,6 +42,7 @@ class Syslog extends LogDetails implements IWriter { * write a message in the log * @param string|array $message */ + #[\Override] public function write(string $app, $message, int $level): void { $syslog_level = $this->levels[$level]; openlog($this->tag, LOG_PID | LOG_CONS, LOG_USER); diff --git a/lib/private/Log/Systemdlog.php b/lib/private/Log/Systemdlog.php index ffea0511732..8e3a68e2ffb 100644 --- a/lib/private/Log/Systemdlog.php +++ b/lib/private/Log/Systemdlog.php @@ -57,6 +57,7 @@ class Systemdlog extends LogDetails implements IWriter { * Write a message to the log. * @param string|array $message */ + #[\Override] public function write(string $app, $message, int $level): void { $journal_level = $this->levels[$level]; sd_journal_send('PRIORITY=' . $journal_level, diff --git a/lib/private/Mail/Attachment.php b/lib/private/Mail/Attachment.php index 2a5246c0019..54b0cc76d9a 100644 --- a/lib/private/Mail/Attachment.php +++ b/lib/private/Mail/Attachment.php @@ -30,6 +30,7 @@ class Attachment implements IAttachment { * @return $this * @since 13.0.0 */ + #[\Override] public function setFilename(string $filename): IAttachment { $this->name = $filename; return $this; @@ -39,6 +40,7 @@ class Attachment implements IAttachment { * @return $this * @since 13.0.0 */ + #[\Override] public function setContentType(string $contentType): IAttachment { $this->contentType = $contentType; return $this; @@ -48,6 +50,7 @@ class Attachment implements IAttachment { * @return $this * @since 13.0.0 */ + #[\Override] public function setBody(string $body): IAttachment { $this->body = $body; return $this; diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php index a327109cc12..2e4d905cf44 100644 --- a/lib/private/Mail/EMailTemplate.php +++ b/lib/private/Mail/EMailTemplate.php @@ -333,6 +333,7 @@ EOF; /** * Sets the subject of the email */ + #[\Override] public function setSubject(string $subject): void { $this->subject = $subject; } @@ -340,6 +341,7 @@ EOF; /** * Adds a header to the email */ + #[\Override] public function addHeader(): void { if ($this->headerAdded) { return; @@ -362,6 +364,7 @@ EOF; * @param string|bool $plainTitle Title that is used in the plain text email * if empty the $title is used, if false none will be used */ + #[\Override] public function addHeading(string $title, $plainTitle = ''): void { if ($this->footerAdded) { return; @@ -395,6 +398,7 @@ EOF; * @param string|bool $plainText Text that is used in the plain text email * if empty the $text is used, if false none will be used */ + #[\Override] public function addBodyText(string $text, $plainText = ''): void { if ($this->footerAdded) { return; @@ -426,6 +430,7 @@ EOF; * @param integer $plainIndent plainIndent If > 0, Indent plainText by this amount. * @since 12.0.0 */ + #[\Override] public function addBodyListItem( string $text, string $metaInfo = '', @@ -512,6 +517,7 @@ EOF; * @param string $plainTextLeft Text of left button that is used in the plain text version - if unset the $textLeft is used * @param string $plainTextRight Text of right button that is used in the plain text version - if unset the $textRight is used */ + #[\Override] public function addBodyButtonGroup( string $textLeft, string $urlLeft, @@ -554,6 +560,7 @@ EOF; * * @since 12.0.0 */ + #[\Override] public function addBodyButton(string $text, string $url, $plainText = ''): void { if ($this->footerAdded) { return; @@ -597,6 +604,7 @@ EOF; * * @param string $text If the text is empty the default "Name - Slogan
This is an automatically sent email" will be used */ + #[\Override] public function addFooter(string $text = '', ?string $lang = null): void { if ($text === '') { $l10n = $this->l10nFactory->get('lib', $lang); @@ -623,6 +631,7 @@ EOF; /** * Returns the rendered email subject as string */ + #[\Override] public function renderSubject(): string { return $this->subject; } @@ -630,6 +639,7 @@ EOF; /** * Returns the rendered HTML email as string */ + #[\Override] public function renderHtml(): string { if (!$this->footerAdded) { $this->footerAdded = true; @@ -642,6 +652,7 @@ EOF; /** * Returns the rendered plain text email as string */ + #[\Override] public function renderText(): string { if (!$this->footerAdded) { $this->footerAdded = true; diff --git a/lib/private/Mail/EmailValidator.php b/lib/private/Mail/EmailValidator.php index e819817b7a9..82e951ebc1e 100644 --- a/lib/private/Mail/EmailValidator.php +++ b/lib/private/Mail/EmailValidator.php @@ -21,6 +21,7 @@ class EmailValidator implements IEmailValidator { ) { } + #[\Override] public function isValid(string $email): bool { if ($email === '') { // Shortcut: empty addresses are never valid diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php index a7fe5dd7438..99d9cd99f3a 100644 --- a/lib/private/Mail/Mailer.php +++ b/lib/private/Mail/Mailer.php @@ -76,6 +76,7 @@ class Mailer implements IMailer { /** * Creates a new message object that can be passed to send() */ + #[\Override] public function createMessage(): Message { $plainTextOnly = $this->config->getSystemValueBool('mail_send_plaintext_only', false); return new Message(new Email(), $plainTextOnly); @@ -87,6 +88,7 @@ class Mailer implements IMailer { * @param string|null $contentType * @since 13.0.0 */ + #[\Override] public function createAttachment($data = null, $filename = null, $contentType = null): IAttachment { return new Attachment($data, $filename, $contentType); } @@ -95,6 +97,7 @@ class Mailer implements IMailer { * @param string|null $contentType * @since 13.0.0 */ + #[\Override] public function createAttachmentFromPath(string $path, $contentType = null): IAttachment { return new Attachment(null, null, $contentType, $path); } @@ -104,6 +107,7 @@ class Mailer implements IMailer { * * @since 12.0.0 */ + #[\Override] public function createEMailTemplate(string $emailId, array $data = []): IEMailTemplate { $logoDimensions = $this->config->getAppValue('theming', 'logoDimensions', self::DEFAULT_DIMENSIONS); if (str_contains($logoDimensions, 'x')) { @@ -165,6 +169,7 @@ class Mailer implements IMailer { * @param IMessage $message Message to send * @return string[] $failedRecipients */ + #[\Override] public function send(IMessage $message): array { $debugMode = $this->config->getSystemValueBool('mail_smtpdebug', false); @@ -237,6 +242,7 @@ class Mailer implements IMailer { * @return bool True if the mail address is valid, false otherwise * @deprecated 32.0.0 use {@see IEmailValidator::isValid()} instead */ + #[\Override] public function validateMailAddress(string $email): bool { return $this->emailValidator->isValid($email); } diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php index 097af11e24c..d27f2e5797d 100644 --- a/lib/private/Mail/Message.php +++ b/lib/private/Mail/Message.php @@ -39,6 +39,7 @@ class Message implements IMessage { * @since 13.0.0 * @return $this */ + #[\Override] public function attach(IAttachment $attachment): IMessage { /** @var Attachment $attachment */ $attachment->attach($this->symfonyEmail); @@ -50,6 +51,7 @@ class Message implements IMessage { * {@inheritDoc} * @since 26.0.0 */ + #[\Override] public function attachInline(string $body, string $name, ?string $contentType = null): IMessage { # To be sure this works with iCalendar messages, we encode with 8bit instead of # quoted-printable encoding. We save the current encoder, replace the current @@ -94,6 +96,7 @@ class Message implements IMessage { * @param array $addresses Example: array('sender@domain.org', 'other@domain.org' => 'A name') * @return $this */ + #[\Override] public function setFrom(array $addresses): IMessage { $this->from = $addresses; return $this; @@ -110,6 +113,7 @@ class Message implements IMessage { * Set the Reply-To address of this message * @return $this */ + #[\Override] public function setReplyTo(array $addresses): IMessage { $this->replyTo = $addresses; return $this; @@ -128,6 +132,7 @@ class Message implements IMessage { * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name') * @return $this */ + #[\Override] public function setTo(array $recipients): IMessage { $this->to = $recipients; return $this; @@ -146,6 +151,7 @@ class Message implements IMessage { * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name') * @return $this */ + #[\Override] public function setCc(array $recipients): IMessage { $this->cc = $recipients; return $this; @@ -164,6 +170,7 @@ class Message implements IMessage { * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name') * @return $this */ + #[\Override] public function setBcc(array $recipients): IMessage { $this->bcc = $recipients; return $this; @@ -179,6 +186,7 @@ class Message implements IMessage { /** * @return $this */ + #[\Override] public function setSubject(string $subject): IMessage { $this->symfonyEmail->subject($subject); return $this; @@ -194,6 +202,7 @@ class Message implements IMessage { /** * @return $this */ + #[\Override] public function setPlainBody(string $body): IMessage { $this->symfonyEmail->text($body); return $this; @@ -211,6 +220,7 @@ class Message implements IMessage { /** * @return $this */ + #[\Override] public function setHtmlBody(string $body): IMessage { if (!$this->plainTextOnly) { $this->symfonyEmail->html($body); @@ -275,6 +285,7 @@ class Message implements IMessage { /** * @return $this */ + #[\Override] public function useTemplate(IEMailTemplate $emailTemplate): IMessage { $this->setSubject($emailTemplate->renderSubject()); $this->setPlainBody($emailTemplate->renderText()); @@ -291,6 +302,7 @@ class Message implements IMessage { * @param AutoSubmitted::VALUE_* $value (one of AutoSubmitted::VALUE_NO, AutoSubmitted::VALUE_AUTO_GENERATED, AutoSubmitted::VALUE_AUTO_REPLIED) * @return $this */ + #[\Override] public function setAutoSubmitted(string $value): IMessage { $headers = $this->symfonyEmail->getHeaders(); diff --git a/lib/private/Mail/Provider/Manager.php b/lib/private/Mail/Provider/Manager.php index f162d30b834..99f7b21c621 100644 --- a/lib/private/Mail/Provider/Manager.php +++ b/lib/private/Mail/Provider/Manager.php @@ -34,6 +34,7 @@ class Manager implements IManager { * * @return bool */ + #[\Override] public function has(): bool { // return true if collection has any providers @@ -48,6 +49,7 @@ class Manager implements IManager { * * @return int */ + #[\Override] public function count(): int { // return count of providers in collection @@ -62,6 +64,7 @@ class Manager implements IManager { * * @return array collection of provider id and label ['jmap' => 'JMap Connector'] */ + #[\Override] public function types(): array { // construct types collection @@ -82,6 +85,7 @@ class Manager implements IManager { * * @return array collection of provider id and object ['jmap' => IProviderObject] */ + #[\Override] public function providers(): array { // evaluate if we already have a cached collection of providers and return the collection if we do @@ -125,6 +129,7 @@ class Manager implements IManager { * * @return IProvider|null */ + #[\Override] public function findProviderById(string $providerId): ?IProvider { // evaluate if we already have a cached collection of providers @@ -149,6 +154,7 @@ class Manager implements IManager { * * @return array> collection of provider id, service id and object ['jmap' => ['Service1' => IServiceObject]] */ + #[\Override] public function services(string $userId): array { // initilize collection @@ -178,6 +184,7 @@ class Manager implements IManager { * * @return IService|null returns service object or null if none found */ + #[\Override] public function findServiceById(string $userId, string $serviceId, ?string $providerId = null): ?IService { // evaluate if provider id was specified @@ -222,6 +229,7 @@ class Manager implements IManager { * * @return IService|null returns service object or null if none found */ + #[\Override] public function findServiceByAddress(string $userId, string $address, ?string $providerId = null): ?IService { // evaluate if provider id was specified diff --git a/lib/private/Memcache/APCu.php b/lib/private/Memcache/APCu.php index 324218797e5..f7f4f65fa5e 100644 --- a/lib/private/Memcache/APCu.php +++ b/lib/private/Memcache/APCu.php @@ -18,6 +18,7 @@ class APCu extends Cache implements IMemcache { use CADTrait; + #[\Override] public function get($key) { $result = apcu_fetch($this->getPrefix() . $key, $success); if (!$success) { @@ -26,6 +27,7 @@ class APCu extends Cache implements IMemcache { return $result; } + #[\Override] public function set($key, $value, $ttl = 0) { if ($ttl === 0) { $ttl = self::DEFAULT_TTL; @@ -33,14 +35,17 @@ class APCu extends Cache implements IMemcache { return apcu_store($this->getPrefix() . $key, $value, $ttl); } + #[\Override] public function hasKey($key) { return apcu_exists($this->getPrefix() . $key); } + #[\Override] public function remove($key) { return apcu_delete($this->getPrefix() . $key); } + #[\Override] public function clear($prefix = '') { $ns = $this->getPrefix() . $prefix; $ns = preg_quote($ns, '/'); @@ -60,6 +65,7 @@ class APCu extends Cache implements IMemcache { * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 * @return bool */ + #[\Override] public function add($key, $value, $ttl = 0) { if ($ttl === 0) { $ttl = self::DEFAULT_TTL; @@ -74,6 +80,7 @@ class APCu extends Cache implements IMemcache { * @param int $step * @return int | bool */ + #[\Override] public function inc($key, $step = 1) { $success = null; return apcu_inc($this->getPrefix() . $key, $step, $success, self::DEFAULT_TTL); @@ -86,6 +93,7 @@ class APCu extends Cache implements IMemcache { * @param int $step * @return int | bool */ + #[\Override] public function dec($key, $step = 1) { return apcu_exists($this->getPrefix() . $key) ? apcu_dec($this->getPrefix() . $key, $step) @@ -100,6 +108,7 @@ class APCu extends Cache implements IMemcache { * @param mixed $new * @return bool */ + #[\Override] public function cas($key, $old, $new) { // apc only does cas for ints if (is_int($old) && is_int($new)) { @@ -109,6 +118,7 @@ class APCu extends Cache implements IMemcache { } } + #[\Override] public static function isAvailable(): bool { if (!extension_loaded('apcu')) { return false; diff --git a/lib/private/Memcache/ArrayCache.php b/lib/private/Memcache/ArrayCache.php index 9b3540b771f..b93211d9143 100644 --- a/lib/private/Memcache/ArrayCache.php +++ b/lib/private/Memcache/ArrayCache.php @@ -18,6 +18,7 @@ class ArrayCache extends Cache implements IMemcache { /** * {@inheritDoc} */ + #[\Override] public function get($key) { if ($this->hasKey($key)) { return $this->cachedData[$key]; @@ -28,6 +29,7 @@ class ArrayCache extends Cache implements IMemcache { /** * {@inheritDoc} */ + #[\Override] public function set($key, $value, $ttl = 0) { $this->cachedData[$key] = $value; return true; @@ -36,6 +38,7 @@ class ArrayCache extends Cache implements IMemcache { /** * {@inheritDoc} */ + #[\Override] public function hasKey($key) { return isset($this->cachedData[$key]); } @@ -43,6 +46,7 @@ class ArrayCache extends Cache implements IMemcache { /** * {@inheritDoc} */ + #[\Override] public function remove($key) { unset($this->cachedData[$key]); return true; @@ -51,6 +55,7 @@ class ArrayCache extends Cache implements IMemcache { /** * {@inheritDoc} */ + #[\Override] public function clear($prefix = '') { if ($prefix === '') { $this->cachedData = []; @@ -73,6 +78,7 @@ class ArrayCache extends Cache implements IMemcache { * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 * @return bool */ + #[\Override] public function add($key, $value, $ttl = 0) { // since this cache is not shared race conditions aren't an issue if ($this->hasKey($key)) { @@ -89,6 +95,7 @@ class ArrayCache extends Cache implements IMemcache { * @param int $step * @return int | bool */ + #[\Override] public function inc($key, $step = 1) { $oldValue = $this->get($key); if (is_int($oldValue)) { @@ -107,6 +114,7 @@ class ArrayCache extends Cache implements IMemcache { * @param int $step * @return int | bool */ + #[\Override] public function dec($key, $step = 1) { $oldValue = $this->get($key); if (is_int($oldValue)) { @@ -125,6 +133,7 @@ class ArrayCache extends Cache implements IMemcache { * @param mixed $new * @return bool */ + #[\Override] public function cas($key, $old, $new) { if ($this->get($key) === $old) { return $this->set($key, $new); @@ -136,6 +145,7 @@ class ArrayCache extends Cache implements IMemcache { /** * {@inheritDoc} */ + #[\Override] public static function isAvailable(): bool { return true; } diff --git a/lib/private/Memcache/Cache.php b/lib/private/Memcache/Cache.php index 48013e2fe6b..f1a8b0f811c 100644 --- a/lib/private/Memcache/Cache.php +++ b/lib/private/Memcache/Cache.php @@ -29,6 +29,7 @@ abstract class Cache implements \ArrayAccess, ICache { * @param string $key * @return mixed */ + #[\Override] abstract public function get($key); /** @@ -37,32 +38,38 @@ abstract class Cache implements \ArrayAccess, ICache { * @param int $ttl * @return mixed */ + #[\Override] abstract public function set($key, $value, $ttl = 0); /** * @param string $key * @return mixed */ + #[\Override] abstract public function hasKey($key); /** * @param string $key * @return mixed */ + #[\Override] abstract public function remove($key); /** * @param string $prefix * @return mixed */ + #[\Override] abstract public function clear($prefix = ''); //implement the ArrayAccess interface + #[\Override] public function offsetExists($offset): bool { return $this->hasKey($offset); } + #[\Override] public function offsetSet($offset, $value): void { $this->set($offset, $value); } @@ -70,11 +77,13 @@ abstract class Cache implements \ArrayAccess, ICache { /** * @return mixed */ + #[\Override] #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->get($offset); } + #[\Override] public function offsetUnset($offset): void { $this->remove($offset); } diff --git a/lib/private/Memcache/Factory.php b/lib/private/Memcache/Factory.php index 940813536c5..6cefc3d2dbc 100644 --- a/lib/private/Memcache/Factory.php +++ b/lib/private/Memcache/Factory.php @@ -161,6 +161,7 @@ class Factory implements ICacheFactory { * @param string $prefix * @return IMemcache */ + #[\Override] public function createLocking(string $prefix = ''): IMemcache { $cache = new $this->lockingCacheClass($this->getGlobalPrefix() . '/' . $prefix); if ($this->lockingCacheClass === Redis::class) { @@ -183,6 +184,7 @@ class Factory implements ICacheFactory { * @param string $prefix * @return ICache */ + #[\Override] public function createDistributed(string $prefix = ''): ICache { $cache = new $this->distributedCacheClass($this->getGlobalPrefix() . '/' . $prefix); if ($this->distributedCacheClass === Redis::class) { @@ -205,6 +207,7 @@ class Factory implements ICacheFactory { * @param string $prefix * @return ICache */ + #[\Override] public function createLocal(string $prefix = ''): ICache { $cache = new $this->localCacheClass($this->getGlobalPrefix() . '/' . $prefix); if ($this->localCacheClass === Redis::class) { @@ -226,10 +229,12 @@ class Factory implements ICacheFactory { * * @return bool */ + #[\Override] public function isAvailable(): bool { return $this->distributedCacheClass !== self::NULL_CACHE; } + #[\Override] public function createInMemory(int $capacity = 512): ICache { return new CappedMemoryCache($capacity); } @@ -239,6 +244,7 @@ class Factory implements ICacheFactory { * * @return bool */ + #[\Override] public function isLocalCacheAvailable(): bool { return $this->localCacheClass !== self::NULL_CACHE; } diff --git a/lib/private/Memcache/LoggerWrapperCache.php b/lib/private/Memcache/LoggerWrapperCache.php index a25185eb8c4..512a8ed2293 100644 --- a/lib/private/Memcache/LoggerWrapperCache.php +++ b/lib/private/Memcache/LoggerWrapperCache.php @@ -21,6 +21,7 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { parent::__construct($wrappedCache->getPrefix()); } + #[\Override] public function getPrefix(): string { return $this->prefix; } @@ -30,6 +31,7 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { } /** @inheritDoc */ + #[\Override] public function get($key) { file_put_contents( $this->logFile, @@ -40,6 +42,7 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { } /** @inheritDoc */ + #[\Override] public function set($key, $value, $ttl = 0) { file_put_contents( $this->logFile, @@ -51,6 +54,7 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { } /** @inheritDoc */ + #[\Override] public function hasKey($key) { file_put_contents( $this->logFile, @@ -62,6 +66,7 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { } /** @inheritDoc */ + #[\Override] public function remove($key) { file_put_contents( $this->logFile, @@ -73,6 +78,7 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { } /** @inheritDoc */ + #[\Override] public function clear($prefix = '') { file_put_contents( $this->logFile, @@ -84,6 +90,7 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { } /** @inheritDoc */ + #[\Override] public function add($key, $value, $ttl = 0) { file_put_contents( $this->logFile, @@ -95,6 +102,7 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { } /** @inheritDoc */ + #[\Override] public function inc($key, $step = 1) { file_put_contents( $this->logFile, @@ -106,6 +114,7 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { } /** @inheritDoc */ + #[\Override] public function dec($key, $step = 1) { file_put_contents( $this->logFile, @@ -117,6 +126,7 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { } /** @inheritDoc */ + #[\Override] public function cas($key, $old, $new) { file_put_contents( $this->logFile, @@ -128,6 +138,7 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { } /** @inheritDoc */ + #[\Override] public function cad($key, $old) { file_put_contents( $this->logFile, @@ -139,6 +150,7 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { } /** @inheritDoc */ + #[\Override] public function ncad(string $key, mixed $old): bool { file_put_contents( $this->logFile, @@ -150,18 +162,22 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { } /** @inheritDoc */ + #[\Override] public function setTTL(string $key, int $ttl) { $this->wrappedCache->setTTL($key, $ttl); } + #[\Override] public function getTTL(string $key): int|false { return $this->wrappedCache->getTTL($key); } + #[\Override] public function compareSetTTL(string $key, mixed $value, int $ttl): bool { return $this->wrappedCache->compareSetTTL($key, $value, $ttl); } + #[\Override] public static function isAvailable(): bool { return true; } diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php index 044a0fccd25..d6e0e182aca 100644 --- a/lib/private/Memcache/Memcached.php +++ b/lib/private/Memcache/Memcached.php @@ -83,6 +83,7 @@ class Memcached extends Cache implements IMemcache { return $this->prefix; } + #[\Override] public function get($key) { $result = self::$cache->get($this->getNameSpace() . $key); if ($result === false && self::$cache->getResultCode() === \Memcached::RES_NOTFOUND) { @@ -92,6 +93,7 @@ class Memcached extends Cache implements IMemcache { } } + #[\Override] public function set($key, $value, $ttl = 0) { if ($ttl > 0) { $result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl); @@ -101,16 +103,19 @@ class Memcached extends Cache implements IMemcache { return $result || $this->isSuccess(); } + #[\Override] public function hasKey($key) { self::$cache->get($this->getNameSpace() . $key); return self::$cache->getResultCode() === \Memcached::RES_SUCCESS; } + #[\Override] public function remove($key) { $result = self::$cache->delete($this->getNameSpace() . $key); return $result || $this->isSuccess() || self::$cache->getResultCode() === \Memcached::RES_NOTFOUND; } + #[\Override] public function clear($prefix = '') { // Newer Memcached doesn't like getAllKeys(), flush everything self::$cache->flush(); @@ -125,6 +130,7 @@ class Memcached extends Cache implements IMemcache { * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 * @return bool */ + #[\Override] public function add($key, $value, $ttl = 0) { $result = self::$cache->add($this->getPrefix() . $key, $value, $ttl); return $result || $this->isSuccess(); @@ -137,6 +143,7 @@ class Memcached extends Cache implements IMemcache { * @param int $step * @return int | bool */ + #[\Override] public function inc($key, $step = 1) { $this->add($key, 0); $result = self::$cache->increment($this->getPrefix() . $key, $step); @@ -155,6 +162,7 @@ class Memcached extends Cache implements IMemcache { * @param int $step * @return int | bool */ + #[\Override] public function dec($key, $step = 1) { $result = self::$cache->decrement($this->getPrefix() . $key, $step); @@ -165,6 +173,7 @@ class Memcached extends Cache implements IMemcache { return $result; } + #[\Override] public static function isAvailable(): bool { return extension_loaded('memcached'); } diff --git a/lib/private/Memcache/NullCache.php b/lib/private/Memcache/NullCache.php index 0fc66db82f8..683a71ba2bb 100644 --- a/lib/private/Memcache/NullCache.php +++ b/lib/private/Memcache/NullCache.php @@ -12,51 +12,63 @@ namespace OC\Memcache; use OCP\IMemcache; class NullCache extends Cache implements IMemcache { + #[\Override] public function get($key) { return null; } + #[\Override] public function set($key, $value, $ttl = 0) { return true; } + #[\Override] public function hasKey($key) { return false; } + #[\Override] public function remove($key) { return true; } + #[\Override] public function add($key, $value, $ttl = 0) { return true; } + #[\Override] public function inc($key, $step = 1) { return true; } + #[\Override] public function dec($key, $step = 1) { return true; } + #[\Override] public function cas($key, $old, $new) { return true; } + #[\Override] public function cad($key, $old) { return true; } + #[\Override] public function ncad(string $key, mixed $old): bool { return true; } + #[\Override] public function clear($prefix = '') { return true; } + #[\Override] public static function isAvailable(): bool { return true; } diff --git a/lib/private/Memcache/ProfilerWrapperCache.php b/lib/private/Memcache/ProfilerWrapperCache.php index c9fb77885b4..49c7eac8d87 100644 --- a/lib/private/Memcache/ProfilerWrapperCache.php +++ b/lib/private/Memcache/ProfilerWrapperCache.php @@ -40,6 +40,7 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL } /** @inheritDoc */ + #[\Override] public function get($key) { $start = microtime(true); $ret = $this->wrappedCache->get($key); @@ -58,6 +59,7 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL } /** @inheritDoc */ + #[\Override] public function set($key, $value, $ttl = 0) { $start = microtime(true); $ret = $this->wrappedCache->set($key, $value, $ttl); @@ -70,6 +72,7 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL } /** @inheritDoc */ + #[\Override] public function hasKey($key) { $start = microtime(true); $ret = $this->wrappedCache->hasKey($key); @@ -82,6 +85,7 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL } /** @inheritDoc */ + #[\Override] public function remove($key) { $start = microtime(true); $ret = $this->wrappedCache->remove($key); @@ -94,6 +98,7 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL } /** @inheritDoc */ + #[\Override] public function clear($prefix = '') { $start = microtime(true); $ret = $this->wrappedCache->clear($prefix); @@ -106,6 +111,7 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL } /** @inheritDoc */ + #[\Override] public function add($key, $value, $ttl = 0) { $start = microtime(true); $ret = $this->wrappedCache->add($key, $value, $ttl); @@ -118,6 +124,7 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL } /** @inheritDoc */ + #[\Override] public function inc($key, $step = 1) { $start = microtime(true); $ret = $this->wrappedCache->inc($key, $step); @@ -130,6 +137,7 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL } /** @inheritDoc */ + #[\Override] public function dec($key, $step = 1) { $start = microtime(true); $ret = $this->wrappedCache->dec($key, $step); @@ -142,6 +150,7 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL } /** @inheritDoc */ + #[\Override] public function cas($key, $old, $new) { $start = microtime(true); $ret = $this->wrappedCache->cas($key, $old, $new); @@ -154,6 +163,7 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL } /** @inheritDoc */ + #[\Override] public function cad($key, $old) { $start = microtime(true); $ret = $this->wrappedCache->cad($key, $old); @@ -166,6 +176,7 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL } /** @inheritDoc */ + #[\Override] public function ncad(string $key, mixed $old): bool { $start = microtime(true); $ret = $this->wrappedCache->ncad($key, $old); @@ -178,22 +189,27 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL } /** @inheritDoc */ + #[\Override] public function setTTL(string $key, int $ttl) { $this->wrappedCache->setTTL($key, $ttl); } + #[\Override] public function getTTL(string $key): int|false { return $this->wrappedCache->getTTL($key); } + #[\Override] public function compareSetTTL(string $key, mixed $value, int $ttl): bool { return $this->wrappedCache->compareSetTTL($key, $value, $ttl); } + #[\Override] public function offsetExists($offset): bool { return $this->hasKey($offset); } + #[\Override] public function offsetSet($offset, $value): void { $this->set($offset, $value); } @@ -201,23 +217,28 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL /** * @return mixed */ + #[\Override] #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->get($offset); } + #[\Override] public function offsetUnset($offset): void { $this->remove($offset); } + #[\Override] public function collect(Request $request, Response $response, ?\Throwable $exception = null): void { // Nothing to do here $data is already ready } + #[\Override] public function getName(): string { return 'cache/' . $this->type . '/' . $this->prefix; } + #[\Override] public static function isAvailable(): bool { return true; } diff --git a/lib/private/Memcache/Redis.php b/lib/private/Memcache/Redis.php index 1611d428f30..03da8e138e7 100644 --- a/lib/private/Memcache/Redis.php +++ b/lib/private/Memcache/Redis.php @@ -57,6 +57,7 @@ class Redis extends Cache implements IMemcacheTTL { return self::$cache; } + #[\Override] public function get($key) { $result = $this->getCache()->get($this->getPrefix() . $key); if ($result === false) { @@ -66,6 +67,7 @@ class Redis extends Cache implements IMemcacheTTL { return self::decodeValue($result); } + #[\Override] public function set($key, $value, $ttl = 0) { $value = self::encodeValue($value); if ($ttl === 0) { @@ -76,10 +78,12 @@ class Redis extends Cache implements IMemcacheTTL { return $this->getCache()->setex($this->getPrefix() . $key, $ttl, $value); } + #[\Override] public function hasKey($key) { return (bool)$this->getCache()->exists($this->getPrefix() . $key); } + #[\Override] public function remove($key) { if ($this->getCache()->unlink($this->getPrefix() . $key)) { return true; @@ -88,6 +92,7 @@ class Redis extends Cache implements IMemcacheTTL { } } + #[\Override] public function clear($prefix = '') { // TODO: this is slow and would fail with Redis cluster $prefix = $this->getPrefix() . $prefix . '*'; @@ -105,6 +110,7 @@ class Redis extends Cache implements IMemcacheTTL { * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 * @return bool */ + #[\Override] public function add($key, $value, $ttl = 0) { $value = self::encodeValue($value); if ($ttl === 0) { @@ -126,6 +132,7 @@ class Redis extends Cache implements IMemcacheTTL { * @param int $step * @return int | bool */ + #[\Override] public function inc($key, $step = 1) { return $this->getCache()->incrBy($this->getPrefix() . $key, $step); } @@ -137,6 +144,7 @@ class Redis extends Cache implements IMemcacheTTL { * @param int $step * @return int | bool */ + #[\Override] public function dec($key, $step = 1) { $res = $this->evalLua('dec', [$key], [$step]); return ($res === 'NEX') ? false : $res; @@ -150,6 +158,7 @@ class Redis extends Cache implements IMemcacheTTL { * @param mixed $new * @return bool */ + #[\Override] public function cas($key, $old, $new) { $old = self::encodeValue($old); $new = self::encodeValue($new); @@ -164,18 +173,21 @@ class Redis extends Cache implements IMemcacheTTL { * @param mixed $old * @return bool */ + #[\Override] public function cad($key, $old) { $old = self::encodeValue($old); return $this->evalLua('cad', [$key], [$old]) > 0; } + #[\Override] public function ncad(string $key, mixed $old): bool { $old = self::encodeValue($old); return $this->evalLua('ncad', [$key], [$old]) > 0; } + #[\Override] public function setTTL($key, $ttl) { if ($ttl === 0) { // having infinite TTL can lead to leaked keys as the prefix changes with version upgrades @@ -185,17 +197,20 @@ class Redis extends Cache implements IMemcacheTTL { $this->getCache()->expire($this->getPrefix() . $key, $ttl); } + #[\Override] public function getTTL(string $key): int|false { $ttl = $this->getCache()->ttl($this->getPrefix() . $key); return $ttl > 0 ? (int)$ttl : false; } + #[\Override] public function compareSetTTL(string $key, mixed $value, int $ttl): bool { $value = self::encodeValue($value); return $this->evalLua('caSetTtl', [$key], [$value, $ttl]) > 0; } + #[\Override] public static function isAvailable(): bool { return Server::get('RedisFactory')->isAvailable(); } diff --git a/lib/private/Memcache/WithLocalCache.php b/lib/private/Memcache/WithLocalCache.php index 334fa4bc753..339c097f3db 100644 --- a/lib/private/Memcache/WithLocalCache.php +++ b/lib/private/Memcache/WithLocalCache.php @@ -22,6 +22,7 @@ class WithLocalCache implements ICache { $this->cached = new CappedMemoryCache($localCapacity); } + #[\Override] public function get($key) { if (isset($this->cached[$key])) { return $this->cached[$key]; @@ -34,25 +35,30 @@ class WithLocalCache implements ICache { } } + #[\Override] public function set($key, $value, $ttl = 0) { $this->cached[$key] = $value; return $this->inner->set($key, $value, $ttl); } + #[\Override] public function hasKey($key) { return isset($this->cached[$key]) || $this->inner->hasKey($key); } + #[\Override] public function remove($key) { unset($this->cached[$key]); return $this->inner->remove($key); } + #[\Override] public function clear($prefix = '') { $this->cached->clear(); return $this->inner->clear($prefix); } + #[\Override] public static function isAvailable(): bool { return false; } diff --git a/lib/private/Migration/BackgroundRepair.php b/lib/private/Migration/BackgroundRepair.php index d542b82d5e1..ca252962d4e 100644 --- a/lib/private/Migration/BackgroundRepair.php +++ b/lib/private/Migration/BackgroundRepair.php @@ -35,6 +35,7 @@ class BackgroundRepair extends TimedJob { * @param array $argument * @throws \Exception */ + #[\Override] protected function run($argument): void { if (!isset($argument['app']) || !isset($argument['step'])) { // remove the job - we can never execute it diff --git a/lib/private/Migration/ConsoleOutput.php b/lib/private/Migration/ConsoleOutput.php index 31412bf4ff0..a97ffe5cb93 100644 --- a/lib/private/Migration/ConsoleOutput.php +++ b/lib/private/Migration/ConsoleOutput.php @@ -27,6 +27,7 @@ class ConsoleOutput implements IOutput { ) { } + #[\Override] public function debug(string $message): void { $this->output->writeln($message, OutputInterface::VERBOSITY_VERBOSE); } @@ -34,6 +35,7 @@ class ConsoleOutput implements IOutput { /** * @param string $message */ + #[\Override] public function info($message): void { $this->output->writeln("$message"); } @@ -41,6 +43,7 @@ class ConsoleOutput implements IOutput { /** * @param string $message */ + #[\Override] public function warning($message): void { $this->output->writeln("$message"); } @@ -48,6 +51,7 @@ class ConsoleOutput implements IOutput { /** * @param int $max */ + #[\Override] public function startProgress($max = 0): void { if (!is_null($this->progressBar)) { $this->progressBar->finish(); @@ -60,6 +64,7 @@ class ConsoleOutput implements IOutput { * @param int $step * @param string $description */ + #[\Override] public function advance($step = 1, $description = ''): void { if (is_null($this->progressBar)) { $this->progressBar = new ProgressBar($this->output); @@ -71,6 +76,7 @@ class ConsoleOutput implements IOutput { } } + #[\Override] public function finishProgress(): void { if (is_null($this->progressBar)) { return; diff --git a/lib/private/Migration/NullOutput.php b/lib/private/Migration/NullOutput.php index f099d515c77..86b92312534 100644 --- a/lib/private/Migration/NullOutput.php +++ b/lib/private/Migration/NullOutput.php @@ -18,21 +18,27 @@ use OCP\Migration\IOutput; * @package OC\Migration */ class NullOutput implements IOutput { + #[\Override] public function debug(string $message): void { } + #[\Override] public function info($message): void { } + #[\Override] public function warning($message): void { } + #[\Override] public function startProgress($max = 0): void { } + #[\Override] public function advance($step = 1, $description = ''): void { } + #[\Override] public function finishProgress(): void { } } diff --git a/lib/private/Migration/SimpleOutput.php b/lib/private/Migration/SimpleOutput.php index b7a07cc6ff2..48df5e43141 100644 --- a/lib/private/Migration/SimpleOutput.php +++ b/lib/private/Migration/SimpleOutput.php @@ -25,6 +25,7 @@ class SimpleOutput implements IOutput { ) { } + #[\Override] public function debug(string $message): void { $this->logger->debug($message, ['app' => $this->appName]); } @@ -33,6 +34,7 @@ class SimpleOutput implements IOutput { * @param string $message * @since 9.1.0 */ + #[\Override] public function info($message): void { $this->logger->info($message, ['app' => $this->appName]); } @@ -41,6 +43,7 @@ class SimpleOutput implements IOutput { * @param string $message * @since 9.1.0 */ + #[\Override] public function warning($message): void { $this->logger->warning($message, ['app' => $this->appName]); } @@ -49,6 +52,7 @@ class SimpleOutput implements IOutput { * @param int $max * @since 9.1.0 */ + #[\Override] public function startProgress($max = 0): void { } @@ -57,12 +61,14 @@ class SimpleOutput implements IOutput { * @param string $description * @since 9.1.0 */ + #[\Override] public function advance($step = 1, $description = ''): void { } /** * @since 9.1.0 */ + #[\Override] public function finishProgress(): void { } } diff --git a/lib/private/Notification/Action.php b/lib/private/Notification/Action.php index 0ae86760a32..45e99bf6264 100644 --- a/lib/private/Notification/Action.php +++ b/lib/private/Notification/Action.php @@ -21,6 +21,7 @@ class Action implements IAction { /** * {@inheritDoc} */ + #[\Override] public function setLabel(string $label): IAction { if ($label === '' || isset($label[32])) { throw new InvalidValueException('label'); @@ -32,6 +33,7 @@ class Action implements IAction { /** * {@inheritDoc} */ + #[\Override] public function getLabel(): string { return $this->label; } @@ -39,6 +41,7 @@ class Action implements IAction { /** * {@inheritDoc} */ + #[\Override] public function setParsedLabel(string $label): IAction { if ($label === '') { throw new InvalidValueException('parsedLabel'); @@ -50,6 +53,7 @@ class Action implements IAction { /** * {@inheritDoc} */ + #[\Override] public function getParsedLabel(): string { return $this->labelParsed; } @@ -57,6 +61,7 @@ class Action implements IAction { /** * {@inheritDoc} */ + #[\Override] public function setPrimary(bool $primary): IAction { $this->primary = $primary; return $this; @@ -65,6 +70,7 @@ class Action implements IAction { /** * {@inheritDoc} */ + #[\Override] public function isPrimary(): bool { return $this->primary; } @@ -72,6 +78,7 @@ class Action implements IAction { /** * {@inheritDoc} */ + #[\Override] public function setLink(string $link, string $requestType): IAction { if ($link === '' || isset($link[256])) { throw new InvalidValueException('link'); @@ -99,6 +106,7 @@ class Action implements IAction { /** * {@inheritDoc} */ + #[\Override] public function getLink(): string { return $this->link; } @@ -106,6 +114,7 @@ class Action implements IAction { /** * {@inheritDoc} */ + #[\Override] public function getRequestType(): string { return $this->requestType; } @@ -113,6 +122,7 @@ class Action implements IAction { /** * {@inheritDoc} */ + #[\Override] public function isValid(): bool { return $this->label !== '' && $this->link !== ''; } @@ -120,6 +130,7 @@ class Action implements IAction { /** * {@inheritDoc} */ + #[\Override] public function isValidParsed(): bool { return $this->labelParsed !== '' && $this->link !== ''; } diff --git a/lib/private/Notification/Manager.php b/lib/private/Notification/Manager.php index 24b401a0e90..a1c15759d4f 100644 --- a/lib/private/Notification/Manager.php +++ b/lib/private/Notification/Manager.php @@ -77,6 +77,7 @@ class Manager implements IManager { * \InvalidArgumentException is thrown later * @since 17.0.0 */ + #[\Override] public function registerApp(string $appClass): void { // other apps may want to rely on the 'main' notification app so make it deterministic that // the 'main' notification app adds it's notifications first and removes it's notifications last @@ -95,6 +96,7 @@ class Manager implements IManager { * \InvalidArgumentException is thrown later * @since 17.0.0 */ + #[\Override] public function registerNotifierService(string $notifierService): void { $this->notifierClasses[] = $notifierService; } @@ -136,6 +138,7 @@ class Manager implements IManager { /** * @return INotifier[] */ + #[\Override] public function getNotifiers(): array { if (!$this->parsedRegistrationContext) { $notifierServices = $this->coordinator->getRegistrationContext()->getNotifierServices(); @@ -197,6 +200,7 @@ class Manager implements IManager { * @return INotification * @since 8.2.0 */ + #[\Override] public function createNotification(): INotification { return new Notification($this->validator, $this->richTextFormatter); } @@ -205,6 +209,7 @@ class Manager implements IManager { * @return bool * @since 8.2.0 */ + #[\Override] public function hasNotifiers(): bool { return !empty($this->notifiers) || !empty($this->notifierClasses) @@ -215,6 +220,7 @@ class Manager implements IManager { * @param bool $preparingPushNotification * @since 14.0.0 */ + #[\Override] public function setPreparingPushNotification(bool $preparingPushNotification): void { $this->preparingPushNotification = $preparingPushNotification; } @@ -223,6 +229,7 @@ class Manager implements IManager { * @return bool * @since 14.0.0 */ + #[\Override] public function isPreparingPushNotification(): bool { return $this->preparingPushNotification; } @@ -232,6 +239,7 @@ class Manager implements IManager { * @return bool * @since 20.0.0 */ + #[\Override] public function defer(): bool { $alreadyDeferring = $this->deferPushing; $this->deferPushing = true; @@ -250,6 +258,7 @@ class Manager implements IManager { /** * @since 20.0.0 */ + #[\Override] public function flush(): void { $apps = array_reverse($this->getApps()); @@ -270,6 +279,7 @@ class Manager implements IManager { /** * {@inheritDoc} */ + #[\Override] public function isFairUseOfFreePushService(): bool { $pushAllowed = $this->cache->get('push_fair_use'); if ($pushAllowed === null) { @@ -288,6 +298,7 @@ class Manager implements IManager { /** * {@inheritDoc} */ + #[\Override] public function notify(INotification $notification): void { if (!$notification->isValid()) { throw new IncompleteNotificationException('The given notification is invalid'); @@ -312,6 +323,7 @@ class Manager implements IManager { * @return string * @since 17.0.0 */ + #[\Override] public function getID(): string { return 'core'; } @@ -322,6 +334,7 @@ class Manager implements IManager { * @return string * @since 17.0.0 */ + #[\Override] public function getName(): string { return 'core'; } @@ -329,6 +342,7 @@ class Manager implements IManager { /** * {@inheritDoc} */ + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { $notifiers = $this->getNotifiers(); @@ -360,6 +374,7 @@ class Manager implements IManager { return $notification; } + #[\Override] public function preloadDataForParsing( array $notifications, string $languageCode, @@ -378,6 +393,7 @@ class Manager implements IManager { /** * @param INotification $notification */ + #[\Override] public function markProcessed(INotification $notification): void { $apps = array_reverse($this->getApps()); @@ -390,6 +406,7 @@ class Manager implements IManager { * @param INotification $notification * @return int */ + #[\Override] public function getCount(INotification $notification): int { $apps = array_reverse($this->getApps()); @@ -404,6 +421,7 @@ class Manager implements IManager { /** * {@inheritDoc} */ + #[\Override] public function dismissNotification(INotification $notification): void { $notifiers = $this->getNotifiers(); diff --git a/lib/private/Notification/Notification.php b/lib/private/Notification/Notification.php index 07d7aef363f..b055b0f9c79 100644 --- a/lib/private/Notification/Notification.php +++ b/lib/private/Notification/Notification.php @@ -58,6 +58,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function setApp(string $app): INotification { if ($app === '' || isset($app[32])) { throw new InvalidValueException('app'); @@ -69,6 +70,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getApp(): string { return $this->app; } @@ -76,6 +78,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function setUser(string $user): INotification { if ($user === '' || isset($user[64])) { throw new InvalidValueException('user'); @@ -87,6 +90,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getUser(): string { return $this->user; } @@ -94,6 +98,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function setDateTime(\DateTime $dateTime): INotification { if ($dateTime->getTimestamp() === 0) { throw new InvalidValueException('dateTime'); @@ -105,6 +110,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getDateTime(): \DateTime { return $this->dateTime; } @@ -112,6 +118,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function setObject(string $type, string $id): INotification { if ($type === '' || isset($type[64])) { throw new InvalidValueException('objectType'); @@ -128,6 +135,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getObjectType(): string { return $this->objectType; } @@ -135,6 +143,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getObjectId(): string { return $this->objectId; } @@ -142,6 +151,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function setSubject(string $subject, array $parameters = []): INotification { if ($subject === '' || isset($subject[64])) { throw new InvalidValueException('subject'); @@ -156,6 +166,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getSubject(): string { return $this->subject; } @@ -163,6 +174,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getSubjectParameters(): array { return $this->subjectParameters; } @@ -170,6 +182,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function setParsedSubject(string $subject): INotification { if ($subject === '') { throw new InvalidValueException('parsedSubject'); @@ -181,6 +194,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getParsedSubject(): string { return $this->subjectParsed; } @@ -188,6 +202,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function setRichSubject(string $subject, array $parameters = []): INotification { if ($subject === '') { throw new InvalidValueException('richSubject'); @@ -210,6 +225,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getRichSubject(): string { return $this->subjectRich; } @@ -217,6 +233,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getRichSubjectParameters(): array { return $this->subjectRichParameters; } @@ -224,6 +241,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function setMessage(string $message, array $parameters = []): INotification { if ($message === '' || isset($message[64])) { throw new InvalidValueException('message'); @@ -238,6 +256,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getMessage(): string { return $this->message; } @@ -245,6 +264,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getMessageParameters(): array { return $this->messageParameters; } @@ -252,6 +272,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function setParsedMessage(string $message): INotification { if ($message === '') { throw new InvalidValueException('parsedMessage'); @@ -263,6 +284,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getParsedMessage(): string { return $this->messageParsed; } @@ -270,6 +292,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function setRichMessage(string $message, array $parameters = []): INotification { if ($message === '') { throw new InvalidValueException('richMessage'); @@ -292,6 +315,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getRichMessage(): string { return $this->messageRich; } @@ -299,6 +323,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getRichMessageParameters(): array { return $this->messageRichParameters; } @@ -306,6 +331,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function setLink(string $link): INotification { if ($link === '' || isset($link[4000])) { throw new InvalidValueException('link'); @@ -323,6 +349,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getLink(): string { return $this->link; } @@ -330,6 +357,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function setIcon(string $icon): INotification { if ($icon === '' || isset($icon[4000])) { throw new InvalidValueException('icon'); @@ -347,6 +375,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getIcon(): string { return $this->icon; } @@ -354,6 +383,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function setPriorityNotification(bool $priorityNotification): INotification { if ($priorityNotification && !in_array($this->getApp(), self::PRIORITY_NOTIFICATION_APPS, true)) { throw new InvalidValueException('priorityNotification'); @@ -366,6 +396,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function isPriorityNotification(): bool { return $this->priorityNotification; } @@ -373,6 +404,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function createAction(): IAction { return new Action(); } @@ -380,6 +412,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function addAction(IAction $action): INotification { if (!$action->isValid()) { throw new InvalidValueException('action'); @@ -400,6 +433,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getActions(): array { return $this->actions; } @@ -407,6 +441,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function addParsedAction(IAction $action): INotification { if (!$action->isValidParsed()) { throw new InvalidValueException('action'); @@ -431,6 +466,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function getParsedActions(): array { return $this->actionsParsed; } @@ -438,6 +474,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function isValid(): bool { return $this->isValidCommon() @@ -448,6 +485,7 @@ class Notification implements INotification { /** * {@inheritDoc} */ + #[\Override] public function isValidParsed(): bool { if ($this->getRichSubject() !== '' || !empty($this->getRichSubjectParameters())) { try { diff --git a/lib/private/OCM/Model/OCMProvider.php b/lib/private/OCM/Model/OCMProvider.php index bbbace0d882..20d3fbf8360 100644 --- a/lib/private/OCM/Model/OCMProvider.php +++ b/lib/private/OCM/Model/OCMProvider.php @@ -38,6 +38,7 @@ class OCMProvider implements IOCMProvider { * * @return $this */ + #[\Override] public function setEnabled(bool $enabled): static { $this->enabled = $enabled; @@ -47,6 +48,7 @@ class OCMProvider implements IOCMProvider { /** * @return bool */ + #[\Override] public function isEnabled(): bool { return $this->enabled; } @@ -56,6 +58,7 @@ class OCMProvider implements IOCMProvider { * * @return $this */ + #[\Override] public function setApiVersion(string $apiVersion): static { $this->apiVersion = $apiVersion; @@ -65,6 +68,7 @@ class OCMProvider implements IOCMProvider { /** * @return string */ + #[\Override] public function getApiVersion(): string { return $this->apiVersion; } @@ -75,6 +79,7 @@ class OCMProvider implements IOCMProvider { * @return string * @since 32.0.0 */ + #[\Override] public function getInviteAcceptDialog(): string { return $this->inviteAcceptDialog; } @@ -87,6 +92,7 @@ class OCMProvider implements IOCMProvider { * @return $this * @since 32.0.0 */ + #[\Override] public function setInviteAcceptDialog(string $inviteAcceptDialog): static { $this->inviteAcceptDialog = $inviteAcceptDialog; @@ -98,6 +104,7 @@ class OCMProvider implements IOCMProvider { * * @return $this */ + #[\Override] public function setEndPoint(string $endPoint): static { $this->endPoint = $endPoint; @@ -107,6 +114,7 @@ class OCMProvider implements IOCMProvider { /** * @return string */ + #[\Override] public function getEndPoint(): string { return $this->endPoint; } @@ -114,6 +122,7 @@ class OCMProvider implements IOCMProvider { /** * @return string */ + #[\Override] public function getProvider(): string { return $this->provider; } @@ -123,6 +132,7 @@ class OCMProvider implements IOCMProvider { * * @return $this */ + #[\Override] public function setCapabilities(array $capabilities): static { $this->capabilities = array_unique(array_merge( $this->capabilities, @@ -134,6 +144,7 @@ class OCMProvider implements IOCMProvider { /** * @return array */ + #[\Override] public function getCapabilities(): array { return $this->capabilities; } @@ -142,6 +153,7 @@ class OCMProvider implements IOCMProvider { * @param string $capability * @return bool */ + #[\Override] public function hasCapability(string $capability): bool { return (in_array($this->normalizeCapability($capability), $this->capabilities, true)); } @@ -155,6 +167,7 @@ class OCMProvider implements IOCMProvider { * create a new resource to later add it with {@see IOCMProvider::addResourceType()} * @return IOCMResource */ + #[\Override] public function createNewResourceType(): IOCMResource { return new OCMResource(); } @@ -164,6 +177,7 @@ class OCMProvider implements IOCMProvider { * * @return $this */ + #[\Override] public function addResourceType(IOCMResource $resource): static { $this->resourceTypes[] = $resource; @@ -175,6 +189,7 @@ class OCMProvider implements IOCMProvider { * * @return $this */ + #[\Override] public function setResourceTypes(array $resourceTypes): static { $this->resourceTypes = $resourceTypes; @@ -184,6 +199,7 @@ class OCMProvider implements IOCMProvider { /** * @return IOCMResource[] */ + #[\Override] public function getResourceTypes(): array { return $this->resourceTypes; } @@ -195,6 +211,7 @@ class OCMProvider implements IOCMProvider { * @return string * @throws OCMArgumentException */ + #[\Override] public function extractProtocolEntry(string $resourceName, string $protocol): string { foreach ($this->getResourceTypes() as $resource) { if ($resource->getName() === $resourceName) { @@ -226,6 +243,7 @@ class OCMProvider implements IOCMProvider { * @return OCMProvider&static * @throws OCMProviderException in case a descent provider cannot be generated from data */ + #[\Override] public function import(array $data): static { $this->setEnabled(is_bool($data['enabled'] ?? '') ? $data['enabled'] : false) // Fall back to old apiVersion for Nextcloud 30 compatibility @@ -269,6 +287,7 @@ class OCMProvider implements IOCMProvider { /** * @since 28.0.0 */ + #[\Override] public function jsonSerialize(): array { $resourceTypes = []; foreach ($this->getResourceTypes() as $res) { diff --git a/lib/private/OCM/Model/OCMResource.php b/lib/private/OCM/Model/OCMResource.php index 3d619db1927..58d8afc4c8f 100644 --- a/lib/private/OCM/Model/OCMResource.php +++ b/lib/private/OCM/Model/OCMResource.php @@ -26,6 +26,7 @@ class OCMResource implements IOCMResource { * * @return $this */ + #[\Override] public function setName(string $name): static { $this->name = $name; @@ -35,6 +36,7 @@ class OCMResource implements IOCMResource { /** * @return string */ + #[\Override] public function getName(): string { return $this->name; } @@ -44,6 +46,7 @@ class OCMResource implements IOCMResource { * * @return $this */ + #[\Override] public function setShareTypes(array $shareTypes): static { $this->shareTypes = $shareTypes; @@ -53,6 +56,7 @@ class OCMResource implements IOCMResource { /** * @return list */ + #[\Override] public function getShareTypes(): array { return $this->shareTypes; } @@ -62,6 +66,7 @@ class OCMResource implements IOCMResource { * * @return $this */ + #[\Override] public function setProtocols(array $protocols): static { $this->protocols = $protocols; @@ -71,6 +76,7 @@ class OCMResource implements IOCMResource { /** * @return array */ + #[\Override] public function getProtocols(): array { return $this->protocols; } @@ -83,6 +89,7 @@ class OCMResource implements IOCMResource { * @return $this * @see self::jsonSerialize() */ + #[\Override] public function import(array $data): static { return $this->setName((string)($data['name'] ?? '')) ->setShareTypes($data['shareTypes'] ?? []) @@ -96,6 +103,7 @@ class OCMResource implements IOCMResource { * protocols: array * } */ + #[\Override] public function jsonSerialize(): array { return [ 'name' => $this->getName(), diff --git a/lib/private/OCM/OCMDiscoveryHandler.php b/lib/private/OCM/OCMDiscoveryHandler.php index b70218151c6..8fbcfd217f5 100644 --- a/lib/private/OCM/OCMDiscoveryHandler.php +++ b/lib/private/OCM/OCMDiscoveryHandler.php @@ -21,6 +21,7 @@ class OCMDiscoveryHandler implements IHandler { ) { } + #[\Override] public function handle(string $service, IRequestContext $context, ?IResponse $previousResponse): ?IResponse { if ($service !== 'ocm') { return $previousResponse; diff --git a/lib/private/OCM/OCMDiscoveryService.php b/lib/private/OCM/OCMDiscoveryService.php index 17a84c12d50..9459e9a03f0 100644 --- a/lib/private/OCM/OCMDiscoveryService.php +++ b/lib/private/OCM/OCMDiscoveryService.php @@ -79,6 +79,7 @@ final class OCMDiscoveryService implements IOCMDiscoveryService { * @throws OCMProviderException if no valid discovery data can be returned * @since 28.0.0 */ + #[\Override] public function discover(string $remote, bool $skipCache = false): IOCMProvider { $remote = rtrim($remote, '/'); if (!str_starts_with($remote, 'http://') && !str_starts_with($remote, 'https://')) { @@ -180,6 +181,7 @@ final class OCMDiscoveryService implements IOCMDiscoveryService { * @return IOCMProvider * @since 33.0.0 */ + #[\Override] public function getLocalOCMProvider(bool $fullDetails = true): IOCMProvider { if ($this->localProvider !== null) { return $this->localProvider; @@ -249,6 +251,7 @@ final class OCMDiscoveryService implements IOCMDiscoveryService { * @throws IncomingRequestException * @since 33.0.0 */ + #[\Override] public function getIncomingSignedRequest(): ?IIncomingSignedRequest { try { $signedRequest = $this->signatureManager->getIncomingSignedRequest($this->signatoryManager); @@ -291,6 +294,7 @@ final class OCMDiscoveryService implements IOCMDiscoveryService { * @throws OCMRequestException on internal issue * @since 33.0.0 */ + #[\Override] public function requestRemoteOcmEndpoint( ?string $capability, string $remote, diff --git a/lib/private/OCM/OCMSignatoryManager.php b/lib/private/OCM/OCMSignatoryManager.php index e9926ff6622..b239a4d1bce 100644 --- a/lib/private/OCM/OCMSignatoryManager.php +++ b/lib/private/OCM/OCMSignatoryManager.php @@ -54,6 +54,7 @@ class OCMSignatoryManager implements ISignatoryManager { * @return string * @since 31.0.0 */ + #[\Override] public function getProviderId(): string { return self::PROVIDER_ID; } @@ -64,6 +65,7 @@ class OCMSignatoryManager implements ISignatoryManager { * @return array * @since 31.0.0 */ + #[\Override] public function getOptions(): array { return [ 'algorithm' => SignatureAlgorithm::RSA_SHA512, @@ -83,6 +85,7 @@ class OCMSignatoryManager implements ISignatoryManager { * @throws IdentityNotFoundException * @since 31.0.0 */ + #[\Override] public function getLocalSignatory(): Signatory { /** * TODO: manage multiple identity (external, internal, ...) to allow a limitation @@ -144,6 +147,7 @@ class OCMSignatoryManager implements ISignatoryManager { * @return Signatory|null must be NULL if no signatory is found * @since 31.0.0 */ + #[\Override] public function getRemoteSignatory(string $remote): ?Signatory { try { $ocmProvider = Server::get(OCMDiscoveryService::class)->discover($remote, true); diff --git a/lib/private/OCS/CoreCapabilities.php b/lib/private/OCS/CoreCapabilities.php index 2729cc738f4..4a697e72c2d 100644 --- a/lib/private/OCS/CoreCapabilities.php +++ b/lib/private/OCS/CoreCapabilities.php @@ -40,6 +40,7 @@ class CoreCapabilities implements ICapability { * }, * } */ + #[\Override] public function getCapabilities(): array { return [ 'core' => [ diff --git a/lib/private/OCS/DiscoveryService.php b/lib/private/OCS/DiscoveryService.php index 85686e59b02..26d7abbd0a7 100644 --- a/lib/private/OCS/DiscoveryService.php +++ b/lib/private/OCS/DiscoveryService.php @@ -44,6 +44,7 @@ class DiscoveryService implements IDiscoveryService { * @param bool $skipCache We won't check if the data is in the cache. This is useful if a background job is updating the status * @return array */ + #[\Override] public function discover(string $remote, string $service, bool $skipCache = false): array { // Check the cache first if ($skipCache === false) { diff --git a/lib/private/OpenMetrics/Exporters/ActiveSessions.php b/lib/private/OpenMetrics/Exporters/ActiveSessions.php index b95279fa83e..a4bc39bee08 100644 --- a/lib/private/OpenMetrics/Exporters/ActiveSessions.php +++ b/lib/private/OpenMetrics/Exporters/ActiveSessions.php @@ -21,22 +21,27 @@ class ActiveSessions implements IMetricFamily { ) { } + #[\Override] public function name(): string { return 'active_sessions'; } + #[\Override] public function type(): MetricType { return MetricType::gauge; } + #[\Override] public function unit(): string { return 'sessions'; } + #[\Override] public function help(): string { return 'Number of active sessions'; } + #[\Override] public function metrics(): Generator { $now = time(); $timeFrames = [ diff --git a/lib/private/OpenMetrics/Exporters/ActiveUsers.php b/lib/private/OpenMetrics/Exporters/ActiveUsers.php index 43425fd37e2..68a1eb23f9c 100644 --- a/lib/private/OpenMetrics/Exporters/ActiveUsers.php +++ b/lib/private/OpenMetrics/Exporters/ActiveUsers.php @@ -21,22 +21,27 @@ class ActiveUsers implements IMetricFamily { ) { } + #[\Override] public function name(): string { return 'active_users'; } + #[\Override] public function type(): MetricType { return MetricType::gauge; } + #[\Override] public function unit(): string { return 'users'; } + #[\Override] public function help(): string { return 'Number of active users'; } + #[\Override] public function metrics(): Generator { $now = time(); $timeFrames = [ diff --git a/lib/private/OpenMetrics/Exporters/LogLevel.php b/lib/private/OpenMetrics/Exporters/LogLevel.php index e073b5d7ba2..ac2d62a911f 100644 --- a/lib/private/OpenMetrics/Exporters/LogLevel.php +++ b/lib/private/OpenMetrics/Exporters/LogLevel.php @@ -22,22 +22,27 @@ class LogLevel implements IMetricFamily { ) { } + #[\Override] public function name(): string { return 'log_level'; } + #[\Override] public function type(): MetricType { return MetricType::gauge; } + #[\Override] public function unit(): string { return ''; } + #[\Override] public function help(): string { return 'Current log level (lower level means more logs)'; } + #[\Override] public function metrics(): Generator { yield new Metric((int)$this->config->getSystemValue('loglevel', ILogger::WARN)); } diff --git a/lib/private/OpenMetrics/Exporters/Maintenance.php b/lib/private/OpenMetrics/Exporters/Maintenance.php index 89b53547e33..a0086cd70b5 100644 --- a/lib/private/OpenMetrics/Exporters/Maintenance.php +++ b/lib/private/OpenMetrics/Exporters/Maintenance.php @@ -21,6 +21,7 @@ use Override; * Export maintenance state */ class Maintenance implements IMetricFamily { + #[\Override] public function name(): string { return 'maintenance'; } diff --git a/lib/private/PhoneNumberUtil.php b/lib/private/PhoneNumberUtil.php index e53c7a51a1b..8e4405ff74f 100644 --- a/lib/private/PhoneNumberUtil.php +++ b/lib/private/PhoneNumberUtil.php @@ -19,6 +19,7 @@ class PhoneNumberUtil implements IPhoneNumberUtil { /** * {@inheritDoc} */ + #[\Override] public function getCountryCodeForRegion(string $regionCode): ?int { $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); $countryCode = $phoneUtil->getCountryCodeForRegion($regionCode); @@ -28,6 +29,7 @@ class PhoneNumberUtil implements IPhoneNumberUtil { /** * {@inheritDoc} */ + #[\Override] public function convertToStandardFormat(string $input, ?string $defaultRegion = null): ?string { $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); try { diff --git a/lib/private/Preview/BMP.php b/lib/private/Preview/BMP.php index b4d4d5829cb..624bd051c44 100644 --- a/lib/private/Preview/BMP.php +++ b/lib/private/Preview/BMP.php @@ -13,6 +13,7 @@ class BMP extends Image { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/image\/bmp/'; } diff --git a/lib/private/Preview/BackgroundCleanupJob.php b/lib/private/Preview/BackgroundCleanupJob.php index 70579d3b9d1..b853e98114f 100644 --- a/lib/private/Preview/BackgroundCleanupJob.php +++ b/lib/private/Preview/BackgroundCleanupJob.php @@ -32,6 +32,7 @@ class BackgroundCleanupJob extends TimedJob { $this->setTimeSensitivity(self::TIME_INSENSITIVE); } + #[\Override] public function run($argument): void { foreach ($this->getDeletedFiles() as $fileId) { $previewIds = []; diff --git a/lib/private/Preview/Bitmap.php b/lib/private/Preview/Bitmap.php index 9585b8a1f39..a9f5004201b 100644 --- a/lib/private/Preview/Bitmap.php +++ b/lib/private/Preview/Bitmap.php @@ -35,6 +35,7 @@ abstract class Bitmap extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { $tmpPath = $this->getLocalFile($file); if ($tmpPath === false) { diff --git a/lib/private/Preview/Db/PreviewMapper.php b/lib/private/Preview/Db/PreviewMapper.php index 05c1d4695f2..0d9699a5015 100644 --- a/lib/private/Preview/Db/PreviewMapper.php +++ b/lib/private/Preview/Db/PreviewMapper.php @@ -38,6 +38,7 @@ class PreviewMapper extends QBMapper { parent::__construct($db, self::TABLE_NAME, Preview::class); } + #[\Override] protected function mapRowToEntity(array $row): Entity { $row['mimetype'] = $this->mimeTypeLoader->getMimetypeById((int)$row['mimetype_id']); $row['source_mimetype'] = $this->mimeTypeLoader->getMimetypeById((int)$row['source_mimetype_id']); diff --git a/lib/private/Preview/EMF.php b/lib/private/Preview/EMF.php index a3c48e7d8aa..84d8a5cd9b6 100644 --- a/lib/private/Preview/EMF.php +++ b/lib/private/Preview/EMF.php @@ -10,6 +10,7 @@ declare(strict_types=1); namespace OC\Preview; class EMF extends Office { + #[\Override] public function getMimeType(): string { return '/image\/emf/'; } diff --git a/lib/private/Preview/Font.php b/lib/private/Preview/Font.php index 85f5d1f78d1..312d5de2bb8 100644 --- a/lib/private/Preview/Font.php +++ b/lib/private/Preview/Font.php @@ -14,6 +14,7 @@ class Font extends Bitmap { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/application\/(?:font-sfnt|x-font$)/'; } @@ -21,6 +22,7 @@ class Font extends Bitmap { /** * {@inheritDoc} */ + #[\Override] protected function getAllowedMimeTypes(): string { return '/(application|image)\/(?:font-sfnt|x-font|x-otf|x-ttf|x-pfb$)/'; } diff --git a/lib/private/Preview/GIF.php b/lib/private/Preview/GIF.php index be54bf8659c..e1d632fb4ec 100644 --- a/lib/private/Preview/GIF.php +++ b/lib/private/Preview/GIF.php @@ -13,6 +13,7 @@ class GIF extends Image { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/image\/gif/'; } diff --git a/lib/private/Preview/HEIC.php b/lib/private/Preview/HEIC.php index f2b6cc7254e..413a3ef9e1e 100644 --- a/lib/private/Preview/HEIC.php +++ b/lib/private/Preview/HEIC.php @@ -25,6 +25,7 @@ class HEIC extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/image\/(x-)?hei(f|c)/'; } @@ -32,6 +33,7 @@ class HEIC extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function isAvailable(FileInfo $file): bool { return in_array('HEIC', \Imagick::queryFormats('HEI*')); } @@ -39,6 +41,7 @@ class HEIC extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { if (!$this->isAvailable($file)) { return null; diff --git a/lib/private/Preview/Illustrator.php b/lib/private/Preview/Illustrator.php index 937da1d9f87..fdbe68542c7 100644 --- a/lib/private/Preview/Illustrator.php +++ b/lib/private/Preview/Illustrator.php @@ -14,6 +14,7 @@ class Illustrator extends Bitmap { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/application\/illustrator/'; } @@ -21,6 +22,7 @@ class Illustrator extends Bitmap { /** * {@inheritDoc} */ + #[\Override] protected function getAllowedMimeTypes(): string { return '/application\/(illustrator|pdf)/'; } diff --git a/lib/private/Preview/Image.php b/lib/private/Preview/Image.php index 25c74b5fdef..8a299bd2848 100644 --- a/lib/private/Preview/Image.php +++ b/lib/private/Preview/Image.php @@ -17,6 +17,7 @@ abstract class Image extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { $maxSizeForImages = Server::get(IConfig::class)->getSystemValueInt('preview_max_filesize_image', 50); $size = $file->getSize(); diff --git a/lib/private/Preview/Imaginary.php b/lib/private/Preview/Imaginary.php index bd5645d417e..e029823a9cf 100644 --- a/lib/private/Preview/Imaginary.php +++ b/lib/private/Preview/Imaginary.php @@ -37,6 +37,7 @@ class Imaginary extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return self::supportedMimeTypes(); } @@ -186,6 +187,7 @@ class Imaginary extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { return $this->getCroppedThumbnail($file, $maxX, $maxY, false); } diff --git a/lib/private/Preview/ImaginaryPDF.php b/lib/private/Preview/ImaginaryPDF.php index 2786700f5a7..0eb2cd970f2 100644 --- a/lib/private/Preview/ImaginaryPDF.php +++ b/lib/private/Preview/ImaginaryPDF.php @@ -9,6 +9,7 @@ declare(strict_types=1); namespace OC\Preview; class ImaginaryPDF extends Imaginary { + #[\Override] public static function supportedMimeTypes(): string { return '/application\/pdf/'; } diff --git a/lib/private/Preview/JPEG.php b/lib/private/Preview/JPEG.php index 97a6a0c94c1..4121e664941 100644 --- a/lib/private/Preview/JPEG.php +++ b/lib/private/Preview/JPEG.php @@ -13,6 +13,7 @@ class JPEG extends Image { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/image\/jpeg/'; } diff --git a/lib/private/Preview/Krita.php b/lib/private/Preview/Krita.php index 8654698c125..736f317f6da 100644 --- a/lib/private/Preview/Krita.php +++ b/lib/private/Preview/Krita.php @@ -15,6 +15,7 @@ class Krita extends Bundled { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/application\/x-krita/'; } @@ -23,6 +24,7 @@ class Krita extends Bundled { /** * @inheritDoc */ + #[\Override] public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { $image = $this->extractThumbnail($file, 'mergedimage.png'); if (($image !== null) && $image->valid()) { diff --git a/lib/private/Preview/MP3.php b/lib/private/Preview/MP3.php index dd3e809a7de..ed2a904194a 100644 --- a/lib/private/Preview/MP3.php +++ b/lib/private/Preview/MP3.php @@ -19,6 +19,7 @@ class MP3 extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/audio\/mpeg/'; } @@ -26,6 +27,7 @@ class MP3 extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { $tmpPath = $this->getLocalFile($file); if ($tmpPath === false) { diff --git a/lib/private/Preview/MSOffice2003.php b/lib/private/Preview/MSOffice2003.php index 977ebf467bf..844ee3ead71 100644 --- a/lib/private/Preview/MSOffice2003.php +++ b/lib/private/Preview/MSOffice2003.php @@ -14,6 +14,7 @@ class MSOffice2003 extends Office { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/application\/vnd.ms-.*/'; } diff --git a/lib/private/Preview/MSOffice2007.php b/lib/private/Preview/MSOffice2007.php index 6ccf70be0c2..6b979f16962 100644 --- a/lib/private/Preview/MSOffice2007.php +++ b/lib/private/Preview/MSOffice2007.php @@ -14,6 +14,7 @@ class MSOffice2007 extends Office { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/application\/vnd.openxmlformats-officedocument.*/'; } diff --git a/lib/private/Preview/MSOfficeDoc.php b/lib/private/Preview/MSOfficeDoc.php index 479e9170689..807c07c5fc5 100644 --- a/lib/private/Preview/MSOfficeDoc.php +++ b/lib/private/Preview/MSOfficeDoc.php @@ -14,6 +14,7 @@ class MSOfficeDoc extends Office { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/application\/msword/'; } diff --git a/lib/private/Preview/MarkDown.php b/lib/private/Preview/MarkDown.php index d8ae8c48ea9..7dba88278d9 100644 --- a/lib/private/Preview/MarkDown.php +++ b/lib/private/Preview/MarkDown.php @@ -15,10 +15,12 @@ class MarkDown extends TXT { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/text\/(x-)?markdown/'; } + #[\Override] public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { $content = $file->fopen('r'); diff --git a/lib/private/Preview/MimeIconProvider.php b/lib/private/Preview/MimeIconProvider.php index d1963fe882b..4c6ed18ab83 100644 --- a/lib/private/Preview/MimeIconProvider.php +++ b/lib/private/Preview/MimeIconProvider.php @@ -23,6 +23,7 @@ class MimeIconProvider implements IMimeIconProvider { ) { } + #[\Override] public function getMimeIconUrl(string $mime): ?string { if (!$mime) { return null; diff --git a/lib/private/Preview/Movie.php b/lib/private/Preview/Movie.php index ea14423505a..f34bf60c147 100644 --- a/lib/private/Preview/Movie.php +++ b/lib/private/Preview/Movie.php @@ -27,6 +27,7 @@ class Movie extends ProviderV2 { $this->config = Server::get(IConfig::class); } + #[\Override] public function getMimeType(): string { return '/video\/.*/'; } @@ -34,6 +35,7 @@ class Movie extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function isAvailable(FileInfo $file): bool { if (is_null($this->binary)) { if (isset($this->options['movieBinary'])) { @@ -63,6 +65,7 @@ class Movie extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { // TODO: use proc_open() and stream the source file ? diff --git a/lib/private/Preview/Office.php b/lib/private/Preview/Office.php index c67e4829db8..d1879a96622 100644 --- a/lib/private/Preview/Office.php +++ b/lib/private/Preview/Office.php @@ -19,6 +19,7 @@ abstract class Office extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function isAvailable(FileInfo $file): bool { return is_string($this->options['officeBinary']); } @@ -26,6 +27,7 @@ abstract class Office extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { if (!$this->isAvailable($file)) { return null; diff --git a/lib/private/Preview/OpenDocument.php b/lib/private/Preview/OpenDocument.php index 8eea9fecce7..a574bb41311 100644 --- a/lib/private/Preview/OpenDocument.php +++ b/lib/private/Preview/OpenDocument.php @@ -17,6 +17,7 @@ class OpenDocument extends Bundled { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/application\/vnd.oasis.opendocument.*/'; } @@ -25,6 +26,7 @@ class OpenDocument extends Bundled { /** * @inheritDoc */ + #[\Override] public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { $image = $this->extractThumbnail($file, 'Thumbnails/thumbnail.png'); if (($image !== null) && $image->valid()) { diff --git a/lib/private/Preview/PDF.php b/lib/private/Preview/PDF.php index dc8b37079b3..2aab2385569 100644 --- a/lib/private/Preview/PDF.php +++ b/lib/private/Preview/PDF.php @@ -14,6 +14,7 @@ class PDF extends Bitmap { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/application\/pdf/'; } @@ -21,6 +22,7 @@ class PDF extends Bitmap { /** * {@inheritDoc} */ + #[\Override] protected function getAllowedMimeTypes(): string { return '/application\/pdf/'; } diff --git a/lib/private/Preview/PNG.php b/lib/private/Preview/PNG.php index 5e2750c4f14..1569a4283fa 100644 --- a/lib/private/Preview/PNG.php +++ b/lib/private/Preview/PNG.php @@ -13,6 +13,7 @@ class PNG extends Image { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/image\/png/'; } diff --git a/lib/private/Preview/Photoshop.php b/lib/private/Preview/Photoshop.php index dcb893626c8..fea1bcf9a0d 100644 --- a/lib/private/Preview/Photoshop.php +++ b/lib/private/Preview/Photoshop.php @@ -14,6 +14,7 @@ class Photoshop extends Bitmap { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/application\/x-photoshop/'; } @@ -21,6 +22,7 @@ class Photoshop extends Bitmap { /** * {@inheritDoc} */ + #[\Override] protected function getAllowedMimeTypes(): string { return '/(application|image)\/(x-photoshop|x-psd)/'; } diff --git a/lib/private/Preview/Postscript.php b/lib/private/Preview/Postscript.php index b03db86e5f8..49b3ff5af22 100644 --- a/lib/private/Preview/Postscript.php +++ b/lib/private/Preview/Postscript.php @@ -14,6 +14,7 @@ class Postscript extends Bitmap { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/application\/postscript/'; } @@ -21,6 +22,7 @@ class Postscript extends Bitmap { /** * {@inheritDoc} */ + #[\Override] protected function getAllowedMimeTypes(): string { return '/(application\/postscript|image\/x-eps)/'; } diff --git a/lib/private/Preview/ProviderV2.php b/lib/private/Preview/ProviderV2.php index 9e1a6fcefcd..d0e013a3030 100644 --- a/lib/private/Preview/ProviderV2.php +++ b/lib/private/Preview/ProviderV2.php @@ -28,6 +28,7 @@ abstract class ProviderV2 implements IProviderV2 { /** * @return string Regex with the mimetypes that are supported by this provider */ + #[\Override] abstract public function getMimeType(): string ; /** @@ -36,6 +37,7 @@ abstract class ProviderV2 implements IProviderV2 { * @param FileInfo $file * @return bool */ + #[\Override] public function isAvailable(FileInfo $file): bool { return true; } @@ -49,6 +51,7 @@ abstract class ProviderV2 implements IProviderV2 { * @return null|IImage null if no preview was generated * @since 17.0.0 */ + #[\Override] abstract public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage; protected function useTempFile(File $file): bool { diff --git a/lib/private/Preview/SGI.php b/lib/private/Preview/SGI.php index 64e1ed2863d..b27a270034d 100644 --- a/lib/private/Preview/SGI.php +++ b/lib/private/Preview/SGI.php @@ -13,6 +13,7 @@ class SGI extends Bitmap { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/image\/(x-)?sgi/'; } @@ -20,6 +21,7 @@ class SGI extends Bitmap { /** * {@inheritDoc} */ + #[\Override] protected function getAllowedMimeTypes(): string { return '/image\/(x-)?sgi/'; } diff --git a/lib/private/Preview/SVG.php b/lib/private/Preview/SVG.php index be9b88fcc40..c23553090d5 100644 --- a/lib/private/Preview/SVG.php +++ b/lib/private/Preview/SVG.php @@ -17,6 +17,7 @@ class SVG extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/image\/svg\+xml/'; } @@ -24,6 +25,7 @@ class SVG extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { try { $content = stream_get_contents($file->fopen('r')); diff --git a/lib/private/Preview/StarOffice.php b/lib/private/Preview/StarOffice.php index e2d2b10dfce..2306ea2fb57 100644 --- a/lib/private/Preview/StarOffice.php +++ b/lib/private/Preview/StarOffice.php @@ -14,6 +14,7 @@ class StarOffice extends Office { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/application\/vnd.sun.xml.*/'; } diff --git a/lib/private/Preview/TGA.php b/lib/private/Preview/TGA.php index 24e55a09d90..98ae85ad865 100644 --- a/lib/private/Preview/TGA.php +++ b/lib/private/Preview/TGA.php @@ -13,6 +13,7 @@ class TGA extends Bitmap { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/image\/(x-)?t(ar)?ga/'; } @@ -20,6 +21,7 @@ class TGA extends Bitmap { /** * {@inheritDoc} */ + #[\Override] protected function getAllowedMimeTypes(): string { return '/image\/(x-)?t(ar)?ga/'; } diff --git a/lib/private/Preview/TIFF.php b/lib/private/Preview/TIFF.php index 866e26cc3d8..f04f56c3343 100644 --- a/lib/private/Preview/TIFF.php +++ b/lib/private/Preview/TIFF.php @@ -14,6 +14,7 @@ class TIFF extends Bitmap { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/image\/tiff/'; } @@ -21,6 +22,7 @@ class TIFF extends Bitmap { /** * {@inheritDoc} */ + #[\Override] protected function getAllowedMimeTypes(): string { return '/image\/tiff/'; } diff --git a/lib/private/Preview/TXT.php b/lib/private/Preview/TXT.php index 2d407d88b56..95977e3e5d7 100644 --- a/lib/private/Preview/TXT.php +++ b/lib/private/Preview/TXT.php @@ -16,6 +16,7 @@ class TXT extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/text\/plain/'; } @@ -23,6 +24,7 @@ class TXT extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function isAvailable(FileInfo $file): bool { return $file->getSize() > 0; } @@ -30,6 +32,7 @@ class TXT extends ProviderV2 { /** * {@inheritDoc} */ + #[\Override] public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { if (!$this->isAvailable($file)) { return null; diff --git a/lib/private/Preview/WebP.php b/lib/private/Preview/WebP.php index 25b922e9190..4edc21aa97f 100644 --- a/lib/private/Preview/WebP.php +++ b/lib/private/Preview/WebP.php @@ -14,10 +14,12 @@ class WebP extends Image { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/image\/webp/'; } + #[\Override] public function isAvailable(FileInfo $file): bool { return (bool)(imagetypes() & IMG_WEBP); } diff --git a/lib/private/Preview/XBitmap.php b/lib/private/Preview/XBitmap.php index 95ea589835a..75a22402f6b 100644 --- a/lib/private/Preview/XBitmap.php +++ b/lib/private/Preview/XBitmap.php @@ -13,6 +13,7 @@ class XBitmap extends Image { /** * {@inheritDoc} */ + #[\Override] public function getMimeType(): string { return '/image\/x-xbitmap/'; } diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index 268e265c7ab..578c256aac0 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -107,6 +107,7 @@ class PreviewManager implements IPreview { * @param string $mimeTypeRegex Regex with the mime types that are supported by this provider * @param ProviderClosure $callable */ + #[\Override] public function registerProvider(string $mimeTypeRegex, Closure $callable): void { if (!$this->enablePreviews) { return; @@ -122,6 +123,7 @@ class PreviewManager implements IPreview { /** * Get all providers */ + #[\Override] public function getProviders(): array { if (!$this->enablePreviews) { return []; @@ -141,6 +143,7 @@ class PreviewManager implements IPreview { /** * Does the manager have any providers */ + #[\Override] public function hasProviders(): bool { $this->registerCoreProviders(); return !empty($this->providers); @@ -163,6 +166,7 @@ class PreviewManager implements IPreview { return $this->generator; } + #[\Override] public function getPreview( File $file, int $width = -1, @@ -193,11 +197,13 @@ class PreviewManager implements IPreview { * @throws \InvalidArgumentException if the preview would be invalid (in case the original image is invalid) * @since 19.0.0 */ + #[\Override] public function generatePreviews(File $file, array $specifications, ?string $mimeType = null): ISimpleFile { $this->throwIfPreviewsDisabled($file, $mimeType); return $this->getGenerator()->generatePreviews($file, $specifications, $mimeType); } + #[\Override] public function isMimeSupported(string $mimeType = '*'): bool { if (!$this->enablePreviews) { return false; @@ -220,6 +226,7 @@ class PreviewManager implements IPreview { return false; } + #[\Override] public function isAvailable(FileInfo $file, ?string $mimeType = null): bool { if (!$this->enablePreviews) { return false; diff --git a/lib/private/Profile/Actions/BlueskyAction.php b/lib/private/Profile/Actions/BlueskyAction.php index d05682aac1a..3c22823effc 100644 --- a/lib/private/Profile/Actions/BlueskyAction.php +++ b/lib/private/Profile/Actions/BlueskyAction.php @@ -25,36 +25,44 @@ class BlueskyAction implements ILinkAction { ) { } + #[\Override] public function preload(IUser $targetUser): void { $account = $this->accountManager->getAccount($targetUser); $this->value = $account->getProperty(IAccountManager::PROPERTY_BLUESKY)->getValue(); } + #[\Override] public function getAppId(): string { return 'core'; } + #[\Override] public function getId(): string { return IAccountManager::PROPERTY_BLUESKY; } + #[\Override] public function getDisplayId(): string { return $this->l10nFactory->get('lib')->t('Bluesky'); } + #[\Override] public function getTitle(): string { $displayUsername = $this->value; return $this->l10nFactory->get('lib')->t('View %s on Bluesky', [$displayUsername]); } + #[\Override] public function getPriority(): int { return 60; } + #[\Override] public function getIcon(): string { return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/bluesky.svg')); } + #[\Override] public function getTarget(): ?string { if (empty($this->value)) { return null; diff --git a/lib/private/Profile/Actions/EmailAction.php b/lib/private/Profile/Actions/EmailAction.php index c01f368b476..779d94d9205 100644 --- a/lib/private/Profile/Actions/EmailAction.php +++ b/lib/private/Profile/Actions/EmailAction.php @@ -25,35 +25,43 @@ class EmailAction implements ILinkAction { ) { } + #[\Override] public function preload(IUser $targetUser): void { $account = $this->accountManager->getAccount($targetUser); $this->value = $account->getProperty(IAccountManager::PROPERTY_EMAIL)->getValue(); } + #[\Override] public function getAppId(): string { return 'core'; } + #[\Override] public function getId(): string { return IAccountManager::PROPERTY_EMAIL; } + #[\Override] public function getDisplayId(): string { return $this->l10nFactory->get('lib')->t('Email'); } + #[\Override] public function getTitle(): string { return $this->l10nFactory->get('lib')->t('Mail %s', [$this->value]); } + #[\Override] public function getPriority(): int { return 20; } + #[\Override] public function getIcon(): string { return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/mail.svg')); } + #[\Override] public function getTarget(): ?string { if (empty($this->value)) { return null; diff --git a/lib/private/Profile/Actions/FediverseAction.php b/lib/private/Profile/Actions/FediverseAction.php index b48f1db5c50..17c1f5510a2 100644 --- a/lib/private/Profile/Actions/FediverseAction.php +++ b/lib/private/Profile/Actions/FediverseAction.php @@ -27,6 +27,7 @@ class FediverseAction implements ILinkAction { ) { } + #[\Override] public function preload(IUser $targetUser): void { try { $account = $this->accountManager->getAccount($targetUser); @@ -37,31 +38,38 @@ class FediverseAction implements ILinkAction { } } + #[\Override] public function getAppId(): string { return 'core'; } + #[\Override] public function getId(): string { return IAccountManager::PROPERTY_FEDIVERSE; } + #[\Override] public function getDisplayId(): string { return $this->l10nFactory->get('lib')->t('Fediverse'); } + #[\Override] public function getTitle(): string { $displayUsername = $this->value[0] === '@' ? $this->value : '@' . $this->value; return $this->l10nFactory->get('lib')->t('View %s on the fediverse', [$displayUsername]); } + #[\Override] public function getPriority(): int { return 50; } + #[\Override] public function getIcon(): string { return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/mastodon.svg')); } + #[\Override] public function getTarget(): ?string { if ($this->value === '') { return null; diff --git a/lib/private/Profile/Actions/PhoneAction.php b/lib/private/Profile/Actions/PhoneAction.php index 598cdc49051..64fc889c77e 100644 --- a/lib/private/Profile/Actions/PhoneAction.php +++ b/lib/private/Profile/Actions/PhoneAction.php @@ -25,35 +25,43 @@ class PhoneAction implements ILinkAction { ) { } + #[\Override] public function preload(IUser $targetUser): void { $account = $this->accountManager->getAccount($targetUser); $this->value = $account->getProperty(IAccountManager::PROPERTY_PHONE)->getValue(); } + #[\Override] public function getAppId(): string { return 'core'; } + #[\Override] public function getId(): string { return IAccountManager::PROPERTY_PHONE; } + #[\Override] public function getDisplayId(): string { return $this->l10nFactory->get('lib')->t('Phone'); } + #[\Override] public function getTitle(): string { return $this->l10nFactory->get('lib')->t('Call %s', [$this->value]); } + #[\Override] public function getPriority(): int { return 30; } + #[\Override] public function getIcon(): string { return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/phone.svg')); } + #[\Override] public function getTarget(): ?string { if (empty($this->value)) { return null; diff --git a/lib/private/Profile/Actions/TwitterAction.php b/lib/private/Profile/Actions/TwitterAction.php index 78e7137f64b..1e2fb38ae80 100644 --- a/lib/private/Profile/Actions/TwitterAction.php +++ b/lib/private/Profile/Actions/TwitterAction.php @@ -26,36 +26,44 @@ class TwitterAction implements ILinkAction { ) { } + #[\Override] public function preload(IUser $targetUser): void { $account = $this->accountManager->getAccount($targetUser); $this->value = $account->getProperty(IAccountManager::PROPERTY_TWITTER)->getValue(); } + #[\Override] public function getAppId(): string { return 'core'; } + #[\Override] public function getId(): string { return IAccountManager::PROPERTY_TWITTER; } + #[\Override] public function getDisplayId(): string { return $this->l10nFactory->get('lib')->t('Twitter'); } + #[\Override] public function getTitle(): string { $displayUsername = $this->value[0] === '@' ? $this->value : '@' . $this->value; return $this->l10nFactory->get('lib')->t('View %s on Twitter', [$displayUsername]); } + #[\Override] public function getPriority(): int { return 50; } + #[\Override] public function getIcon(): string { return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/twitter.svg')); } + #[\Override] public function getTarget(): ?string { if (empty($this->value)) { return null; diff --git a/lib/private/Profile/Actions/WebsiteAction.php b/lib/private/Profile/Actions/WebsiteAction.php index 4f5dcb568e7..0967af55c2e 100644 --- a/lib/private/Profile/Actions/WebsiteAction.php +++ b/lib/private/Profile/Actions/WebsiteAction.php @@ -25,35 +25,43 @@ class WebsiteAction implements ILinkAction { ) { } + #[\Override] public function preload(IUser $targetUser): void { $account = $this->accountManager->getAccount($targetUser); $this->value = $account->getProperty(IAccountManager::PROPERTY_WEBSITE)->getValue(); } + #[\Override] public function getAppId(): string { return 'core'; } + #[\Override] public function getId(): string { return IAccountManager::PROPERTY_WEBSITE; } + #[\Override] public function getDisplayId(): string { return $this->l10nFactory->get('lib')->t('Website'); } + #[\Override] public function getTitle(): string { return $this->l10nFactory->get('lib')->t('Visit %s', [$this->value]); } + #[\Override] public function getPriority(): int { return 40; } + #[\Override] public function getIcon(): string { return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/timezone.svg')); } + #[\Override] public function getTarget(): ?string { if (empty($this->value)) { return null; diff --git a/lib/private/Profile/ProfileManager.php b/lib/private/Profile/ProfileManager.php index c38412f6bd0..df046aacc28 100644 --- a/lib/private/Profile/ProfileManager.php +++ b/lib/private/Profile/ProfileManager.php @@ -95,6 +95,7 @@ class ProfileManager implements IProfileManager { /** * If no user is passed as an argument return whether profile is enabled globally in `config.php` */ + #[\Override] public function isProfileEnabled(?IUser $user = null): bool { $profileEnabledGlobally = $this->config->getSystemValueBool('profile.enabled', true); @@ -187,6 +188,7 @@ class ProfileManager implements IProfileManager { * Return whether the profile parameter of the target user * is visible to the visiting user */ + #[\Override] public function isProfileFieldVisible(string $profileField, IUser $targetUser, ?IUser $visitingUser): bool { try { $account = $this->accountManager->getAccount($targetUser); @@ -234,6 +236,7 @@ class ProfileManager implements IProfileManager { * in an associative array * @psalm-return CoreProfileFields */ + #[\Override] public function getProfileFields(IUser $targetUser, ?IUser $visitingUser): array { $account = $this->accountManager->getAccount($targetUser); diff --git a/lib/private/Profiler/Profile.php b/lib/private/Profiler/Profile.php index d823a7c8327..48b1d54ebd4 100644 --- a/lib/private/Profiler/Profile.php +++ b/lib/private/Profiler/Profile.php @@ -33,63 +33,78 @@ class Profile implements \JsonSerializable, IProfile { ) { } + #[\Override] public function getToken(): string { return $this->token; } + #[\Override] public function setToken(string $token): void { $this->token = $token; } + #[\Override] public function getTime(): ?int { return $this->time; } + #[\Override] public function setTime(int $time): void { $this->time = $time; } + #[\Override] public function getUrl(): ?string { return $this->url; } + #[\Override] public function setUrl(string $url): void { $this->url = $url; } + #[\Override] public function getMethod(): ?string { return $this->method; } + #[\Override] public function setMethod(string $method): void { $this->method = $method; } + #[\Override] public function getStatusCode(): ?int { return $this->statusCode; } + #[\Override] public function setStatusCode(int $statusCode): void { $this->statusCode = $statusCode; } + #[\Override] public function addCollector(IDataCollector $collector) { $this->collectors[$collector->getName()] = $collector; } + #[\Override] public function getParent(): ?IProfile { return $this->parent; } + #[\Override] public function setParent(?IProfile $parent): void { $this->parent = $parent; } + #[\Override] public function getParentToken(): ?string { return $this->parent ? $this->parent->getToken() : null; } /** @return IProfile[] */ + #[\Override] public function getChildren(): array { return $this->children; } @@ -97,6 +112,7 @@ class Profile implements \JsonSerializable, IProfile { /** * @param IProfile[] $children */ + #[\Override] public function setChildren(array $children): void { $this->children = []; foreach ($children as $child) { @@ -104,6 +120,7 @@ class Profile implements \JsonSerializable, IProfile { } } + #[\Override] public function addChild(IProfile $profile): void { $this->children[] = $profile; $profile->setParent($this); @@ -112,6 +129,7 @@ class Profile implements \JsonSerializable, IProfile { /** * @return IDataCollector[] */ + #[\Override] public function getCollectors(): array { return $this->collectors; } @@ -119,6 +137,7 @@ class Profile implements \JsonSerializable, IProfile { /** * @param IDataCollector[] $collectors */ + #[\Override] public function setCollectors(array $collectors): void { $this->collectors = $collectors; } @@ -127,6 +146,7 @@ class Profile implements \JsonSerializable, IProfile { return ['token', 'parent', 'children', 'collectors', 'method', 'url', 'time', 'statusCode']; } + #[\Override] #[\ReturnTypeWillChange] public function jsonSerialize() { // Everything but parent @@ -141,6 +161,7 @@ class Profile implements \JsonSerializable, IProfile { ]; } + #[\Override] public function getCollector(string $collectorName): ?IDataCollector { if (!array_key_exists($collectorName, $this->collectors)) { return null; diff --git a/lib/private/Profiler/Profiler.php b/lib/private/Profiler/Profiler.php index 84a4e3eff34..cde8c548bb8 100644 --- a/lib/private/Profiler/Profiler.php +++ b/lib/private/Profiler/Profiler.php @@ -31,10 +31,12 @@ class Profiler implements IProfiler { } } + #[\Override] public function add(IDataCollector $dataCollector): void { $this->dataCollectors[$dataCollector->getName()] = $dataCollector; } + #[\Override] public function loadProfileFromResponse(Response $response): ?IProfile { if (!$token = $response->getHeaders()['X-Debug-Token']) { return null; @@ -43,6 +45,7 @@ class Profiler implements IProfiler { return $this->loadProfile($token); } + #[\Override] public function loadProfile(string $token): ?IProfile { if ($this->storage) { return $this->storage->read($token); @@ -51,6 +54,7 @@ class Profiler implements IProfiler { } } + #[\Override] public function saveProfile(IProfile $profile): bool { if ($this->storage) { return $this->storage->write($profile); @@ -59,6 +63,7 @@ class Profiler implements IProfiler { } } + #[\Override] public function collect(Request $request, Response $response): IProfile { $profile = new Profile($request->getId()); $profile->setTime(time()); @@ -77,6 +82,7 @@ class Profiler implements IProfiler { /** * @return array[] */ + #[\Override] public function find(?string $url, ?int $limit, ?string $method, ?int $start, ?int $end, ?string $statusCode = null): array { if ($this->storage) { @@ -86,18 +92,22 @@ class Profiler implements IProfiler { } } + #[\Override] public function dataProviders(): array { return array_keys($this->dataCollectors); } + #[\Override] public function isEnabled(): bool { return $this->enabled; } + #[\Override] public function setEnabled(bool $enabled): void { $this->enabled = $enabled; } + #[\Override] public function clear(): void { $this->storage->purge(); } diff --git a/lib/private/Profiler/RoutingDataCollector.php b/lib/private/Profiler/RoutingDataCollector.php index 47d4af1149c..fba3e2425e0 100644 --- a/lib/private/Profiler/RoutingDataCollector.php +++ b/lib/private/Profiler/RoutingDataCollector.php @@ -21,6 +21,7 @@ class RoutingDataCollector extends AbstractDataCollector { ) { } + #[\Override] public function collect(Request $request, Response $response, ?\Throwable $exception = null): void { $this->data = [ 'appName' => $this->appName, @@ -29,6 +30,7 @@ class RoutingDataCollector extends AbstractDataCollector { ]; } + #[\Override] public function getName(): string { return 'router'; } diff --git a/lib/private/Remote/Api/ApiCollection.php b/lib/private/Remote/Api/ApiCollection.php index b42c7c484ba..7f89a70ac11 100644 --- a/lib/private/Remote/Api/ApiCollection.php +++ b/lib/private/Remote/Api/ApiCollection.php @@ -21,10 +21,12 @@ class ApiCollection implements IApiCollection { ) { } + #[\Override] public function getCapabilitiesApi() { return new OCS($this->instance, $this->credentials, $this->clientService); } + #[\Override] public function getUserApi() { return new OCS($this->instance, $this->credentials, $this->clientService); } diff --git a/lib/private/Remote/Api/ApiFactory.php b/lib/private/Remote/Api/ApiFactory.php index 8c908a2f91f..2ffa38991b4 100644 --- a/lib/private/Remote/Api/ApiFactory.php +++ b/lib/private/Remote/Api/ApiFactory.php @@ -19,6 +19,7 @@ class ApiFactory implements IApiFactory { ) { } + #[\Override] public function getApiCollection(IInstance $instance, ICredentials $credentials) { return new ApiCollection($instance, $credentials, $this->clientService); } diff --git a/lib/private/Remote/Api/OCS.php b/lib/private/Remote/Api/OCS.php index 36bc22751a5..458ed718060 100644 --- a/lib/private/Remote/Api/OCS.php +++ b/lib/private/Remote/Api/OCS.php @@ -25,6 +25,7 @@ class OCS extends ApiBase implements ICapabilitiesApi, IUserApi { * @throws NotFoundException * @throws \Exception */ + #[\Override] protected function request($method, $url, array $body = [], array $query = [], array $headers = []) { try { $response = json_decode(parent::request($method, 'ocs/v2.php/' . $url, $body, $query, $headers), true); @@ -67,6 +68,7 @@ class OCS extends ApiBase implements ICapabilitiesApi, IUserApi { } } + #[\Override] public function getUser($userId) { $result = $this->request('get', 'cloud/users/' . $userId); $this->checkResponseArray($result, 'user', User::EXPECTED_KEYS); @@ -76,6 +78,7 @@ class OCS extends ApiBase implements ICapabilitiesApi, IUserApi { /** * @return array The capabilities in the form of [$appId => [$capability => $value]] */ + #[\Override] public function getCapabilities() { $result = $this->request('get', 'cloud/capabilities'); return $result['capabilities']; diff --git a/lib/private/Remote/Credentials.php b/lib/private/Remote/Credentials.php index 607c403b4bf..2bb7c86ee4d 100644 --- a/lib/private/Remote/Credentials.php +++ b/lib/private/Remote/Credentials.php @@ -17,10 +17,12 @@ class Credentials implements ICredentials { ) { } + #[\Override] public function getUsername(): string { return $this->user; } + #[\Override] public function getPassword(): string { return $this->password; } diff --git a/lib/private/Remote/InstanceFactory.php b/lib/private/Remote/InstanceFactory.php index 5279d0146cd..13a4e2c1e56 100644 --- a/lib/private/Remote/InstanceFactory.php +++ b/lib/private/Remote/InstanceFactory.php @@ -17,6 +17,7 @@ class InstanceFactory implements IInstanceFactory { ) { } + #[\Override] public function getInstance($url) { return new Instance($url, $this->cache, $this->clientService); } diff --git a/lib/private/Remote/User.php b/lib/private/Remote/User.php index a8f665154ad..a3d0f3815e8 100644 --- a/lib/private/Remote/User.php +++ b/lib/private/Remote/User.php @@ -32,6 +32,7 @@ class User implements IUser { /** * @return string */ + #[\Override] public function getUserId() { return $this->data['id']; } @@ -39,6 +40,7 @@ class User implements IUser { /** * @return string */ + #[\Override] public function getEmail() { return $this->data['email']; } @@ -46,6 +48,7 @@ class User implements IUser { /** * @return string */ + #[\Override] public function getDisplayName() { return $this->data['displayname']; } @@ -53,6 +56,7 @@ class User implements IUser { /** * @return string */ + #[\Override] public function getPhone() { return $this->data['phone']; } @@ -60,6 +64,7 @@ class User implements IUser { /** * @return string */ + #[\Override] public function getAddress() { return $this->data['address']; } @@ -67,6 +72,7 @@ class User implements IUser { /** * @return string */ + #[\Override] public function getWebsite() { return $this->data['website']; } @@ -74,6 +80,7 @@ class User implements IUser { /** * @return string */ + #[\Override] public function getTwitter() { return $this->data['twitter'] ?? ''; } @@ -81,6 +88,7 @@ class User implements IUser { /** * @return string[] */ + #[\Override] public function getGroups() { return $this->data['groups']; } @@ -88,6 +96,7 @@ class User implements IUser { /** * @return string */ + #[\Override] public function getLanguage() { return $this->data['language']; } @@ -95,6 +104,7 @@ class User implements IUser { /** * @return int */ + #[\Override] public function getUsedSpace() { return $this->data['quota']['used']; } @@ -102,6 +112,7 @@ class User implements IUser { /** * @return int */ + #[\Override] public function getFreeSpace() { return $this->data['quota']['free']; } @@ -109,6 +120,7 @@ class User implements IUser { /** * @return int */ + #[\Override] public function getTotalSpace() { return $this->data['quota']['total']; } @@ -116,6 +128,7 @@ class User implements IUser { /** * @return int */ + #[\Override] public function getQuota() { return $this->data['quota']['quota']; } diff --git a/lib/private/Repair.php b/lib/private/Repair.php index be6de73579c..90e209cfe90 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -222,12 +222,14 @@ class Repair implements IOutput { ]; } + #[\Override] public function debug(string $message): void { } /** * @param string $message */ + #[\Override] public function info($message): void { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairInfoEvent($message)); @@ -236,6 +238,7 @@ class Repair implements IOutput { /** * @param string $message */ + #[\Override] public function warning($message): void { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairWarningEvent($message)); @@ -244,6 +247,7 @@ class Repair implements IOutput { /** * @param int $max */ + #[\Override] public function startProgress($max = 0): void { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairStartEvent($max, $this->currentStep)); @@ -253,11 +257,13 @@ class Repair implements IOutput { * @param int $step number of step to advance * @param string $description */ + #[\Override] public function advance($step = 1, $description = ''): void { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairAdvanceEvent($step, $description)); } + #[\Override] public function finishProgress(): void { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairFinishEvent()); diff --git a/lib/private/Repair/AddBruteForceCleanupJob.php b/lib/private/Repair/AddBruteForceCleanupJob.php index 9473d9031a4..20c1191b006 100644 --- a/lib/private/Repair/AddBruteForceCleanupJob.php +++ b/lib/private/Repair/AddBruteForceCleanupJob.php @@ -19,10 +19,12 @@ class AddBruteForceCleanupJob implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Add job to cleanup the bruteforce entries'; } + #[\Override] public function run(IOutput $output): void { $this->jobList->add(CleanupJob::class); } diff --git a/lib/private/Repair/AddCleanupDeletedUsersBackgroundJob.php b/lib/private/Repair/AddCleanupDeletedUsersBackgroundJob.php index 6d983b8456c..ac66d4f59d7 100644 --- a/lib/private/Repair/AddCleanupDeletedUsersBackgroundJob.php +++ b/lib/private/Repair/AddCleanupDeletedUsersBackgroundJob.php @@ -19,10 +19,12 @@ class AddCleanupDeletedUsersBackgroundJob implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Add cleanup-deleted-users background job'; } + #[\Override] public function run(IOutput $output): void { $this->jobList->add(CleanupDeletedUsers::class); } diff --git a/lib/private/Repair/AddCleanupUpdaterBackupsJob.php b/lib/private/Repair/AddCleanupUpdaterBackupsJob.php index 731bf4537c7..f0138133196 100644 --- a/lib/private/Repair/AddCleanupUpdaterBackupsJob.php +++ b/lib/private/Repair/AddCleanupUpdaterBackupsJob.php @@ -19,10 +19,12 @@ class AddCleanupUpdaterBackupsJob implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Queue a one-time job to cleanup old backups of the updater'; } + #[\Override] public function run(IOutput $output): void { $this->jobList->add(BackgroundCleanupUpdaterBackupsJob::class); } diff --git a/lib/private/Repair/AddMetadataGenerationJob.php b/lib/private/Repair/AddMetadataGenerationJob.php index f907144dc7d..3ab619d6246 100644 --- a/lib/private/Repair/AddMetadataGenerationJob.php +++ b/lib/private/Repair/AddMetadataGenerationJob.php @@ -19,10 +19,12 @@ class AddMetadataGenerationJob implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Queue a job to generate metadata'; } + #[\Override] public function run(IOutput $output): void { $this->jobList->add(GenerateMetadataJob::class); } diff --git a/lib/private/Repair/AddMovePreviewJob.php b/lib/private/Repair/AddMovePreviewJob.php index 84d32887f28..37f8398e56f 100644 --- a/lib/private/Repair/AddMovePreviewJob.php +++ b/lib/private/Repair/AddMovePreviewJob.php @@ -20,6 +20,7 @@ class AddMovePreviewJob implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Queue a job to move the preview'; } diff --git a/lib/private/Repair/AddRemoveOldTasksBackgroundJob.php b/lib/private/Repair/AddRemoveOldTasksBackgroundJob.php index eac9d5c3dc1..292a4e85a7b 100644 --- a/lib/private/Repair/AddRemoveOldTasksBackgroundJob.php +++ b/lib/private/Repair/AddRemoveOldTasksBackgroundJob.php @@ -21,10 +21,12 @@ class AddRemoveOldTasksBackgroundJob implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Add AI tasks cleanup jobs'; } + #[\Override] public function run(IOutput $output) { $this->jobList->add(RemoveOldTextProcessingTasksBackgroundJob::class); $this->jobList->add(RemoveOldTextToImageTasksBackgroundJob::class); diff --git a/lib/private/Repair/CleanTags.php b/lib/private/Repair/CleanTags.php index 4397f2cf09e..3ea09e8c97c 100644 --- a/lib/private/Repair/CleanTags.php +++ b/lib/private/Repair/CleanTags.php @@ -28,6 +28,7 @@ class CleanTags implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Clean tags and favorites'; } @@ -35,6 +36,7 @@ class CleanTags implements IRepairStep { /** * Updates the configuration after running an update */ + #[\Override] public function run(IOutput $output): void { $this->deleteOrphanTags($output); $this->deleteOrphanFileEntries($output); diff --git a/lib/private/Repair/CleanUpAbandonedApps.php b/lib/private/Repair/CleanUpAbandonedApps.php index ce166ebd2b3..4300bf18d8b 100644 --- a/lib/private/Repair/CleanUpAbandonedApps.php +++ b/lib/private/Repair/CleanUpAbandonedApps.php @@ -19,10 +19,12 @@ class CleanUpAbandonedApps implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Clean up abandoned apps'; } + #[\Override] public function run(IOutput $output): void { foreach (self::ABANDONED_APPS as $app) { // only remove global app values diff --git a/lib/private/Repair/ClearFrontendCaches.php b/lib/private/Repair/ClearFrontendCaches.php index b5631b660cb..4211f6c745f 100644 --- a/lib/private/Repair/ClearFrontendCaches.php +++ b/lib/private/Repair/ClearFrontendCaches.php @@ -20,10 +20,12 @@ class ClearFrontendCaches implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Clear frontend caches'; } + #[\Override] public function run(IOutput $output): void { try { $c = $this->cacheFactory->createDistributed('imagePath'); diff --git a/lib/private/Repair/ClearGeneratedAvatarCache.php b/lib/private/Repair/ClearGeneratedAvatarCache.php index cc71a5dc6e4..75b5d8fe85e 100644 --- a/lib/private/Repair/ClearGeneratedAvatarCache.php +++ b/lib/private/Repair/ClearGeneratedAvatarCache.php @@ -22,6 +22,7 @@ class ClearGeneratedAvatarCache implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Clear every generated avatar'; } @@ -37,6 +38,7 @@ class ClearGeneratedAvatarCache implements IRepairStep { return version_compare($versionFromBeforeUpdate, '27.0.0', '<'); } + #[\Override] public function run(IOutput $output): void { if ($this->shouldRun()) { try { diff --git a/lib/private/Repair/ClearGeneratedAvatarCacheJob.php b/lib/private/Repair/ClearGeneratedAvatarCacheJob.php index 6637becd4a1..2cd0596f274 100644 --- a/lib/private/Repair/ClearGeneratedAvatarCacheJob.php +++ b/lib/private/Repair/ClearGeneratedAvatarCacheJob.php @@ -20,6 +20,7 @@ class ClearGeneratedAvatarCacheJob extends QueuedJob { parent::__construct($timeFactory); } + #[\Override] public function run($argument) { $this->avatarManager->clearCachedAvatars(); } diff --git a/lib/private/Repair/Collation.php b/lib/private/Repair/Collation.php index 450b132ef47..52537886961 100644 --- a/lib/private/Repair/Collation.php +++ b/lib/private/Repair/Collation.php @@ -25,6 +25,7 @@ class Collation implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Repair MySQL collation'; } @@ -32,6 +33,7 @@ class Collation implements IRepairStep { /** * Fix mime types */ + #[\Override] public function run(IOutput $output): void { if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_MYSQL) { $output->info('Not a mysql database -> nothing to do'); diff --git a/lib/private/Repair/ConfigKeyMigration.php b/lib/private/Repair/ConfigKeyMigration.php index acdda68dc0a..8c69fee2e70 100644 --- a/lib/private/Repair/ConfigKeyMigration.php +++ b/lib/private/Repair/ConfigKeyMigration.php @@ -19,10 +19,12 @@ class ConfigKeyMigration implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Migrate config keys'; } + #[\Override] public function run(IOutput $output): void { $this->configManager->migrateConfigLexiconKeys(); $this->configManager->updateLexiconEntries('core'); diff --git a/lib/private/Repair/MoveUpdaterStepFile.php b/lib/private/Repair/MoveUpdaterStepFile.php index 28fe0db1314..72ea92be0fb 100644 --- a/lib/private/Repair/MoveUpdaterStepFile.php +++ b/lib/private/Repair/MoveUpdaterStepFile.php @@ -19,10 +19,12 @@ class MoveUpdaterStepFile implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Move .step file of updater to backup location'; } + #[\Override] public function run(IOutput $output): void { $updateDir = $this->config->getSystemValue('updatedirectory', null) ?? $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data'); $instanceId = $this->config->getSystemValueString('instanceid'); diff --git a/lib/private/Repair/NC13/AddLogRotateJob.php b/lib/private/Repair/NC13/AddLogRotateJob.php index a44610dd07a..68e3693aac4 100644 --- a/lib/private/Repair/NC13/AddLogRotateJob.php +++ b/lib/private/Repair/NC13/AddLogRotateJob.php @@ -19,10 +19,12 @@ class AddLogRotateJob implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Add log rotate job'; } + #[\Override] public function run(IOutput $output): void { $this->jobList->add(Rotate::class); } diff --git a/lib/private/Repair/NC14/AddPreviewBackgroundCleanupJob.php b/lib/private/Repair/NC14/AddPreviewBackgroundCleanupJob.php index c7a95775083..dff83d7a6cb 100644 --- a/lib/private/Repair/NC14/AddPreviewBackgroundCleanupJob.php +++ b/lib/private/Repair/NC14/AddPreviewBackgroundCleanupJob.php @@ -19,10 +19,12 @@ class AddPreviewBackgroundCleanupJob implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Add preview background cleanup job'; } + #[\Override] public function run(IOutput $output) { $this->jobList->add(BackgroundCleanupJob::class); } diff --git a/lib/private/Repair/NC16/AddCleanupLoginFlowV2BackgroundJob.php b/lib/private/Repair/NC16/AddCleanupLoginFlowV2BackgroundJob.php index 630b20a4128..028cce593f9 100644 --- a/lib/private/Repair/NC16/AddCleanupLoginFlowV2BackgroundJob.php +++ b/lib/private/Repair/NC16/AddCleanupLoginFlowV2BackgroundJob.php @@ -19,10 +19,12 @@ class AddCleanupLoginFlowV2BackgroundJob implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Add background job to cleanup login flow v2 tokens'; } + #[\Override] public function run(IOutput $output) { $this->jobList->add(CleanupLoginFlowV2::class); } diff --git a/lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php b/lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php index 646dd2c5e83..d21c0df6177 100644 --- a/lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php +++ b/lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php @@ -35,6 +35,7 @@ class CleanupCardDAVPhotoCache implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Cleanup invalid photocache files for carddav'; } @@ -80,6 +81,7 @@ class CleanupCardDAVPhotoCache implements IRepairStep { ); } + #[\Override] public function run(IOutput $output): void { if ($this->shouldRun()) { $this->repair($output); diff --git a/lib/private/Repair/NC16/ClearCollectionsAccessCache.php b/lib/private/Repair/NC16/ClearCollectionsAccessCache.php index e1eef24eedd..163f5794700 100644 --- a/lib/private/Repair/NC16/ClearCollectionsAccessCache.php +++ b/lib/private/Repair/NC16/ClearCollectionsAccessCache.php @@ -20,6 +20,7 @@ class ClearCollectionsAccessCache implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Clear access cache of projects'; } @@ -29,6 +30,7 @@ class ClearCollectionsAccessCache implements IRepairStep { return version_compare($versionFromBeforeUpdate, '17.0.0.3', '<='); } + #[\Override] public function run(IOutput $output): void { if ($this->shouldRun()) { $this->manager->invalidateAccessCacheForAllCollections(); diff --git a/lib/private/Repair/NC18/ResetGeneratedAvatarFlag.php b/lib/private/Repair/NC18/ResetGeneratedAvatarFlag.php index d07bc2d7193..5de39b58a95 100644 --- a/lib/private/Repair/NC18/ResetGeneratedAvatarFlag.php +++ b/lib/private/Repair/NC18/ResetGeneratedAvatarFlag.php @@ -20,6 +20,7 @@ class ResetGeneratedAvatarFlag implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Reset generated avatar flag'; } @@ -29,6 +30,7 @@ class ResetGeneratedAvatarFlag implements IRepairStep { return version_compare($versionFromBeforeUpdate, '18.0.0.5', '<='); } + #[\Override] public function run(IOutput $output): void { if ($this->shouldRun()) { $query = $this->connection->getQueryBuilder(); diff --git a/lib/private/Repair/NC20/EncryptionLegacyCipher.php b/lib/private/Repair/NC20/EncryptionLegacyCipher.php index ca8986e78db..32f98a140d7 100644 --- a/lib/private/Repair/NC20/EncryptionLegacyCipher.php +++ b/lib/private/Repair/NC20/EncryptionLegacyCipher.php @@ -20,6 +20,7 @@ class EncryptionLegacyCipher implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Keep legacy encryption enabled'; } @@ -29,6 +30,7 @@ class EncryptionLegacyCipher implements IRepairStep { return version_compare($versionFromBeforeUpdate, '20.0.0.0', '<='); } + #[\Override] public function run(IOutput $output): void { if (!$this->shouldRun()) { return; diff --git a/lib/private/Repair/NC20/EncryptionMigration.php b/lib/private/Repair/NC20/EncryptionMigration.php index 91fca99c5d2..d46752dbcfc 100644 --- a/lib/private/Repair/NC20/EncryptionMigration.php +++ b/lib/private/Repair/NC20/EncryptionMigration.php @@ -20,6 +20,7 @@ class EncryptionMigration implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Check encryption key format'; } @@ -29,6 +30,7 @@ class EncryptionMigration implements IRepairStep { return version_compare($versionFromBeforeUpdate, '20.0.0.1', '<='); } + #[\Override] public function run(IOutput $output): void { if (!$this->shouldRun()) { return; diff --git a/lib/private/Repair/NC20/ShippedDashboardEnable.php b/lib/private/Repair/NC20/ShippedDashboardEnable.php index 5d505d0c3ef..4ff1bae77e1 100644 --- a/lib/private/Repair/NC20/ShippedDashboardEnable.php +++ b/lib/private/Repair/NC20/ShippedDashboardEnable.php @@ -18,10 +18,12 @@ class ShippedDashboardEnable implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Remove old dashboard app config data'; } + #[\Override] public function run(IOutput $output): void { $version = $this->config->getAppValue('dashboard', 'version', '7.0.0'); if (version_compare($version, '7.0.0', '<')) { diff --git a/lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php b/lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php index 1890df81cf1..e16a5862cd5 100644 --- a/lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php +++ b/lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php @@ -21,6 +21,7 @@ class AddCheckForUserCertificatesJob implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Queue a one-time job to check for user uploaded certificates'; } @@ -32,6 +33,7 @@ class AddCheckForUserCertificatesJob implements IRepairStep { return version_compare($versionFromBeforeUpdate, '21.0.0.2', '<'); } + #[\Override] public function run(IOutput $output): void { if ($this->shouldRun()) { $this->config->setAppValue('files_external', 'user_certificate_scan', 'not-run-yet'); diff --git a/lib/private/Repair/NC22/LookupServerSendCheck.php b/lib/private/Repair/NC22/LookupServerSendCheck.php index 453e06fd606..47d752cfcb7 100644 --- a/lib/private/Repair/NC22/LookupServerSendCheck.php +++ b/lib/private/Repair/NC22/LookupServerSendCheck.php @@ -19,10 +19,12 @@ class LookupServerSendCheck implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Add background job to set the lookup server share state for users'; } + #[\Override] public function run(IOutput $output): void { $this->jobList->add(LookupServerSendCheckBackgroundJob::class); } diff --git a/lib/private/Repair/NC24/AddTokenCleanupJob.php b/lib/private/Repair/NC24/AddTokenCleanupJob.php index be6b24b0c1c..2fa9235c9f9 100644 --- a/lib/private/Repair/NC24/AddTokenCleanupJob.php +++ b/lib/private/Repair/NC24/AddTokenCleanupJob.php @@ -19,10 +19,12 @@ class AddTokenCleanupJob implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Add token cleanup job'; } + #[\Override] public function run(IOutput $output) { $this->jobList->add(TokenCleanupJob::class); } diff --git a/lib/private/Repair/NC25/AddMissingSecretJob.php b/lib/private/Repair/NC25/AddMissingSecretJob.php index 2b8f5934ee8..d754862a1ac 100644 --- a/lib/private/Repair/NC25/AddMissingSecretJob.php +++ b/lib/private/Repair/NC25/AddMissingSecretJob.php @@ -21,10 +21,12 @@ class AddMissingSecretJob implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Add possibly missing system config'; } + #[\Override] public function run(IOutput $output): void { $passwordSalt = $this->config->getSystemValueString('passwordsalt', ''); if ($passwordSalt === '') { diff --git a/lib/private/Repair/NC29/SanitizeAccountProperties.php b/lib/private/Repair/NC29/SanitizeAccountProperties.php index 412570ba71d..da51c67e268 100644 --- a/lib/private/Repair/NC29/SanitizeAccountProperties.php +++ b/lib/private/Repair/NC29/SanitizeAccountProperties.php @@ -19,10 +19,12 @@ class SanitizeAccountProperties implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Validate account properties and store phone numbers in a known format for search'; } + #[\Override] public function run(IOutput $output): void { $this->jobList->add(SanitizeAccountPropertiesJob::class, null); $output->info('Queued background to validate account properties.'); diff --git a/lib/private/Repair/NC29/SanitizeAccountPropertiesJob.php b/lib/private/Repair/NC29/SanitizeAccountPropertiesJob.php index 530805d3637..fbce960d302 100644 --- a/lib/private/Repair/NC29/SanitizeAccountPropertiesJob.php +++ b/lib/private/Repair/NC29/SanitizeAccountPropertiesJob.php @@ -35,6 +35,7 @@ class SanitizeAccountPropertiesJob extends QueuedJob { $this->setAllowParallelRuns(false); } + #[\Override] protected function run(mixed $argument): void { $numRemoved = 0; diff --git a/lib/private/Repair/NC30/RemoveLegacyDatadirFile.php b/lib/private/Repair/NC30/RemoveLegacyDatadirFile.php index 623163927bd..80b7da014f4 100644 --- a/lib/private/Repair/NC30/RemoveLegacyDatadirFile.php +++ b/lib/private/Repair/NC30/RemoveLegacyDatadirFile.php @@ -19,10 +19,12 @@ class RemoveLegacyDatadirFile implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Remove legacy ".ocdata" file'; } + #[\Override] public function run(IOutput $output): void { $ocdata = $this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata'; if (file_exists($ocdata)) { diff --git a/lib/private/Repair/OldGroupMembershipShares.php b/lib/private/Repair/OldGroupMembershipShares.php index a0ae19957e5..602cbcac478 100644 --- a/lib/private/Repair/OldGroupMembershipShares.php +++ b/lib/private/Repair/OldGroupMembershipShares.php @@ -25,6 +25,7 @@ class OldGroupMembershipShares implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Remove shares of old group memberships'; } @@ -35,6 +36,7 @@ class OldGroupMembershipShares implements IRepairStep { * * @throws \Exception in case of failure */ + #[\Override] public function run(IOutput $output): void { $deletedEntries = 0; diff --git a/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php b/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php index be63bda063e..ff83de3b5bb 100644 --- a/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php +++ b/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php @@ -29,6 +29,7 @@ class CleanPreviewsBackgroundJob extends QueuedJob { parent::__construct($timeFactory); } + #[\Override] public function run($argument): void { $uid = $argument['uid']; if (!$this->userManager->userExists($uid)) { diff --git a/lib/private/Repair/Owncloud/DropAccountTermsTable.php b/lib/private/Repair/Owncloud/DropAccountTermsTable.php index f848a99af57..a0b4b19433c 100644 --- a/lib/private/Repair/Owncloud/DropAccountTermsTable.php +++ b/lib/private/Repair/Owncloud/DropAccountTermsTable.php @@ -18,10 +18,12 @@ class DropAccountTermsTable implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Drop account terms table when migrating from ownCloud'; } + #[\Override] public function run(IOutput $output): void { if (!$this->db->tableExists('account_terms')) { return; diff --git a/lib/private/Repair/Owncloud/MigrateOauthTables.php b/lib/private/Repair/Owncloud/MigrateOauthTables.php index 1d7b630b4e5..437ef59821b 100644 --- a/lib/private/Repair/Owncloud/MigrateOauthTables.php +++ b/lib/private/Repair/Owncloud/MigrateOauthTables.php @@ -34,10 +34,12 @@ class MigrateOauthTables implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Migrate oauth2_clients table to nextcloud schema'; } + #[\Override] public function run(IOutput $output): void { $schema = new SchemaWrapper($this->db); if (!$schema->hasTable('oauth2_clients')) { diff --git a/lib/private/Repair/Owncloud/MigratePropertiesTable.php b/lib/private/Repair/Owncloud/MigratePropertiesTable.php index 60122bbf3d1..09fe5fddb89 100644 --- a/lib/private/Repair/Owncloud/MigratePropertiesTable.php +++ b/lib/private/Repair/Owncloud/MigratePropertiesTable.php @@ -23,10 +23,12 @@ class MigratePropertiesTable implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Migrate oc_properties table to nextcloud schema'; } + #[\Override] public function run(IOutput $output): void { $schema = new SchemaWrapper($this->db); if (!$schema->hasTable('oc_properties')) { diff --git a/lib/private/Repair/Owncloud/MoveAvatars.php b/lib/private/Repair/Owncloud/MoveAvatars.php index fd38fc79d64..26c280fb840 100644 --- a/lib/private/Repair/Owncloud/MoveAvatars.php +++ b/lib/private/Repair/Owncloud/MoveAvatars.php @@ -20,10 +20,12 @@ class MoveAvatars implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Add move avatar background job'; } + #[\Override] public function run(IOutput $output): void { // only run once if ($this->config->getAppValue('core', 'moveavatarsdone') === 'yes') { diff --git a/lib/private/Repair/Owncloud/MoveAvatarsBackgroundJob.php b/lib/private/Repair/Owncloud/MoveAvatarsBackgroundJob.php index 3b8936894e7..6895cad0e1c 100644 --- a/lib/private/Repair/Owncloud/MoveAvatarsBackgroundJob.php +++ b/lib/private/Repair/Owncloud/MoveAvatarsBackgroundJob.php @@ -36,6 +36,7 @@ class MoveAvatarsBackgroundJob extends QueuedJob { } } + #[\Override] public function run($argument) { $this->logger->info('Started migrating avatars to AppData folder'); $this->moveAvatars(); diff --git a/lib/private/Repair/Owncloud/SaveAccountsTableData.php b/lib/private/Repair/Owncloud/SaveAccountsTableData.php index 61284a09e5d..d37c941b7e8 100644 --- a/lib/private/Repair/Owncloud/SaveAccountsTableData.php +++ b/lib/private/Repair/Owncloud/SaveAccountsTableData.php @@ -28,10 +28,12 @@ class SaveAccountsTableData implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Copy data from accounts table when migrating from ownCloud'; } + #[\Override] public function run(IOutput $output): void { if (!$this->shouldRun()) { return; diff --git a/lib/private/Repair/RemoveLinkShares.php b/lib/private/Repair/RemoveLinkShares.php index 5ea1d4b9258..25255f9d3f8 100644 --- a/lib/private/Repair/RemoveLinkShares.php +++ b/lib/private/Repair/RemoveLinkShares.php @@ -31,6 +31,7 @@ class RemoveLinkShares implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Remove potentially over exposing share links'; } @@ -184,6 +185,7 @@ class RemoveLinkShares implements IRepairStep { $this->sendNotification(); } + #[\Override] public function run(IOutput $output): void { if ($this->shouldRun() === false || ($total = $this->getTotal()) === 0) { $output->info('No need to remove link shares.'); diff --git a/lib/private/Repair/RepairDavShares.php b/lib/private/Repair/RepairDavShares.php index c21c0274461..1321fd7913c 100644 --- a/lib/private/Repair/RepairDavShares.php +++ b/lib/private/Repair/RepairDavShares.php @@ -33,6 +33,7 @@ class RepairDavShares implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Repair DAV shares'; } @@ -88,6 +89,7 @@ class RepairDavShares implements IRepairStep { return true; } + #[\Override] public function run(IOutput $output): void { $versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0'); if (version_compare($versionFromBeforeUpdate, '20.0.8', '<') diff --git a/lib/private/Repair/RepairInvalidShares.php b/lib/private/Repair/RepairInvalidShares.php index 5939d0d6430..1793ef55f30 100644 --- a/lib/private/Repair/RepairInvalidShares.php +++ b/lib/private/Repair/RepairInvalidShares.php @@ -25,6 +25,7 @@ class RepairInvalidShares implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Repair invalid shares'; } @@ -85,6 +86,7 @@ class RepairInvalidShares implements IRepairStep { } } + #[\Override] public function run(IOutput $output) { $ocVersionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0'); if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.11', '<')) { diff --git a/lib/private/Repair/RepairLogoDimension.php b/lib/private/Repair/RepairLogoDimension.php index 854aeb3ab07..7d01bbea696 100644 --- a/lib/private/Repair/RepairLogoDimension.php +++ b/lib/private/Repair/RepairLogoDimension.php @@ -22,10 +22,12 @@ class RepairLogoDimension implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Cache logo dimension to fix size in emails on Outlook'; } + #[\Override] public function run(IOutput $output): void { $logoDimensions = $this->config->getAppValue('theming', 'logoDimensions'); if (preg_match('/^\d+x\d+$/', $logoDimensions)) { diff --git a/lib/private/Repair/RepairMimeTypes.php b/lib/private/Repair/RepairMimeTypes.php index a9ef95b50c2..0fa3ebc51fe 100644 --- a/lib/private/Repair/RepairMimeTypes.php +++ b/lib/private/Repair/RepairMimeTypes.php @@ -28,6 +28,7 @@ class RepairMimeTypes implements IRepairStep { ) { } + #[\Override] public function getName(): string { return 'Repair mime types'; } @@ -403,6 +404,7 @@ class RepairMimeTypes implements IRepairStep { * * @throws Exception */ + #[\Override] public function run(IOutput $output): void { $serverVersion = $this->config->getSystemValueString('version', '0.0.0'); $mimeTypeVersion = $this->getMimeTypeVersion(); diff --git a/lib/private/RichObjectStrings/RichTextFormatter.php b/lib/private/RichObjectStrings/RichTextFormatter.php index 9c9ddf94fa9..643ca5ba3fe 100644 --- a/lib/private/RichObjectStrings/RichTextFormatter.php +++ b/lib/private/RichObjectStrings/RichTextFormatter.php @@ -15,6 +15,7 @@ class RichTextFormatter implements IRichTextFormatter { /** * @throws \InvalidArgumentException if a parameter has no name or no type */ + #[\Override] public function richToParsed(string $message, array $parameters): string { $placeholders = []; $replacements = []; diff --git a/lib/private/RichObjectStrings/Validator.php b/lib/private/RichObjectStrings/Validator.php index adc4a8710f7..14a034d0980 100644 --- a/lib/private/RichObjectStrings/Validator.php +++ b/lib/private/RichObjectStrings/Validator.php @@ -32,6 +32,7 @@ class Validator implements IValidator { * @throws InvalidObjectExeption * @since 11.0.0 */ + #[\Override] public function validate(string $subject, array $parameters): void { $matches = []; $result = preg_match_all('/\{(' . self::PLACEHOLDER_REGEX . ')\}/', $subject, $matches); diff --git a/lib/private/Route/CachingRouter.php b/lib/private/Route/CachingRouter.php index 8ed90350135..bbc20ac7b77 100644 --- a/lib/private/Route/CachingRouter.php +++ b/lib/private/Route/CachingRouter.php @@ -46,6 +46,7 @@ class CachingRouter extends Router { * @param bool $absolute * @return string */ + #[\Override] public function generate($name, $parameters = [], $absolute = false) { asort($parameters); $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . (int)$absolute; @@ -73,6 +74,7 @@ class CachingRouter extends Router { * @throws \Exception * @return array */ + #[\Override] public function findMatchingRoute(string $url): array { $this->eventLogger->start('cacheroute:match', 'Match route'); $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . '#rootCollection'; @@ -117,6 +119,7 @@ class CachingRouter extends Router { /** * @param array{action:mixed, ...} $parameters */ + #[\Override] protected function callLegacyActionRoute(array $parameters): void { /* * Closures cannot be serialized to cache, so for legacy routes calling an action we have to include the routes.php file again @@ -138,6 +141,7 @@ class CachingRouter extends Router { * @param array $defaults An array of default parameter values * @param array $requirements An array of requirements for parameters (regexes) */ + #[\Override] public function create($name, $pattern, array $defaults = [], array $requirements = []): Route { $this->legacyCreatedRoutes[] = $name; return parent::create($name, $pattern, $defaults, $requirements); @@ -146,6 +150,7 @@ class CachingRouter extends Router { /** * Require a routes.php file */ + #[\Override] protected function requireRouteFile(string $file, string $appName): void { $this->legacyCreatedRoutes = []; parent::requireRouteFile($file, $appName); diff --git a/lib/private/Route/Route.php b/lib/private/Route/Route.php index ad967135104..2d9becc86e3 100644 --- a/lib/private/Route/Route.php +++ b/lib/private/Route/Route.php @@ -17,6 +17,7 @@ class Route extends SymfonyRoute implements IRoute { * @param string|array $method HTTP method * @return \OC\Route\Route */ + #[\Override] public function method($method) { $this->setMethods($method); return $this; @@ -26,6 +27,7 @@ class Route extends SymfonyRoute implements IRoute { * Specify POST as the method to use with this route * @return \OC\Route\Route */ + #[\Override] public function post() { $this->method('POST'); return $this; @@ -35,6 +37,7 @@ class Route extends SymfonyRoute implements IRoute { * Specify GET as the method to use with this route * @return \OC\Route\Route */ + #[\Override] public function get() { $this->method('GET'); return $this; @@ -44,6 +47,7 @@ class Route extends SymfonyRoute implements IRoute { * Specify PUT as the method to use with this route * @return \OC\Route\Route */ + #[\Override] public function put() { $this->method('PUT'); return $this; @@ -53,6 +57,7 @@ class Route extends SymfonyRoute implements IRoute { * Specify DELETE as the method to use with this route * @return \OC\Route\Route */ + #[\Override] public function delete() { $this->method('DELETE'); return $this; @@ -62,6 +67,7 @@ class Route extends SymfonyRoute implements IRoute { * Specify PATCH as the method to use with this route * @return \OC\Route\Route */ + #[\Override] public function patch() { $this->method('PATCH'); return $this; @@ -73,6 +79,7 @@ class Route extends SymfonyRoute implements IRoute { * @param array $defaults The defaults * @return \OC\Route\Route */ + #[\Override] public function defaults($defaults) { $action = $this->getDefault('action'); $this->setDefaults($defaults); @@ -89,6 +96,7 @@ class Route extends SymfonyRoute implements IRoute { * @param array $requirements The requirements * @return \OC\Route\Route */ + #[\Override] public function requirements($requirements) { $method = $this->getMethods(); $this->setRequirements($requirements); @@ -111,6 +119,7 @@ class Route extends SymfonyRoute implements IRoute { * This function is called with $class set to a callable or * to the class with $function */ + #[\Override] public function action($class, $function = null) { $action = [$class, $function]; if (is_null($function)) { @@ -125,6 +134,7 @@ class Route extends SymfonyRoute implements IRoute { * it is called directly * @param string $file */ + #[\Override] public function actionInclude($file) { $this->setDefault('file', $file); return $this; diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index c0170b7dd83..e4d1a65da3f 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -233,6 +233,7 @@ class Router implements IRouter { * @param array $requirements An array of requirements for parameters (regexes) * @return \OC\Route\Route */ + #[\Override] public function create($name, $pattern, array $defaults = [], diff --git a/lib/private/Search/Filter/BooleanFilter.php b/lib/private/Search/Filter/BooleanFilter.php index 894dc13b657..2be28b672fe 100644 --- a/lib/private/Search/Filter/BooleanFilter.php +++ b/lib/private/Search/Filter/BooleanFilter.php @@ -23,6 +23,7 @@ class BooleanFilter implements IFilter { }; } + #[\Override] public function get(): bool { return $this->value; } diff --git a/lib/private/Search/Filter/DateTimeFilter.php b/lib/private/Search/Filter/DateTimeFilter.php index 48c1725a5e1..b4a70af8fe5 100644 --- a/lib/private/Search/Filter/DateTimeFilter.php +++ b/lib/private/Search/Filter/DateTimeFilter.php @@ -23,6 +23,7 @@ class DateTimeFilter implements IFilter { $this->value = new DateTimeImmutable($value); } + #[\Override] public function get(): DateTimeImmutable { return $this->value; } diff --git a/lib/private/Search/Filter/FloatFilter.php b/lib/private/Search/Filter/FloatFilter.php index f2384552943..db221725427 100644 --- a/lib/private/Search/Filter/FloatFilter.php +++ b/lib/private/Search/Filter/FloatFilter.php @@ -22,6 +22,7 @@ class FloatFilter implements IFilter { } } + #[\Override] public function get(): float { return $this->value; } diff --git a/lib/private/Search/Filter/GroupFilter.php b/lib/private/Search/Filter/GroupFilter.php index fe0b2ce42d8..ee742290898 100644 --- a/lib/private/Search/Filter/GroupFilter.php +++ b/lib/private/Search/Filter/GroupFilter.php @@ -28,6 +28,7 @@ class GroupFilter implements IFilter { $this->group = $group; } + #[\Override] public function get(): IGroup { return $this->group; } diff --git a/lib/private/Search/Filter/IntegerFilter.php b/lib/private/Search/Filter/IntegerFilter.php index 028b7d0678f..24e91c2501b 100644 --- a/lib/private/Search/Filter/IntegerFilter.php +++ b/lib/private/Search/Filter/IntegerFilter.php @@ -22,6 +22,7 @@ class IntegerFilter implements IFilter { } } + #[\Override] public function get(): int { return $this->value; } diff --git a/lib/private/Search/Filter/StringFilter.php b/lib/private/Search/Filter/StringFilter.php index 6944a7803f3..309d4f6c699 100644 --- a/lib/private/Search/Filter/StringFilter.php +++ b/lib/private/Search/Filter/StringFilter.php @@ -21,6 +21,7 @@ class StringFilter implements IFilter { } } + #[\Override] public function get(): string { return $this->value; } diff --git a/lib/private/Search/Filter/StringsFilter.php b/lib/private/Search/Filter/StringsFilter.php index 8b8fabb5347..c393442e1f6 100644 --- a/lib/private/Search/Filter/StringsFilter.php +++ b/lib/private/Search/Filter/StringsFilter.php @@ -28,6 +28,7 @@ class StringsFilter implements IFilter { /** * @return string[] */ + #[\Override] public function get(): array { return $this->values; } diff --git a/lib/private/Search/Filter/UserFilter.php b/lib/private/Search/Filter/UserFilter.php index 4f2061a4ba6..52660e0dda1 100644 --- a/lib/private/Search/Filter/UserFilter.php +++ b/lib/private/Search/Filter/UserFilter.php @@ -28,6 +28,7 @@ class UserFilter implements IFilter { $this->user = $user; } + #[\Override] public function get(): IUser { return $this->user; } diff --git a/lib/private/Search/FilterCollection.php b/lib/private/Search/FilterCollection.php index 030564db7de..dfd02e7ef2e 100644 --- a/lib/private/Search/FilterCollection.php +++ b/lib/private/Search/FilterCollection.php @@ -27,20 +27,24 @@ class FilterCollection implements IFilterCollection { $this->filters = $filters; } + #[\Override] public function has(string $name): bool { return isset($this->filters[$name]); } + #[\Override] public function get(string $name): ?IFilter { return $this->filters[$name] ?? null; } + #[\Override] public function getIterator(): Generator { foreach ($this->filters as $k => $v) { yield $k => $v; } } + #[\Override] public function count(): int { return count($this->filters); } diff --git a/lib/private/Search/SearchQuery.php b/lib/private/Search/SearchQuery.php index 791edb7a0f7..4ed81bdebff 100644 --- a/lib/private/Search/SearchQuery.php +++ b/lib/private/Search/SearchQuery.php @@ -29,36 +29,44 @@ class SearchQuery implements ISearchQuery { ) { } + #[\Override] public function getTerm(): string { return $this->getFilter('term')?->get() ?? ''; } + #[\Override] public function getFilter(string $name): ?IFilter { return $this->filters->has($name) ? $this->filters->get($name) : null; } + #[\Override] public function getFilters(): IFilterCollection { return $this->filters; } + #[\Override] public function getSortOrder(): int { return $this->sortOrder; } + #[\Override] public function getLimit(): int { return $this->limit; } + #[\Override] public function getCursor(): int|string|null { return $this->cursor; } + #[\Override] public function getRoute(): string { return $this->route; } + #[\Override] public function getRouteParameters(): array { return $this->routeParameters; } diff --git a/lib/private/Security/Bruteforce/Backend/DatabaseBackend.php b/lib/private/Security/Bruteforce/Backend/DatabaseBackend.php index ddf31175c5e..49570685851 100644 --- a/lib/private/Security/Bruteforce/Backend/DatabaseBackend.php +++ b/lib/private/Security/Bruteforce/Backend/DatabaseBackend.php @@ -21,6 +21,7 @@ class DatabaseBackend implements IBackend { /** * {@inheritDoc} */ + #[\Override] public function getAttempts( string $ipSubnet, int $maxAgeTimestamp, @@ -52,6 +53,7 @@ class DatabaseBackend implements IBackend { /** * {@inheritDoc} */ + #[\Override] public function resetAttempts( string $ipSubnet, ?string $action = null, @@ -76,6 +78,7 @@ class DatabaseBackend implements IBackend { /** * {@inheritDoc} */ + #[\Override] public function registerAttempt( string $ip, string $ipSubnet, diff --git a/lib/private/Security/Bruteforce/Backend/MemoryCacheBackend.php b/lib/private/Security/Bruteforce/Backend/MemoryCacheBackend.php index 9a0723db47e..633f75d4e9d 100644 --- a/lib/private/Security/Bruteforce/Backend/MemoryCacheBackend.php +++ b/lib/private/Security/Bruteforce/Backend/MemoryCacheBackend.php @@ -51,6 +51,7 @@ class MemoryCacheBackend implements IBackend { /** * {@inheritDoc} */ + #[\Override] public function getAttempts( string $ipSubnet, int $maxAgeTimestamp, @@ -80,6 +81,7 @@ class MemoryCacheBackend implements IBackend { /** * {@inheritDoc} */ + #[\Override] public function resetAttempts( string $ipSubnet, ?string $action = null, @@ -116,6 +118,7 @@ class MemoryCacheBackend implements IBackend { /** * {@inheritDoc} */ + #[\Override] public function registerAttempt( string $ip, string $ipSubnet, diff --git a/lib/private/Security/Bruteforce/Capabilities.php b/lib/private/Security/Bruteforce/Capabilities.php index 581b4480a27..d2ddc0bf05b 100644 --- a/lib/private/Security/Bruteforce/Capabilities.php +++ b/lib/private/Security/Bruteforce/Capabilities.php @@ -23,6 +23,7 @@ class Capabilities implements IPublicCapability, IInitialStateExcludedCapability /** * @return array{bruteforce: array{delay: int, allow-listed: bool}} */ + #[\Override] public function getCapabilities(): array { return [ 'bruteforce' => [ diff --git a/lib/private/Security/Bruteforce/CleanupJob.php b/lib/private/Security/Bruteforce/CleanupJob.php index f07e4dbacbd..9033d4b775e 100644 --- a/lib/private/Security/Bruteforce/CleanupJob.php +++ b/lib/private/Security/Bruteforce/CleanupJob.php @@ -25,6 +25,7 @@ class CleanupJob extends TimedJob { $this->setTimeSensitivity(self::TIME_INSENSITIVE); } + #[\Override] protected function run($argument): void { // Delete all entries more than 48 hours old $time = $this->time->getTime() - (48 * 3600); diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php index 574f6c80c3f..6c5ebdce084 100644 --- a/lib/private/Security/Bruteforce/Throttler.php +++ b/lib/private/Security/Bruteforce/Throttler.php @@ -46,6 +46,7 @@ class Throttler implements IThrottler { /** * {@inheritDoc} */ + #[\Override] public function registerAttempt(string $action, string $ip, array $metadata = []): void { @@ -82,6 +83,7 @@ class Throttler implements IThrottler { /** * Check if the IP is whitelisted */ + #[\Override] public function isBypassListed(string $ip): bool { return $this->allowList->isBypassListed($ip); } @@ -89,6 +91,7 @@ class Throttler implements IThrottler { /** * {@inheritDoc} */ + #[\Override] public function showBruteforceWarning(string $ip, string $action = ''): bool { $attempts = $this->getAttempts($ip, $action); // 4 failed attempts is the last delay below 5 seconds @@ -98,6 +101,7 @@ class Throttler implements IThrottler { /** * {@inheritDoc} */ + #[\Override] public function getAttempts(string $ip, string $action = '', float $maxAgeHours = 12): int { if ($maxAgeHours > 48) { $this->logger->error('Bruteforce has to use less than 48 hours'); @@ -125,6 +129,7 @@ class Throttler implements IThrottler { /** * {@inheritDoc} */ + #[\Override] public function getDelay(string $ip, string $action = ''): int { $attempts = $this->getAttempts($ip, $action); return $this->calculateDelay($attempts); @@ -154,6 +159,7 @@ class Throttler implements IThrottler { /** * {@inheritDoc} */ + #[\Override] public function resetDelay(string $ip, string $action, array $metadata): void { // No need to log if the bruteforce protection is disabled if (!$this->config->getSystemValueBool('auth.bruteforce.protection.enabled', true)) { @@ -177,6 +183,7 @@ class Throttler implements IThrottler { /** * {@inheritDoc} */ + #[\Override] public function resetDelayForIP(string $ip): void { // No need to log if the bruteforce protection is disabled if (!$this->config->getSystemValueBool('auth.bruteforce.protection.enabled', true)) { @@ -194,6 +201,7 @@ class Throttler implements IThrottler { /** * {@inheritDoc} */ + #[\Override] public function sleepDelay(string $ip, string $action = ''): int { $delay = $this->getDelay($ip, $action); if (!$this->config->getSystemValueBool('auth.bruteforce.protection.testing')) { @@ -205,6 +213,7 @@ class Throttler implements IThrottler { /** * {@inheritDoc} */ + #[\Override] public function sleepDelayOrThrowOnMax(string $ip, string $action = ''): int { $maxAttempts = $this->config->getSystemValueInt('auth.bruteforce.max-attempts', self::MAX_ATTEMPTS); $attempts = $this->getAttempts($ip, $action); diff --git a/lib/private/Security/CSP/ContentSecurityPolicyManager.php b/lib/private/Security/CSP/ContentSecurityPolicyManager.php index e9d6b2945a8..7804bca7741 100644 --- a/lib/private/Security/CSP/ContentSecurityPolicyManager.php +++ b/lib/private/Security/CSP/ContentSecurityPolicyManager.php @@ -25,6 +25,7 @@ class ContentSecurityPolicyManager implements IContentSecurityPolicyManager { } /** {@inheritdoc} */ + #[\Override] public function addDefaultPolicy(EmptyContentSecurityPolicy $policy): void { $this->policies[] = $policy; } diff --git a/lib/private/Security/Certificate.php b/lib/private/Security/Certificate.php index 81c2b9461a3..31015a1d6bd 100644 --- a/lib/private/Security/Certificate.php +++ b/lib/private/Security/Certificate.php @@ -63,35 +63,43 @@ class Certificate implements ICertificate { $this->issuerOrganization = $info['issuer']['O'] ?? null; } + #[\Override] public function getName(): string { return $this->name; } + #[\Override] public function getCommonName(): ?string { return $this->commonName; } + #[\Override] public function getOrganization(): ?string { return $this->organization; } + #[\Override] public function getIssueDate(): \DateTime { return $this->issueDate; } + #[\Override] public function getExpireDate(): \DateTime { return $this->expireDate; } + #[\Override] public function isExpired(): bool { $now = new \DateTime(); return $this->issueDate > $now || $now > $this->expireDate; } + #[\Override] public function getIssuerName(): ?string { return $this->issuerName; } + #[\Override] public function getIssuerOrganization(): ?string { return $this->issuerOrganization; } diff --git a/lib/private/Security/CertificateManager.php b/lib/private/Security/CertificateManager.php index 5dfeed1c07a..fb0e3d5fffa 100644 --- a/lib/private/Security/CertificateManager.php +++ b/lib/private/Security/CertificateManager.php @@ -34,6 +34,7 @@ class CertificateManager implements ICertificateManager { * * @return ICertificate[] */ + #[\Override] public function listCertificates(): array { if (!$this->config->getSystemValueBool('installed', false)) { return []; @@ -148,6 +149,7 @@ class CertificateManager implements ICertificateManager { * @param string $name the filename for the certificate * @throws \Exception If the certificate could not get added */ + #[\Override] public function addCertificate(string $certificate, string $name): ICertificate { $path = $this->getPathToCertificates() . 'uploads/' . $name; $directory = dirname($path); @@ -172,6 +174,7 @@ class CertificateManager implements ICertificateManager { /** * Remove the certificate and re-generate the certificate bundle */ + #[\Override] public function removeCertificate(string $name): bool { $path = $this->getPathToCertificates() . 'uploads/' . $name; @@ -192,6 +195,7 @@ class CertificateManager implements ICertificateManager { /** * Get the path to the certificate bundle */ + #[\Override] public function getCertificateBundle(): string { return $this->getPathToCertificates() . 'rootcerts.crt'; } @@ -200,6 +204,7 @@ class CertificateManager implements ICertificateManager { * Get the full local path to the certificate bundle * @throws \Exception when getting bundle path fails */ + #[\Override] public function getAbsoluteBundlePath(): string { try { if ($this->bundlePath === null) { @@ -249,6 +254,7 @@ class CertificateManager implements ICertificateManager { return filemtime($this->getDefaultCertificatesBundlePath()); } + #[\Override] public function getDefaultCertificatesBundlePath(): string { return $this->config->getSystemValueString('default_certificates_bundle_path', \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); } diff --git a/lib/private/Security/CredentialsManager.php b/lib/private/Security/CredentialsManager.php index 254984261d2..202cde52397 100644 --- a/lib/private/Security/CredentialsManager.php +++ b/lib/private/Security/CredentialsManager.php @@ -32,6 +32,7 @@ class CredentialsManager implements ICredentialsManager { * @param string $userId empty string for system-wide credentials * @param mixed $credentials */ + #[\Override] public function store(string $userId, string $identifier, $credentials): void { $value = $this->crypto->encrypt(json_encode($credentials)); @@ -48,6 +49,7 @@ class CredentialsManager implements ICredentialsManager { * * @param string $userId empty string for system-wide credentials */ + #[\Override] public function retrieve(string $userId, string $identifier): mixed { $qb = $this->dbConnection->getQueryBuilder(); $qb->select('credentials') @@ -78,6 +80,7 @@ class CredentialsManager implements ICredentialsManager { * @param string $userId empty string for system-wide credentials * @return int rows removed */ + #[\Override] public function delete(string $userId, string $identifier): int { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete(self::DB_TABLE) @@ -97,6 +100,7 @@ class CredentialsManager implements ICredentialsManager { * * @return int rows removed */ + #[\Override] public function erase(string $userId): int { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete(self::DB_TABLE) diff --git a/lib/private/Security/Crypto.php b/lib/private/Security/Crypto.php index 7bbeec9e291..594b769e8f3 100644 --- a/lib/private/Security/Crypto.php +++ b/lib/private/Security/Crypto.php @@ -39,6 +39,7 @@ class Crypto implements ICrypto { * @param string $password Password to use (defaults to `secret` in config.php) * @return string Calculated HMAC */ + #[\Override] public function calculateHMAC(string $message, string $password = ''): string { if ($password === '') { $password = $this->config->getSystemValueString('secret'); @@ -60,6 +61,7 @@ class Crypto implements ICrypto { * @throws Exception if it was not possible to gather sufficient entropy * @throws Exception if encrypting the data failed */ + #[\Override] public function encrypt(string $plaintext, string $password = ''): string { if ($password === '') { $password = $this->config->getSystemValueString('secret'); @@ -89,6 +91,7 @@ class Crypto implements ICrypto { * @throws Exception If the HMAC does not match * @throws Exception If the decryption failed */ + #[\Override] public function decrypt(string $authenticatedCiphertext, string $password = ''): string { $secret = $this->config->getSystemValue('secret'); try { diff --git a/lib/private/Security/Hasher.php b/lib/private/Security/Hasher.php index 722fdab902f..d962d4bef19 100644 --- a/lib/private/Security/Hasher.php +++ b/lib/private/Security/Hasher.php @@ -62,6 +62,7 @@ class Hasher implements IHasher { * @param string $message Message to generate hash from * @return string Hash of the message with appended version parameter */ + #[\Override] public function hash(string $message): string { $alg = $this->getPrefferedAlgorithm(); @@ -150,6 +151,7 @@ class Hasher implements IHasher { * @param null|string &$newHash Reference will contain the updated hash if necessary. Update the existing hash with this one. * @return bool Whether $hash is a valid hash of $message */ + #[\Override] public function verify(string $message, string $hash, &$newHash = null): bool { $splittedHash = $this->splitHash($hash); @@ -191,6 +193,7 @@ class Hasher implements IHasher { return $default; } + #[\Override] public function validate(string $prefixedHash): bool { $splitHash = $this->splitHash($prefixedHash); if (empty($splitHash)) { diff --git a/lib/private/Security/Ip/Address.php b/lib/private/Security/Ip/Address.php index 0e94ec2d9ea..122d511a4f2 100644 --- a/lib/private/Security/Ip/Address.php +++ b/lib/private/Security/Ip/Address.php @@ -29,10 +29,12 @@ class Address implements IAddress { $this->ip = $ip; } + #[\Override] public static function isValid(string $ip): bool { return Factory::parseAddressString($ip, ParseStringFlag::MAY_INCLUDE_ZONEID) !== null; } + #[\Override] public function matches(IRange ... $ranges): bool { foreach ($ranges as $range) { if ($range->contains($this)) { diff --git a/lib/private/Security/Ip/Factory.php b/lib/private/Security/Ip/Factory.php index 1eedcf27a09..6014ade61db 100644 --- a/lib/private/Security/Ip/Factory.php +++ b/lib/private/Security/Ip/Factory.php @@ -13,10 +13,12 @@ use OCP\Security\Ip\IFactory; use OCP\Security\Ip\IRange; class Factory implements IFactory { + #[\Override] public function rangeFromString(string $range): IRange { return new Range($range); } + #[\Override] public function addressFromString(string $ip): IAddress { return new Address($ip); } diff --git a/lib/private/Security/Ip/Range.php b/lib/private/Security/Ip/Range.php index e32b7a5abc0..a8baffeef1c 100644 --- a/lib/private/Security/Ip/Range.php +++ b/lib/private/Security/Ip/Range.php @@ -26,10 +26,12 @@ class Range implements IRange { $this->range = $range; } + #[\Override] public static function isValid(string $range): bool { return Factory::parseRangeString($range) !== null; } + #[\Override] public function contains(IAddress $address): bool { return $this->range->contains(Factory::parseAddressString((string)$address, ParseStringFlag::MAY_INCLUDE_ZONEID)); } diff --git a/lib/private/Security/Ip/RemoteAddress.php b/lib/private/Security/Ip/RemoteAddress.php index 4eef8813898..62ca08e7860 100644 --- a/lib/private/Security/Ip/RemoteAddress.php +++ b/lib/private/Security/Ip/RemoteAddress.php @@ -30,16 +30,19 @@ class RemoteAddress implements IRemoteAddress, IAddress { : new Address($remoteAddress); } + #[\Override] public static function isValid(string $ip): bool { return Address::isValid($ip); } + #[\Override] public function matches(IRange ... $ranges): bool { return $this->ip === null ? true : $this->ip->matches(... $ranges); } + #[\Override] public function allowsAdminActions(): bool { if ($this->ip === null) { return true; diff --git a/lib/private/Security/RateLimiting/Backend/DatabaseBackend.php b/lib/private/Security/RateLimiting/Backend/DatabaseBackend.php index 9fb237f2f72..16b51ae264a 100644 --- a/lib/private/Security/RateLimiting/Backend/DatabaseBackend.php +++ b/lib/private/Security/RateLimiting/Backend/DatabaseBackend.php @@ -63,6 +63,7 @@ class DatabaseBackend implements IBackend { /** * {@inheritDoc} */ + #[\Override] public function getAttempts( string $methodIdentifier, string $userIdentifier, @@ -74,6 +75,7 @@ class DatabaseBackend implements IBackend { /** * {@inheritDoc} */ + #[\Override] public function registerAttempt( string $methodIdentifier, string $userIdentifier, diff --git a/lib/private/Security/RateLimiting/Backend/MemoryCacheBackend.php b/lib/private/Security/RateLimiting/Backend/MemoryCacheBackend.php index 4c33b49d05e..466c7efde05 100644 --- a/lib/private/Security/RateLimiting/Backend/MemoryCacheBackend.php +++ b/lib/private/Security/RateLimiting/Backend/MemoryCacheBackend.php @@ -54,6 +54,7 @@ class MemoryCacheBackend implements IBackend { /** * {@inheritDoc} */ + #[\Override] public function getAttempts( string $methodIdentifier, string $userIdentifier, @@ -75,6 +76,7 @@ class MemoryCacheBackend implements IBackend { /** * {@inheritDoc} */ + #[\Override] public function registerAttempt( string $methodIdentifier, string $userIdentifier, diff --git a/lib/private/Security/RateLimiting/Limiter.php b/lib/private/Security/RateLimiting/Limiter.php index 316becfa009..e14def14550 100644 --- a/lib/private/Security/RateLimiting/Limiter.php +++ b/lib/private/Security/RateLimiting/Limiter.php @@ -51,6 +51,7 @@ class Limiter implements ILimiter { * @param int $anonPeriod in seconds * @throws RateLimitExceededException */ + #[\Override] public function registerAnonRequest( string $identifier, int $anonLimit, @@ -69,6 +70,7 @@ class Limiter implements ILimiter { * @param int $userPeriod in seconds * @throws RateLimitExceededException */ + #[\Override] public function registerUserRequest( string $identifier, int $userLimit, diff --git a/lib/private/Security/RemoteHostValidator.php b/lib/private/Security/RemoteHostValidator.php index 30bd59db2c1..459bcb8d512 100644 --- a/lib/private/Security/RemoteHostValidator.php +++ b/lib/private/Security/RemoteHostValidator.php @@ -30,6 +30,7 @@ final class RemoteHostValidator implements IRemoteHostValidator { ) { } + #[\Override] public function isValid(string $host): bool { if ($this->config->getSystemValueBool('allow_local_remote_servers', false)) { return true; diff --git a/lib/private/Security/SecureRandom.php b/lib/private/Security/SecureRandom.php index b2a3d19ce74..ddb6b16655d 100644 --- a/lib/private/Security/SecureRandom.php +++ b/lib/private/Security/SecureRandom.php @@ -27,6 +27,7 @@ class SecureRandom implements ISecureRandom { * specified all valid base64 characters are used. * @throws \LengthException if an invalid length is requested */ + #[\Override] public function generate( int $length, string $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', diff --git a/lib/private/Security/Signature/Model/IncomingSignedRequest.php b/lib/private/Security/Signature/Model/IncomingSignedRequest.php index ab2c6f708a1..c5b5584475c 100644 --- a/lib/private/Security/Signature/Model/IncomingSignedRequest.php +++ b/lib/private/Security/Signature/Model/IncomingSignedRequest.php @@ -191,6 +191,7 @@ class IncomingSignedRequest extends SignedRequest implements * @return IRequest * @since 31.0.0 */ + #[\Override] public function getRequest(): IRequest { return $this->request; } @@ -213,6 +214,7 @@ class IncomingSignedRequest extends SignedRequest implements * @throws IncomingRequestException * @since 31.0.0 */ + #[\Override] public function getOrigin(): string { if ($this->origin === '') { throw new IncomingRequestException('empty origin'); @@ -228,6 +230,7 @@ class IncomingSignedRequest extends SignedRequest implements * @throws SignatureElementNotFoundException * @since 31.0.0 */ + #[\Override] public function getKeyId(): string { return $this->getSigningElement('keyId'); } @@ -239,6 +242,7 @@ class IncomingSignedRequest extends SignedRequest implements * @throws SignatoryNotFoundException * @since 31.0.0 */ + #[\Override] public function verify(): void { $publicKey = $this->getSignatory()->getPublicKey(); if ($publicKey === '') { @@ -256,6 +260,7 @@ class IncomingSignedRequest extends SignedRequest implements } } + #[\Override] public function jsonSerialize(): array { return array_merge( parent::jsonSerialize(), diff --git a/lib/private/Security/Signature/Model/OutgoingSignedRequest.php b/lib/private/Security/Signature/Model/OutgoingSignedRequest.php index 1cba76e45ce..0a87aa70895 100644 --- a/lib/private/Security/Signature/Model/OutgoingSignedRequest.php +++ b/lib/private/Security/Signature/Model/OutgoingSignedRequest.php @@ -75,6 +75,7 @@ class OutgoingSignedRequest extends SignedRequest implements * @return $this * @since 31.0.0 */ + #[\Override] public function setHost(string $host): self { $this->host = $host; return $this; @@ -86,6 +87,7 @@ class OutgoingSignedRequest extends SignedRequest implements * @return string * @since 31.0.0 */ + #[\Override] public function getHost(): string { return $this->host; } @@ -99,6 +101,7 @@ class OutgoingSignedRequest extends SignedRequest implements * @return self * @since 31.0.0 */ + #[\Override] public function addHeader(string $key, string|int|float $value): self { $this->headers[$key] = $value; return $this; @@ -110,6 +113,7 @@ class OutgoingSignedRequest extends SignedRequest implements * @return array * @since 31.0.0 */ + #[\Override] public function getHeaders(): array { return $this->headers; } @@ -122,6 +126,7 @@ class OutgoingSignedRequest extends SignedRequest implements * @return self * @since 31.0.0 */ + #[\Override] public function setHeaderList(array $list): self { $this->headerList = $list; return $this; @@ -133,6 +138,7 @@ class OutgoingSignedRequest extends SignedRequest implements * @return list * @since 31.0.0 */ + #[\Override] public function getHeaderList(): array { return $this->headerList; } @@ -145,6 +151,7 @@ class OutgoingSignedRequest extends SignedRequest implements * @return self * @since 31.0.0 */ + #[\Override] public function setAlgorithm(SignatureAlgorithm $algorithm): self { $this->algorithm = $algorithm; return $this; @@ -156,6 +163,7 @@ class OutgoingSignedRequest extends SignedRequest implements * @return SignatureAlgorithm * @since 31.0.0 */ + #[\Override] public function getAlgorithm(): SignatureAlgorithm { return $this->algorithm; } @@ -168,6 +176,7 @@ class OutgoingSignedRequest extends SignedRequest implements * @throws SignatoryNotFoundException * @since 31.0.0 */ + #[\Override] public function sign(): self { $privateKey = $this->getSignatory()->getPrivateKey(); if ($privateKey === '') { @@ -213,6 +222,7 @@ class OutgoingSignedRequest extends SignedRequest implements return base64_encode($signed); } + #[\Override] public function jsonSerialize(): array { return array_merge( parent::jsonSerialize(), diff --git a/lib/private/Security/Signature/Model/SignedRequest.php b/lib/private/Security/Signature/Model/SignedRequest.php index 7fe7149da2b..1b60a49cedc 100644 --- a/lib/private/Security/Signature/Model/SignedRequest.php +++ b/lib/private/Security/Signature/Model/SignedRequest.php @@ -39,6 +39,7 @@ class SignedRequest implements ISignedRequest, JsonSerializable { * @return string * @since 31.0.0 */ + #[\Override] public function getBody(): string { return $this->body; } @@ -62,6 +63,7 @@ class SignedRequest implements ISignedRequest, JsonSerializable { * @return DigestAlgorithm * @since 31.0.0 */ + #[\Override] public function getDigestAlgorithm(): DigestAlgorithm { return $this->digestAlgorithm; } @@ -72,6 +74,7 @@ class SignedRequest implements ISignedRequest, JsonSerializable { * @return string * @since 31.0.0 */ + #[\Override] public function getDigest(): string { if ($this->digest === '') { $this->digest = $this->digestAlgorithm->value . '=' @@ -88,6 +91,7 @@ class SignedRequest implements ISignedRequest, JsonSerializable { * @return self * @since 31.0.0 */ + #[\Override] public function setSigningElements(array $elements): self { $this->signingElements = $elements; return $this; @@ -99,6 +103,7 @@ class SignedRequest implements ISignedRequest, JsonSerializable { * @return array * @since 31.0.0 */ + #[\Override] public function getSigningElements(): array { return $this->signingElements; } @@ -111,6 +116,7 @@ class SignedRequest implements ISignedRequest, JsonSerializable { * @since 31.0.0 * */ + #[\Override] public function getSigningElement(string $key): string { // getSignatureDetail / getSignatureEntry() ? if (!array_key_exists($key, $this->signingElements)) { throw new SignatureElementNotFoundException('missing element ' . $key . ' in Signature header'); @@ -138,6 +144,7 @@ class SignedRequest implements ISignedRequest, JsonSerializable { * @return array * @since 31.0.0 */ + #[\Override] public function getSignatureData(): array { return $this->signatureData; } @@ -161,6 +168,7 @@ class SignedRequest implements ISignedRequest, JsonSerializable { * @return string * @since 31.0.0 */ + #[\Override] public function getSignature(): string { return $this->signature; } @@ -172,6 +180,7 @@ class SignedRequest implements ISignedRequest, JsonSerializable { * @return self * @since 31.0.0 */ + #[\Override] public function setSignatory(Signatory $signatory): self { $this->signatory = $signatory; return $this; @@ -184,6 +193,7 @@ class SignedRequest implements ISignedRequest, JsonSerializable { * @throws SignatoryNotFoundException * @since 31.0.0 */ + #[\Override] public function getSignatory(): Signatory { if ($this->signatory === null) { throw new SignatoryNotFoundException(); @@ -198,10 +208,12 @@ class SignedRequest implements ISignedRequest, JsonSerializable { * @return bool * @since 31.0.0 */ + #[\Override] public function hasSignatory(): bool { return ($this->signatory !== null); } + #[\Override] public function jsonSerialize(): array { return [ 'body' => $this->body, diff --git a/lib/private/Security/Signature/SignatureManager.php b/lib/private/Security/Signature/SignatureManager.php index 0c5bfdcc3ae..11aff48438d 100644 --- a/lib/private/Security/Signature/SignatureManager.php +++ b/lib/private/Security/Signature/SignatureManager.php @@ -90,6 +90,7 @@ class SignatureManager implements ISignatureManager { * @throws SignatureException if signature could not be confirmed * @since 31.0.0 */ + #[\Override] public function getIncomingSignedRequest( ISignatoryManager $signatoryManager, ?string $body = null, @@ -191,6 +192,7 @@ class SignatureManager implements ISignatureManager { * @throws SignatoryNotFoundException * @since 31.0.0 */ + #[\Override] public function getOutgoingSignedRequest( ISignatoryManager $signatoryManager, string $content, @@ -222,6 +224,7 @@ class SignatureManager implements ISignatureManager { * @return array new payload to be sent, including original payload and signature elements in headers * @since 31.0.0 */ + #[\Override] public function signOutgoingRequestIClientPayload( ISignatoryManager $signatoryManager, array $payload, @@ -245,6 +248,7 @@ class SignatureManager implements ISignatureManager { * @throws SignatoryNotFoundException if entry does not exist in local database * @since 31.0.0 */ + #[\Override] public function getSignatory(string $host, string $account = ''): Signatory { return $this->mapper->getByHost($host, $account); } @@ -261,6 +265,7 @@ class SignatureManager implements ISignatureManager { * @throws IdentityNotFoundException is identity is not set in app config * @since 31.0.0 */ + #[\Override] public function generateKeyIdFromConfig(string $path): string { if (!$this->appConfig->hasKey('core', self::APPCONFIG_IDENTITY, true)) { throw new IdentityNotFoundException(self::APPCONFIG_IDENTITY . ' not set'); @@ -280,6 +285,7 @@ class SignatureManager implements ISignatureManager { * @throws IdentityNotFoundException if identity cannot be extracted * @since 31.0.0 */ + #[\Override] public function extractIdentityFromUri(string $uri): string { return Signatory::extractIdentityFromUri($uri); } diff --git a/lib/private/Security/TrustedDomainHelper.php b/lib/private/Security/TrustedDomainHelper.php index a65779780e8..526c20be26f 100644 --- a/lib/private/Security/TrustedDomainHelper.php +++ b/lib/private/Security/TrustedDomainHelper.php @@ -36,6 +36,7 @@ class TrustedDomainHelper implements ITrustedDomainHelper { /** * {@inheritDoc} */ + #[\Override] public function isTrustedUrl(string $url): bool { $parsedUrl = parse_url($url); if (empty($parsedUrl['host'])) { @@ -52,6 +53,7 @@ class TrustedDomainHelper implements ITrustedDomainHelper { /** * {@inheritDoc} */ + #[\Override] public function isTrustedDomain(string $domainWithPort): bool { // overwritehost is always trusted if ($this->config->getSystemValue('overwritehost') !== '') { diff --git a/lib/private/Security/VerificationToken/CleanUpJob.php b/lib/private/Security/VerificationToken/CleanUpJob.php index ba8f4352f80..5b951da1398 100644 --- a/lib/private/Security/VerificationToken/CleanUpJob.php +++ b/lib/private/Security/VerificationToken/CleanUpJob.php @@ -30,6 +30,7 @@ class CleanUpJob extends Job { parent::__construct($time); } + #[\Override] public function setArgument($argument): void { parent::setArgument($argument); $args = \json_decode($argument, true); @@ -39,6 +40,7 @@ class CleanUpJob extends Job { $this->runNotBefore = (int)$args['notBefore']; } + #[\Override] protected function run($argument): void { try { $user = $this->userManager->get($this->userId); @@ -54,6 +56,7 @@ class CleanUpJob extends Job { } } + #[\Override] public function start(IJobList $jobList): void { if ($this->time->getTime() >= $this->runNotBefore) { $jobList->remove($this, $this->argument); diff --git a/lib/private/Security/VerificationToken/VerificationToken.php b/lib/private/Security/VerificationToken/VerificationToken.php index 89f45180359..602b06390aa 100644 --- a/lib/private/Security/VerificationToken/VerificationToken.php +++ b/lib/private/Security/VerificationToken/VerificationToken.php @@ -36,6 +36,7 @@ class VerificationToken implements IVerificationToken { throw new InvalidTokenException($code); } + #[\Override] public function check( string $token, ?IUser $user, @@ -78,6 +79,7 @@ class VerificationToken implements IVerificationToken { } } + #[\Override] public function create( IUser $user, string $subject, @@ -103,6 +105,7 @@ class VerificationToken implements IVerificationToken { return $token; } + #[\Override] public function delete(string $token, IUser $user, string $subject): void { $this->config->deleteUserValue($user->getUID(), 'core', $subject); } diff --git a/lib/private/Server.php b/lib/private/Server.php index e24d47f3f06..2a33c18eb05 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -1355,6 +1355,7 @@ class Server extends ServerContainer implements IServerContainer { * @return Folder|null * @deprecated 20.0.0 */ + #[\Override] public function getUserFolder($userId = null): ?Folder { if ($userId === null) { $user = $this->get(IUserSession::class)->getUser(); @@ -1379,6 +1380,7 @@ class Server extends ServerContainer implements IServerContainer { * @return string * @deprecated 20.0.0 */ + #[\Override] public function getWebRoot(): string { return $this->webRoot; } @@ -1391,6 +1393,7 @@ class Server extends ServerContainer implements IServerContainer { * @return IL10N * @deprecated 20.0.0 use DI of {@see IL10N} or {@see IFactory} instead, or {@see \OCP\Util::getL10N()} as a last resort */ + #[\Override] public function getL10N($app, $lang = null) { return $this->get(IFactory::class)->get($app, $lang); } diff --git a/lib/private/ServerContainer.php b/lib/private/ServerContainer.php index c06c2c46acf..d6b5681dd9f 100644 --- a/lib/private/ServerContainer.php +++ b/lib/private/ServerContainer.php @@ -100,6 +100,7 @@ class ServerContainer extends SimpleContainer { throw new QueryException(); } + #[\Override] public function has($id, bool $noRecursion = false): bool { if (!$noRecursion && ($appContainer = $this->getAppContainerForService($id)) !== null) { return $appContainer->has($id); @@ -119,6 +120,7 @@ class ServerContainer extends SimpleContainer { * @throws QueryException * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get */ + #[\Override] public function query(string $name, bool $autoload = true, array $chain = []): mixed { $name = $this->sanitizeName($name); diff --git a/lib/private/Session/CryptoSessionData.php b/lib/private/Session/CryptoSessionData.php index 67199aa2337..bd9d35c18f7 100644 --- a/lib/private/Session/CryptoSessionData.php +++ b/lib/private/Session/CryptoSessionData.php @@ -83,6 +83,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { * @param string $key * @param mixed $value */ + #[\Override] public function set(string $key, $value) { if ($this->get($key) === $value) { // Do not write the session if the value hasn't changed to avoid reopening @@ -103,6 +104,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { * @param string $key * @return string|null Either the value or null */ + #[\Override] public function get(string $key) { if (isset($this->sessionValues[$key])) { return $this->sessionValues[$key]; @@ -117,6 +119,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { * @param string $key * @return bool */ + #[\Override] public function exists(string $key): bool { return isset($this->sessionValues[$key]); } @@ -126,6 +129,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { * * @param string $key */ + #[\Override] public function remove(string $key) { $reopened = $this->reopen(); $this->isModified = true; @@ -138,6 +142,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { /** * Reset and recreate the session */ + #[\Override] public function clear() { $reopened = $this->reopen(); $requesttoken = $this->get('requesttoken'); @@ -152,6 +157,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { } } + #[\Override] public function reopen(): bool { $reopened = $this->session->reopen(); if ($reopened) { @@ -167,6 +173,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { * @param bool $updateToken Wheater to update the associated auth token * @return void */ + #[\Override] public function regenerateId(bool $deleteOldSession = true, bool $updateToken = false) { $this->session->regenerateId($deleteOldSession, $updateToken); } @@ -178,6 +185,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { * @throws SessionNotAvailableException * @since 9.1.0 */ + #[\Override] public function getId(): string { return $this->session->getId(); } @@ -185,6 +193,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { /** * Close the session and release the lock, also writes all changed data in batch */ + #[\Override] public function close() { if ($this->isModified) { $encryptedValue = $this->crypto->encrypt(json_encode($this->sessionValues), $this->passphrase); @@ -198,6 +207,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { * @param mixed $offset * @return bool */ + #[\Override] public function offsetExists($offset): bool { return $this->exists($offset); } @@ -206,6 +216,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { * @param mixed $offset * @return mixed */ + #[\Override] #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->get($offset); @@ -215,6 +226,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { * @param mixed $offset * @param mixed $value */ + #[\Override] public function offsetSet($offset, $value): void { $this->set($offset, $value); } @@ -222,6 +234,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { /** * @param mixed $offset */ + #[\Override] public function offsetUnset($offset): void { $this->remove($offset); } diff --git a/lib/private/Session/Internal.php b/lib/private/Session/Internal.php index d07174fad14..953544e374c 100644 --- a/lib/private/Session/Internal.php +++ b/lib/private/Session/Internal.php @@ -55,6 +55,7 @@ class Internal extends Session { * @param string $key * @param integer $value */ + #[\Override] public function set(string $key, $value) { $reopened = $this->reopen(); $_SESSION[$key] = $value; @@ -67,6 +68,7 @@ class Internal extends Session { * @param string $key * @return mixed */ + #[\Override] public function get(string $key) { if (!$this->exists($key)) { return null; @@ -78,6 +80,7 @@ class Internal extends Session { * @param string $key * @return bool */ + #[\Override] public function exists(string $key): bool { return isset($_SESSION[$key]); } @@ -85,12 +88,14 @@ class Internal extends Session { /** * @param string $key */ + #[\Override] public function remove(string $key) { if (isset($_SESSION[$key])) { unset($_SESSION[$key]); } } + #[\Override] public function clear() { $this->reopen(); $this->invoke('session_unset'); @@ -100,6 +105,7 @@ class Internal extends Session { $_SESSION = []; } + #[\Override] public function close() { $this->invoke('session_write_close'); parent::close(); @@ -112,6 +118,7 @@ class Internal extends Session { * @param bool $updateToken Whether to update the associated auth token * @return void */ + #[\Override] public function regenerateId(bool $deleteOldSession = true, bool $updateToken = false) { $this->reopen(); $oldId = null; @@ -154,6 +161,7 @@ class Internal extends Session { * @throws SessionNotAvailableException * @since 9.1.0 */ + #[\Override] public function getId(): string { $id = $this->invoke('session_id', [], true); if ($id === '') { @@ -165,6 +173,7 @@ class Internal extends Session { /** * @throws \Exception */ + #[\Override] public function reopen(): bool { if ($this->sessionClosed) { $this->startSession(false, false); diff --git a/lib/private/Session/Memory.php b/lib/private/Session/Memory.php index 395711836f5..e73a8c3fa31 100644 --- a/lib/private/Session/Memory.php +++ b/lib/private/Session/Memory.php @@ -24,6 +24,7 @@ class Memory extends Session { * @param string $key * @param integer $value */ + #[\Override] public function set(string $key, $value) { $this->data[$key] = $value; } @@ -32,6 +33,7 @@ class Memory extends Session { * @param string $key * @return mixed */ + #[\Override] public function get(string $key) { if (!$this->exists($key)) { return null; @@ -43,6 +45,7 @@ class Memory extends Session { * @param string $key * @return bool */ + #[\Override] public function exists(string $key): bool { return isset($this->data[$key]); } @@ -50,10 +53,12 @@ class Memory extends Session { /** * @param string $key */ + #[\Override] public function remove(string $key) { unset($this->data[$key]); } + #[\Override] public function clear() { $this->data = []; } @@ -63,6 +68,7 @@ class Memory extends Session { * * @param bool $deleteOldSession */ + #[\Override] public function regenerateId(bool $deleteOldSession = true, bool $updateToken = false) { } @@ -73,6 +79,7 @@ class Memory extends Session { * @throws SessionNotAvailableException * @since 9.1.0 */ + #[\Override] public function getId(): string { throw new SessionNotAvailableException('Memory session does not have an ID'); } @@ -80,6 +87,7 @@ class Memory extends Session { /** * Helper function for PHPUnit execution - don't use in non-test code */ + #[\Override] public function reopen(): bool { $reopened = $this->sessionClosed; $this->sessionClosed = false; diff --git a/lib/private/Session/Session.php b/lib/private/Session/Session.php index b7510b63683..08465ba3b08 100644 --- a/lib/private/Session/Session.php +++ b/lib/private/Session/Session.php @@ -23,6 +23,7 @@ abstract class Session implements \ArrayAccess, ISession { * @param mixed $offset * @return bool */ + #[\Override] public function offsetExists($offset): bool { return $this->exists($offset); } @@ -31,6 +32,7 @@ abstract class Session implements \ArrayAccess, ISession { * @param mixed $offset * @return mixed */ + #[\Override] #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->get($offset); @@ -40,6 +42,7 @@ abstract class Session implements \ArrayAccess, ISession { * @param mixed $offset * @param mixed $value */ + #[\Override] public function offsetSet($offset, $value): void { $this->set($offset, $value); } @@ -47,6 +50,7 @@ abstract class Session implements \ArrayAccess, ISession { /** * @param mixed $offset */ + #[\Override] public function offsetUnset($offset): void { $this->remove($offset); } @@ -54,6 +58,7 @@ abstract class Session implements \ArrayAccess, ISession { /** * Close the session and release the lock */ + #[\Override] public function close() { $this->sessionClosed = true; } diff --git a/lib/private/Settings/AuthorizedGroup.php b/lib/private/Settings/AuthorizedGroup.php index 4ad9b228b5c..284c3ae42ce 100644 --- a/lib/private/Settings/AuthorizedGroup.php +++ b/lib/private/Settings/AuthorizedGroup.php @@ -16,6 +16,8 @@ use OCP\AppFramework\Db\Entity; * @method setClass(string $class) * @method string getGroupId() * @method string getClass() + * + * @psalm-api - we cannot use final as this will break unit tests */ class AuthorizedGroup extends Entity implements JsonSerializable { public $id; @@ -27,6 +29,7 @@ class AuthorizedGroup extends Entity implements JsonSerializable { /** * @return array */ + #[\Override] public function jsonSerialize(): array { return [ 'id' => $this->getId(), diff --git a/lib/private/Settings/AuthorizedGroupMapper.php b/lib/private/Settings/AuthorizedGroupMapper.php index 800dc5b8077..e057ab94c9d 100644 --- a/lib/private/Settings/AuthorizedGroupMapper.php +++ b/lib/private/Settings/AuthorizedGroupMapper.php @@ -21,6 +21,7 @@ use OCP\Server; /** * @template-extends QBMapper + * @psalm-api - we cannot use final as this will break unit tests */ class AuthorizedGroupMapper extends QBMapper { public function __construct(IDBConnection $db) { diff --git a/lib/private/Settings/DeclarativeManager.php b/lib/private/Settings/DeclarativeManager.php index 534b4b19984..10419913a16 100644 --- a/lib/private/Settings/DeclarativeManager.php +++ b/lib/private/Settings/DeclarativeManager.php @@ -57,6 +57,7 @@ class DeclarativeManager implements IDeclarativeManager { /** * @inheritdoc */ + #[\Override] public function registerSchema(string $app, array $schema): void { $this->appSchemas[$app] ??= []; @@ -83,6 +84,7 @@ class DeclarativeManager implements IDeclarativeManager { /** * @inheritdoc */ + #[\Override] public function loadSchemas(): void { if (empty($this->declarativeForms)) { $declarativeSettings = $this->coordinator->getRegistrationContext()->getDeclarativeSettings(); @@ -101,6 +103,7 @@ class DeclarativeManager implements IDeclarativeManager { /** * @inheritdoc */ + #[\Override] public function getFormIDs(IUser $user, string $type, string $section): array { $isAdmin = $this->groupManager->isAdmin($user->getUID()); /** @var array> $formIds */ @@ -130,6 +133,7 @@ class DeclarativeManager implements IDeclarativeManager { * @inheritdoc * @throws Exception */ + #[\Override] public function getFormsWithValues(IUser $user, ?string $type, ?string $section): array { $isAdmin = $this->groupManager->isAdmin($user->getUID()); $forms = []; @@ -252,6 +256,7 @@ class DeclarativeManager implements IDeclarativeManager { /** * @inheritdoc */ + #[\Override] public function setValue(IUser $user, string $app, string $formId, string $fieldId, mixed $value): void { $sectionType = $this->getSectionType($app, $fieldId); $this->assertAuthorized($user, $sectionType); diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 7b4dd9fcc9b..129be0f66a3 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -52,6 +52,7 @@ class Manager implements IManager { /** * @inheritdoc */ + #[\Override] public function registerSection(string $type, string $section) { if (!isset($this->sectionClasses[$type])) { $this->sectionClasses[$type] = []; @@ -102,6 +103,7 @@ class Manager implements IManager { /** * @inheritdoc */ + #[\Override] public function getSection(string $type, string $sectionId): ?IIconSection { if (isset($this->sections[$type]) && isset($this->sections[$type][$sectionId])) { return $this->sections[$type][$sectionId]; @@ -119,6 +121,7 @@ class Manager implements IManager { /** * @inheritdoc */ + #[\Override] public function registerSetting(string $type, string $setting) { $this->settingClasses[$setting] = $type; } @@ -179,6 +182,7 @@ class Manager implements IManager { /** * @inheritdoc */ + #[\Override] public function getAdminSections(): array { // built-in sections $sections = []; @@ -202,6 +206,7 @@ class Manager implements IManager { /** * @inheritdoc */ + #[\Override] public function getAdminSettings(string $section, bool $subAdminOnly = false): array { if ($subAdminOnly) { $subAdminSettingsFilter = function (ISettings $settings) { @@ -227,6 +232,7 @@ class Manager implements IManager { /** * @inheritdoc */ + #[\Override] public function getPersonalSections(): array { if ($this->l === null) { $this->l = $this->l10nFactory->get('lib'); @@ -257,6 +263,7 @@ class Manager implements IManager { /** * @inheritdoc */ + #[\Override] public function getPersonalSettings(string $section): array { $settings = []; $appSettings = $this->getSettings('personal', $section); @@ -275,6 +282,7 @@ class Manager implements IManager { /** * @inheritdoc */ + #[\Override] public function getAllowedAdminSettings(string $section, IUser $user): array { $isAdmin = $this->groupManager->isAdmin($user->getUID()); if ($isAdmin) { @@ -309,6 +317,7 @@ class Manager implements IManager { /** * @inheritdoc */ + #[\Override] public function getAllAllowedAdminSettings(IUser $user): array { $this->getSettings('admin', ''); // Make sure all the settings are loaded $settings = []; @@ -326,6 +335,7 @@ class Manager implements IManager { /** * @return array}> */ + #[\Override] public function getAdminDelegatedSettings(): array { $sections = $this->getAdminSections(); $settings = []; diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php index 9de18d75a51..e2923578d3d 100644 --- a/lib/private/Setup/MySQL.php +++ b/lib/private/Setup/MySQL.php @@ -17,6 +17,7 @@ use OCP\IDBConnection; class MySQL extends AbstractDatabase { public string $dbprettyname = 'MySQL/MariaDB'; + #[\Override] public function setupDatabase(): void { //check if the database user has admin right $connection = $this->connect(['dbname' => null]); diff --git a/lib/private/Setup/OCI.php b/lib/private/Setup/OCI.php index 7bde42c1ace..5e343b754f1 100644 --- a/lib/private/Setup/OCI.php +++ b/lib/private/Setup/OCI.php @@ -14,6 +14,7 @@ class OCI extends AbstractDatabase { protected $dbtablespace; + #[\Override] public function initialize(array $config): void { parent::initialize($config); if (array_key_exists('dbtablespace', $config)) { @@ -30,6 +31,7 @@ class OCI extends AbstractDatabase { ]); } + #[\Override] public function validate(array $config): array { $errors = []; if (empty($config['dbuser']) && empty($config['dbname'])) { @@ -42,6 +44,7 @@ class OCI extends AbstractDatabase { return $errors; } + #[\Override] public function setupDatabase(): void { try { $this->connect(); diff --git a/lib/private/Setup/PostgreSQL.php b/lib/private/Setup/PostgreSQL.php index 189a6a969a4..687d9b2c7d7 100644 --- a/lib/private/Setup/PostgreSQL.php +++ b/lib/private/Setup/PostgreSQL.php @@ -18,6 +18,7 @@ class PostgreSQL extends AbstractDatabase { /** * @throws DatabaseSetupException */ + #[\Override] public function setupDatabase(): void { try { $connection = $this->connect([ diff --git a/lib/private/Setup/Sqlite.php b/lib/private/Setup/Sqlite.php index 325a26ce896..cbbcf18d259 100644 --- a/lib/private/Setup/Sqlite.php +++ b/lib/private/Setup/Sqlite.php @@ -12,10 +12,12 @@ use OC\DB\ConnectionFactory; class Sqlite extends AbstractDatabase { public string $dbprettyname = 'Sqlite'; + #[\Override] public function validate(array $config): array { return []; } + #[\Override] public function initialize(array $config): void { /* * Web: When using web based installer its not possible to set dbname @@ -45,6 +47,7 @@ class Sqlite extends AbstractDatabase { } } + #[\Override] public function setupDatabase(): void { $datadir = $this->config->getValue( 'datadirectory', diff --git a/lib/private/SetupCheck/SetupCheckManager.php b/lib/private/SetupCheck/SetupCheckManager.php index 721885848e2..ee5c2a8c617 100644 --- a/lib/private/SetupCheck/SetupCheckManager.php +++ b/lib/private/SetupCheck/SetupCheckManager.php @@ -23,6 +23,7 @@ class SetupCheckManager implements ISetupCheckManager { ) { } + #[\Override] public function runAll(): array { $results = []; $setupChecks = $this->coordinator->getRegistrationContext()->getSetupChecks(); diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 4c824b2aa55..da0e179fe28 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -81,6 +81,7 @@ class DefaultShareProvider implements * * @return string Containing only [a-zA-Z0-9] */ + #[\Override] public function identifier() { return 'ocinternal'; } @@ -93,6 +94,7 @@ class DefaultShareProvider implements * @throws ShareNotFound * @throws \Exception */ + #[\Override] public function create(IShare $share) { $qb = $this->dbConn->getQueryBuilder(); @@ -212,6 +214,7 @@ class DefaultShareProvider implements * @throws InvalidPathException * @throws NotFoundException */ + #[\Override] public function update(IShare $share) { $originalShare = $this->getShareById($share->getId()); @@ -317,6 +320,7 @@ class DefaultShareProvider implements * @return IShare The share object * @since 9.0.0 */ + #[\Override] public function acceptShare(IShare $share, string $recipient): IShare { if ($share->getShareType() === IShare::TYPE_GROUP) { $group = $this->groupManager->get($share->getSharedWith()); @@ -371,6 +375,7 @@ class DefaultShareProvider implements return $share; } + #[\Override] public function getChildren(IShare $parent): array { $children = []; @@ -405,6 +410,7 @@ class DefaultShareProvider implements * * @param IShare $share */ + #[\Override] public function delete(IShare $share) { $qb = $this->dbConn->getQueryBuilder(); $qb->delete('share') @@ -430,6 +436,7 @@ class DefaultShareProvider implements * @throws BackendError * @throws ProviderException */ + #[\Override] public function deleteFromSelf(IShare $share, $recipient) { if ($share->getShareType() === IShare::TYPE_GROUP) { $group = $this->groupManager->get($share->getSharedWith()); @@ -525,6 +532,7 @@ class DefaultShareProvider implements * For now this only works for group shares * If this gets implemented for normal shares we have to extend it */ + #[\Override] public function restore(IShare $share, string $recipient): IShare { $qb = $this->dbConn->getQueryBuilder(); $qb->select('permissions') @@ -557,6 +565,7 @@ class DefaultShareProvider implements /** * @inheritdoc */ + #[\Override] public function move(IShare $share, $recipient) { if ($share->getShareType() === IShare::TYPE_USER) { // Just update the target @@ -615,6 +624,7 @@ class DefaultShareProvider implements return $share; } + #[\Override] public function getSharesInFolder($userId, Folder $node, $reshares, $shallow = true) { if (!$shallow) { throw new \Exception('non-shallow getSharesInFolder is no longer supported'); @@ -623,6 +633,7 @@ class DefaultShareProvider implements return $this->getSharesInFolderInternal($userId, $node, $reshares); } + #[\Override] public function getAllSharesInFolder(Folder $node): array { return $this->getSharesInFolderInternal(null, $node, null); } @@ -699,6 +710,7 @@ class DefaultShareProvider implements /** * @inheritdoc */ + #[\Override] public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset) { $qb = $this->dbConn->getQueryBuilder(); $qb->select('*') @@ -747,6 +759,7 @@ class DefaultShareProvider implements /** * @inheritdoc */ + #[\Override] public function getShareById($id, $recipientId = null) { $qb = $this->dbConn->getQueryBuilder(); @@ -793,6 +806,7 @@ class DefaultShareProvider implements * @param Node $path * @return IShare[] */ + #[\Override] public function getSharesByPath(Node $path) { $qb = $this->dbConn->getQueryBuilder(); @@ -838,10 +852,12 @@ class DefaultShareProvider implements return true; } + #[\Override] public function getSharedWith($userId, $shareType, $node, $limit, $offset) { return $this->_getSharedWith($userId, $shareType, $limit, $offset, $node); } + #[\Override] public function getSharedWithByPath( string $userId, int $shareType, @@ -1051,6 +1067,7 @@ class DefaultShareProvider implements * @return IShare * @throws ShareNotFound */ + #[\Override] public function getShareByToken($token) { $qb = $this->dbConn->getQueryBuilder(); @@ -1195,6 +1212,7 @@ class DefaultShareProvider implements * @param string $uid * @param int $shareType */ + #[\Override] public function userDeleted($uid, $shareType) { $qb = $this->dbConn->getQueryBuilder(); @@ -1260,6 +1278,7 @@ class DefaultShareProvider implements * * @param string $gid */ + #[\Override] public function groupDeleted($gid) { /* * First delete all custom group shares for group members @@ -1308,6 +1327,7 @@ class DefaultShareProvider implements * @param string $gid * @return void */ + #[\Override] public function userDeletedFromGroup($uid, $gid) { /* * Get all group shares @@ -1386,6 +1406,7 @@ class DefaultShareProvider implements /** * @inheritdoc */ + #[\Override] public function getAccessList($nodes, $currentAccess) { $ids = []; foreach ($nodes as $node) { @@ -1516,6 +1537,7 @@ class DefaultShareProvider implements } } + #[\Override] public function sendMailNotification(IShare $share): bool { try { // Check user @@ -1718,6 +1740,7 @@ class DefaultShareProvider implements } } + #[\Override] public function getAllShares(): iterable { $qb = $this->dbConn->getQueryBuilder(); @@ -1782,6 +1805,7 @@ class DefaultShareProvider implements return \json_encode($compressedAttributes); } + #[\Override] public function getUsersForShare(IShare $share): iterable { if ($share->getShareType() === IShare::TYPE_USER) { return [new LazyUser($share->getSharedWith(), $this->userManager)]; diff --git a/lib/private/Share20/GroupDeletedListener.php b/lib/private/Share20/GroupDeletedListener.php index 7e1ad71c465..e6370cd958f 100644 --- a/lib/private/Share20/GroupDeletedListener.php +++ b/lib/private/Share20/GroupDeletedListener.php @@ -22,6 +22,7 @@ class GroupDeletedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof GroupDeletedEvent) { return; diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 707fbfd5b41..a2d45ee3147 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1349,6 +1349,7 @@ class Manager implements IManager { /** * @inheritDoc */ + #[\Override] public function getSharedWithByPath(string $userId, int $shareType, string $path, bool $forChildren, int $limit = 50, int $offset = 0): iterable { try { $provider = $this->factory->getProviderForType($shareType); @@ -1842,6 +1843,7 @@ class Manager implements IManager { return $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_user_id', 'yes') === 'yes'; } + #[\Override] public function matchDisplayName(): bool { return $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_displayname', 'yes') === 'yes'; } @@ -1924,6 +1926,7 @@ class Manager implements IManager { return true; } + #[\Override] public function registerShareProvider(string $shareProviderClass): void { $this->factory->registerProvider($shareProviderClass); } @@ -1993,6 +1996,7 @@ class Manager implements IManager { } } + #[\Override] public function getUsersForShare(IShare $share): iterable { $provider = $this->factory->getProviderForType($share->getShareType()); if ($provider instanceof IShareProviderGetUsers) { diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php index c84dd5f7f45..769dc7426c7 100644 --- a/lib/private/Share20/ProviderFactory.php +++ b/lib/private/Share20/ProviderFactory.php @@ -46,6 +46,7 @@ class ProviderFactory implements IProviderFactory { ) { } + #[\Override] public function registerProvider(string $shareProviderClass): void { $this->registeredShareProviders[] = $shareProviderClass; } @@ -128,6 +129,7 @@ class ProviderFactory implements IProviderFactory { /** * @inheritdoc */ + #[\Override] public function getProvider($id) { $provider = null; if (isset($this->shareProviders[$id])) { @@ -171,6 +173,7 @@ class ProviderFactory implements IProviderFactory { /** * @inheritdoc */ + #[\Override] public function getProviderForType($shareType) { $provider = null; @@ -199,6 +202,7 @@ class ProviderFactory implements IProviderFactory { return $provider; } + #[\Override] public function getAllProviders() { $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()]; $shareByMail = $this->getShareByMailProvider(); diff --git a/lib/private/Share20/PublicShareTemplateFactory.php b/lib/private/Share20/PublicShareTemplateFactory.php index d1079cc9662..164a0b79a64 100644 --- a/lib/private/Share20/PublicShareTemplateFactory.php +++ b/lib/private/Share20/PublicShareTemplateFactory.php @@ -25,6 +25,7 @@ class PublicShareTemplateFactory implements IPublicShareTemplateFactory { ) { } + #[\Override] public function getProvider(IShare $share): IPublicShareTemplateProvider { $context = $this->coordinator->getRegistrationContext(); if ($context === null) { diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php index 3dd57fb3565..2ededbc7c36 100644 --- a/lib/private/Share20/Share.php +++ b/lib/private/Share20/Share.php @@ -155,6 +155,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setNodeId($fileId) { $this->node = null; $this->fileId = $fileId; @@ -164,6 +165,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getNodeId(): int { if ($this->fileId === null) { $this->fileId = $this->getNode()->getId(); @@ -179,6 +181,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setNodeType($type) { if ($type !== 'file' && $type !== 'folder') { throw new \InvalidArgumentException(); @@ -191,6 +194,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getNodeType() { if ($this->nodeType === null) { if ($this->getNodeCacheEntry()) { @@ -208,6 +212,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setShareType($shareType) { $this->shareType = $shareType; return $this; @@ -216,6 +221,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getShareType() { return $this->shareType; } @@ -223,6 +229,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setSharedWith($sharedWith) { if (!is_string($sharedWith)) { throw new \InvalidArgumentException(); @@ -234,6 +241,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getSharedWith() { return $this->sharedWith; } @@ -241,6 +249,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setSharedWithDisplayName($displayName) { if (!is_string($displayName)) { throw new \InvalidArgumentException(); @@ -252,6 +261,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getSharedWithDisplayName() { return $this->sharedWithDisplayName; } @@ -259,6 +269,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setSharedWithAvatar($src) { if (!is_string($src)) { throw new \InvalidArgumentException(); @@ -270,6 +281,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getSharedWithAvatar() { return $this->sharedWithAvatar; } @@ -277,6 +289,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setPermissions($permissions) { //TODO checks @@ -287,6 +300,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getPermissions() { return $this->permissions; } @@ -294,6 +308,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function newAttributes(): IAttributes { return new ShareAttributes(); } @@ -301,6 +316,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setAttributes(?IAttributes $attributes) { $this->attributes = $attributes; return $this; @@ -309,6 +325,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getAttributes(): ?IAttributes { return $this->attributes; } @@ -316,6 +333,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setStatus(int $status): IShare { $this->status = $status; return $this; @@ -324,6 +342,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getStatus(): int { return $this->status; } @@ -331,6 +350,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setNote($note) { $this->note = $note; return $this; @@ -339,6 +359,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getNote() { if (is_string($this->note)) { return $this->note; @@ -349,6 +370,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setLabel($label) { $this->label = $label; return $this; @@ -357,6 +379,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getLabel() { return $this->label; } @@ -364,6 +387,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setExpirationDate($expireDate) { //TODO checks @@ -374,6 +398,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getExpirationDate() { return $this->expireDate; } @@ -381,6 +406,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setNoExpirationDate(bool $noExpirationDate) { $this->noExpirationDate = $noExpirationDate; return $this; @@ -389,6 +415,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getNoExpirationDate(): bool { return $this->noExpirationDate; } @@ -396,6 +423,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function isExpired() { return $this->getExpirationDate() !== null && $this->getExpirationDate() <= new \DateTime(); @@ -404,6 +432,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setSharedBy($sharedBy) { if (!is_string($sharedBy)) { throw new \InvalidArgumentException(); @@ -417,6 +446,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getSharedBy() { //TODO check if set return $this->sharedBy; @@ -425,6 +455,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setShareOwner($shareOwner) { if (!is_string($shareOwner)) { throw new \InvalidArgumentException(); @@ -438,6 +469,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getShareOwner() { //TODO check if set return $this->shareOwner; @@ -446,6 +478,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setPassword($password) { $this->password = $password; return $this; @@ -454,6 +487,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getPassword() { return $this->password; } @@ -461,6 +495,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setPasswordExpirationTime(?\DateTimeInterface $passwordExpirationTime = null): IShare { $this->passwordExpirationTime = $passwordExpirationTime; return $this; @@ -469,6 +504,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getPasswordExpirationTime(): ?\DateTimeInterface { return $this->passwordExpirationTime; } @@ -476,6 +512,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setSendPasswordByTalk(bool $sendPasswordByTalk) { $this->sendPasswordByTalk = $sendPasswordByTalk; return $this; @@ -484,6 +521,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getSendPasswordByTalk(): bool { return $this->sendPasswordByTalk; } @@ -491,6 +529,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setToken($token) { $this->token = $token; return $this; @@ -499,15 +538,18 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getToken() { return $this->token; } + #[\Override] public function setParent(int $parent): self { $this->parent = $parent; return $this; } + #[\Override] public function getParent(): ?int { return $this->parent; } @@ -515,6 +557,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setTarget($target) { // if the target is changed, save the original target if ($this->target && !$this->originalTarget) { @@ -527,6 +570,7 @@ class Share implements IShare { /** * Return the original target, if this share was moved */ + #[\Override] public function getOriginalTarget(): ?string { return $this->originalTarget; } @@ -534,6 +578,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getTarget() { return $this->target; } @@ -541,6 +586,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setShareTime(\DateTime $shareTime) { $this->shareTime = $shareTime; return $this; @@ -549,6 +595,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getShareTime() { return $this->shareTime; } @@ -556,6 +603,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setMailSend($mailSend) { $this->mailSend = $mailSend; return $this; @@ -564,6 +612,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getMailSend() { return $this->mailSend; } @@ -571,6 +620,7 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function setNodeCacheEntry(ICacheEntry $entry) { $this->nodeCacheEntry = $entry; } @@ -578,28 +628,34 @@ class Share implements IShare { /** * @inheritdoc */ + #[\Override] public function getNodeCacheEntry() { return $this->nodeCacheEntry; } + #[\Override] public function setHideDownload(bool $hide): IShare { $this->hideDownload = $hide; return $this; } + #[\Override] public function getHideDownload(): bool { return $this->hideDownload; } + #[\Override] public function setReminderSent(bool $reminderSent): IShare { $this->reminderSent = $reminderSent; return $this; } + #[\Override] public function getReminderSent(): bool { return $this->reminderSent; } + #[\Override] public function canDownload(): bool { if (($this->getPermissions() & Constants::PERMISSION_READ) === 0) { return false; @@ -613,6 +669,7 @@ class Share implements IShare { return true; } + #[\Override] public function canSeeContent(): bool { $shareManager = Server::get(IManager::class); diff --git a/lib/private/Share20/ShareAttributes.php b/lib/private/Share20/ShareAttributes.php index f90fbd9c6cd..617322d5499 100644 --- a/lib/private/Share20/ShareAttributes.php +++ b/lib/private/Share20/ShareAttributes.php @@ -20,6 +20,7 @@ class ShareAttributes implements IAttributes { /** * @inheritdoc */ + #[\Override] public function setAttribute(string $scope, string $key, mixed $value): IAttributes { if (!\array_key_exists($scope, $this->attributes)) { $this->attributes[$scope] = []; @@ -31,6 +32,7 @@ class ShareAttributes implements IAttributes { /** * @inheritdoc */ + #[\Override] public function getAttribute(string $scope, string $key): mixed { if (\array_key_exists($scope, $this->attributes) && \array_key_exists($key, $this->attributes[$scope])) { @@ -42,6 +44,7 @@ class ShareAttributes implements IAttributes { /** * @inheritdoc */ + #[\Override] public function toArray(): array { $result = []; foreach ($this->attributes as $scope => $keys) { diff --git a/lib/private/Share20/ShareHelper.php b/lib/private/Share20/ShareHelper.php index 98c413b55b8..4b4e57ecb0b 100644 --- a/lib/private/Share20/ShareHelper.php +++ b/lib/private/Share20/ShareHelper.php @@ -16,6 +16,9 @@ use OCP\Share\IManager; use OCP\Share\IShareHelper; use Override; +/** + * @psalm-api - we cannot use final as this will break unit tests + */ class ShareHelper implements IShareHelper { public function __construct( private readonly IManager $shareManager, diff --git a/lib/private/Share20/UserDeletedListener.php b/lib/private/Share20/UserDeletedListener.php index e0e091454b0..426b3857c91 100644 --- a/lib/private/Share20/UserDeletedListener.php +++ b/lib/private/Share20/UserDeletedListener.php @@ -22,6 +22,7 @@ class UserDeletedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof UserDeletedEvent) { return; diff --git a/lib/private/Share20/UserRemovedListener.php b/lib/private/Share20/UserRemovedListener.php index 10cb68f9b9e..e0da6e050f0 100644 --- a/lib/private/Share20/UserRemovedListener.php +++ b/lib/private/Share20/UserRemovedListener.php @@ -22,6 +22,7 @@ class UserRemovedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!$event instanceof UserRemovedEvent) { return; diff --git a/lib/private/SpeechToText/SpeechToTextManager.php b/lib/private/SpeechToText/SpeechToTextManager.php index d69add2d80b..bf9da3709c6 100644 --- a/lib/private/SpeechToText/SpeechToTextManager.php +++ b/lib/private/SpeechToText/SpeechToTextManager.php @@ -48,6 +48,7 @@ class SpeechToTextManager implements ISpeechToTextManager { ) { } + #[\Override] public function getProviders(): array { $context = $this->coordinator->getRegistrationContext(); if ($context === null) { @@ -74,6 +75,7 @@ class SpeechToTextManager implements ISpeechToTextManager { return $this->providers; } + #[\Override] public function hasProviders(): bool { $context = $this->coordinator->getRegistrationContext(); if ($context === null) { @@ -82,6 +84,7 @@ class SpeechToTextManager implements ISpeechToTextManager { return !empty($context->getSpeechToTextProviders()); } + #[\Override] public function scheduleFileTranscription(File $file, ?string $userId, string $appId): void { if (!$this->hasProviders()) { throw new PreConditionNotMetException('No SpeechToText providers have been registered'); @@ -98,6 +101,7 @@ class SpeechToTextManager implements ISpeechToTextManager { } } + #[\Override] public function cancelScheduledFileTranscription(File $file, ?string $userId, string $appId): void { try { $jobArguments = [ @@ -116,6 +120,7 @@ class SpeechToTextManager implements ISpeechToTextManager { } } + #[\Override] public function transcribeFile(File $file, ?string $userId = null, string $appId = 'core'): string { // try to run a TaskProcessing core:audio2text task // this covers scheduling as well because OC\SpeechToText\TranscriptionJob calls this method diff --git a/lib/private/SpeechToText/TranscriptionJob.php b/lib/private/SpeechToText/TranscriptionJob.php index 6e899ef6e96..11ef970ab0b 100644 --- a/lib/private/SpeechToText/TranscriptionJob.php +++ b/lib/private/SpeechToText/TranscriptionJob.php @@ -40,6 +40,7 @@ class TranscriptionJob extends QueuedJob { /** * @inheritDoc */ + #[\Override] protected function run($argument) { $fileId = $argument['fileId']; $owner = $argument['owner']; diff --git a/lib/private/SubAdmin.php b/lib/private/SubAdmin.php index 5d97623726b..18c5d81d2f7 100644 --- a/lib/private/SubAdmin.php +++ b/lib/private/SubAdmin.php @@ -38,6 +38,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { * @param IUser $user user to be SubAdmin * @param IGroup $group group $user becomes subadmin of */ + #[\Override] public function createSubAdmin(IUser $user, IGroup $group): void { $qb = $this->dbConn->getQueryBuilder(); @@ -59,6 +60,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { * @param IUser $user the user that is the SubAdmin * @param IGroup $group the group */ + #[\Override] public function deleteSubAdmin(IUser $user, IGroup $group): void { $qb = $this->dbConn->getQueryBuilder(); @@ -78,6 +80,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { * @param IUser $user the SubAdmin * @return IGroup[] */ + #[\Override] public function getSubAdminsGroups(IUser $user): array { $groupIds = $this->getSubAdminsGroupIds($user); @@ -130,6 +133,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { * @param IGroup $group the group * @return IUser[] */ + #[\Override] public function getGroupsSubAdmins(IGroup $group): array { $qb = $this->dbConn->getQueryBuilder(); @@ -183,6 +187,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { * @param IGroup $group * @return bool */ + #[\Override] public function isSubAdminOfGroup(IUser $user, IGroup $group): bool { $qb = $this->dbConn->getQueryBuilder(); @@ -207,6 +212,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { * @param IUser $user * @return bool */ + #[\Override] public function isSubAdmin(IUser $user): bool { // Check if the user is already an admin if ($this->groupManager->isAdmin($user->getUID())) { @@ -238,6 +244,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { * @param IUser $user * @return bool */ + #[\Override] public function isUserAccessible(IUser $subadmin, IUser $user): bool { if ($subadmin->getUID() === $user->getUID()) { return true; diff --git a/lib/private/Support/CrashReport/Registry.php b/lib/private/Support/CrashReport/Registry.php index 4fbbb8448ca..21acbcc810b 100644 --- a/lib/private/Support/CrashReport/Registry.php +++ b/lib/private/Support/CrashReport/Registry.php @@ -30,6 +30,7 @@ class Registry implements IRegistry { /** * Register a reporter instance */ + #[\Override] public function register(IReporter $reporter): void { $this->reporters[] = $reporter; } @@ -43,6 +44,7 @@ class Registry implements IRegistry { * * @since 15.0.0 */ + #[\Override] public function delegateBreadcrumb(string $message, string $category, array $context = []): void { $this->loadLazyProviders(); @@ -58,6 +60,7 @@ class Registry implements IRegistry { * * @param Exception|Throwable $exception */ + #[\Override] public function delegateReport($exception, array $context = []): void { $this->loadLazyProviders(); @@ -71,6 +74,7 @@ class Registry implements IRegistry { * * @return void */ + #[\Override] public function delegateMessage(string $message, array $context = []): void { $this->loadLazyProviders(); @@ -114,6 +118,7 @@ class Registry implements IRegistry { } } + #[\Override] public function hasReporters(): bool { return !empty($this->lazyReporters) || !empty($this->reporters); } diff --git a/lib/private/Support/Subscription/Assertion.php b/lib/private/Support/Subscription/Assertion.php index 7e90b0f2bbc..a05df9d7594 100644 --- a/lib/private/Support/Subscription/Assertion.php +++ b/lib/private/Support/Subscription/Assertion.php @@ -24,6 +24,7 @@ class Assertion implements IAssertion { /** * @inheritDoc */ + #[\Override] public function createUserIsLegit(): void { if ($this->registry->delegateIsHardUserLimitReached($this->notificationManager)) { $l = $this->l10nFactory->get('lib'); diff --git a/lib/private/Support/Subscription/Registry.php b/lib/private/Support/Subscription/Registry.php index 862f5647cf1..7cf5b4b9583 100644 --- a/lib/private/Support/Subscription/Registry.php +++ b/lib/private/Support/Subscription/Registry.php @@ -53,6 +53,7 @@ class Registry implements IRegistry { * * @since 17.0.0 */ + #[\Override] public function register(ISubscription $subscription): void { if ($this->subscription !== null || $this->subscriptionService !== null) { throw new AlreadyRegisteredException(); @@ -60,6 +61,7 @@ class Registry implements IRegistry { $this->subscription = $subscription; } + #[\Override] public function registerService(string $subscriptionService): void { if ($this->subscription !== null || $this->subscriptionService !== null) { throw new AlreadyRegisteredException(); @@ -74,6 +76,7 @@ class Registry implements IRegistry { * * @since 17.0.0 */ + #[\Override] public function delegateGetSupportedApps(): array { if ($this->getSubscription() instanceof ISupportedApps) { return $this->getSubscription()->getSupportedApps(); @@ -86,6 +89,7 @@ class Registry implements IRegistry { * * @since 17.0.0 */ + #[\Override] public function delegateHasValidSubscription(): bool { // Allow overwriting this manually for environments where the subscription information cannot be fetched if ($this->config->getSystemValueBool('has_valid_subscription')) { @@ -103,6 +107,7 @@ class Registry implements IRegistry { * * @since 17.0.0 */ + #[\Override] public function delegateHasExtendedSupport(): bool { if ($this->getSubscription() instanceof ISubscription) { return $this->getSubscription()->hasExtendedSupport(); @@ -117,6 +122,7 @@ class Registry implements IRegistry { * @param IManager|null $notificationManager * @since 21.0.0 */ + #[\Override] public function delegateIsHardUserLimitReached(?IManager $notificationManager = null): bool { $subscription = $this->getSubscription(); if ($subscription instanceof ISubscription diff --git a/lib/private/SystemTag/ManagerFactory.php b/lib/private/SystemTag/ManagerFactory.php index 4d3a1396529..7f3e732ddf0 100644 --- a/lib/private/SystemTag/ManagerFactory.php +++ b/lib/private/SystemTag/ManagerFactory.php @@ -38,6 +38,7 @@ class ManagerFactory implements ISystemTagManagerFactory { * * @since 9.0.0 */ + #[\Override] public function getManager(): ISystemTagManager { return new SystemTagManager( $this->serverContainer->get(IDBConnection::class), @@ -54,6 +55,7 @@ class ManagerFactory implements ISystemTagManagerFactory { * * @since 9.0.0 */ + #[\Override] public function getObjectMapper(): ISystemTagObjectMapper { return new SystemTagObjectMapper( $this->serverContainer->get(IDBConnection::class), diff --git a/lib/private/SystemTag/SystemTag.php b/lib/private/SystemTag/SystemTag.php index 1a573dabeaa..52f303896b8 100644 --- a/lib/private/SystemTag/SystemTag.php +++ b/lib/private/SystemTag/SystemTag.php @@ -21,22 +21,27 @@ class SystemTag implements ISystemTag { ) { } + #[\Override] public function getId(): string { return $this->id; } + #[\Override] public function getName(): string { return $this->name; } + #[\Override] public function isUserVisible(): bool { return $this->userVisible; } + #[\Override] public function isUserAssignable(): bool { return $this->userAssignable; } + #[\Override] public function getAccessLevel(): int { if (!$this->userVisible) { return self::ACCESS_LEVEL_INVISIBLE; @@ -49,10 +54,12 @@ class SystemTag implements ISystemTag { return self::ACCESS_LEVEL_PUBLIC; } + #[\Override] public function getETag(): ?string { return $this->etag; } + #[\Override] public function getColor(): ?string { return $this->color; } diff --git a/lib/private/SystemTag/SystemTagManager.php b/lib/private/SystemTag/SystemTagManager.php index f83c8176f1a..97d3708be8e 100644 --- a/lib/private/SystemTag/SystemTagManager.php +++ b/lib/private/SystemTag/SystemTagManager.php @@ -51,6 +51,7 @@ class SystemTagManager implements ISystemTagManager { ->andWhere($query->expr()->eq('editable', $query->createParameter('editable'))); } + #[\Override] public function getTagsByIds($tagIds, ?IUser $user = null): array { if (!\is_array($tagIds)) { $tagIds = [$tagIds]; @@ -95,6 +96,7 @@ class SystemTagManager implements ISystemTagManager { return $tags; } + #[\Override] public function getAllTags($visibilityFilter = null, $nameSearchPattern = null): array { $tags = []; @@ -130,6 +132,7 @@ class SystemTagManager implements ISystemTagManager { return $tags; } + #[\Override] public function getTag(string $tagName, bool $userVisible, bool $userAssignable): ISystemTag { // Length of name column is 64 $truncatedTagName = substr($tagName, 0, 64); @@ -159,6 +162,7 @@ class SystemTagManager implements ISystemTagManager { } } + #[\Override] public function createTag(string $tagName, bool $userVisible, bool $userAssignable, ?IUser $user = null): ISystemTag { $user ??= $this->userSession->getUser(); if (!$this->canUserCreateTag($user)) { @@ -213,6 +217,7 @@ class SystemTagManager implements ISystemTagManager { return $tag; } + #[\Override] public function updateTag( string $tagId, string $newName, @@ -291,6 +296,7 @@ class SystemTagManager implements ISystemTagManager { )); } + #[\Override] public function deleteTags($tagIds): void { if (!\is_array($tagIds)) { $tagIds = [$tagIds]; @@ -340,6 +346,7 @@ class SystemTagManager implements ISystemTagManager { } } + #[\Override] public function canUserAssignTag(ISystemTag $tag, ?IUser $user): bool { if ($user === null) { return false; @@ -369,6 +376,7 @@ class SystemTagManager implements ISystemTagManager { return false; } + #[\Override] public function canUserCreateTag(?IUser $user): bool { if ($user === null) { // If no user given, allows only calls from CLI @@ -382,11 +390,13 @@ class SystemTagManager implements ISystemTagManager { return $this->groupManager->isAdmin($user->getUID()); } + #[\Override] public function canUserUpdateTag(?IUser $user): bool { // We currently have no different permissions for updating tags than for creating them return $this->canUserCreateTag($user); } + #[\Override] public function canUserSeeTag(ISystemTag $tag, ?IUser $user): bool { // If no user, then we only show public tags if (!$user && $tag->getAccessLevel() === ISystemTag::ACCESS_LEVEL_PUBLIC) { @@ -413,6 +423,7 @@ class SystemTagManager implements ISystemTagManager { return new SystemTag((string)$row['id'], $row['name'], (bool)$row['visibility'], (bool)$row['editable'], $row['etag'], $row['color']); } + #[\Override] public function setTagGroups(ISystemTag $tag, array $groupIds): void { // delete relationships first $this->connection->beginTransaction(); @@ -444,6 +455,7 @@ class SystemTagManager implements ISystemTagManager { } } + #[\Override] public function getTagGroups(ISystemTag $tag): array { $groupIds = []; $query = $this->connection->getQueryBuilder(); diff --git a/lib/private/SystemTag/SystemTagObjectMapper.php b/lib/private/SystemTag/SystemTagObjectMapper.php index 43dddde0b23..59fafe3200b 100644 --- a/lib/private/SystemTag/SystemTagObjectMapper.php +++ b/lib/private/SystemTag/SystemTagObjectMapper.php @@ -70,6 +70,7 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { /** * {@inheritdoc} */ + #[\Override] public function getObjectIdsForTags($tagIds, string $objectType, int $limit = 0, string $offset = ''): array { if (!\is_array($tagIds)) { $tagIds = [$tagIds]; @@ -232,6 +233,7 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { /** * {@inheritdoc} */ + #[\Override] public function haveTag($objIds, string $objectType, string $tagId, bool $all = true): bool { $this->assertTagsExist([$tagId]); @@ -296,6 +298,7 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { /** * {@inheritdoc} */ + #[\Override] public function setObjectIdsForTag(string $tagId, string $objectType, array $objectIds): void { $currentObjectIds = $this->getObjectIdsForTags($tagId, $objectType); $removedObjectIds = array_diff($currentObjectIds, $objectIds); @@ -369,6 +372,7 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { /** * {@inheritdoc} */ + #[\Override] public function getAvailableObjectTypes(): array { $query = $this->connection->getQueryBuilder(); $query->selectDistinct('objecttype') diff --git a/lib/private/TagManager.php b/lib/private/TagManager.php index d93647c4e4f..90b8d558d88 100644 --- a/lib/private/TagManager.php +++ b/lib/private/TagManager.php @@ -51,6 +51,7 @@ class TagManager implements ITagManager, IEventListener { * * since 20.0.0 $includeShared isn't used anymore */ + #[\Override] public function load($type, $defaultTags = [], $includeShared = false, $userId = null) { if (is_null($userId)) { $user = $this->userSession->getUser(); @@ -87,6 +88,7 @@ class TagManager implements ITagManager, IEventListener { return $users; } + #[\Override] public function handle(Event $event): void { if (!($event instanceof UserDeletedEvent)) { return; diff --git a/lib/private/Tagging/Tag.php b/lib/private/Tagging/Tag.php index 55a3a410281..7ddcd97e6ac 100644 --- a/lib/private/Tagging/Tag.php +++ b/lib/private/Tagging/Tag.php @@ -45,6 +45,7 @@ class Tag extends Entity { * @todo migrate existing database columns to the correct names * to be able to drop this direct mapping */ + #[\Override] public function columnToProperty(string $columnName): string { if ($columnName === 'category') { return 'name'; @@ -63,6 +64,7 @@ class Tag extends Entity { * @param string $property the name of the property * @return string the column name */ + #[\Override] public function propertyToColumn(string $property): string { if ($property === 'name') { return 'category'; diff --git a/lib/private/Tags.php b/lib/private/Tags.php index d4f4b93e470..ec06259db70 100644 --- a/lib/private/Tags.php +++ b/lib/private/Tags.php @@ -72,6 +72,7 @@ class Tags implements ITags { * * @return boolean */ + #[\Override] public function isEmpty(): bool { return count($this->tags) === 0; } @@ -83,6 +84,7 @@ class Tags implements ITags { * @param string $id The ID of the tag that is going to be mapped * @return array|false */ + #[\Override] public function getTag(string $id) { $key = $this->getTagById($id); if ($key !== false) { @@ -102,6 +104,7 @@ class Tags implements ITags { * * @return array */ + #[\Override] public function getTags(): array { if (!count($this->tags)) { return []; @@ -142,6 +145,7 @@ class Tags implements ITags { * @return array>|false of tags id as key to array of tag names * or false if an error occurred */ + #[\Override] public function getTagsForObjects(array $objIds) { $entries = []; @@ -188,6 +192,7 @@ class Tags implements ITags { * @return int[]|false An array of object ids or false on error. * @throws \Exception */ + #[\Override] public function getIdsForTag($tag) { $tagId = false; if (is_numeric($tag)) { @@ -238,6 +243,7 @@ class Tags implements ITags { * @param string $name The tag name to check for. * @param string $user The user whose tags are to be checked. */ + #[\Override] public function userHasTag(string $name, string $user): bool { return $this->array_searchi($name, $this->getTagsForUser($user)) !== false; } @@ -247,6 +253,7 @@ class Tags implements ITags { * * @param string $name The tag name to check for. */ + #[\Override] public function hasTag(string $name): bool { return $this->getTagId($name) !== false; } @@ -257,6 +264,7 @@ class Tags implements ITags { * @param string $name A string with a name of the tag * @return false|int the id of the added tag or false on error. */ + #[\Override] public function add(string $name) { $name = trim($name); @@ -290,6 +298,7 @@ class Tags implements ITags { * @param string $to The new name of the tag. * @return bool */ + #[\Override] public function rename($from, string $to): bool { $from = trim($from); $to = trim($to); @@ -337,6 +346,7 @@ class Tags implements ITags { * @param int|null $id int Optional object id to add to this|these tag(s) * @return bool Returns false on error. */ + #[\Override] public function addMultiple($names, bool $sync = false, ?int $id = null): bool { if (!is_array($names)) { $names = [$names]; @@ -417,6 +427,7 @@ class Tags implements ITags { * @param array $ids The ids of the objects * @return boolean Returns false on error. */ + #[\Override] public function purgeObjects(array $ids): bool { if (count($ids) === 0) { // job done ;) @@ -443,6 +454,7 @@ class Tags implements ITags { * * @return array|false An array of object ids. */ + #[\Override] public function getFavorites() { if (!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) { return []; @@ -468,6 +480,7 @@ class Tags implements ITags { * @param int $objid The id of the object * @return boolean */ + #[\Override] public function addToFavorites($objid) { if (!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) { $this->add(ITags::TAG_FAVORITE); @@ -481,6 +494,7 @@ class Tags implements ITags { * @param int $objid The id of the object * @return boolean */ + #[\Override] public function removeFromFavorites($objid) { return $this->unTag($objid, ITags::TAG_FAVORITE); } @@ -488,6 +502,7 @@ class Tags implements ITags { /** * Creates a tag/object relation. */ + #[\Override] public function tagAs($objid, $tag, ?string $path = null) { if (is_string($tag) && !is_numeric($tag)) { $tag = trim($tag); @@ -536,6 +551,7 @@ class Tags implements ITags { /** * Delete single tag/object relation from the db */ + #[\Override] public function unTag($objid, $tag, ?string $path = null) { if (is_string($tag) && !is_numeric($tag)) { $tag = trim($tag); @@ -584,6 +600,7 @@ class Tags implements ITags { * @param string[]|integer[] $names An array of tags (names or IDs) to delete * @return bool Returns false on error */ + #[\Override] public function delete($names) { if (!is_array($names)) { $names = [$names]; diff --git a/lib/private/Talk/Broker.php b/lib/private/Talk/Broker.php index eaf5fad96c6..6feca955023 100644 --- a/lib/private/Talk/Broker.php +++ b/lib/private/Talk/Broker.php @@ -32,6 +32,7 @@ class Broker implements IBroker { ) { } + #[\Override] public function hasBackend(): bool { if ($this->hasBackend !== null) { return $this->hasBackend; @@ -66,10 +67,12 @@ class Broker implements IBroker { } } + #[\Override] public function newConversationOptions(): IConversationOptions { return ConversationOptions::default(); } + #[\Override] public function createConversation(string $name, array $moderators, ?IConversationOptions $options = null): IConversation { @@ -84,6 +87,7 @@ class Broker implements IBroker { ); } + #[\Override] public function deleteConversation(string $id): void { if (!$this->hasBackend()) { throw new NoBackendException('The Talk broker has no registered backend'); diff --git a/lib/private/Talk/ConversationOptions.php b/lib/private/Talk/ConversationOptions.php index f237491f355..eff5a44a4ab 100644 --- a/lib/private/Talk/ConversationOptions.php +++ b/lib/private/Talk/ConversationOptions.php @@ -23,25 +23,30 @@ class ConversationOptions implements IConversationOptions { return new self(false); } + #[\Override] public function setPublic(bool $isPublic = true): IConversationOptions { $this->isPublic = $isPublic; return $this; } + #[\Override] public function isPublic(): bool { return $this->isPublic; } + #[\Override] public function setMeetingDate(\DateTimeInterface $meetingStartDate, \DateTimeInterface $meetingEndDate): IConversationOptions { $this->meetingStartDate = $meetingStartDate; $this->meetingEndDate = $meetingEndDate; return $this; } + #[\Override] public function getMeetingStartDate(): ?\DateTimeInterface { return $this->meetingStartDate; } + #[\Override] public function getMeetingEndDate(): ?\DateTimeInterface { return $this->meetingEndDate; } diff --git a/lib/private/TaskProcessing/Db/TaskMapper.php b/lib/private/TaskProcessing/Db/TaskMapper.php index fd3b81c0dfb..544fefa40d2 100644 --- a/lib/private/TaskProcessing/Db/TaskMapper.php +++ b/lib/private/TaskProcessing/Db/TaskMapper.php @@ -216,6 +216,7 @@ class TaskMapper extends QBMapper { }; } + #[\Override] public function update(Entity $entity): Entity { $entity->setLastUpdated($this->timeFactory->now()->getTimestamp()); return parent::update($entity); diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index ef8ece9c823..4dd4fc36a24 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -197,6 +197,7 @@ class Manager implements IManager { ) { } + #[\Override] public function getId(): string { if ($this->provider instanceof IProviderWithId) { return $this->provider->getId(); @@ -204,10 +205,12 @@ class Manager implements IManager { return Manager::LEGACY_PREFIX_TEXTPROCESSING . $this->provider::class; } + #[\Override] public function getName(): string { return $this->provider->getName(); } + #[\Override] public function getTaskTypeId(): string { return match ($this->provider->getTaskType()) { FreePromptTaskType::class => TextToText::ID, @@ -218,6 +221,7 @@ class Manager implements IManager { }; } + #[\Override] public function getExpectedRuntime(): int { if ($this->provider instanceof IProviderWithExpectedRuntime) { return $this->provider->getExpectedRuntime(); @@ -225,14 +229,17 @@ class Manager implements IManager { return 60; } + #[\Override] public function getOptionalInputShape(): array { return []; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { if ($this->provider instanceof IProviderWithUserId) { $this->provider->setUserId($userId); @@ -244,26 +251,32 @@ class Manager implements IManager { } } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } @@ -301,22 +314,27 @@ class Manager implements IManager { $this->l = Server::get(IFactory::class)->get('core'); } + #[\Override] public function getId(): string { return Manager::LEGACY_PREFIX_TEXTPROCESSING . $this->oldTaskTypeClass; } + #[\Override] public function getName(): string { return $this->oldTaskType->getName(); } + #[\Override] public function getDescription(): string { return $this->oldTaskType->getDescription(); } + #[\Override] public function getInputShape(): array { return ['input' => new ShapeDescriptor($this->l->t('Input text'), $this->l->t('The input text'), EShapeType::Text)]; } + #[\Override] public function getOutputShape(): array { return ['output' => new ShapeDescriptor($this->l->t('Input text'), $this->l->t('The input text'), EShapeType::Text)]; } @@ -343,30 +361,37 @@ class Manager implements IManager { ) { } + #[\Override] public function getId(): string { return Manager::LEGACY_PREFIX_TEXTTOIMAGE . $this->provider->getId(); } + #[\Override] public function getName(): string { return $this->provider->getName(); } + #[\Override] public function getTaskTypeId(): string { return TextToImage::ID; } + #[\Override] public function getExpectedRuntime(): int { return $this->provider->getExpectedRuntime(); } + #[\Override] public function getOptionalInputShape(): array { return []; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { try { $folder = $this->appData->getFolder('text2image'); @@ -417,26 +442,32 @@ class Manager implements IManager { return ['images' => array_map(fn (ISimpleFile $file) => $file->getContent(), $files)]; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } @@ -486,6 +517,7 @@ class Manager implements IManager { ) { } + #[\Override] public function getId(): string { if ($this->provider instanceof ISpeechToTextProviderWithId) { return Manager::LEGACY_PREFIX_SPEECHTOTEXT . $this->provider->getId(); @@ -493,26 +525,32 @@ class Manager implements IManager { return Manager::LEGACY_PREFIX_SPEECHTOTEXT . $this->provider::class; } + #[\Override] public function getName(): string { return $this->provider->getName(); } + #[\Override] public function getTaskTypeId(): string { return AudioToText::ID; } + #[\Override] public function getExpectedRuntime(): int { return 60; } + #[\Override] public function getOptionalInputShape(): array { return []; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { if ($this->provider instanceof ISpeechToTextProviderWithUserId) { $this->provider->setUserId($userId); @@ -525,26 +563,32 @@ class Manager implements IManager { return ['output' => $result]; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } @@ -829,10 +873,12 @@ class Manager implements IManager { return array_combine($keys, $values); } + #[\Override] public function hasProviders(): bool { return count($this->getProviders()) !== 0; } + #[\Override] public function getProviders(): array { if ($this->providers === null) { $this->providers = $this->_getProviders(); @@ -841,6 +887,7 @@ class Manager implements IManager { return $this->providers; } + #[\Override] public function getPreferredProvider(string $taskTypeId) { try { if ($this->preferences === null) { @@ -878,6 +925,7 @@ class Manager implements IManager { throw new \OCP\TaskProcessing\Exception\Exception('No matching provider found'); } + #[\Override] public function getAvailableTaskTypes(bool $showDisabled = false, ?string $userId = null): array { // We cache by language, because some task type fields are translated $cacheKey = self::TASK_TYPES_CACHE_KEY . ':' . $this->l10nFactory->findLanguage(); @@ -940,6 +988,7 @@ class Manager implements IManager { return $this->availableTaskTypes; } + #[\Override] public function getAvailableTaskTypeIds(bool $showDisabled = false, ?string $userId = null): array { // userId will be obtained from the session if left to null if (!$this->checkGuestAccess($userId)) { @@ -1003,6 +1052,7 @@ class Manager implements IManager { return false; } + #[\Override] public function scheduleTask(Task $task): void { if (!$this->checkGuestAccess($task->getUserId())) { throw new PreConditionNotMetException('Access to this resource is forbidden for guests.'); @@ -1042,6 +1092,7 @@ class Manager implements IManager { } } + #[\Override] public function runTask(Task $task): Task { if (!$this->checkGuestAccess($task->getUserId())) { throw new PreConditionNotMetException('Access to this resource is forbidden for guests.'); @@ -1068,6 +1119,7 @@ class Manager implements IManager { return $task; } + #[\Override] public function processTask(Task $task, ISynchronousProvider $provider): bool { try { try { @@ -1103,11 +1155,13 @@ class Manager implements IManager { return true; } + #[\Override] public function deleteTask(Task $task): void { $taskEntity = \OC\TaskProcessing\Db\Task::fromPublicTask($task); $this->taskMapper->delete($taskEntity); } + #[\Override] public function getTask(int $id): Task { try { $taskEntity = $this->taskMapper->find($id); @@ -1121,6 +1175,7 @@ class Manager implements IManager { } } + #[\Override] public function cancelTask(int $id): void { $task = $this->getTask($id); if ($task->getStatus() !== Task::STATUS_SCHEDULED && $task->getStatus() !== Task::STATUS_RUNNING) { @@ -1137,6 +1192,7 @@ class Manager implements IManager { } } + #[\Override] public function setTaskProgress(int $id, float $progress): bool { // TODO: Not sure if we should rather catch the exceptions of getTask here and fail silently $task = $this->getTask($id); @@ -1158,6 +1214,7 @@ class Manager implements IManager { return true; } + #[\Override] public function setTaskResult(int $id, ?string $error, ?array $result, bool $isUsingFileIds = false, ?string $userFacingError = null): void { // TODO: Not sure if we should rather catch the exceptions of getTask here and fail silently $task = $this->getTask($id); @@ -1252,6 +1309,7 @@ class Manager implements IManager { $this->dispatcher->dispatchTyped($event); } + #[\Override] public function getNextScheduledTask(array $taskTypeIds = [], array $taskIdsToIgnore = []): Task { try { $taskEntity = $this->taskMapper->findOldestScheduledByType($taskTypeIds, $taskIdsToIgnore); @@ -1265,6 +1323,7 @@ class Manager implements IManager { } } + #[\Override] public function getNextScheduledTasks(array $taskTypeIds = [], array $taskIdsToIgnore = [], int $numberOfTasks = 1): array { try { return array_map(fn ($taskEntity) => $taskEntity->toPublicTask(), $this->taskMapper->findNOldestScheduledByType($taskTypeIds, $taskIdsToIgnore, $numberOfTasks)); @@ -1319,6 +1378,7 @@ class Manager implements IManager { return $newInputOutput; } + #[\Override] public function getUserTask(int $id, ?string $userId): Task { try { $taskEntity = $this->taskMapper->findByIdAndUser($id, $userId); @@ -1332,6 +1392,7 @@ class Manager implements IManager { } } + #[\Override] public function getUserTasks(?string $userId, ?string $taskTypeId = null, ?string $customId = null): array { try { $taskEntities = $this->taskMapper->findByUserAndTaskType($userId, $taskTypeId, $customId); @@ -1343,6 +1404,7 @@ class Manager implements IManager { } } + #[\Override] public function getTasks( ?string $userId, ?string $taskTypeId = null, ?string $appId = null, ?string $customId = null, ?int $status = null, ?int $scheduleAfter = null, ?int $endedBefore = null, @@ -1357,6 +1419,7 @@ class Manager implements IManager { } } + #[\Override] public function countTasks(int $status, array $taskTypeIds = []): int { try { return $this->taskMapper->countByStatus($taskTypeIds, $status); @@ -1365,6 +1428,7 @@ class Manager implements IManager { } } + #[\Override] public function getUserTasksByApp(?string $userId, string $appId, ?string $customId = null): array { try { $taskEntities = $this->taskMapper->findUserTasksByApp($userId, $appId, $customId); @@ -1425,6 +1489,7 @@ class Manager implements IManager { * @throws NotPermittedException * @throws ValidationException|UnauthorizedException */ + #[\Override] public function prepareInputData(Task $task): array { $taskTypes = $this->getAvailableTaskTypes(); $inputShape = $taskTypes[$task->getTaskTypeId()]['inputShape']; @@ -1435,6 +1500,7 @@ class Manager implements IManager { return $input; } + #[\Override] public function lockTask(Task $task): bool { $taskEntity = \OC\TaskProcessing\Db\Task::fromPublicTask($task); if ($this->taskMapper->lockTask($taskEntity) === 0) { @@ -1448,6 +1514,7 @@ class Manager implements IManager { * @throws \JsonException * @throws Exception */ + #[\Override] public function setTaskStatus(Task $task, int $status): void { $currentTaskStatus = $task->getStatus(); if ($currentTaskStatus === Task::STATUS_SCHEDULED && $status === Task::STATUS_RUNNING) { @@ -1602,6 +1669,7 @@ class Manager implements IManager { * @return list * @throws NotFoundException */ + #[\Override] public function extractFileIdsFromTask(Task $task): array { $ids = []; $taskTypes = $this->getAvailableTaskTypes(); diff --git a/lib/private/TaskProcessing/SynchronousBackgroundJob.php b/lib/private/TaskProcessing/SynchronousBackgroundJob.php index 19c53d59932..ec221635992 100644 --- a/lib/private/TaskProcessing/SynchronousBackgroundJob.php +++ b/lib/private/TaskProcessing/SynchronousBackgroundJob.php @@ -30,6 +30,7 @@ class SynchronousBackgroundJob extends QueuedJob { /** * @inheritDoc */ + #[\Override] protected function run($argument) { $providers = $this->taskProcessingManager->getProviders(); diff --git a/lib/private/Teams/TeamManager.php b/lib/private/Teams/TeamManager.php index fea2ccc9587..8e838365ed8 100644 --- a/lib/private/Teams/TeamManager.php +++ b/lib/private/Teams/TeamManager.php @@ -32,10 +32,12 @@ class TeamManager implements ITeamManager { ) { } + #[\Override] public function hasTeamSupport(): bool { return $this->circlesManager !== null; } + #[\Override] public function getProviders(): array { if (!$this->hasTeamSupport()) { return []; @@ -57,6 +59,7 @@ class TeamManager implements ITeamManager { return $this->providers; } + #[\Override] public function getProvider(string $providerId): ITeamResourceProvider { $providers = $this->getProviders(); if (isset($providers[$providerId])) { @@ -66,6 +69,7 @@ class TeamManager implements ITeamManager { throw new \RuntimeException('No provider found for id ' . $providerId); } + #[\Override] public function getSharedWith(string $teamId, string $userId): array { if (!$this->hasTeamSupport()) { return []; @@ -84,6 +88,7 @@ class TeamManager implements ITeamManager { return array_values($resources); } + #[\Override] public function getSharedWithList(array $teams, string $userId, string $resourceId): array { if (!$this->hasTeamSupport()) { return []; @@ -103,6 +108,7 @@ class TeamManager implements ITeamManager { return array_merge_recursive(...$resources); } + #[\Override] public function getTeamsForResource(string $providerId, string $resourceId, string $userId): array { if (!$this->hasTeamSupport()) { return []; @@ -137,6 +143,7 @@ class TeamManager implements ITeamManager { * * @return array userId => displayName */ + #[\Override] public function getMembersOfTeam(string $teamId, string $userId): array { $team = $this->getTeam($teamId, $userId); if ($team === null) { @@ -163,6 +170,7 @@ class TeamManager implements ITeamManager { return $this->circlesManager->getCirclesByIds($teams); } + #[\Override] public function getTeamsForUser(string $userId): array { if (!$this->hasTeamSupport()) { return []; diff --git a/lib/private/TempManager.php b/lib/private/TempManager.php index 052b1845add..c45912f03bb 100644 --- a/lib/private/TempManager.php +++ b/lib/private/TempManager.php @@ -44,6 +44,7 @@ class TempManager implements ITempManager { return $absolutePath . $postFix; } + #[\Override] public function getTemporaryFile($postFix = ''): string|false { $path = $this->generateTemporaryPath($postFix); @@ -65,6 +66,7 @@ class TempManager implements ITempManager { return $path; } + #[\Override] public function getTemporaryFolder($postFix = ''): string|false { $path = $this->generateTemporaryPath($postFix) . '/'; @@ -85,6 +87,7 @@ class TempManager implements ITempManager { /** * Remove the temporary files and folders generated during this request */ + #[\Override] public function clean() { $this->cleanFiles($this->current); } @@ -113,6 +116,7 @@ class TempManager implements ITempManager { /** * Remove old temporary files and folders that were failed to be cleaned */ + #[\Override] public function cleanOld() { $this->cleanFiles($this->getOldFiles()); } @@ -146,6 +150,7 @@ class TempManager implements ITempManager { * @return string Path to the temporary directory or null * @throws \UnexpectedValueException */ + #[\Override] public function getTempBaseDir(): string { if ($this->tmpBaseDir) { return $this->tmpBaseDir; diff --git a/lib/private/Template/CSSResourceLocator.php b/lib/private/Template/CSSResourceLocator.php index f77bfca0562..9de9b4c608a 100644 --- a/lib/private/Template/CSSResourceLocator.php +++ b/lib/private/Template/CSSResourceLocator.php @@ -24,6 +24,7 @@ class CSSResourceLocator extends ResourceLocator { parent::__construct($logger, $config); } + #[\Override] public function doFind(string $resource): void { $parts = explode('/', $resource); if (count($parts) < 2) { @@ -57,6 +58,7 @@ class CSSResourceLocator extends ResourceLocator { $this->append($app_path, join('/', array_slice($parts, 1)) . '.css', $app_url); } + #[\Override] public function doFindTheme(string $resource): void { $theme_dir = 'themes/' . $this->theme . '/'; $this->appendIfExist($this->serverroot, $theme_dir . 'apps/' . $resource . '.css') @@ -64,6 +66,7 @@ class CSSResourceLocator extends ResourceLocator { || $this->appendIfExist($this->serverroot, $theme_dir . 'core/' . $resource . '.css'); } + #[\Override] public function append(string $root, string $file, ?string $webRoot = null, bool $throw = true, bool $scss = false): void { if (!$scss) { parent::append($root, $file, $webRoot, $throw); diff --git a/lib/private/Template/JSResourceLocator.php b/lib/private/Template/JSResourceLocator.php index fc35b6c3128..7353b3c77fd 100644 --- a/lib/private/Template/JSResourceLocator.php +++ b/lib/private/Template/JSResourceLocator.php @@ -25,6 +25,7 @@ class JSResourceLocator extends ResourceLocator { parent::__construct($logger, $config); } + #[\Override] public function doFind(string $resource): void { $theme_dir = 'themes/' . $this->theme . '/'; @@ -89,6 +90,7 @@ class JSResourceLocator extends ResourceLocator { ]); } + #[\Override] public function doFindTheme(string $resource): void { } diff --git a/lib/private/Template/Template.php b/lib/private/Template/Template.php index 040c1daf19e..f7d14f9cbb5 100644 --- a/lib/private/Template/Template.php +++ b/lib/private/Template/Template.php @@ -108,6 +108,7 @@ class Template extends Base implements ITemplate { * This function process the template. If $this->renderAs is set, it * will produce a full page. */ + #[\Override] public function fetchPage(?array $additionalParams = null): string { $data = parent::fetchPage($additionalParams); diff --git a/lib/private/Template/TemplateManager.php b/lib/private/Template/TemplateManager.php index 0f0af51798a..810400e5ac4 100644 --- a/lib/private/Template/TemplateManager.php +++ b/lib/private/Template/TemplateManager.php @@ -32,6 +32,7 @@ class TemplateManager implements ITemplateManager { * @param TemplateResponse::RENDER_AS_* $renderAs * @throws TemplateNotFoundException if the template cannot be found */ + #[\Override] public function getTemplate(string $app, string $name, string $renderAs = TemplateResponse::RENDER_AS_BLANK, bool $registerCall = true): ITemplate { return new Template($app, $name, $renderAs, $registerCall); } @@ -42,6 +43,7 @@ class TemplateManager implements ITemplateManager { * @param string $name Name of the template * @param array $parameters Parameters for the template */ + #[\Override] public function printGuestPage(string $application, string $name, array $parameters = []): void { $content = $this->getTemplate($application, $name, $name === 'error' ? $name : 'guest'); foreach ($parameters as $key => $value) { @@ -55,6 +57,7 @@ class TemplateManager implements ITemplateManager { * @param string $error_msg The error message to show * @param string $hint An optional hint message - needs to be properly escape */ + #[\Override] public function printErrorPage(string $error_msg, string $hint = '', int $statusCode = 500): never { if ($this->appManager->isEnabledForUser('theming') && !$this->appManager->isAppLoaded('theming')) { $this->appManager->loadApp('theming'); @@ -109,6 +112,7 @@ class TemplateManager implements ITemplateManager { /** * print error page using Exception details */ + #[\Override] public function printExceptionErrorPage(\Throwable $exception, int $statusCode = 503): never { $debug = false; http_response_code($statusCode); diff --git a/lib/private/TextProcessing/Db/TaskMapper.php b/lib/private/TextProcessing/Db/TaskMapper.php index b03e5833958..cafcae24362 100644 --- a/lib/private/TextProcessing/Db/TaskMapper.php +++ b/lib/private/TextProcessing/Db/TaskMapper.php @@ -95,6 +95,7 @@ class TaskMapper extends QBMapper { return $qb->executeStatement(); } + #[\Override] public function update(Entity $entity): Entity { $entity->setLastUpdated($this->timeFactory->now()->getTimestamp()); return parent::update($entity); diff --git a/lib/private/TextProcessing/Manager.php b/lib/private/TextProcessing/Manager.php index 3fe45ce55ec..ea2f1d2a5d2 100644 --- a/lib/private/TextProcessing/Manager.php +++ b/lib/private/TextProcessing/Manager.php @@ -62,6 +62,7 @@ class Manager implements IManager { ) { } + #[\Override] public function getProviders(): array { $context = $this->coordinator->getRegistrationContext(); if ($context === null) { @@ -88,6 +89,7 @@ class Manager implements IManager { return $this->providers; } + #[\Override] public function hasProviders(): bool { // check if task processing equivalent types are available $taskTaskTypes = $this->taskProcessingManager->getAvailableTaskTypes(); @@ -107,6 +109,7 @@ class Manager implements IManager { /** * @inheritDoc */ + #[\Override] public function getAvailableTaskTypes(): array { $tasks = []; foreach ($this->getProviders() as $provider) { @@ -131,6 +134,7 @@ class Manager implements IManager { /** * @inheritDoc */ + #[\Override] public function runTask(OCPTask $task): string { // try to run a task processing task if possible $taskTypeClass = $task->getType(); @@ -215,6 +219,7 @@ class Manager implements IManager { /** * @inheritDoc */ + #[\Override] public function scheduleTask(OCPTask $task): void { if (!$this->canHandleTask($task)) { throw new PreConditionNotMetException('No LanguageModel provider is installed that can handle this task'); @@ -245,6 +250,7 @@ class Manager implements IManager { /** * @inheritDoc */ + #[\Override] public function runOrScheduleTask(OCPTask $task): bool { if (!$this->canHandleTask($task)) { throw new PreConditionNotMetException('No LanguageModel provider is installed that can handle this task'); @@ -264,6 +270,7 @@ class Manager implements IManager { /** * @inheritDoc */ + #[\Override] public function deleteTask(Task $task): void { $taskEntity = DbTask::fromPublicTask($task); $this->taskMapper->delete($taskEntity); @@ -280,6 +287,7 @@ class Manager implements IManager { * @throws RuntimeException If the query failed * @throws NotFoundException If the task could not be found */ + #[\Override] public function getTask(int $id): OCPTask { try { $taskEntity = $this->taskMapper->find($id); @@ -303,6 +311,7 @@ class Manager implements IManager { * @throws RuntimeException If the query failed * @throws NotFoundException If the task could not be found */ + #[\Override] public function getUserTask(int $id, ?string $userId): OCPTask { try { $taskEntity = $this->taskMapper->findByIdAndUser($id, $userId); @@ -326,6 +335,7 @@ class Manager implements IManager { * @param string|null $identifier * @return array */ + #[\Override] public function getUserTasksByApp(string $userId, string $appId, ?string $identifier = null): array { try { $taskEntities = $this->taskMapper->findUserTasksByApp($userId, $appId, $identifier); diff --git a/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php b/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php index be5e4127d08..2c120d8aac5 100644 --- a/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php @@ -33,6 +33,7 @@ class RemoveOldTasksBackgroundJob extends TimedJob { * @param mixed $argument * @inheritDoc */ + #[\Override] protected function run($argument) { try { $this->taskMapper->deleteOlderThan(self::MAX_TASK_AGE_SECONDS); diff --git a/lib/private/TextProcessing/TaskBackgroundJob.php b/lib/private/TextProcessing/TaskBackgroundJob.php index 2942fd7d0aa..e44adf8b179 100644 --- a/lib/private/TextProcessing/TaskBackgroundJob.php +++ b/lib/private/TextProcessing/TaskBackgroundJob.php @@ -33,6 +33,7 @@ class TaskBackgroundJob extends QueuedJob { * @param array{taskId: int} $argument * @inheritDoc */ + #[\Override] protected function run($argument) { $taskId = $argument['taskId']; $task = $this->textProcessingManager->getTask($taskId); diff --git a/lib/private/TextToImage/Db/TaskMapper.php b/lib/private/TextToImage/Db/TaskMapper.php index 37f492e14cf..f500443f70b 100644 --- a/lib/private/TextToImage/Db/TaskMapper.php +++ b/lib/private/TextToImage/Db/TaskMapper.php @@ -104,6 +104,7 @@ class TaskMapper extends QBMapper { return $deletedTasks; } + #[\Override] public function update(Entity $entity): Entity { $entity->setLastUpdated($this->timeFactory->getDateTime()); return parent::update($entity); diff --git a/lib/private/TextToImage/Manager.php b/lib/private/TextToImage/Manager.php index eec6cc3d241..330b130f075 100644 --- a/lib/private/TextToImage/Manager.php +++ b/lib/private/TextToImage/Manager.php @@ -53,6 +53,7 @@ class Manager implements IManager { /** * @inheritDoc */ + #[\Override] public function getProviders(): array { $context = $this->coordinator->getRegistrationContext(); if ($context === null) { @@ -84,6 +85,7 @@ class Manager implements IManager { /** * @inheritDoc */ + #[\Override] public function hasProviders(): bool { $context = $this->coordinator->getRegistrationContext(); if ($context === null) { @@ -95,6 +97,7 @@ class Manager implements IManager { /** * @inheritDoc */ + #[\Override] public function runTask(Task $task): void { $this->logger->debug('Running TextToImage Task'); if (!$this->hasProviders()) { @@ -191,6 +194,7 @@ class Manager implements IManager { /** * @inheritDoc */ + #[\Override] public function scheduleTask(Task $task): void { if (!$this->hasProviders()) { throw new PreConditionNotMetException('No text to image provider is installed that can handle this task'); @@ -211,6 +215,7 @@ class Manager implements IManager { /** * @inheritDoc */ + #[\Override] public function runOrScheduleTask(Task $task) : void { if (!$this->hasProviders()) { throw new PreConditionNotMetException('No text to image provider is installed that can handle this task'); @@ -228,6 +233,7 @@ class Manager implements IManager { /** * @inheritDoc */ + #[\Override] public function deleteTask(Task $task): void { $taskEntity = DbTask::fromPublicTask($task); $this->taskMapper->delete($taskEntity); @@ -244,6 +250,7 @@ class Manager implements IManager { * @throws RuntimeException If the query failed * @throws TaskNotFoundException If the task could not be found */ + #[\Override] public function getTask(int $id): Task { try { $taskEntity = $this->taskMapper->find($id); @@ -267,6 +274,7 @@ class Manager implements IManager { * @throws RuntimeException If the query failed * @throws TaskNotFoundException If the task could not be found */ + #[\Override] public function getUserTask(int $id, ?string $userId): Task { try { $taskEntity = $this->taskMapper->findByIdAndUser($id, $userId); @@ -291,6 +299,7 @@ class Manager implements IManager { * @return Task[] * @throws RuntimeException */ + #[\Override] public function getUserTasksByApp(?string $userId, string $appId, ?string $identifier = null): array { try { $taskEntities = $this->taskMapper->findUserTasksByApp($userId, $appId, $identifier); diff --git a/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php b/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php index 225984a7956..7a38b847948 100644 --- a/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php @@ -41,6 +41,7 @@ class RemoveOldTasksBackgroundJob extends TimedJob { * @param mixed $argument * @inheritDoc */ + #[\Override] protected function run($argument) { try { $deletedTasks = $this->taskMapper->deleteOlderThan(self::MAX_TASK_AGE_SECONDS); diff --git a/lib/private/TextToImage/TaskBackgroundJob.php b/lib/private/TextToImage/TaskBackgroundJob.php index 16990005530..8127addca50 100644 --- a/lib/private/TextToImage/TaskBackgroundJob.php +++ b/lib/private/TextToImage/TaskBackgroundJob.php @@ -33,6 +33,7 @@ class TaskBackgroundJob extends QueuedJob { * @param array{taskId: int} $argument * @inheritDoc */ + #[\Override] protected function run($argument) { $taskId = $argument['taskId']; $task = $this->text2imageManager->getTask($taskId); diff --git a/lib/private/Translation/TranslationManager.php b/lib/private/Translation/TranslationManager.php index 08f9f36678a..a4d7138531a 100644 --- a/lib/private/Translation/TranslationManager.php +++ b/lib/private/Translation/TranslationManager.php @@ -41,6 +41,7 @@ class TranslationManager implements ITranslationManager { ) { } + #[\Override] public function getLanguages(): array { $languages = []; foreach ($this->getProviders() as $provider) { @@ -49,6 +50,7 @@ class TranslationManager implements ITranslationManager { return $languages; } + #[\Override] public function translate(string $text, ?string &$fromLanguage, string $toLanguage): string { if (!$this->hasProviders()) { throw new PreConditionNotMetException('No translation providers available'); @@ -112,6 +114,7 @@ class TranslationManager implements ITranslationManager { throw new CouldNotTranslateException($fromLanguage); } + #[\Override] public function getProviders(): array { $context = $this->coordinator->getRegistrationContext(); @@ -134,11 +137,13 @@ class TranslationManager implements ITranslationManager { return $this->providers; } + #[\Override] public function hasProviders(): bool { $context = $this->coordinator->getRegistrationContext(); return !empty($context->getTranslationProviders()); } + #[\Override] public function canDetectLanguage(): bool { foreach ($this->getProviders() as $provider) { if ($provider instanceof IDetectLanguageProvider) { diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index 0debd9ba99a..2c7070f1c2d 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -60,6 +60,7 @@ class URLGenerator implements IURLGenerator { * * Returns a url to the given route. */ + #[\Override] public function linkToRoute(string $routeName, array $arguments = []): string { return $this->router->generate($routeName, $arguments); } @@ -72,10 +73,12 @@ class URLGenerator implements IURLGenerator { * * Returns an absolute url to the given route. */ + #[\Override] public function linkToRouteAbsolute(string $routeName, array $arguments = []): string { return $this->getAbsoluteURL($this->linkToRoute($routeName, $arguments)); } + #[\Override] public function linkToOCSRouteAbsolute(string $routeName, array $arguments = []): string { // Returns `/subfolder/index.php/ocsapp/…` with `'htaccess.IgnoreFrontController' => false` in config.php // And `/subfolder/ocsapp/…` with `'htaccess.IgnoreFrontController' => true` in config.php @@ -110,6 +113,7 @@ class URLGenerator implements IURLGenerator { * * Returns a url to the given app and file. */ + #[\Override] public function linkTo(string $appName, string $file, array $args = []): string { $frontControllerActive = ($this->config->getSystemValueBool('htaccess.IgnoreFrontController', false) || getenv('front_controller_active') === 'true'); @@ -158,6 +162,7 @@ class URLGenerator implements IURLGenerator { * * Returns the path to the image. */ + #[\Override] public function imagePath(string $appName, string $file): string { $cache = $this->cacheFactory->createDistributed('imagePath-' . md5($this->getBaseUrl()) . '-'); $cacheKey = $appName . '-' . $file; @@ -241,6 +246,7 @@ class URLGenerator implements IURLGenerator { * @param string $url the url in the Nextcloud host * @return string the absolute version of the url */ + #[\Override] public function getAbsoluteURL(string $url): string { $separator = str_starts_with($url, '/') ? '' : '/'; @@ -259,6 +265,7 @@ class URLGenerator implements IURLGenerator { * @param string $key * @return string url to the online documentation */ + #[\Override] public function linkToDocs(string $key): string { $theme = Server::get('ThemingDefaults'); return $theme->buildDocLinkToKey($key); @@ -269,6 +276,7 @@ class URLGenerator implements IURLGenerator { * and the apps visible for the current user * @return string */ + #[\Override] public function linkToDefaultPageUrl(): string { // Deny the redirect if the URL contains a @ // This prevents unvalidated redirects like ?redirect_url=:user@domain.com @@ -302,6 +310,7 @@ class URLGenerator implements IURLGenerator { /** * @return string base url of the current request */ + #[\Override] public function getBaseUrl(): string { // BaseUrl can be equal to 'http(s)://' during the first steps of the initial setup. if ($this->baseUrl === null || $this->baseUrl === 'http://' || $this->baseUrl === 'https://') { @@ -313,6 +322,7 @@ class URLGenerator implements IURLGenerator { /** * @return string webroot part of the base url */ + #[\Override] public function getWebroot(): string { return \OC::$WEBROOT; } diff --git a/lib/private/User/AvailabilityCoordinator.php b/lib/private/User/AvailabilityCoordinator.php index 988f2e55260..32535711817 100644 --- a/lib/private/User/AvailabilityCoordinator.php +++ b/lib/private/User/AvailabilityCoordinator.php @@ -34,6 +34,7 @@ class AvailabilityCoordinator implements IAvailabilityCoordinator { $this->cache = $cacheFactory->createLocal('OutOfOfficeData'); } + #[\Override] public function isEnabled(): bool { return $this->config->getAppValue(Application::APP_ID, 'hide_absence_settings', 'no') === 'no'; } @@ -87,6 +88,7 @@ class AvailabilityCoordinator implements IAvailabilityCoordinator { $this->cache->set($data->getUser()->getUID(), $cachedString, 300); } + #[\Override] public function getCurrentOutOfOfficeData(IUser $user): ?IOutOfOfficeData { $timezone = $this->getCachedTimezone($user->getUID()); if ($timezone === null) { @@ -115,11 +117,13 @@ class AvailabilityCoordinator implements IAvailabilityCoordinator { $this->cache->set($userId . '_timezone', $timezone, 3600); } + #[\Override] public function clearCache(string $userId): void { $this->cache->set($userId, null, 300); $this->cache->set($userId . '_timezone', null, 3600); } + #[\Override] public function isInEffect(IOutOfOfficeData $data): bool { return $this->absenceService->isInEffect($data); } diff --git a/lib/private/User/Backend.php b/lib/private/User/Backend.php index 9b6a9a890ef..878a7ae8c7e 100644 --- a/lib/private/User/Backend.php +++ b/lib/private/User/Backend.php @@ -68,6 +68,7 @@ abstract class Backend implements UserInterface { * Returns the supported actions as int to be * compared with self::CREATE_USER etc. */ + #[\Override] public function implementsActions($actions) { return (bool)($this->getSupportedActions() & $actions); } @@ -79,6 +80,7 @@ abstract class Backend implements UserInterface { * * Deletes a user */ + #[\Override] public function deleteUser($uid) { return false; } @@ -91,6 +93,7 @@ abstract class Backend implements UserInterface { * @param null|int $offset * @return string[] an array of all uids */ + #[\Override] public function getUsers($search = '', $limit = null, $offset = null) { return []; } @@ -100,6 +103,7 @@ abstract class Backend implements UserInterface { * @param string $uid the username * @return boolean */ + #[\Override] public function userExists($uid) { return false; } @@ -118,6 +122,7 @@ abstract class Backend implements UserInterface { * @param string $uid user ID of the user * @return string display name */ + #[\Override] public function getDisplayName($uid) { return $uid; } @@ -130,6 +135,7 @@ abstract class Backend implements UserInterface { * @param int|null $offset * @return array an array of all displayNames (value) and the corresponding uids (key) */ + #[\Override] public function getDisplayNames($search = '', $limit = null, $offset = null) { $displayNames = []; $users = $this->getUsers($search, $limit, $offset); @@ -143,6 +149,7 @@ abstract class Backend implements UserInterface { * Check if a user list is available or not * @return boolean if users can be listed or not */ + #[\Override] public function hasUserListings() { return false; } diff --git a/lib/private/User/BackgroundJobs/CleanupDeletedUsers.php b/lib/private/User/BackgroundJobs/CleanupDeletedUsers.php index 0adb7861670..983ff73be65 100644 --- a/lib/private/User/BackgroundJobs/CleanupDeletedUsers.php +++ b/lib/private/User/BackgroundJobs/CleanupDeletedUsers.php @@ -30,6 +30,7 @@ class CleanupDeletedUsers extends TimedJob { $this->setInterval(24 * 60 * 60); } + #[\Override] protected function run($argument): void { $backend = new PartiallyDeletedUsersBackend($this->config); $users = $backend->getUsers(); diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index 7877deff62f..d65ef769c52 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -82,6 +82,7 @@ class Database extends ABackend implements * Creates a new user. Basic checking of username is done in OC_User * itself, not in its subclasses. */ + #[\Override] public function createUser(string $uid, string $password): bool { if ($this->userExists($uid)) { return false; @@ -116,6 +117,7 @@ class Database extends ABackend implements * @param string $uid The username of the user to delete * @return bool */ + #[\Override] public function deleteUser($uid) { // Delete user-group-relation $dbConn = $this->getDbConnection(); @@ -157,6 +159,7 @@ class Database extends ABackend implements * * Change the password of a user */ + #[\Override] public function setPassword(string $uid, string $password): bool { if (!$this->userExists($uid)) { return false; @@ -176,6 +179,7 @@ class Database extends ABackend implements return $return; } + #[\Override] public function getPasswordHash(string $userId): ?string { if (!$this->userExists($userId)) { return null; @@ -199,6 +203,7 @@ class Database extends ABackend implements return $hash; } + #[\Override] public function setPasswordHash(string $userId, string $passwordHash): bool { if (!Server::get(IHasher::class)->validate($passwordHash)) { throw new InvalidArgumentException(); @@ -224,6 +229,7 @@ class Database extends ABackend implements * * Change the display name of a user */ + #[\Override] public function setDisplayName(string $uid, string $displayName): bool { if (mb_strlen($displayName) > 64) { throw new \InvalidArgumentException('Invalid displayname'); @@ -251,6 +257,7 @@ class Database extends ABackend implements * @param string $uid user ID of the user * @return string display name */ + #[\Override] public function getDisplayName($uid): string { $uid = (string)$uid; $this->loadUser($uid); @@ -265,6 +272,7 @@ class Database extends ABackend implements * @param int|null $offset * @return array an array of all displayNames (value) and the corresponding uids (key) */ + #[\Override] public function getDisplayNames($search = '', $limit = null, $offset = null) { $limit = $this->fixLimit($limit); @@ -304,6 +312,7 @@ class Database extends ABackend implements * @return array * @since 21.0.1 */ + #[\Override] public function searchKnownUsersByDisplayName(string $searcher, string $pattern, ?int $limit = null, ?int $offset = null): array { $limit = $this->fixLimit($limit); @@ -345,6 +354,7 @@ class Database extends ABackend implements * Check if the password is correct without logging in the user * returns the user id or false */ + #[\Override] public function checkPassword(string $loginName, string $password) { $found = $this->loadUser($loginName); @@ -433,6 +443,7 @@ class Database extends ABackend implements * @param null|int $offset * @return string[] an array of all uids */ + #[\Override] public function getUsers($search = '', $limit = null, $offset = null) { $limit = $this->fixLimit($limit); @@ -450,6 +461,7 @@ class Database extends ABackend implements * @param string $uid the username * @return boolean */ + #[\Override] public function userExists($uid) { return $this->loadUser($uid); } @@ -460,6 +472,7 @@ class Database extends ABackend implements * @param string $uid the username * @return string|false */ + #[\Override] public function getHome(string $uid) { if ($this->userExists($uid)) { return $this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $uid; @@ -471,6 +484,7 @@ class Database extends ABackend implements /** * @return bool */ + #[\Override] public function hasUserListings() { return true; } @@ -478,6 +492,7 @@ class Database extends ABackend implements /** * counts the users in the database */ + #[\Override] public function countUsers(int $limit = 0): int|false { $dbConn = $this->getDbConnection(); $query = $dbConn->getQueryBuilder(); @@ -510,6 +525,7 @@ class Database extends ABackend implements * * @return string the name of the backend to be shown */ + #[\Override] public function getBackendName() { return 'Database'; } @@ -532,6 +548,7 @@ class Database extends ABackend implements } } + #[\Override] public function getRealUID(string $uid): string { if (!$this->userExists($uid)) { throw new \RuntimeException($uid . ' does not exist'); diff --git a/lib/private/User/DisplayNameCache.php b/lib/private/User/DisplayNameCache.php index 96386ca35f2..186fef23602 100644 --- a/lib/private/User/DisplayNameCache.php +++ b/lib/private/User/DisplayNameCache.php @@ -69,6 +69,7 @@ class DisplayNameCache implements IEventListener { $this->memCache->clear(); } + #[\Override] public function handle(Event $event): void { if ($event instanceof UserChangedEvent && $event->getFeature() === 'displayName') { $userId = $event->getUser()->getUID(); diff --git a/lib/private/User/LazyUser.php b/lib/private/User/LazyUser.php index f7b0dd23c6c..3ae6a557a2d 100644 --- a/lib/private/User/LazyUser.php +++ b/lib/private/User/LazyUser.php @@ -41,10 +41,12 @@ class LazyUser implements IUser { return $this->user; } + #[\Override] public function getUID(): string { return $this->uid; } + #[\Override] public function getDisplayName() { if ($this->displayName) { return $this->displayName; @@ -53,126 +55,157 @@ class LazyUser implements IUser { return $this->userManager->getDisplayName($this->uid) ?? $this->uid; } + #[\Override] public function setDisplayName($displayName) { return $this->getUser()->setDisplayName($displayName); } + #[\Override] public function getLastLogin(): int { return $this->getUser()->getLastLogin(); } + #[\Override] public function getFirstLogin(): int { return $this->getUser()->getFirstLogin(); } + #[\Override] public function updateLastLoginTimestamp(): bool { return $this->getUser()->updateLastLoginTimestamp(); } + #[\Override] public function delete() { return $this->getUser()->delete(); } + #[\Override] public function setPassword($password, $recoveryPassword = null) { return $this->getUser()->setPassword($password, $recoveryPassword); } + #[\Override] public function getPasswordHash(): ?string { return $this->getUser()->getPasswordHash(); } + #[\Override] public function setPasswordHash(string $passwordHash): bool { return $this->getUser()->setPasswordHash($passwordHash); } + #[\Override] public function getHome() { return $this->getUser()->getHome(); } + #[\Override] public function getBackendClassName() { return $this->getUser()->getBackendClassName(); } + #[\Override] public function getBackend(): ?UserInterface { return $this->getUser()->getBackend(); } + #[\Override] public function canChangeAvatar(): bool { return $this->getUser()->canChangeAvatar(); } + #[\Override] public function canChangePassword(): bool { return $this->getUser()->canChangePassword(); } + #[\Override] public function canChangeDisplayName(): bool { return $this->getUser()->canChangeDisplayName(); } + #[\Override] public function canChangeEmail(): bool { return $this->getUser()->canChangeEmail(); } + #[\Override] public function canEditProperty(string $property): bool { return $this->getUser()->canEditProperty($property); } + #[\Override] public function isEnabled() { return $this->getUser()->isEnabled(); } + #[\Override] public function setEnabled(bool $enabled = true) { return $this->getUser()->setEnabled($enabled); } + #[\Override] public function getEMailAddress() { return $this->getUser()->getEMailAddress(); } + #[\Override] public function getSystemEMailAddress(): ?string { return $this->getUser()->getSystemEMailAddress(); } + #[\Override] public function getPrimaryEMailAddress(): ?string { return $this->getUser()->getPrimaryEMailAddress(); } + #[\Override] public function getAvatarImage($size) { return $this->getUser()->getAvatarImage($size); } + #[\Override] public function getCloudId() { return $this->getUser()->getCloudId(); } + #[\Override] public function setEMailAddress($mailAddress) { $this->getUser()->setEMailAddress($mailAddress); } + #[\Override] public function setSystemEMailAddress(string $mailAddress): void { $this->getUser()->setSystemEMailAddress($mailAddress); } + #[\Override] public function setPrimaryEMailAddress(string $mailAddress): void { $this->getUser()->setPrimaryEMailAddress($mailAddress); } + #[\Override] public function getQuota() { return $this->getUser()->getQuota(); } + #[\Override] public function getQuotaBytes(): int|float { return $this->getUser()->getQuotaBytes(); } + #[\Override] public function setQuota($quota) { $this->getUser()->setQuota($quota); } + #[\Override] public function getManagerUids(): array { return $this->getUser()->getManagerUids(); } + #[\Override] public function setManagerUids(array $uids): void { $this->getUser()->setManagerUids($uids); } diff --git a/lib/private/User/Listeners/BeforeUserDeletedListener.php b/lib/private/User/Listeners/BeforeUserDeletedListener.php index c5d7efa767a..322b4e9f94a 100644 --- a/lib/private/User/Listeners/BeforeUserDeletedListener.php +++ b/lib/private/User/Listeners/BeforeUserDeletedListener.php @@ -27,6 +27,7 @@ class BeforeUserDeletedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof BeforeUserDeletedEvent)) { return; diff --git a/lib/private/User/Listeners/UserChangedListener.php b/lib/private/User/Listeners/UserChangedListener.php index 4dd4439574d..7ce6f8126f1 100644 --- a/lib/private/User/Listeners/UserChangedListener.php +++ b/lib/private/User/Listeners/UserChangedListener.php @@ -23,6 +23,7 @@ class UserChangedListener implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof UserChangedEvent)) { return; diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index 5c899b7892f..6aa9784e2bd 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -88,14 +88,17 @@ class Manager extends PublicEmitter implements IUserManager { * Get the active backends * @return UserInterface[] */ + #[\Override] public function getBackends(): array { return $this->backends; } + #[\Override] public function registerBackend(UserInterface $backend): void { $this->backends[] = $backend; } + #[\Override] public function removeBackend(UserInterface $backend): void { $this->cachedUsers = []; if (($i = array_search($backend, $this->backends)) !== false) { @@ -103,6 +106,7 @@ class Manager extends PublicEmitter implements IUserManager { } } + #[\Override] public function clearBackends(): void { $this->cachedUsers = []; $this->backends = []; @@ -114,6 +118,7 @@ class Manager extends PublicEmitter implements IUserManager { * @param string $uid * @return User|null Either the user or null if the specified user does not exist */ + #[\Override] public function get($uid) { if (is_null($uid) || $uid === '' || $uid === false) { return null; @@ -150,6 +155,7 @@ class Manager extends PublicEmitter implements IUserManager { return null; } + #[\Override] public function getDisplayName(string $uid): ?string { return $this->displayNameCache->getDisplayName($uid); } @@ -184,6 +190,7 @@ class Manager extends PublicEmitter implements IUserManager { * @param string $uid * @return bool */ + #[\Override] public function userExists($uid) { if (strlen($uid) > IUser::MAX_USERID_LENGTH) { return false; @@ -200,6 +207,7 @@ class Manager extends PublicEmitter implements IUserManager { * @param string $password * @return IUser|false the User object on success, false otherwise */ + #[\Override] public function checkPassword($loginName, $password) { $result = $this->checkPasswordNoLogging($loginName, $password); @@ -256,6 +264,7 @@ class Manager extends PublicEmitter implements IUserManager { return false; } + #[\Override] public function search($pattern, $limit = null, $offset = null) { $users = []; foreach ($this->backends as $backend) { @@ -273,6 +282,7 @@ class Manager extends PublicEmitter implements IUserManager { return $users; } + #[\Override] public function searchDisplayName($pattern, $limit = null, $offset = null) { $users = []; foreach ($this->backends as $backend) { @@ -293,6 +303,7 @@ class Manager extends PublicEmitter implements IUserManager { /** * @return IUser[] */ + #[\Override] public function getDisabledUsers(?int $limit = null, int $offset = 0, string $search = ''): array { $users = $this->config->getUsersForUserValue('core', 'enabled', 'false'); $users = array_combine( @@ -342,6 +353,7 @@ class Manager extends PublicEmitter implements IUserManager { * @param int|null $offset * @return IUser[] */ + #[\Override] public function searchKnownUsersByDisplayName(string $searcher, string $pattern, ?int $limit = null, ?int $offset = null): array { $users = []; foreach ($this->backends as $backend) { @@ -375,6 +387,7 @@ class Manager extends PublicEmitter implements IUserManager { * @throws \InvalidArgumentException * @throws HintException */ + #[\Override] public function createUser($uid, $password): IUser|false { // DI injection is not used here as IRegistry needs the user manager itself for user count and thus it would create a cyclic dependency /** @var IAssertion $assertion */ @@ -408,6 +421,7 @@ class Manager extends PublicEmitter implements IUserManager { * @param string $password * @throws \InvalidArgumentException */ + #[\Override] public function createUserFromBackend($uid, $password, UserInterface $backend): IUser|false { $l = Util::getL10N('lib'); @@ -445,6 +459,7 @@ class Manager extends PublicEmitter implements IUserManager { * * @return array an array of backend class as key and count number as value */ + #[\Override] public function countUsers(bool $onlyMappedUsers = false) { $userCountStatistics = []; foreach ($this->backends as $backend) { @@ -472,6 +487,7 @@ class Manager extends PublicEmitter implements IUserManager { return $userCountStatistics; } + #[\Override] public function countUsersTotal(int $limit = 0, bool $onlyMappedUsers = false): int|false { $userCount = false; @@ -536,6 +552,7 @@ class Manager extends PublicEmitter implements IUserManager { * in the preferences table will be affected * @since 9.0.0 */ + #[\Override] public function callForAllUsers(\Closure $callback, $search = '', $onlySeen = false) { if ($onlySeen) { $this->callForSeenUsers($callback); @@ -567,6 +584,7 @@ class Manager extends PublicEmitter implements IUserManager { * @return int * @since 12.0.0 */ + #[\Override] public function countDisabledUsers(): int { $queryBuilder = Server::get(IDBConnection::class)->getQueryBuilder(); $queryBuilder->select($queryBuilder->func()->count('*')) @@ -595,6 +613,7 @@ class Manager extends PublicEmitter implements IUserManager { * @return int * @since 11.0.0 */ + #[\Override] public function countSeenUsers() { $queryBuilder = Server::get(IDBConnection::class)->getQueryBuilder(); $queryBuilder->select($queryBuilder->func()->count('*')) @@ -610,6 +629,7 @@ class Manager extends PublicEmitter implements IUserManager { return $result; } + #[\Override] public function callForSeenUsers(\Closure $callback) { $users = $this->getSeenUsers(); foreach ($users as $user) { @@ -672,6 +692,7 @@ class Manager extends PublicEmitter implements IUserManager { * @return IUser[] * @since 9.1.0 */ + #[\Override] public function getByEmail($email): array { $users = []; $userConfig = $this->getUserConfig(); @@ -692,6 +713,7 @@ class Manager extends PublicEmitter implements IUserManager { * @throws \InvalidArgumentException Message is an already translated string with a reason why the id is not valid * @since 26.0.0 */ + #[\Override] public function validateUserId(string $uid, bool $checkDataDirectory = false): void { $l = Server::get(IFactory::class)->get('lib'); @@ -736,6 +758,7 @@ class Manager extends PublicEmitter implements IUserManager { * @param string $search search users based on search params * @return list list of user IDs */ + #[\Override] public function getLastLoggedInUsers(?int $limit = null, int $offset = 0, string $search = ''): array { // We can't load all users who already logged in $limit = min(100, $limit ?: 25); @@ -808,6 +831,7 @@ class Manager extends PublicEmitter implements IUserManager { return $this->displayNameCache; } + #[\Override] public function getSeenUsers(int $offset = 0, ?int $limit = null): \Iterator { $maxBatchSize = 1000; @@ -834,6 +858,7 @@ class Manager extends PublicEmitter implements IUserManager { } while (count($userIds) === $batchSize && $limit !== 0); } + #[\Override] public function getExistingUser(string $userId, ?string $displayName = null): IUser { return new LazyUser($userId, $this, $displayName); } diff --git a/lib/private/User/OutOfOfficeData.php b/lib/private/User/OutOfOfficeData.php index 0d4e142567e..0a778ea89c3 100644 --- a/lib/private/User/OutOfOfficeData.php +++ b/lib/private/User/OutOfOfficeData.php @@ -25,38 +25,47 @@ class OutOfOfficeData implements IOutOfOfficeData { ) { } + #[\Override] public function getId(): string { return $this->id; } + #[\Override] public function getUser(): IUser { return $this->user; } + #[\Override] public function getStartDate(): int { return $this->startDate; } + #[\Override] public function getEndDate(): int { return $this->endDate; } + #[\Override] public function getShortMessage(): string { return $this->shortMessage; } + #[\Override] public function getMessage(): string { return $this->message; } + #[\Override] public function getReplacementUserId(): ?string { return $this->replacementUserId; } + #[\Override] public function getReplacementUserDisplayName(): ?string { return $this->replacementUserDisplayName; } + #[\Override] public function jsonSerialize(): array { return [ 'id' => $this->getId(), diff --git a/lib/private/User/PartiallyDeletedUsersBackend.php b/lib/private/User/PartiallyDeletedUsersBackend.php index 298ddaff6c6..4a49261768f 100644 --- a/lib/private/User/PartiallyDeletedUsersBackend.php +++ b/lib/private/User/PartiallyDeletedUsersBackend.php @@ -22,23 +22,28 @@ class PartiallyDeletedUsersBackend extends Backend implements IGetHomeBackend, I ) { } + #[\Override] public function deleteUser($uid): bool { // fake true, deleting failed users is automatically handled by User::delete() return true; } + #[\Override] public function getBackendName(): string { return 'deleted users'; } + #[\Override] public function userExists($uid) { return $this->config->getUserValue($uid, 'core', 'deleted') === 'true'; } + #[\Override] public function getHome(string $uid): string|false { return $this->config->getUserValue($uid, 'core', 'deleted.home-path') ?: false; } + #[\Override] public function getUsers($search = '', $limit = null, $offset = null) { return $this->config->getUsersForUserValue('core', 'deleted', 'true'); } diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 651d5e8f9c4..beba7778e50 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -98,6 +98,7 @@ class Session implements IUserSession, Emitter { * @param string $method * @param callable $callback */ + #[\Override] public function listen($scope, $method, callable $callback) { $this->manager->listen($scope, $method, $callback); } @@ -107,6 +108,7 @@ class Session implements IUserSession, Emitter { * @param string $method optional * @param callable $callback optional */ + #[\Override] public function removeListener($scope = null, $method = null, ?callable $callback = null) { $this->manager->removeListener($scope, $method, $callback); } @@ -147,6 +149,7 @@ class Session implements IUserSession, Emitter { * * @param IUser|null $user */ + #[\Override] public function setUser($user) { if (is_null($user)) { $this->session->remove('user_id'); @@ -161,6 +164,7 @@ class Session implements IUserSession, Emitter { * * @param IUser|null $user */ + #[\Override] public function setVolatileActiveUser(?IUser $user): void { $this->activeUser = $user; } @@ -170,6 +174,7 @@ class Session implements IUserSession, Emitter { * * @return IUser|null Current user, otherwise null */ + #[\Override] public function getUser() { // FIXME: This is a quick'n dirty work-around for the incognito mode as // described at https://github.com/owncloud/core/pull/12912#issuecomment-67391155 @@ -221,6 +226,7 @@ class Session implements IUserSession, Emitter { * * @return bool if logged in */ + #[\Override] public function isLoggedIn() { $user = $this->getUser(); if (is_null($user)) { @@ -265,10 +271,12 @@ class Session implements IUserSession, Emitter { /** * @return null|string */ + #[\Override] public function getImpersonatingUserID(): ?string { return $this->session->get('oldUserId'); } + #[\Override] public function setImpersonatingUserID(bool $useCurrentUser = true): void { if ($useCurrentUser === false) { $this->session->remove('oldUserId'); @@ -303,6 +311,7 @@ class Session implements IUserSession, Emitter { * @return boolean|null * @throws LoginException */ + #[\Override] public function login($uid, $password) { $this->session->regenerateId(); if ($this->validateToken($password, $uid)) { @@ -962,6 +971,7 @@ class Session implements IUserSession, Emitter { /** * logout the user from the session */ + #[\Override] public function logout() { $user = $this->getUser(); $this->manager->emit('\OC\User', 'logout', [$user]); diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 8de3486a9b9..6b83d1a7fc7 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -74,6 +74,7 @@ class User implements IUser { $this->urlGenerator = $urlGenerator ?? Server::get(IURLGenerator::class); } + #[\Override] public function getUID(): string { return $this->uid; } @@ -81,6 +82,7 @@ class User implements IUser { /** * Get the display name for the user, if no specific display name is set it will fallback to the user id */ + #[\Override] public function getDisplayName(): string { if ($this->displayName === null) { $displayName = ''; @@ -109,6 +111,7 @@ class User implements IUser { * @since 25.0.0 Throw InvalidArgumentException * @throws \InvalidArgumentException */ + #[\Override] public function setDisplayName($displayName): bool { $displayName = trim($displayName); $oldDisplayName = $this->getDisplayName(); @@ -128,6 +131,7 @@ class User implements IUser { /** * @inheritDoc */ + #[\Override] public function setEMailAddress($mailAddress): void { $this->setSystemEMailAddress($mailAddress); } @@ -135,6 +139,7 @@ class User implements IUser { /** * @inheritDoc */ + #[\Override] public function setSystemEMailAddress(string $mailAddress): void { $oldMailAddress = $this->getSystemEMailAddress(); $mailAddress = mb_strtolower(trim($mailAddress)); @@ -159,6 +164,7 @@ class User implements IUser { /** * @inheritDoc */ + #[\Override] public function setPrimaryEMailAddress(string $mailAddress): void { $mailAddress = mb_strtolower(trim($mailAddress)); if ($mailAddress === '') { @@ -187,6 +193,7 @@ class User implements IUser { * returns the timestamp of the user's last login or 0 if the user did never * login */ + #[\Override] public function getLastLogin(): int { if ($this->lastLogin === null) { $this->lastLogin = (int)$this->config->getUserValue($this->uid, 'login', 'lastLogin', 0); @@ -198,6 +205,7 @@ class User implements IUser { * returns the timestamp of the user's last login or 0 if the user did never * login */ + #[\Override] public function getFirstLogin(): int { if ($this->firstLogin === null) { $this->firstLogin = (int)$this->config->getUserValue($this->uid, 'login', 'firstLogin', 0); @@ -208,6 +216,7 @@ class User implements IUser { /** * updates the timestamp of the most recent login of this user */ + #[\Override] public function updateLastLoginTimestamp(): bool { $previousLogin = $this->getLastLogin(); $firstLogin = $this->getFirstLogin(); @@ -235,6 +244,7 @@ class User implements IUser { /** * Delete the user */ + #[\Override] public function delete(): bool { if ($this->backend === null) { Server::get(LoggerInterface::class)->error('Cannot delete user: No backend set'); @@ -323,6 +333,7 @@ class User implements IUser { * @param string $password * @param string $recoveryPassword for the encryption app to reset encryption keys */ + #[\Override] public function setPassword($password, $recoveryPassword = null): bool { $this->dispatcher->dispatchTyped(new BeforePasswordUpdatedEvent($this, $password, $recoveryPassword)); if ($this->emitter) { @@ -346,6 +357,7 @@ class User implements IUser { } } + #[\Override] public function getPasswordHash(): ?string { if (!($this->backend instanceof IPasswordHashBackend)) { return null; @@ -353,6 +365,7 @@ class User implements IUser { return $this->backend->getPasswordHash($this->uid); } + #[\Override] public function setPasswordHash(string $passwordHash): bool { if (!($this->backend instanceof IPasswordHashBackend)) { return false; @@ -363,6 +376,7 @@ class User implements IUser { /** * Get the users home folder to mount */ + #[\Override] public function getHome(): string { if (!$this->home) { /** @psalm-suppress UndefinedInterfaceMethod Once we get rid of the legacy implementsActions, psalm won't complain anymore */ @@ -378,6 +392,7 @@ class User implements IUser { /** * Get the name of the backend class the user is connected with */ + #[\Override] public function getBackendClassName(): string { if ($this->backend instanceof IUserBackend) { return $this->backend->getBackendName(); @@ -385,22 +400,27 @@ class User implements IUser { return get_class($this->backend); } + #[\Override] public function getBackend(): ?UserInterface { return $this->backend; } + #[\Override] public function canChangeAvatar(): bool { return $this->canEditProperty(IAccountManager::PROPERTY_AVATAR); } + #[\Override] public function canChangePassword(): bool { return $this->backend->implementsActions(Backend::SET_PASSWORD); } + #[\Override] public function canChangeDisplayName(): bool { return $this->canEditProperty(IAccountManager::PROPERTY_DISPLAYNAME); } + #[\Override] public function canChangeEmail(): bool { return $this->canEditProperty(IAccountManager::PROPERTY_EMAIL); } @@ -408,6 +428,7 @@ class User implements IUser { /** * @param IAccountManager::PROPERTY_*|IAccountManager::COLLECTION_* $property */ + #[\Override] public function canEditProperty(string $property): bool { if ($this->backend instanceof IPropertyPermissionBackend) { $permission = $this->backend->canEditProperty($this->uid, $property); @@ -438,6 +459,7 @@ class User implements IUser { /** * Check if the user is enabled */ + #[\Override] public function isEnabled(): bool { $queryDatabaseValue = function (): bool { if ($this->enabled === null) { @@ -458,6 +480,7 @@ class User implements IUser { * * @return void */ + #[\Override] public function setEnabled(bool $enabled = true) { $oldStatus = $this->isEnabled(); $setDatabaseValue = function (bool $enabled): void { @@ -487,6 +510,7 @@ class User implements IUser { * * @since 9.0.0 */ + #[\Override] public function getEMailAddress(): ?string { return $this->getPrimaryEMailAddress() ?? $this->getSystemEMailAddress(); } @@ -494,6 +518,7 @@ class User implements IUser { /** * @inheritDoc */ + #[\Override] public function getSystemEMailAddress(): ?string { $email = $this->config->getUserValue($this->uid, 'settings', 'email', null); return $email ? mb_strtolower(trim($email)) : null; @@ -502,6 +527,7 @@ class User implements IUser { /** * @inheritDoc */ + #[\Override] public function getPrimaryEMailAddress(): ?string { $email = $this->config->getUserValue($this->uid, 'settings', 'primary_email', null); return $email ? mb_strtolower(trim($email)) : null; @@ -512,6 +538,7 @@ class User implements IUser { * * @since 9.0.0 */ + #[\Override] public function getQuota(): string { // allow apps to modify the user quota by hooking into the event $event = new GetQuotaEvent($this); @@ -540,6 +567,7 @@ class User implements IUser { return $quota; } + #[\Override] public function getQuotaBytes(): int|float { $quota = $this->getQuota(); if ($quota === 'none') { @@ -560,6 +588,7 @@ class User implements IUser { * @throws InvalidArgumentException * @since 9.0.0 */ + #[\Override] public function setQuota($quota): void { $oldQuota = $this->config->getUserValue($this->uid, 'files', 'quota', ''); if ($quota !== 'none' && $quota !== 'default') { @@ -576,6 +605,7 @@ class User implements IUser { \OC_Helper::clearStorageInfo('/' . $this->uid . '/files'); } + #[\Override] public function getManagerUids(): array { $encodedUids = $this->config->getUserValue( $this->uid, @@ -586,6 +616,7 @@ class User implements IUser { return json_decode($encodedUids, false, 512, JSON_THROW_ON_ERROR); } + #[\Override] public function setManagerUids(array $uids): void { $oldUids = $this->getManagerUids(); $this->config->setUserValue( @@ -603,6 +634,7 @@ class User implements IUser { * @param int $size * @since 9.0.0 */ + #[\Override] public function getAvatarImage($size): ?IImage { // delay the initialization if (is_null($this->avatarManager)) { @@ -623,6 +655,7 @@ class User implements IUser { * * @since 9.0.0 */ + #[\Override] public function getCloudId(): string { $uid = $this->getUID(); $server = rtrim($this->urlGenerator->getAbsoluteURL('/'), '/'); diff --git a/lib/private/UserStatus/Manager.php b/lib/private/UserStatus/Manager.php index 4cfd1c18e79..abd5440e738 100644 --- a/lib/private/UserStatus/Manager.php +++ b/lib/private/UserStatus/Manager.php @@ -28,6 +28,7 @@ class Manager implements IManager { /** * @inheritDoc */ + #[\Override] public function getUserStatuses(array $userIds): array { $this->setupProvider(); if (!$this->provider) { @@ -73,6 +74,7 @@ class Manager implements IManager { $this->provider = $provider; } + #[\Override] public function setUserStatus(string $userId, string $messageId, string $status, bool $createBackup = false, ?string $customMessage = null): void { $this->setupProvider(); if (!$this->provider instanceof ISettableProvider) { @@ -82,6 +84,7 @@ class Manager implements IManager { $this->provider->setUserStatus($userId, $messageId, $status, $createBackup, $customMessage); } + #[\Override] public function revertUserStatus(string $userId, string $messageId, string $status): void { $this->setupProvider(); if (!$this->provider instanceof ISettableProvider) { @@ -90,6 +93,7 @@ class Manager implements IManager { $this->provider->revertUserStatus($userId, $messageId, $status); } + #[\Override] public function revertMultipleUserStatus(array $userIds, string $messageId, string $status): void { $this->setupProvider(); if (!$this->provider instanceof ISettableProvider) { diff --git a/lib/public/Activity/ActivitySettings.php b/lib/public/Activity/ActivitySettings.php index fa187164e19..132be7501f1 100644 --- a/lib/public/Activity/ActivitySettings.php +++ b/lib/public/Activity/ActivitySettings.php @@ -16,12 +16,14 @@ abstract class ActivitySettings implements ISetting { * @return string Lowercase a-z and underscore only identifier * @since 20.0.0 */ + #[\Override] abstract public function getIdentifier(); /** * @return string A translated string * @since 20.0.0 */ + #[\Override] abstract public function getName(); /** @@ -42,12 +44,14 @@ abstract class ActivitySettings implements ISetting { * priority values. It is required to return a value between 0 and 100. * @since 20.0.0 */ + #[\Override] abstract public function getPriority(); /** * @return bool True when the option can be changed for the mail * @since 20.0.0 */ + #[\Override] public function canChangeMail() { return true; } @@ -64,6 +68,7 @@ abstract class ActivitySettings implements ISetting { * @return bool Whether or not an activity email should be send by default * @since 20.0.0 */ + #[\Override] public function isDefaultEnabledMail() { return false; } @@ -82,6 +87,7 @@ abstract class ActivitySettings implements ISetting { * @return bool * @since 20.0.0 */ + #[\Override] public function canChangeStream() { return false; } @@ -92,6 +98,7 @@ abstract class ActivitySettings implements ISetting { * @return bool * @since 20.0.0 */ + #[\Override] public function isDefaultEnabledStream() { return true; } diff --git a/lib/public/AppFramework/Db/SnowflakeAwareEntity.php b/lib/public/AppFramework/Db/SnowflakeAwareEntity.php index 87c91e995b8..c69b0ad36e3 100644 --- a/lib/public/AppFramework/Db/SnowflakeAwareEntity.php +++ b/lib/public/AppFramework/Db/SnowflakeAwareEntity.php @@ -51,7 +51,9 @@ abstract class SnowflakeAwareEntity extends Entity { } if ($this->snowflake === null) { - $this->snowflake = Server::get(ISnowflakeDecoder::class)->decode($this->getId()); + /** @var string $id */ + $id = $this->getId(); + $this->snowflake = Server::get(ISnowflakeDecoder::class)->decode($id); } return $this->snowflake; diff --git a/lib/public/AppFramework/Http/DataDisplayResponse.php b/lib/public/AppFramework/Http/DataDisplayResponse.php index 9a91b9f8417..6141659eb3f 100644 --- a/lib/public/AppFramework/Http/DataDisplayResponse.php +++ b/lib/public/AppFramework/Http/DataDisplayResponse.php @@ -43,6 +43,7 @@ class DataDisplayResponse extends Response { * @return string * @since 8.1.0 */ + #[\Override] public function render() { return $this->data; } diff --git a/lib/public/AppFramework/Http/DataDownloadResponse.php b/lib/public/AppFramework/Http/DataDownloadResponse.php index fe87cfd0c92..de4706f2c17 100644 --- a/lib/public/AppFramework/Http/DataDownloadResponse.php +++ b/lib/public/AppFramework/Http/DataDownloadResponse.php @@ -50,6 +50,7 @@ class DataDownloadResponse extends DownloadResponse { * @return string * @since 8.0.0 */ + #[\Override] public function render() { return $this->data; } diff --git a/lib/public/AppFramework/Http/FileDisplayResponse.php b/lib/public/AppFramework/Http/FileDisplayResponse.php index 87dd895f7ad..a22f540a90f 100644 --- a/lib/public/AppFramework/Http/FileDisplayResponse.php +++ b/lib/public/AppFramework/Http/FileDisplayResponse.php @@ -45,6 +45,7 @@ class FileDisplayResponse extends Response implements ICallbackResponse { * @param IOutput $output * @since 11.0.0 */ + #[\Override] public function callback(IOutput $output) { if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) { $file = $this->file instanceof File diff --git a/lib/public/AppFramework/Http/JSONResponse.php b/lib/public/AppFramework/Http/JSONResponse.php index 03ae3ae61cb..9936f095e1c 100644 --- a/lib/public/AppFramework/Http/JSONResponse.php +++ b/lib/public/AppFramework/Http/JSONResponse.php @@ -62,7 +62,9 @@ class JSONResponse extends Response { * @psalm-taint-escape has_quotes * @psalm-taint-escape html */ + #[\Override] public function render() { + /** @psalm-suppress FalsableReturnStatement */ return json_encode($this->data, JSON_HEX_TAG | JSON_THROW_ON_ERROR | $this->encodeFlags, 2048); } diff --git a/lib/public/AppFramework/Http/StreamResponse.php b/lib/public/AppFramework/Http/StreamResponse.php index a7cf61298be..a6d122eb66d 100644 --- a/lib/public/AppFramework/Http/StreamResponse.php +++ b/lib/public/AppFramework/Http/StreamResponse.php @@ -40,6 +40,7 @@ class StreamResponse extends Response implements ICallbackResponse { * @param IOutput $output a small wrapper that handles output * @since 8.1.0 */ + #[\Override] public function callback(IOutput $output) { // handle caching if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) { diff --git a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php index 4fb0a09efea..14adeb27d02 100644 --- a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php +++ b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php @@ -166,6 +166,7 @@ class PublicTemplateResponse extends TemplateResponse { * @return string * @since 14.0.0 */ + #[\Override] public function render(): string { $params = array_merge($this->getParams(), [ 'template' => $this, diff --git a/lib/public/AppFramework/Http/Template/SimpleMenuAction.php b/lib/public/AppFramework/Http/Template/SimpleMenuAction.php index 03cb9b4c7ea..5339ef2483a 100644 --- a/lib/public/AppFramework/Http/Template/SimpleMenuAction.php +++ b/lib/public/AppFramework/Http/Template/SimpleMenuAction.php @@ -54,6 +54,7 @@ class SimpleMenuAction implements IMenuAction { * @return string * @since 14.0.0 */ + #[\Override] public function getId(): string { return $this->id; } @@ -62,6 +63,7 @@ class SimpleMenuAction implements IMenuAction { * @return string * @since 14.0.0 */ + #[\Override] public function getLabel(): string { return $this->label; } @@ -80,6 +82,7 @@ class SimpleMenuAction implements IMenuAction { * @return string * @since 14.0.0 */ + #[\Override] public function getLink(): string { return $this->link; } @@ -88,6 +91,7 @@ class SimpleMenuAction implements IMenuAction { * @return int * @since 14.0.0 */ + #[\Override] public function getPriority(): int { return $this->priority; } @@ -99,6 +103,7 @@ class SimpleMenuAction implements IMenuAction { * @return string * @since 14.0.0 */ + #[\Override] public function render(): string { return ''; } diff --git a/lib/public/AppFramework/Http/TemplateResponse.php b/lib/public/AppFramework/Http/TemplateResponse.php index a1a39d92e04..b1cee3fd8bd 100644 --- a/lib/public/AppFramework/Http/TemplateResponse.php +++ b/lib/public/AppFramework/Http/TemplateResponse.php @@ -171,6 +171,7 @@ class TemplateResponse extends Response { * @return string the rendered html * @since 6.0.0 */ + #[\Override] public function render() { $renderAs = self::RENDER_AS_USER; if ($this->renderAs === 'blank') { diff --git a/lib/public/AppFramework/Http/TextPlainResponse.php b/lib/public/AppFramework/Http/TextPlainResponse.php index 52c6b6b6f20..f0bc873dee8 100644 --- a/lib/public/AppFramework/Http/TextPlainResponse.php +++ b/lib/public/AppFramework/Http/TextPlainResponse.php @@ -41,6 +41,7 @@ class TextPlainResponse extends Response { * @since 22.0.0 * @throws \Exception If data could not get encoded */ + #[\Override] public function render() : string { return $this->text; } diff --git a/lib/public/AppFramework/Http/TooManyRequestsResponse.php b/lib/public/AppFramework/Http/TooManyRequestsResponse.php index d18d6543ee0..41687e5d9ce 100644 --- a/lib/public/AppFramework/Http/TooManyRequestsResponse.php +++ b/lib/public/AppFramework/Http/TooManyRequestsResponse.php @@ -34,6 +34,7 @@ class TooManyRequestsResponse extends Response { * @return string * @since 19.0.0 */ + #[\Override] public function render() { $template = Server::get(ITemplateManager::class)->getTemplate('core', '429', TemplateResponse::RENDER_AS_BLANK); return $template->fetchPage(); diff --git a/lib/public/AppFramework/Http/ZipResponse.php b/lib/public/AppFramework/Http/ZipResponse.php index 128fb1b7f76..85b1cbe18a5 100644 --- a/lib/public/AppFramework/Http/ZipResponse.php +++ b/lib/public/AppFramework/Http/ZipResponse.php @@ -58,6 +58,7 @@ class ZipResponse extends Response implements ICallbackResponse { /** * @since 15.0.0 */ + #[\Override] public function callback(IOutput $output) { $size = 0; $files = count($this->resources); diff --git a/lib/public/AppFramework/OCSController.php b/lib/public/AppFramework/OCSController.php index 7cde2a7e427..b7c25316653 100644 --- a/lib/public/AppFramework/OCSController.php +++ b/lib/public/AppFramework/OCSController.php @@ -87,6 +87,7 @@ abstract class OCSController extends ApiController { * @return Response * @since 9.1.0 */ + #[\Override] public function buildResponse($response, $format = 'xml') { return parent::buildResponse($response, $format); } diff --git a/lib/public/AppFramework/Services/InitialStateProvider.php b/lib/public/AppFramework/Services/InitialStateProvider.php index d1607bc2262..a7e061ed7c6 100644 --- a/lib/public/AppFramework/Services/InitialStateProvider.php +++ b/lib/public/AppFramework/Services/InitialStateProvider.php @@ -26,6 +26,7 @@ abstract class InitialStateProvider implements \JsonSerializable { * @since 21.0.0 * @return mixed */ + #[\Override] #[\ReturnTypeWillChange] final public function jsonSerialize() { return $this->getData(); diff --git a/lib/public/BackgroundJob/QueuedJob.php b/lib/public/BackgroundJob/QueuedJob.php index ca988daf079..0b86d6909b5 100644 --- a/lib/public/BackgroundJob/QueuedJob.php +++ b/lib/public/BackgroundJob/QueuedJob.php @@ -21,6 +21,7 @@ abstract class QueuedJob extends Job { * * @since 25.0.0 */ + #[\Override] final public function start(IJobList $jobList): void { if ($this->id) { $jobList->removeById($this->id); diff --git a/lib/public/BackgroundJob/TimedJob.php b/lib/public/BackgroundJob/TimedJob.php index 1205f439923..ab5e09e01c8 100644 --- a/lib/public/BackgroundJob/TimedJob.php +++ b/lib/public/BackgroundJob/TimedJob.php @@ -77,6 +77,7 @@ abstract class TimedJob extends Job { * * @since 25.0.0 */ + #[\Override] final public function start(IJobList $jobList): void { if (($this->time->getTime() - $this->lastRun) > $this->interval) { if ($this->interval >= 12 * 60 * 60 && $this->isTimeSensitive()) { diff --git a/lib/public/Cache/CappedMemoryCache.php b/lib/public/Cache/CappedMemoryCache.php index 20d42cfe706..cbffece2c0f 100644 --- a/lib/public/Cache/CappedMemoryCache.php +++ b/lib/public/Cache/CappedMemoryCache.php @@ -35,6 +35,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function hasKey($key): bool { return isset($this->cache[$key]); } @@ -43,6 +44,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess { * @return ?T * @since 25.0.0 */ + #[\Override] public function get($key) { return $this->cache[$key] ?? null; } @@ -55,6 +57,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess { * @since 25.0.0 * @return bool */ + #[\Override] public function set($key, $value, $ttl = 0): bool { if (is_null($key)) { $this->cache[] = $value; @@ -68,6 +71,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess { /** * @since 25.0.0 */ + #[\Override] public function remove($key): bool { unset($this->cache[$key]); return true; @@ -77,6 +81,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function clear($prefix = ''): bool { $this->cache = []; return true; @@ -85,6 +90,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess { /** * @since 25.0.0 */ + #[\Override] public function offsetExists($offset): bool { return $this->hasKey($offset); } @@ -94,6 +100,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess { * @return T * @since 25.0.0 */ + #[\Override] #[\ReturnTypeWillChange] public function &offsetGet($offset) { return $this->cache[$offset]; @@ -105,6 +112,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess { * @param T $value * @since 25.0.0 */ + #[\Override] public function offsetSet($offset, $value): void { $this->set($offset, $value); } @@ -113,6 +121,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function offsetUnset($offset): void { $this->remove($offset); } @@ -141,6 +150,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess { * @inheritdoc * @since 25.0.0 */ + #[\Override] public static function isAvailable(): bool { return true; } diff --git a/lib/public/Calendar/Events/AbstractCalendarObjectEvent.php b/lib/public/Calendar/Events/AbstractCalendarObjectEvent.php index 111ed096f78..f500aa9c646 100644 --- a/lib/public/Calendar/Events/AbstractCalendarObjectEvent.php +++ b/lib/public/Calendar/Events/AbstractCalendarObjectEvent.php @@ -68,6 +68,7 @@ abstract class AbstractCalendarObjectEvent extends Event implements IWebhookComp * @return array * @since 32.0.0 */ + #[\Override] public function getWebhookSerializable(): array { return [ 'calendarId' => $this->getCalendarId(), diff --git a/lib/public/Calendar/Events/CalendarObjectMovedEvent.php b/lib/public/Calendar/Events/CalendarObjectMovedEvent.php index 1c7df0e1ed5..e678f7c5063 100644 --- a/lib/public/Calendar/Events/CalendarObjectMovedEvent.php +++ b/lib/public/Calendar/Events/CalendarObjectMovedEvent.php @@ -90,6 +90,7 @@ class CalendarObjectMovedEvent extends Event implements IWebhookCompatibleEvent * @return array * @since 32.0.0 */ + #[\Override] public function getWebhookSerializable(): array { return [ 'sourceCalendarId' => $this->getSourceCalendarId(), diff --git a/lib/public/Collaboration/Reference/ADiscoverableReferenceProvider.php b/lib/public/Collaboration/Reference/ADiscoverableReferenceProvider.php index 582f51beea3..4f5c7e708f6 100644 --- a/lib/public/Collaboration/Reference/ADiscoverableReferenceProvider.php +++ b/lib/public/Collaboration/Reference/ADiscoverableReferenceProvider.php @@ -17,6 +17,7 @@ abstract class ADiscoverableReferenceProvider implements IDiscoverableReferenceP /** * @since 26.0.0 */ + #[\Override] public function jsonSerialize(): array { $json = [ 'id' => $this->getId(), diff --git a/lib/public/Collaboration/Reference/IReference.php b/lib/public/Collaboration/Reference/IReference.php index eaa82c323b5..c0c326962a5 100644 --- a/lib/public/Collaboration/Reference/IReference.php +++ b/lib/public/Collaboration/Reference/IReference.php @@ -116,5 +116,6 @@ interface IReference extends JsonSerializable { * * @since 25.0.0 */ + #[\Override] public function jsonSerialize(): array; } diff --git a/lib/public/Collaboration/Reference/LinkReferenceProvider.php b/lib/public/Collaboration/Reference/LinkReferenceProvider.php index 5dc71b32914..ab42513f172 100644 --- a/lib/public/Collaboration/Reference/LinkReferenceProvider.php +++ b/lib/public/Collaboration/Reference/LinkReferenceProvider.php @@ -64,6 +64,7 @@ class LinkReferenceProvider implements IReferenceProvider, IPublicReferenceProvi * @inheritDoc * @since 29.0.0 */ + #[\Override] public function matchReference(string $referenceText): bool { if ($this->systemConfig->getValue('reference_opengraph', true) !== true) { return false; @@ -76,6 +77,7 @@ class LinkReferenceProvider implements IReferenceProvider, IPublicReferenceProvi * @inheritDoc * @since 29.0.0 */ + #[\Override] public function resolveReference(string $referenceText): ?IReference { if ($this->matchReference($referenceText)) { $reference = new Reference($referenceText); @@ -90,6 +92,7 @@ class LinkReferenceProvider implements IReferenceProvider, IPublicReferenceProvi * @inheritDoc * @since 30.0.0 */ + #[\Override] public function resolveReferencePublic(string $referenceText, string $sharingToken): ?IReference { return $this->resolveReference($referenceText); } @@ -211,6 +214,7 @@ class LinkReferenceProvider implements IReferenceProvider, IPublicReferenceProvi * @inheritDoc * @since 29.0.0 */ + #[\Override] public function getCachePrefix(string $referenceId): string { return $referenceId; } @@ -219,6 +223,7 @@ class LinkReferenceProvider implements IReferenceProvider, IPublicReferenceProvi * @inheritDoc * @since 29.0.0 */ + #[\Override] public function getCacheKey(string $referenceId): ?string { return null; } @@ -227,6 +232,7 @@ class LinkReferenceProvider implements IReferenceProvider, IPublicReferenceProvi * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getCacheKeyPublic(string $referenceId, string $sharingToken): ?string { return null; } diff --git a/lib/public/Collaboration/Reference/Reference.php b/lib/public/Collaboration/Reference/Reference.php index 3698ae419b7..3b6f7ce27fd 100644 --- a/lib/public/Collaboration/Reference/Reference.php +++ b/lib/public/Collaboration/Reference/Reference.php @@ -38,6 +38,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function getId(): string { return $this->reference; } @@ -46,6 +47,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function setAccessible(bool $accessible): void { $this->accessible = $accessible; } @@ -54,6 +56,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function getAccessible(): bool { return $this->accessible; } @@ -62,6 +65,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function setTitle(string $title): void { $this->title = $title; } @@ -70,6 +74,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function getTitle(): string { return $this->title ?? $this->reference; } @@ -78,6 +83,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function setDescription(?string $description): void { $this->description = $description; } @@ -86,6 +92,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function getDescription(): ?string { return $this->description; } @@ -94,6 +101,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function setImageUrl(?string $imageUrl): void { $this->imageUrl = $imageUrl; } @@ -102,6 +110,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function getImageUrl(): ?string { return $this->imageUrl; } @@ -110,6 +119,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function setImageContentType(?string $contentType): void { $this->contentType = $contentType; } @@ -118,6 +128,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function getImageContentType(): ?string { return $this->contentType; } @@ -126,6 +137,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function setUrl(?string $url): void { $this->url = $url; } @@ -134,6 +146,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function getUrl(): string { return $this->url ?? $this->reference; } @@ -142,6 +155,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function setRichObject(string $type, ?array $richObject): void { $this->richObjectType = $type; $this->richObject = $richObject; @@ -151,6 +165,7 @@ class Reference implements IReference { * @inheritdoc * @since 25.0.0 */ + #[\Override] public function getRichObjectType(): string { if ($this->richObjectType === null) { return 'open-graph'; @@ -163,6 +178,7 @@ class Reference implements IReference { * @since 25.0.0 * @return array */ + #[\Override] public function getRichObject(): array { if ($this->richObject === null) { return $this->getOpenGraphObject(); @@ -175,6 +191,7 @@ class Reference implements IReference { * @since 25.0.0 * @return OpenGraphObject */ + #[\Override] public function getOpenGraphObject(): array { return [ 'id' => $this->getId(), @@ -226,6 +243,7 @@ class Reference implements IReference { * @since 25.0.0 * @return array{richObjectType: string, richObject: array, openGraphObject: OpenGraphObject, accessible: bool} */ + #[\Override] public function jsonSerialize(): array { return [ 'richObjectType' => $this->getRichObjectType(), diff --git a/lib/public/Config/Lexicon/Entry.php b/lib/public/Config/Lexicon/Entry.php index aa35730c4f1..a7ba19b13ff 100644 --- a/lib/public/Config/Lexicon/Entry.php +++ b/lib/public/Config/Lexicon/Entry.php @@ -120,7 +120,7 @@ class Entry { * @since 32.0.0 */ private function convertFromArray(array $default): string { - return json_encode($default); + return json_encode($default, JSON_THROW_ON_ERROR); } /** diff --git a/lib/public/Dashboard/Model/WidgetItem.php b/lib/public/Dashboard/Model/WidgetItem.php index 680daf1b114..f010614b7ec 100644 --- a/lib/public/Dashboard/Model/WidgetItem.php +++ b/lib/public/Dashboard/Model/WidgetItem.php @@ -143,6 +143,7 @@ final class WidgetItem implements JsonSerializable { * sinceId: string, * } */ + #[\Override] public function jsonSerialize(): array { return [ 'subtitle' => $this->getSubtitle(), diff --git a/lib/public/Dashboard/Model/WidgetItems.php b/lib/public/Dashboard/Model/WidgetItems.php index 87491175964..80ceaf9fc9b 100644 --- a/lib/public/Dashboard/Model/WidgetItems.php +++ b/lib/public/Dashboard/Model/WidgetItems.php @@ -68,6 +68,7 @@ class WidgetItems implements JsonSerializable { /** * @since 27.1.0 */ + #[\Override] public function jsonSerialize(): array { $items = array_map(static function (WidgetItem $item) { return $item->jsonSerialize(); diff --git a/lib/public/DataCollector/AbstractDataCollector.php b/lib/public/DataCollector/AbstractDataCollector.php index ffb3cbe7b79..1f252f7cf7c 100644 --- a/lib/public/DataCollector/AbstractDataCollector.php +++ b/lib/public/DataCollector/AbstractDataCollector.php @@ -24,6 +24,7 @@ abstract class AbstractDataCollector implements IDataCollector, \JsonSerializabl /** * @since 24.0.0 */ + #[\Override] public function getName(): string { return static::class; } @@ -34,6 +35,7 @@ abstract class AbstractDataCollector implements IDataCollector, \JsonSerializabl * additional cleaning. * @since 24.0.0 */ + #[\Override] public function reset(): void { $this->data = []; } @@ -62,6 +64,7 @@ abstract class AbstractDataCollector implements IDataCollector, \JsonSerializabl /** * @since 24.0.0 */ + #[\Override] #[\ReturnTypeWillChange] public function jsonSerialize() { return $this->data; diff --git a/lib/public/Diagnostics/IQueryLogger.php b/lib/public/Diagnostics/IQueryLogger.php index 07c999023da..a1b42fd7d32 100644 --- a/lib/public/Diagnostics/IQueryLogger.php +++ b/lib/public/Diagnostics/IQueryLogger.php @@ -25,6 +25,7 @@ interface IQueryLogger extends SQLLogger { * @param array|null $types * @since 8.0.0 */ + #[\Override] public function startQuery($sql, ?array $params = null, ?array $types = null); /** @@ -34,6 +35,7 @@ interface IQueryLogger extends SQLLogger { * @return void * @since 8.0.0 */ + #[\Override] public function stopQuery(); /** diff --git a/lib/public/DirectEditing/ATemplate.php b/lib/public/DirectEditing/ATemplate.php index a70488d8e89..b08c39fe6f6 100644 --- a/lib/public/DirectEditing/ATemplate.php +++ b/lib/public/DirectEditing/ATemplate.php @@ -41,6 +41,7 @@ abstract class ATemplate implements JsonSerializable { /** * @since 18.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'id' => $this->getId(), diff --git a/lib/public/EventDispatcher/Event.php b/lib/public/EventDispatcher/Event.php index f8d2e659f27..1d6fc66a4c6 100644 --- a/lib/public/EventDispatcher/Event.php +++ b/lib/public/EventDispatcher/Event.php @@ -62,6 +62,7 @@ class Event implements StoppableEventInterface { * @since 22.0.0 * @see \Psr\EventDispatcher\StoppableEventInterface */ + #[\Override] public function isPropagationStopped(): bool { return $this->propagationStopped; } diff --git a/lib/public/EventDispatcher/GenericEvent.php b/lib/public/EventDispatcher/GenericEvent.php index 7e646c4d6a7..2d69c79faf0 100644 --- a/lib/public/EventDispatcher/GenericEvent.php +++ b/lib/public/EventDispatcher/GenericEvent.php @@ -119,6 +119,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * @since 18.0.0 * @deprecated 22.0.0 */ + #[\Override] public function getIterator(): Traversable { return new ArrayIterator($this->arguments); } @@ -130,6 +131,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * @since 18.0.0 * @deprecated 22.0.0 */ + #[\Override] public function offsetExists($offset): bool { return $this->hasArgument($offset); } @@ -142,6 +144,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * @deprecated 22.0.0 * @return mixed */ + #[\Override] #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->arguments[$offset]; @@ -154,6 +157,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * @since 18.0.0 * @deprecated 22.0.0 */ + #[\Override] public function offsetSet($offset, $value): void { $this->setArgument($offset, $value); } @@ -165,6 +169,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * @since 18.0.0 * @deprecated 22.0.0 */ + #[\Override] public function offsetUnset($offset): void { if ($this->hasArgument($offset)) { unset($this->arguments[$offset]); diff --git a/lib/public/Files/Cache/AbstractCacheEvent.php b/lib/public/Files/Cache/AbstractCacheEvent.php index b2f01b2e470..678332c9073 100644 --- a/lib/public/Files/Cache/AbstractCacheEvent.php +++ b/lib/public/Files/Cache/AbstractCacheEvent.php @@ -37,6 +37,7 @@ class AbstractCacheEvent extends Event implements ICacheEvent { * @return IStorage * @since 22.0.0 */ + #[\Override] public function getStorage(): IStorage { return $this->storage; } @@ -45,6 +46,7 @@ class AbstractCacheEvent extends Event implements ICacheEvent { * @return string * @since 22.0.0 */ + #[\Override] public function getPath(): string { return $this->path; } @@ -53,6 +55,7 @@ class AbstractCacheEvent extends Event implements ICacheEvent { * @param string $path * @since 22.0.0 */ + #[\Override] public function setPath(string $path): void { $this->path = $path; } @@ -61,6 +64,7 @@ class AbstractCacheEvent extends Event implements ICacheEvent { * @return int * @since 22.0.0 */ + #[\Override] public function getFileId(): int { return $this->fileId; } @@ -69,6 +73,7 @@ class AbstractCacheEvent extends Event implements ICacheEvent { * @return int * @since 22.0.0 */ + #[\Override] public function getStorageId(): int { return $this->storageId; } diff --git a/lib/public/Files/Conversion/ConversionMimeProvider.php b/lib/public/Files/Conversion/ConversionMimeProvider.php index 0daf4a10648..11f45a52cf1 100644 --- a/lib/public/Files/Conversion/ConversionMimeProvider.php +++ b/lib/public/Files/Conversion/ConversionMimeProvider.php @@ -55,6 +55,7 @@ class ConversionMimeProvider implements JsonSerializable { * * @since 31.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'from' => $this->from, diff --git a/lib/public/Files/Events/BeforeZipCreatedEvent.php b/lib/public/Files/Events/BeforeZipCreatedEvent.php index ea84da64a1d..63383f7d28d 100644 --- a/lib/public/Files/Events/BeforeZipCreatedEvent.php +++ b/lib/public/Files/Events/BeforeZipCreatedEvent.php @@ -52,13 +52,18 @@ class BeforeZipCreatedEvent extends Event { } /** + * Returns folder path relative to user folder + * * @since 25.0.0 * @deprecated 33.0.0 Use getFolder instead and use node API - * @return string returns folder path relative to user folder */ public function getDirectory(): string { if ($this->folder instanceof Folder) { - return preg_replace('|^/[^/]+/files/|', '/', $this->folder->getPath()); + $path = preg_replace('|^/[^/]+/files/|', '/', $this->folder->getPath()); + if ($path === null) { + throw new \UnexpectedValueException('Could not determine path from folder'); + } + return $path; } return $this->directory; } diff --git a/lib/public/Files/Events/Node/AbstractNodeEvent.php b/lib/public/Files/Events/Node/AbstractNodeEvent.php index 7afb71277f6..06259051f9c 100644 --- a/lib/public/Files/Events/Node/AbstractNodeEvent.php +++ b/lib/public/Files/Events/Node/AbstractNodeEvent.php @@ -35,6 +35,7 @@ abstract class AbstractNodeEvent extends Event implements IWebhookCompatibleEven /** * @since 30.0.0 */ + #[\Override] public function getWebhookSerializable(): array { return [ 'node' => JsonSerializer::serializeFileInfo($this->node), diff --git a/lib/public/Files/Events/Node/AbstractNodesEvent.php b/lib/public/Files/Events/Node/AbstractNodesEvent.php index 8fa8795d1df..1569b58cfc1 100644 --- a/lib/public/Files/Events/Node/AbstractNodesEvent.php +++ b/lib/public/Files/Events/Node/AbstractNodesEvent.php @@ -43,6 +43,7 @@ abstract class AbstractNodesEvent extends Event implements IWebhookCompatibleEve /** * @since 30.0.0 */ + #[\Override] public function getWebhookSerializable(): array { return [ 'source' => JsonSerializer::serializeFileInfo($this->source), diff --git a/lib/public/Files/File.php b/lib/public/Files/File.php index 67b7a7d0d2a..8c57951a4ca 100644 --- a/lib/public/Files/File.php +++ b/lib/public/Files/File.php @@ -47,6 +47,7 @@ interface File extends Node { * * @since 6.0.0 */ + #[\Override] public function getMimeType(): string; /** @@ -79,6 +80,7 @@ interface File extends Node { * @throws InvalidPathException * @throws NotFoundException */ + #[\Override] public function getChecksum(); /** @@ -87,5 +89,6 @@ interface File extends Node { * @return string * @since 15.0.0 */ + #[\Override] public function getExtension(): string; } diff --git a/lib/public/Files/Folder.php b/lib/public/Files/Folder.php index 9ed1957e8ca..ef8880636c2 100644 --- a/lib/public/Files/Folder.php +++ b/lib/public/Files/Folder.php @@ -190,6 +190,7 @@ interface Folder extends Node { * @return bool * @since 6.0.0 */ + #[\Override] public function isCreatable(); /** diff --git a/lib/public/Files/Node.php b/lib/public/Files/Node.php index edef0a6157f..b3b0ffb5c01 100644 --- a/lib/public/Files/Node.php +++ b/lib/public/Files/Node.php @@ -72,6 +72,7 @@ interface Node extends FileInfo { * @throws NotFoundException * @since 6.0.0 */ + #[\Override] public function getStorage(); /** @@ -80,6 +81,7 @@ interface Node extends FileInfo { * @return string * @since 6.0.0 */ + #[\Override] public function getPath(); /** @@ -88,6 +90,7 @@ interface Node extends FileInfo { * @return string * @since 6.0.0 */ + #[\Override] public function getInternalPath(); /** @@ -98,6 +101,7 @@ interface Node extends FileInfo { * @throws NotFoundException * @since 6.0.0 */ + #[\Override] public function getId(); /** @@ -119,6 +123,7 @@ interface Node extends FileInfo { * @throws NotFoundException * @since 6.0.0 */ + #[\Override] public function getMTime(); /** @@ -130,6 +135,7 @@ interface Node extends FileInfo { * @throws NotFoundException * @since 6.0.0 */ + #[\Override] public function getSize($includeMounts = true); /** @@ -142,6 +148,7 @@ interface Node extends FileInfo { * @throws NotFoundException * @since 6.0.0 */ + #[\Override] public function getEtag(); @@ -158,6 +165,7 @@ interface Node extends FileInfo { * @throws NotFoundException * @since 6.0.0 - namespace of constants has changed in 8.0.0 */ + #[\Override] public function getPermissions(); /** @@ -168,6 +176,7 @@ interface Node extends FileInfo { * @throws NotFoundException * @since 6.0.0 */ + #[\Override] public function isReadable(); /** @@ -178,6 +187,7 @@ interface Node extends FileInfo { * @throws NotFoundException * @since 6.0.0 */ + #[\Override] public function isUpdateable(); /** @@ -188,6 +198,7 @@ interface Node extends FileInfo { * @throws NotFoundException * @since 6.0.0 */ + #[\Override] public function isDeletable(); /** @@ -198,6 +209,7 @@ interface Node extends FileInfo { * @throws NotFoundException * @since 6.0.0 */ + #[\Override] public function isShareable(); /** @@ -214,6 +226,7 @@ interface Node extends FileInfo { * @return string * @since 6.0.0 */ + #[\Override] public function getName(); /** diff --git a/lib/public/Files/SimpleFS/InMemoryFile.php b/lib/public/Files/SimpleFS/InMemoryFile.php index d5a0fa160cb..b8bfbabbf6e 100644 --- a/lib/public/Files/SimpleFS/InMemoryFile.php +++ b/lib/public/Files/SimpleFS/InMemoryFile.php @@ -42,6 +42,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ + #[\Override] public function getName(): string { return $this->name; } @@ -50,6 +51,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ + #[\Override] public function getSize(): int|float { return strlen($this->contents); } @@ -58,6 +60,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ + #[\Override] public function getETag(): string { return ''; } @@ -66,6 +69,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ + #[\Override] public function getMTime(): int { return time(); } @@ -74,6 +78,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ + #[\Override] public function getContent(): string { return $this->contents; } @@ -82,6 +87,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ + #[\Override] public function putContent($data): void { $this->contents = $data; } @@ -91,6 +97,7 @@ class InMemoryFile implements ISimpleFile { * * @since 16.0.0 */ + #[\Override] public function delete(): void { // unimplemented for in memory files } @@ -99,6 +106,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ + #[\Override] public function getMimeType(): string { $fileInfo = new \finfo(FILEINFO_MIME_TYPE); return $fileInfo->buffer($this->contents); @@ -108,6 +116,7 @@ class InMemoryFile implements ISimpleFile { * @inheritDoc * @since 24.0.0 */ + #[\Override] public function getExtension(): string { return \pathinfo($this->name, PATHINFO_EXTENSION); } @@ -117,6 +126,7 @@ class InMemoryFile implements ISimpleFile { * @since 16.0.0 * @since 34.0.0 - return in-memory stream of contents */ + #[\Override] public function read() { $stream = fopen('php://memory', 'r+'); fwrite($stream, $this->contents); @@ -130,6 +140,7 @@ class InMemoryFile implements ISimpleFile { * @throws NotPermittedException * @since 16.0.0 */ + #[\Override] public function write() { throw new NotPermittedException( 'Stream writing is unsupported for in memory files' diff --git a/lib/public/Files/Template/Field.php b/lib/public/Files/Template/Field.php index e047e83a29e..7ac80207ec7 100644 --- a/lib/public/Files/Template/Field.php +++ b/lib/public/Files/Template/Field.php @@ -43,6 +43,7 @@ abstract class Field implements \JsonSerializable { * } * @since 30.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'index' => $this->index, diff --git a/lib/public/Files/Template/Fields/CheckBoxField.php b/lib/public/Files/Template/Fields/CheckBoxField.php index 6fab3ce66a6..076391b822a 100644 --- a/lib/public/Files/Template/Fields/CheckBoxField.php +++ b/lib/public/Files/Template/Fields/CheckBoxField.php @@ -28,6 +28,7 @@ class CheckBoxField extends Field { /** * @since 30.0.0 */ + #[\Override] public function setValue(mixed $value): void { if (!is_bool($value)) { throw new \Exception('Invalid value for checkbox field type'); @@ -48,6 +49,7 @@ class CheckBoxField extends Field { * } * @since 30.0.0 */ + #[\Override] public function jsonSerialize(): array { $jsonProperties = parent::jsonSerialize(); diff --git a/lib/public/Files/Template/Fields/RichTextField.php b/lib/public/Files/Template/Fields/RichTextField.php index 93ead68747c..901305cb721 100644 --- a/lib/public/Files/Template/Fields/RichTextField.php +++ b/lib/public/Files/Template/Fields/RichTextField.php @@ -28,6 +28,7 @@ class RichTextField extends Field { /** * @since 30.0.0 */ + #[\Override] public function setValue(mixed $value): void { if (!is_string($value)) { throw new \Exception('Invalid value for rich-text field type'); @@ -48,6 +49,7 @@ class RichTextField extends Field { * } * @since 30.0.0 */ + #[\Override] public function jsonSerialize(): array { $jsonProperties = parent::jsonSerialize(); diff --git a/lib/public/Files/Template/Template.php b/lib/public/Files/Template/Template.php index 7f01c2afa48..4d838a6d4ad 100644 --- a/lib/public/Files/Template/Template.php +++ b/lib/public/Files/Template/Template.php @@ -84,6 +84,7 @@ final class Template implements \JsonSerializable { * } * @since 21.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'templateType' => $this->templateType, diff --git a/lib/public/Files/Template/TemplateFileCreator.php b/lib/public/Files/Template/TemplateFileCreator.php index 809bd3d0bc2..eb5c79600e4 100644 --- a/lib/public/Files/Template/TemplateFileCreator.php +++ b/lib/public/Files/Template/TemplateFileCreator.php @@ -123,6 +123,7 @@ final class TemplateFileCreator implements \JsonSerializable { * @since 21.0.0 * @return array{app: string, label: string, extension: string, iconClass: ?string, iconSvgInline: ?string, mimetypes: list, ratio: ?float, actionLabel: string} */ + #[\Override] public function jsonSerialize(): array { return [ 'app' => $this->appId, diff --git a/lib/public/Group/Backend/ABackend.php b/lib/public/Group/Backend/ABackend.php index 95af1b85d9b..37605d58a5e 100644 --- a/lib/public/Group/Backend/ABackend.php +++ b/lib/public/Group/Backend/ABackend.php @@ -21,6 +21,7 @@ abstract class ABackend implements GroupInterface, IBatchMethodsBackend { * @param int $actions The action to check for * @return bool */ + #[\Override] public function implementsActions($actions): bool { $implements = 0; @@ -52,6 +53,7 @@ abstract class ABackend implements GroupInterface, IBatchMethodsBackend { /** * @since 28.0.0 */ + #[\Override] public function groupsExists(array $gids): array { return array_values(array_filter( $gids, @@ -62,6 +64,7 @@ abstract class ABackend implements GroupInterface, IBatchMethodsBackend { /** * @since 28.0.0 */ + #[\Override] public function getGroupsDetails(array $gids): array { if (!($this instanceof IGroupDetailsBackend || $this->implementsActions(GroupInterface::GROUP_DETAILS))) { throw new \Exception('Should not have been called'); diff --git a/lib/public/Http/Client/IClient.php b/lib/public/Http/Client/IClient.php index 3f96c80c29a..db675b277cd 100644 --- a/lib/public/Http/Client/IClient.php +++ b/lib/public/Http/Client/IClient.php @@ -282,6 +282,7 @@ interface IClient extends ClientInterface { * @throws \Psr\Http\Client\ClientExceptionInterface If an error happens while processing the request. * @since 34.0.0 */ + #[\Override] public function sendRequest(RequestInterface $request): ResponseInterface; /** diff --git a/lib/public/Http/WellKnown/GenericResponse.php b/lib/public/Http/WellKnown/GenericResponse.php index c5279f075c9..99a238d72e3 100644 --- a/lib/public/Http/WellKnown/GenericResponse.php +++ b/lib/public/Http/WellKnown/GenericResponse.php @@ -27,6 +27,7 @@ final class GenericResponse implements IResponse { /** * @since 21.0.0 */ + #[\Override] public function toHttpResponse(): Response { return $this->response; } diff --git a/lib/public/Http/WellKnown/JrdResponse.php b/lib/public/Http/WellKnown/JrdResponse.php index 21ad948d148..d7eb3dfdf2e 100644 --- a/lib/public/Http/WellKnown/JrdResponse.php +++ b/lib/public/Http/WellKnown/JrdResponse.php @@ -128,6 +128,7 @@ final class JrdResponse implements IResponse { /** * @since 21.0.0 */ + #[\Override] public function toHttpResponse(): Response { return new JSONResponse(array_filter([ 'subject' => $this->subject, diff --git a/lib/public/IContainer.php b/lib/public/IContainer.php index 9f8a38ca2fd..0f91a9990d6 100644 --- a/lib/public/IContainer.php +++ b/lib/public/IContainer.php @@ -36,6 +36,7 @@ interface IContainer extends ContainerInterface { * @return ($id is class-string ? T : mixed) Entry. * @since 34.0.0 */ + #[\Override] public function get(string $id); /** diff --git a/lib/public/IStreamImage.php b/lib/public/IStreamImage.php index 5363e0fcbc7..79b718fc291 100644 --- a/lib/public/IStreamImage.php +++ b/lib/public/IStreamImage.php @@ -14,5 +14,6 @@ interface IStreamImage extends IImage { * @since 24.0.0 * @return false|resource Returns the image resource if any */ + #[\Override] public function resource(); } diff --git a/lib/public/L10N/ILanguageIterator.php b/lib/public/L10N/ILanguageIterator.php index 27f850d4235..f327923c7ad 100644 --- a/lib/public/L10N/ILanguageIterator.php +++ b/lib/public/L10N/ILanguageIterator.php @@ -30,6 +30,7 @@ interface ILanguageIterator extends \Iterator { * * @since 14.0.0 */ + #[\Override] public function current(): string; /** @@ -37,6 +38,7 @@ interface ILanguageIterator extends \Iterator { * * @since 14.0.0 */ + #[\Override] public function next(): void; /** @@ -44,6 +46,7 @@ interface ILanguageIterator extends \Iterator { * * @since 14.0.0 */ + #[\Override] public function key(): int; /** @@ -51,5 +54,6 @@ interface ILanguageIterator extends \Iterator { * * @since 14.0.0 */ + #[\Override] public function valid(): bool; } diff --git a/lib/public/Mail/Provider/Address.php b/lib/public/Mail/Provider/Address.php index 751fb99d930..70513354109 100644 --- a/lib/public/Mail/Provider/Address.php +++ b/lib/public/Mail/Provider/Address.php @@ -41,6 +41,7 @@ class Address implements \OCP\Mail\Provider\IAddress { * * @return self return this object for command chaining */ + #[\Override] public function setAddress(string $value): self { $this->address = $value; return $this; @@ -53,6 +54,7 @@ class Address implements \OCP\Mail\Provider\IAddress { * * @return string|null returns the mail address or null if one is not set */ + #[\Override] public function getAddress(): ?string { return $this->address; } @@ -66,6 +68,7 @@ class Address implements \OCP\Mail\Provider\IAddress { * * @return self return this object for command chaining */ + #[\Override] public function setLabel(string $value): self { $this->label = $value; return $this; @@ -78,6 +81,7 @@ class Address implements \OCP\Mail\Provider\IAddress { * * @return string|null returns the mail address label/name or null if one is not set */ + #[\Override] public function getLabel(): ?string { return $this->label; } diff --git a/lib/public/Mail/Provider/Attachment.php b/lib/public/Mail/Provider/Attachment.php index af7340a3ccf..8b8b2b9cac7 100644 --- a/lib/public/Mail/Provider/Attachment.php +++ b/lib/public/Mail/Provider/Attachment.php @@ -45,6 +45,7 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @return self return this object for command chaining */ + #[\Override] public function setName(string $value): self { $this->name = $value; return $this; @@ -57,6 +58,7 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @return string | null returns the attachment file name or null if not set */ + #[\Override] public function getName(): ?string { return $this->name; } @@ -70,6 +72,7 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @return self return this object for command chaining */ + #[\Override] public function setType(string $value): self { $this->type = $value; return $this; @@ -82,6 +85,7 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @return string | null returns the attachment mime type or null if not set */ + #[\Override] public function getType(): ?string { return $this->type; } @@ -95,6 +99,7 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @return self return this object for command chaining */ + #[\Override] public function setContents(string $value): self { $this->contents = $value; return $this; @@ -107,6 +112,7 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @return string | null returns the attachment contents or null if not set */ + #[\Override] public function getContents(): ?string { return $this->contents; } @@ -120,6 +126,7 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @return self return this object for command chaining */ + #[\Override] public function setEmbedded(bool $value): self { $this->embedded = $value; return $this; @@ -132,6 +139,7 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @return bool embedded status of the attachment */ + #[\Override] public function getEmbedded(): bool { return $this->embedded; } diff --git a/lib/public/Mail/Provider/Message.php b/lib/public/Mail/Provider/Message.php index f7a21c05ed3..4251450bf84 100644 --- a/lib/public/Mail/Provider/Message.php +++ b/lib/public/Mail/Provider/Message.php @@ -37,6 +37,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return string id of this message */ + #[\Override] public function id(): string { // return id of message return (isset($this->data['id'])) ? $this->data['id'] : ''; @@ -51,6 +52,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return self return this object for command chaining */ + #[\Override] public function setFrom(IAddress $value): self { // create or update field in data store with value $this->data['from'] = $value; @@ -65,6 +67,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return IAddress|null sender's mail address object */ + #[\Override] public function getFrom(): ?IAddress { // evaluate if data store field exists and return value(s) or null otherwise return (isset($this->data['from'])) ? $this->data['from'] : null; @@ -79,6 +82,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return self return this object for command chaining */ + #[\Override] public function setReplyTo(IAddress $value): self { // create or update field in data store with value $this->data['replyTo'] = $value; @@ -93,6 +97,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return IAddress|null sender's reply to mail address object */ + #[\Override] public function getReplyTo(): ?IAddress { // evaluate if data store field exists and return value(s) or null otherwise return (isset($this->data['replyTo'])) ? $this->data['replyTo'] : null; @@ -107,6 +112,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return self return this object for command chaining */ + #[\Override] public function setTo(IAddress ...$value): self { // create or update field in data store with value $this->data['to'] = $value; @@ -121,6 +127,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return array collection of all recipient mail address objects */ + #[\Override] public function getTo(): array { // evaluate if data store field exists and return value(s) or empty collection return (isset($this->data['to'])) ? $this->data['to'] : []; @@ -135,6 +142,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return self return this object for command chaining */ + #[\Override] public function setCc(IAddress ...$value): self { // create or update field in data store with value $this->data['cc'] = $value; @@ -149,6 +157,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return array collection of all copied recipient mail address objects */ + #[\Override] public function getCc(): array { // evaluate if data store field exists and return value(s) or empty collection return (isset($this->data['cc'])) ? $this->data['cc'] : []; @@ -163,6 +172,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return self return this object for command chaining */ + #[\Override] public function setBcc(IAddress ...$value): self { // create or update field in data store with value $this->data['bcc'] = $value; @@ -177,6 +187,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return array collection of all blind copied recipient mail address objects */ + #[\Override] public function getBcc(): array { // evaluate if data store field exists and return value(s) or empty collection return (isset($this->data['bcc'])) ? $this->data['bcc'] : []; @@ -191,6 +202,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return self return this object for command chaining */ + #[\Override] public function setSubject(string $value): self { // create or update field in data store with value $this->data['subject'] = $value; @@ -205,6 +217,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return string|null subject of message or null if one is not set */ + #[\Override] public function getSubject(): ?string { // evaluate if data store field exists and return value(s) or null otherwise return (isset($this->data['subject'])) ? $this->data['subject'] : null; @@ -220,6 +233,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return self return this object for command chaining */ + #[\Override] public function setBody(string $value, bool $html = false): self { // evaluate html flag and create or update appropriate field in data store with value if ($html) { @@ -240,6 +254,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return string|null html/plain body of this message or null if one is not set */ + #[\Override] public function getBody(): ?string { // evaluate if data store field(s) exists and return value if (isset($this->data['bodyHtml'])) { @@ -260,6 +275,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return self return this object for command chaining */ + #[\Override] public function setBodyHtml(string $value): self { // create or update field in data store with value $this->data['bodyHtml'] = $value; @@ -274,6 +290,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return string|null html body of this message or null if one is not set */ + #[\Override] public function getBodyHtml(): ?string { // evaluate if data store field exists and return value(s) or null otherwise return (isset($this->data['bodyHtml'])) ? $this->data['bodyHtml'] : null; @@ -288,6 +305,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return self return this object for command chaining */ + #[\Override] public function setBodyPlain(string $value): self { // create or update field in data store with value $this->data['bodyPlain'] = $value; @@ -302,6 +320,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return string|null plain text body of this message or null if one is not set */ + #[\Override] public function getBodyPlain(): ?string { // evaluate if data store field exists and return value(s) or null otherwise return (isset($this->data['bodyPlain'])) ? $this->data['bodyPlain'] : null; @@ -316,6 +335,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return self return this object for command chaining */ + #[\Override] public function setAttachments(IAttachment ...$value): self { // create or update field in data store with value $this->data['attachments'] = $value; @@ -330,6 +350,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @return array collection of all mail attachment objects */ + #[\Override] public function getAttachments(): array { // evaluate if data store field exists and return value(s) or null otherwise return (isset($this->data['attachments'])) ? $this->data['attachments'] : []; diff --git a/lib/public/Migration/Attributes/AddColumn.php b/lib/public/Migration/Attributes/AddColumn.php index e371ec81d19..ba9cd45ef4c 100644 --- a/lib/public/Migration/Attributes/AddColumn.php +++ b/lib/public/Migration/Attributes/AddColumn.php @@ -21,6 +21,7 @@ class AddColumn extends ColumnMigrationAttribute { * @return string * @since 30.0.0 */ + #[\Override] public function definition(): string { $type = is_null($this->getType()) ? '' : ' (' . $this->getType()->value . ')'; return empty($this->getName()) diff --git a/lib/public/Migration/Attributes/AddIndex.php b/lib/public/Migration/Attributes/AddIndex.php index 86b5a89c389..698eaa53a70 100644 --- a/lib/public/Migration/Attributes/AddIndex.php +++ b/lib/public/Migration/Attributes/AddIndex.php @@ -21,6 +21,7 @@ class AddIndex extends IndexMigrationAttribute { * @return string * @since 30.0.0 */ + #[\Override] public function definition(): string { $type = is_null($this->getType()) ? '' : ' (' . $this->getType()->value . ')'; return 'Addition of a new index' . $type . ' to table \'' . $this->getTable() . '\''; diff --git a/lib/public/Migration/Attributes/ColumnMigrationAttribute.php b/lib/public/Migration/Attributes/ColumnMigrationAttribute.php index d3f4aa05ade..fa2b9544f9d 100644 --- a/lib/public/Migration/Attributes/ColumnMigrationAttribute.php +++ b/lib/public/Migration/Attributes/ColumnMigrationAttribute.php @@ -77,6 +77,7 @@ class ColumnMigrationAttribute extends MigrationAttribute { * @return $this * @since 30.0.0 */ + #[\Override] public function import(array $data): self { parent::import($data); $this->setName($data['name'] ?? ''); @@ -88,6 +89,7 @@ class ColumnMigrationAttribute extends MigrationAttribute { * @return array * @since 30.0.0 */ + #[\Override] public function jsonSerialize(): array { return array_merge( parent::jsonSerialize(), diff --git a/lib/public/Migration/Attributes/CreateTable.php b/lib/public/Migration/Attributes/CreateTable.php index c774b0aff56..df759b123c3 100644 --- a/lib/public/Migration/Attributes/CreateTable.php +++ b/lib/public/Migration/Attributes/CreateTable.php @@ -21,6 +21,7 @@ class CreateTable extends TableMigrationAttribute { * @return string * @since 30.0.0 */ + #[\Override] public function definition(): string { $definition = 'Creation of new table \'' . $this->getTable() . '\''; $definition .= empty($this->getColumns()) ? '' : ' with columns ' . implode(', ', $this->getColumns()); diff --git a/lib/public/Migration/Attributes/DataCleansing.php b/lib/public/Migration/Attributes/DataCleansing.php index 6215c8b0268..cc4af24c431 100644 --- a/lib/public/Migration/Attributes/DataCleansing.php +++ b/lib/public/Migration/Attributes/DataCleansing.php @@ -21,6 +21,7 @@ class DataCleansing extends DataMigrationAttribute { * @return string * @since 32.0.0 */ + #[\Override] public function definition(): string { return 'Cleansing data from table \'' . $this->getTable() . '\''; } diff --git a/lib/public/Migration/Attributes/DropColumn.php b/lib/public/Migration/Attributes/DropColumn.php index 4d0568a0a4e..e18fe34f627 100644 --- a/lib/public/Migration/Attributes/DropColumn.php +++ b/lib/public/Migration/Attributes/DropColumn.php @@ -21,6 +21,7 @@ class DropColumn extends ColumnMigrationAttribute { * @return string * @since 30.0.0 */ + #[\Override] public function definition(): string { return empty($this->getName()) ? 'Deletion of a column from table \'' . $this->getTable() . '\'' diff --git a/lib/public/Migration/Attributes/DropIndex.php b/lib/public/Migration/Attributes/DropIndex.php index 39bdd64ced7..3da7daf327d 100644 --- a/lib/public/Migration/Attributes/DropIndex.php +++ b/lib/public/Migration/Attributes/DropIndex.php @@ -21,6 +21,7 @@ class DropIndex extends IndexMigrationAttribute { * @return string * @since 30.0.0 */ + #[\Override] public function definition(): string { return 'Deletion of an index from table \'' . $this->getTable() . '\''; } diff --git a/lib/public/Migration/Attributes/DropTable.php b/lib/public/Migration/Attributes/DropTable.php index ad18d07c8ef..cbd79a52092 100644 --- a/lib/public/Migration/Attributes/DropTable.php +++ b/lib/public/Migration/Attributes/DropTable.php @@ -21,6 +21,7 @@ class DropTable extends TableMigrationAttribute { * @return string * @since 30.0.0 */ + #[\Override] public function definition(): string { return 'Deletion of table \'' . $this->getTable() . '\''; } diff --git a/lib/public/Migration/Attributes/GenericMigrationAttribute.php b/lib/public/Migration/Attributes/GenericMigrationAttribute.php index 870182b0398..9e2ac9b5a6c 100644 --- a/lib/public/Migration/Attributes/GenericMigrationAttribute.php +++ b/lib/public/Migration/Attributes/GenericMigrationAttribute.php @@ -34,14 +34,16 @@ class GenericMigrationAttribute extends MigrationAttribute { * @return string * @since 30.0.0 */ + #[\Override] public function definition(): string { - return json_encode($this->jsonSerialize(), JSON_UNESCAPED_SLASHES); + return json_encode($this->jsonSerialize(), JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR); } /** * @return array * @since 30.0.0 */ + #[\Override] public function jsonSerialize(): array { return $this->details; } diff --git a/lib/public/Migration/Attributes/IndexMigrationAttribute.php b/lib/public/Migration/Attributes/IndexMigrationAttribute.php index 31b9e2da277..b640a900f39 100644 --- a/lib/public/Migration/Attributes/IndexMigrationAttribute.php +++ b/lib/public/Migration/Attributes/IndexMigrationAttribute.php @@ -56,6 +56,7 @@ class IndexMigrationAttribute extends MigrationAttribute { * @return $this * @since 30.0.0 */ + #[\Override] public function import(array $data): self { parent::import($data); $this->setType(IndexType::tryFrom($data['type'] ?? '')); @@ -66,6 +67,7 @@ class IndexMigrationAttribute extends MigrationAttribute { * @return array * @since 30.0.0 */ + #[\Override] public function jsonSerialize(): array { return array_merge( parent::jsonSerialize(), diff --git a/lib/public/Migration/Attributes/MigrationAttribute.php b/lib/public/Migration/Attributes/MigrationAttribute.php index 4df46e7a2fe..3ef4312a195 100644 --- a/lib/public/Migration/Attributes/MigrationAttribute.php +++ b/lib/public/Migration/Attributes/MigrationAttribute.php @@ -88,7 +88,7 @@ class MigrationAttribute implements JsonSerializable { * @since 30.0.0 */ public function definition(): string { - return json_encode($this->jsonSerialize(), JSON_UNESCAPED_SLASHES); + return json_encode($this->jsonSerialize(), JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR); } /** @@ -106,6 +106,7 @@ class MigrationAttribute implements JsonSerializable { * @return array * @since 30.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'class' => get_class($this), diff --git a/lib/public/Migration/Attributes/ModifyColumn.php b/lib/public/Migration/Attributes/ModifyColumn.php index f34c29db74a..840a3db93ad 100644 --- a/lib/public/Migration/Attributes/ModifyColumn.php +++ b/lib/public/Migration/Attributes/ModifyColumn.php @@ -21,6 +21,7 @@ class ModifyColumn extends ColumnMigrationAttribute { * @return string * @since 30.0.0 */ + #[\Override] public function definition(): string { $type = is_null($this->getType()) ? '' : ' to ' . $this->getType()->value; return empty($this->getName()) diff --git a/lib/public/Migration/Attributes/TableMigrationAttribute.php b/lib/public/Migration/Attributes/TableMigrationAttribute.php index aede981c10f..4b11a75137a 100644 --- a/lib/public/Migration/Attributes/TableMigrationAttribute.php +++ b/lib/public/Migration/Attributes/TableMigrationAttribute.php @@ -56,6 +56,7 @@ class TableMigrationAttribute extends MigrationAttribute { * @return $this * @since 30.0.0 */ + #[\Override] public function import(array $data): self { parent::import($data); $this->setColumns($data['columns'] ?? []); @@ -66,6 +67,7 @@ class TableMigrationAttribute extends MigrationAttribute { * @return array * @since 30.0.0 */ + #[\Override] public function jsonSerialize(): array { return array_merge( parent::jsonSerialize(), diff --git a/lib/public/Migration/BigIntMigration.php b/lib/public/Migration/BigIntMigration.php index a2fda697cbc..c16a9ded8cb 100644 --- a/lib/public/Migration/BigIntMigration.php +++ b/lib/public/Migration/BigIntMigration.php @@ -28,6 +28,7 @@ abstract class BigIntMigration extends SimpleMigrationStep { * @return null|ISchemaWrapper * @since 13.0.0 */ + #[\Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/public/OCM/IOCMProvider.php b/lib/public/OCM/IOCMProvider.php index 83f2871d5c5..4896a050bd0 100644 --- a/lib/public/OCM/IOCMProvider.php +++ b/lib/public/OCM/IOCMProvider.php @@ -217,5 +217,6 @@ interface IOCMProvider extends JsonSerializable { * } * @since 28.0.0 */ + #[\Override] public function jsonSerialize(): array; } diff --git a/lib/public/OCM/IOCMResource.php b/lib/public/OCM/IOCMResource.php index 60bf701e8ea..84a8aed8627 100644 --- a/lib/public/OCM/IOCMResource.php +++ b/lib/public/OCM/IOCMResource.php @@ -90,5 +90,6 @@ interface IOCMResource extends JsonSerializable { * } * @since 28.0.0 */ + #[\Override] public function jsonSerialize(): array; } diff --git a/lib/public/SabrePluginException.php b/lib/public/SabrePluginException.php index 8b5b0dfba01..82847e96023 100644 --- a/lib/public/SabrePluginException.php +++ b/lib/public/SabrePluginException.php @@ -19,6 +19,7 @@ class SabrePluginException extends Exception { * @return int * @since 8.2.0 */ + #[\Override] public function getHTTPCode() { return $this->code; } diff --git a/lib/public/Search/IFilterCollection.php b/lib/public/Search/IFilterCollection.php index f68092d1698..a28578a6d31 100644 --- a/lib/public/Search/IFilterCollection.php +++ b/lib/public/Search/IFilterCollection.php @@ -35,6 +35,7 @@ interface IFilterCollection extends IteratorAggregate { * * @since 28.0.0 */ + #[\Override] public function getIterator(): \Traversable; /** diff --git a/lib/public/Search/SearchResult.php b/lib/public/Search/SearchResult.php index 2504ffd01e9..1168dca43ed 100644 --- a/lib/public/Search/SearchResult.php +++ b/lib/public/Search/SearchResult.php @@ -83,6 +83,7 @@ final class SearchResult implements JsonSerializable { * * @since 20.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'name' => $this->name, diff --git a/lib/public/Search/SearchResultEntry.php b/lib/public/Search/SearchResultEntry.php index b28cda3ea0e..cfa6ae52d09 100644 --- a/lib/public/Search/SearchResultEntry.php +++ b/lib/public/Search/SearchResultEntry.php @@ -110,6 +110,7 @@ class SearchResultEntry implements JsonSerializable { * * @since 20.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'thumbnailUrl' => $this->thumbnailUrl, diff --git a/lib/public/Security/Signature/Model/Signatory.php b/lib/public/Security/Signature/Model/Signatory.php index 6ab1133c229..563dadce56e 100644 --- a/lib/public/Security/Signature/Model/Signatory.php +++ b/lib/public/Security/Signature/Model/Signatory.php @@ -169,6 +169,7 @@ class Signatory extends Entity implements JsonSerializable { * @return array * @since 33.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'keyId' => $this->getKeyId(), diff --git a/lib/public/SetupCheck/SetupResult.php b/lib/public/SetupCheck/SetupResult.php index 7d64b838087..1188a321056 100644 --- a/lib/public/SetupCheck/SetupResult.php +++ b/lib/public/SetupCheck/SetupResult.php @@ -176,6 +176,7 @@ class SetupResult implements \JsonSerializable { * * @since 28.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'name' => $this->name, diff --git a/lib/public/SystemTag/MapperEvent.php b/lib/public/SystemTag/MapperEvent.php index 821d1b5dc5e..8647ece01b7 100644 --- a/lib/public/SystemTag/MapperEvent.php +++ b/lib/public/SystemTag/MapperEvent.php @@ -90,6 +90,7 @@ class MapperEvent extends Event implements IWebhookCompatibleEvent { * @return array * @since 32.0.0 */ + #[\Override] public function getWebhookSerializable(): array { return [ 'eventType' => $this->getEvent(), diff --git a/lib/public/SystemTag/TagAssignedEvent.php b/lib/public/SystemTag/TagAssignedEvent.php index 596e30fe0be..50503a6cbdd 100644 --- a/lib/public/SystemTag/TagAssignedEvent.php +++ b/lib/public/SystemTag/TagAssignedEvent.php @@ -63,6 +63,7 @@ class TagAssignedEvent extends Event implements IWebhookCompatibleEvent { * @return array{objectType: string, objectIds: list, tagIds: list} * @since 32.0.0 */ + #[\Override] public function getWebhookSerializable(): array { return [ 'objectType' => $this->getObjectType(), diff --git a/lib/public/SystemTag/TagUnassignedEvent.php b/lib/public/SystemTag/TagUnassignedEvent.php index 8d7fbd4a93b..5ed085ba87c 100644 --- a/lib/public/SystemTag/TagUnassignedEvent.php +++ b/lib/public/SystemTag/TagUnassignedEvent.php @@ -63,6 +63,7 @@ class TagUnassignedEvent extends Event implements IWebhookCompatibleEvent { * @return array{objectType: string, objectIds: list, tagIds: list} * @since 32.0.0 */ + #[\Override] public function getWebhookSerializable(): array { return [ 'objectType' => $this->getObjectType(), diff --git a/lib/public/TaskProcessing/ISynchronousWatermarkingProvider.php b/lib/public/TaskProcessing/ISynchronousWatermarkingProvider.php index 97f283022be..05b7c07ec6c 100644 --- a/lib/public/TaskProcessing/ISynchronousWatermarkingProvider.php +++ b/lib/public/TaskProcessing/ISynchronousWatermarkingProvider.php @@ -31,5 +31,6 @@ interface ISynchronousWatermarkingProvider extends ISynchronousProvider { * @throws ProcessingException * @since 33.0.0 */ + #[\Override] public function process(?string $userId, array $input, callable $reportProgress, bool $includeWatermark = true): array; } diff --git a/lib/public/TaskProcessing/ShapeDescriptor.php b/lib/public/TaskProcessing/ShapeDescriptor.php index 19e57c8a91d..6cdb511e50c 100644 --- a/lib/public/TaskProcessing/ShapeDescriptor.php +++ b/lib/public/TaskProcessing/ShapeDescriptor.php @@ -52,6 +52,7 @@ class ShapeDescriptor implements \JsonSerializable { * @return array{name: string, description: string, type: "Number"|"Text"|"Audio"|"Image"|"Video"|"File"|"Enum"|"ListOfNumbers"|"ListOfTexts"|"ListOfImages"|"ListOfAudios"|"ListOfVideos"|"ListOfFiles"} * @since 30.0.0 */ + #[\Override] public function jsonSerialize(): array { /** @var "Number"|"Text"|"Audio"|"Image"|"Video"|"File"|"Enum"|"ListOfNumbers"|"ListOfTexts"|"ListOfImages"|"ListOfAudios"|"ListOfVideos"|"ListOfFiles" $type */ $type = $this->getShapeType()->name; diff --git a/lib/public/TaskProcessing/ShapeEnumValue.php b/lib/public/TaskProcessing/ShapeEnumValue.php index bc500524304..5afffecd2e6 100644 --- a/lib/public/TaskProcessing/ShapeEnumValue.php +++ b/lib/public/TaskProcessing/ShapeEnumValue.php @@ -42,6 +42,7 @@ class ShapeEnumValue implements \JsonSerializable { * @return array{name: string, value: string} * @since 30.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'name' => $this->getName(), diff --git a/lib/public/TaskProcessing/Task.php b/lib/public/TaskProcessing/Task.php index f0096c42a70..72edc9a17ce 100644 --- a/lib/public/TaskProcessing/Task.php +++ b/lib/public/TaskProcessing/Task.php @@ -298,6 +298,7 @@ final class Task implements \JsonSerializable { * @psalm-return array{id: int, lastUpdated: int, type: string, status: 'STATUS_CANCELLED'|'STATUS_FAILED'|'STATUS_SUCCESSFUL'|'STATUS_RUNNING'|'STATUS_SCHEDULED'|'STATUS_UNKNOWN', userId: ?string, appId: string, input: array|numeric|string>, output: ?array|numeric|string>, customId: ?string, completionExpectedAt: ?int, progress: ?float, scheduledAt: ?int, startedAt: ?int, endedAt: ?int, allowCleanup: bool, includeWatermark: bool, userFacingErrorMessage: ?string} * @since 30.0.0 */ + #[\Override] final public function jsonSerialize(): array { return [ 'id' => (int)$this->getId(), diff --git a/lib/public/TaskProcessing/TaskTypes/AnalyzeImages.php b/lib/public/TaskProcessing/TaskTypes/AnalyzeImages.php index 462016c5c19..97f7ffabf26 100644 --- a/lib/public/TaskProcessing/TaskTypes/AnalyzeImages.php +++ b/lib/public/TaskProcessing/TaskTypes/AnalyzeImages.php @@ -41,6 +41,7 @@ class AnalyzeImages implements ITaskType { * @inheritDoc * @since 32.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Analyze images'); } @@ -49,6 +50,7 @@ class AnalyzeImages implements ITaskType { * @inheritDoc * @since 32.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Ask a question about the given images.'); } @@ -57,6 +59,7 @@ class AnalyzeImages implements ITaskType { * @return string * @since 32.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -65,6 +68,7 @@ class AnalyzeImages implements ITaskType { * @return ShapeDescriptor[] * @since 32.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'images' => new ShapeDescriptor( @@ -84,6 +88,7 @@ class AnalyzeImages implements ITaskType { * @return ShapeDescriptor[] * @since 32.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php b/lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php index 0613a2d07d2..4cee9997408 100644 --- a/lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php +++ b/lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php @@ -42,6 +42,7 @@ class AudioToAudioChat implements IInternalTaskType { * @inheritDoc * @since 32.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Audio chat'); } @@ -50,6 +51,7 @@ class AudioToAudioChat implements IInternalTaskType { * @inheritDoc * @since 32.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Voice chat with the assistant'); } @@ -58,6 +60,7 @@ class AudioToAudioChat implements IInternalTaskType { * @return string * @since 32.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class AudioToAudioChat implements IInternalTaskType { * @return ShapeDescriptor[] * @since 32.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'system_prompt' => new ShapeDescriptor( @@ -90,6 +94,7 @@ class AudioToAudioChat implements IInternalTaskType { * @return ShapeDescriptor[] * @since 32.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'input_transcript' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/AudioToText.php b/lib/public/TaskProcessing/TaskTypes/AudioToText.php index 1982d4c9d28..438fd52a9df 100644 --- a/lib/public/TaskProcessing/TaskTypes/AudioToText.php +++ b/lib/public/TaskProcessing/TaskTypes/AudioToText.php @@ -42,6 +42,7 @@ class AudioToText implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Transcribe audio'); } @@ -50,6 +51,7 @@ class AudioToText implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Transcribe the things said in an audio'); } @@ -58,6 +60,7 @@ class AudioToText implements ITaskType { * @return string * @since 30.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class AudioToText implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -80,6 +84,7 @@ class AudioToText implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/ContextAgentAudioInteraction.php b/lib/public/TaskProcessing/TaskTypes/ContextAgentAudioInteraction.php index b668ea24806..a7059e2fd1e 100644 --- a/lib/public/TaskProcessing/TaskTypes/ContextAgentAudioInteraction.php +++ b/lib/public/TaskProcessing/TaskTypes/ContextAgentAudioInteraction.php @@ -38,6 +38,7 @@ class ContextAgentAudioInteraction implements IInternalTaskType { * @inheritDoc * @since 32.0.0 */ + #[\Override] public function getName(): string { return 'ContextAgent audio'; // We do not translate this } @@ -46,6 +47,7 @@ class ContextAgentAudioInteraction implements IInternalTaskType { * @inheritDoc * @since 32.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Chat by voice with an agent'); } @@ -54,6 +56,7 @@ class ContextAgentAudioInteraction implements IInternalTaskType { * @return string * @since 32.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -62,6 +65,7 @@ class ContextAgentAudioInteraction implements IInternalTaskType { * @return ShapeDescriptor[] * @since 32.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -86,6 +90,7 @@ class ContextAgentAudioInteraction implements IInternalTaskType { * @return ShapeDescriptor[] * @since 32.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'input_transcript' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php b/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php index 6cb126e1894..4ffca7126c2 100644 --- a/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php +++ b/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php @@ -38,6 +38,7 @@ class ContextAgentInteraction implements IInternalTaskType { * @inheritDoc * @since 31.0.0 */ + #[\Override] public function getName(): string { return 'ContextAgent'; // We do not translate this } @@ -46,6 +47,7 @@ class ContextAgentInteraction implements IInternalTaskType { * @inheritDoc * @since 31.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Chat with an agent'); } @@ -54,6 +56,7 @@ class ContextAgentInteraction implements IInternalTaskType { * @return string * @since 31.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -62,6 +65,7 @@ class ContextAgentInteraction implements IInternalTaskType { * @return ShapeDescriptor[] * @since 31.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -86,6 +90,7 @@ class ContextAgentInteraction implements IInternalTaskType { * @return ShapeDescriptor[] * @since 31.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/ContextWrite.php b/lib/public/TaskProcessing/TaskTypes/ContextWrite.php index fd5c6a8f58b..3634168a6bc 100644 --- a/lib/public/TaskProcessing/TaskTypes/ContextWrite.php +++ b/lib/public/TaskProcessing/TaskTypes/ContextWrite.php @@ -42,6 +42,7 @@ class ContextWrite implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Context write'); } @@ -50,6 +51,7 @@ class ContextWrite implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Writes text in a given style based on the provided source material.'); } @@ -58,6 +60,7 @@ class ContextWrite implements ITaskType { * @return string * @since 30.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class ContextWrite implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'style_input' => new ShapeDescriptor( @@ -85,6 +89,7 @@ class ContextWrite implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/GenerateEmoji.php b/lib/public/TaskProcessing/TaskTypes/GenerateEmoji.php index 2cb22b3b455..56a0017e2e1 100644 --- a/lib/public/TaskProcessing/TaskTypes/GenerateEmoji.php +++ b/lib/public/TaskProcessing/TaskTypes/GenerateEmoji.php @@ -42,6 +42,7 @@ class GenerateEmoji implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Emoji generator'); } @@ -50,6 +51,7 @@ class GenerateEmoji implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Takes text and generates a representative emoji for it.'); } @@ -58,6 +60,7 @@ class GenerateEmoji implements ITaskType { * @return string * @since 30.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class GenerateEmoji implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -80,6 +84,7 @@ class GenerateEmoji implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/ImageToTextOpticalCharacterRecognition.php b/lib/public/TaskProcessing/TaskTypes/ImageToTextOpticalCharacterRecognition.php index 6438afd6a53..d342879b8e2 100644 --- a/lib/public/TaskProcessing/TaskTypes/ImageToTextOpticalCharacterRecognition.php +++ b/lib/public/TaskProcessing/TaskTypes/ImageToTextOpticalCharacterRecognition.php @@ -40,6 +40,7 @@ class ImageToTextOpticalCharacterRecognition implements ITaskType { /** * @since 33.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Optical character recognition'); } @@ -47,6 +48,7 @@ class ImageToTextOpticalCharacterRecognition implements ITaskType { /** * @since 33.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Extract text from files like images or PDFs'); } @@ -54,6 +56,7 @@ class ImageToTextOpticalCharacterRecognition implements ITaskType { /** * @since 33.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -62,6 +65,7 @@ class ImageToTextOpticalCharacterRecognition implements ITaskType { * @return ShapeDescriptor[] * @since 33.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -76,6 +80,7 @@ class ImageToTextOpticalCharacterRecognition implements ITaskType { * @return ShapeDescriptor[] * @since 33.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToImage.php b/lib/public/TaskProcessing/TaskTypes/TextToImage.php index ed956d244a1..b5db195a474 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToImage.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToImage.php @@ -42,6 +42,7 @@ class TextToImage implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Generate image'); } @@ -50,6 +51,7 @@ class TextToImage implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Generate an image from a text prompt'); } @@ -58,6 +60,7 @@ class TextToImage implements ITaskType { * @return string * @since 30.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class TextToImage implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -85,6 +89,7 @@ class TextToImage implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'images' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToSpeech.php b/lib/public/TaskProcessing/TaskTypes/TextToSpeech.php index ce35be32a6f..bb5f3db96e9 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToSpeech.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToSpeech.php @@ -42,6 +42,7 @@ class TextToSpeech implements ITaskType { * @inheritDoc * @since 32.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Generate speech'); } @@ -50,6 +51,7 @@ class TextToSpeech implements ITaskType { * @inheritDoc * @since 32.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Generate speech from a transcript'); } @@ -58,6 +60,7 @@ class TextToSpeech implements ITaskType { * @return string * @since 32.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class TextToSpeech implements ITaskType { * @return ShapeDescriptor[] * @since 32.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -80,6 +84,7 @@ class TextToSpeech implements ITaskType { * @return ShapeDescriptor[] * @since 32.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'speech' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToText.php b/lib/public/TaskProcessing/TaskTypes/TextToText.php index c39d435688a..639e99d0cea 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToText.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToText.php @@ -42,6 +42,7 @@ class TextToText implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Free text to text prompt'); } @@ -50,6 +51,7 @@ class TextToText implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Runs an arbitrary prompt through a language model that returns a reply'); } @@ -58,6 +60,7 @@ class TextToText implements ITaskType { * @return string * @since 30.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class TextToText implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -80,6 +84,7 @@ class TextToText implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToTextChangeTone.php b/lib/public/TaskProcessing/TaskTypes/TextToTextChangeTone.php index 0ea4575a187..ef4b0f2ea04 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToTextChangeTone.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToTextChangeTone.php @@ -38,6 +38,7 @@ class TextToTextChangeTone implements ITaskType { * @inheritDoc * @since 31.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Change Tone'); } @@ -46,6 +47,7 @@ class TextToTextChangeTone implements ITaskType { * @inheritDoc * @since 31.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Change the tone of a piece of text.'); } @@ -54,6 +56,7 @@ class TextToTextChangeTone implements ITaskType { * @return string * @since 31.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -62,6 +65,7 @@ class TextToTextChangeTone implements ITaskType { * @return ShapeDescriptor[] * @since 31.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -81,6 +85,7 @@ class TextToTextChangeTone implements ITaskType { * @return ShapeDescriptor[] * @since 31.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToTextChat.php b/lib/public/TaskProcessing/TaskTypes/TextToTextChat.php index 9cf1e7ef3ce..9af9283a7a9 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToTextChat.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToTextChat.php @@ -42,6 +42,7 @@ class TextToTextChat implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Chat'); } @@ -50,6 +51,7 @@ class TextToTextChat implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Chat with the assistant'); } @@ -58,6 +60,7 @@ class TextToTextChat implements ITaskType { * @return string * @since 30.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class TextToTextChat implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'system_prompt' => new ShapeDescriptor( @@ -90,6 +94,7 @@ class TextToTextChat implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToTextChatWithTools.php b/lib/public/TaskProcessing/TaskTypes/TextToTextChatWithTools.php index 3e470bf23ae..bc18a954bbc 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToTextChatWithTools.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToTextChatWithTools.php @@ -38,6 +38,7 @@ class TextToTextChatWithTools implements IInternalTaskType { * @inheritDoc * @since 31.0.0 */ + #[\Override] public function getName(): string { // TRANSLATORS Tool calling, also known as function calling, is a structured way to give LLMs the ability to make requests back to the application that called it. You define the tools you want to make available to the model, and the model will make tool requests to your app as necessary to fulfill the prompts you give it. return $this->l->t('Chat with tools'); @@ -47,6 +48,7 @@ class TextToTextChatWithTools implements IInternalTaskType { * @inheritDoc * @since 31.0.0 */ + #[\Override] public function getDescription(): string { // TRANSLATORS Tool calling, also known as function calling, is a structured way to give LLMs the ability to make requests back to the application that called it. You define the tools you want to make available to the model, and the model will make tool requests to your app as necessary to fulfill the prompts you give it. return $this->l->t('Chat with the language model with tool calling support.'); @@ -56,6 +58,7 @@ class TextToTextChatWithTools implements IInternalTaskType { * @return string * @since 31.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -64,6 +67,7 @@ class TextToTextChatWithTools implements IInternalTaskType { * @return ShapeDescriptor[] * @since 31.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'system_prompt' => new ShapeDescriptor( @@ -100,6 +104,7 @@ class TextToTextChatWithTools implements IInternalTaskType { * @return ShapeDescriptor[] * @since 31.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToTextFormalization.php b/lib/public/TaskProcessing/TaskTypes/TextToTextFormalization.php index 70e38f78c0b..2502d0ef4a3 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToTextFormalization.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToTextFormalization.php @@ -42,6 +42,7 @@ class TextToTextFormalization implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Formalize text'); } @@ -50,6 +51,7 @@ class TextToTextFormalization implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Takes a text and makes it sound more formal'); } @@ -58,6 +60,7 @@ class TextToTextFormalization implements ITaskType { * @return string * @since 30.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class TextToTextFormalization implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -80,6 +84,7 @@ class TextToTextFormalization implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToTextHeadline.php b/lib/public/TaskProcessing/TaskTypes/TextToTextHeadline.php index dde4ea03042..6dbe165486d 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToTextHeadline.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToTextHeadline.php @@ -42,6 +42,7 @@ class TextToTextHeadline implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Generate a headline'); } @@ -50,6 +51,7 @@ class TextToTextHeadline implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Generates a possible headline for a text.'); } @@ -58,6 +60,7 @@ class TextToTextHeadline implements ITaskType { * @return string * @since 30.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class TextToTextHeadline implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -80,6 +84,7 @@ class TextToTextHeadline implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToTextProofread.php b/lib/public/TaskProcessing/TaskTypes/TextToTextProofread.php index 508794490be..14c08710f81 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToTextProofread.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToTextProofread.php @@ -41,6 +41,7 @@ class TextToTextProofread implements ITaskType { * @inheritDoc * @since 31.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Proofread'); } @@ -49,6 +50,7 @@ class TextToTextProofread implements ITaskType { * @inheritDoc * @since 31.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Proofreads a text and lists corrections'); } @@ -57,6 +59,7 @@ class TextToTextProofread implements ITaskType { * @return string * @since 31.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -65,6 +68,7 @@ class TextToTextProofread implements ITaskType { * @return ShapeDescriptor[] * @since 31.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -79,6 +83,7 @@ class TextToTextProofread implements ITaskType { * @return ShapeDescriptor[] * @since 31.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToTextReformulation.php b/lib/public/TaskProcessing/TaskTypes/TextToTextReformulation.php index 120f5316aee..92ce7ad2e86 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToTextReformulation.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToTextReformulation.php @@ -42,6 +42,7 @@ class TextToTextReformulation implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Reformulate text'); } @@ -50,6 +51,7 @@ class TextToTextReformulation implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Takes a text and reformulates it'); } @@ -58,6 +60,7 @@ class TextToTextReformulation implements ITaskType { * @return string * @since 30.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class TextToTextReformulation implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -80,6 +84,7 @@ class TextToTextReformulation implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToTextSimplification.php b/lib/public/TaskProcessing/TaskTypes/TextToTextSimplification.php index d107e584e3a..b4d88501f7b 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToTextSimplification.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToTextSimplification.php @@ -42,6 +42,7 @@ class TextToTextSimplification implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Simplify text'); } @@ -50,6 +51,7 @@ class TextToTextSimplification implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Takes a text and simplifies it'); } @@ -58,6 +60,7 @@ class TextToTextSimplification implements ITaskType { * @return string * @since 30.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class TextToTextSimplification implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -80,6 +84,7 @@ class TextToTextSimplification implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToTextSummary.php b/lib/public/TaskProcessing/TaskTypes/TextToTextSummary.php index 601b478c0bd..6b16b0d1c53 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToTextSummary.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToTextSummary.php @@ -41,6 +41,7 @@ class TextToTextSummary implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Summarize'); } @@ -49,6 +50,7 @@ class TextToTextSummary implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Summarizes a text'); } @@ -57,6 +59,7 @@ class TextToTextSummary implements ITaskType { * @return string * @since 30.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -65,6 +68,7 @@ class TextToTextSummary implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -79,6 +83,7 @@ class TextToTextSummary implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToTextTopics.php b/lib/public/TaskProcessing/TaskTypes/TextToTextTopics.php index 943cc2e2fd4..7aa9aecf36d 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToTextTopics.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToTextTopics.php @@ -42,6 +42,7 @@ class TextToTextTopics implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Extract topics'); } @@ -50,6 +51,7 @@ class TextToTextTopics implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Extracts topics from a text and outputs them separated by commas'); } @@ -58,6 +60,7 @@ class TextToTextTopics implements ITaskType { * @return string * @since 30.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class TextToTextTopics implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -80,6 +84,7 @@ class TextToTextTopics implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/TaskProcessing/TaskTypes/TextToTextTranslate.php b/lib/public/TaskProcessing/TaskTypes/TextToTextTranslate.php index a02550226ee..0de8a7e1ada 100644 --- a/lib/public/TaskProcessing/TaskTypes/TextToTextTranslate.php +++ b/lib/public/TaskProcessing/TaskTypes/TextToTextTranslate.php @@ -42,6 +42,7 @@ class TextToTextTranslate implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getName(): string { return $this->l->t('Translate'); } @@ -50,6 +51,7 @@ class TextToTextTranslate implements ITaskType { * @inheritDoc * @since 30.0.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Translate text from one language to another'); } @@ -58,6 +60,7 @@ class TextToTextTranslate implements ITaskType { * @return string * @since 30.0.0 */ + #[\Override] public function getId(): string { return self::ID; } @@ -66,6 +69,7 @@ class TextToTextTranslate implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getInputShape(): array { return [ 'input' => new ShapeDescriptor( @@ -90,6 +94,7 @@ class TextToTextTranslate implements ITaskType { * @return ShapeDescriptor[] * @since 30.0.0 */ + #[\Override] public function getOutputShape(): array { return [ 'output' => new ShapeDescriptor( diff --git a/lib/public/Teams/Team.php b/lib/public/Teams/Team.php index cc70f6fbd45..a0a2a3c8c9e 100644 --- a/lib/public/Teams/Team.php +++ b/lib/public/Teams/Team.php @@ -58,6 +58,7 @@ class Team implements \JsonSerializable { * * @since 29.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'teamId' => $this->teamId, diff --git a/lib/public/Teams/TeamResource.php b/lib/public/Teams/TeamResource.php index a15faacf79b..b83e5b65adc 100644 --- a/lib/public/Teams/TeamResource.php +++ b/lib/public/Teams/TeamResource.php @@ -110,6 +110,7 @@ class TeamResource implements \JsonSerializable { * * @since 29.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'id' => $this->resourceId, diff --git a/lib/public/TextProcessing/FreePromptTaskType.php b/lib/public/TextProcessing/FreePromptTaskType.php index 2433f24dbd7..d5af0fc8ffa 100644 --- a/lib/public/TextProcessing/FreePromptTaskType.php +++ b/lib/public/TextProcessing/FreePromptTaskType.php @@ -37,6 +37,7 @@ class FreePromptTaskType implements ITaskType { * @inheritDoc * @since 27.1.0 */ + #[\Override] public function getName(): string { return $this->l->t('Free prompt'); } @@ -45,6 +46,7 @@ class FreePromptTaskType implements ITaskType { * @inheritDoc * @since 27.1.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Runs an arbitrary prompt through the language model.'); } diff --git a/lib/public/TextProcessing/HeadlineTaskType.php b/lib/public/TextProcessing/HeadlineTaskType.php index 00eb66466ae..f7fea210a6f 100644 --- a/lib/public/TextProcessing/HeadlineTaskType.php +++ b/lib/public/TextProcessing/HeadlineTaskType.php @@ -37,6 +37,7 @@ class HeadlineTaskType implements ITaskType { * @inheritDoc * @since 27.1.0 */ + #[\Override] public function getName(): string { return $this->l->t('Generate headline'); } @@ -45,6 +46,7 @@ class HeadlineTaskType implements ITaskType { * @inheritDoc * @since 27.1.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Generates a possible headline for a text.'); } diff --git a/lib/public/TextProcessing/SummaryTaskType.php b/lib/public/TextProcessing/SummaryTaskType.php index 656a50ebc62..d3580ca15d6 100644 --- a/lib/public/TextProcessing/SummaryTaskType.php +++ b/lib/public/TextProcessing/SummaryTaskType.php @@ -37,6 +37,7 @@ class SummaryTaskType implements ITaskType { * @inheritDoc * @since 27.1.0 */ + #[\Override] public function getName(): string { return $this->l->t('Summarize'); } @@ -45,6 +46,7 @@ class SummaryTaskType implements ITaskType { * @inheritDoc * @since 27.1.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Summarizes text by reducing its length without losing key information.'); } diff --git a/lib/public/TextProcessing/Task.php b/lib/public/TextProcessing/Task.php index d968ad9ba3e..0f874b92599 100644 --- a/lib/public/TextProcessing/Task.php +++ b/lib/public/TextProcessing/Task.php @@ -193,6 +193,7 @@ final class Task implements \JsonSerializable { * @psalm-return array{id: ?int, type: class-string, status: 0|1|2|3|4, userId: ?string, appId: string, input: string, output: ?string, identifier: string, completionExpectedAt: ?int} * @since 27.1.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'id' => $this->getId(), diff --git a/lib/public/TextProcessing/TopicsTaskType.php b/lib/public/TextProcessing/TopicsTaskType.php index c693ee3d27f..ef47ad7c7af 100644 --- a/lib/public/TextProcessing/TopicsTaskType.php +++ b/lib/public/TextProcessing/TopicsTaskType.php @@ -37,6 +37,7 @@ class TopicsTaskType implements ITaskType { * @inheritDoc * @since 27.1.0 */ + #[\Override] public function getName(): string { return $this->l->t('Extract topics'); } @@ -45,6 +46,7 @@ class TopicsTaskType implements ITaskType { * @inheritDoc * @since 27.1.0 */ + #[\Override] public function getDescription(): string { return $this->l->t('Extracts topics from a text and outputs them separated by commas.'); } diff --git a/lib/public/TextToImage/Task.php b/lib/public/TextToImage/Task.php index ea1b45ef99c..147bff62df1 100644 --- a/lib/public/TextToImage/Task.php +++ b/lib/public/TextToImage/Task.php @@ -188,6 +188,7 @@ final class Task implements \JsonSerializable { * @psalm-return array{id: ?int, status: self::STATUS_*, userId: ?string, appId: string, input: string, identifier: ?string, numberOfImages: int, completionExpectedAt: ?int} * @since 28.0.0 */ + #[\Override] public function jsonSerialize(): array { return [ 'id' => $this->getId(), diff --git a/lib/public/Translation/LanguageTuple.php b/lib/public/Translation/LanguageTuple.php index 07507ece687..e30a37a8b11 100644 --- a/lib/public/Translation/LanguageTuple.php +++ b/lib/public/Translation/LanguageTuple.php @@ -32,6 +32,7 @@ class LanguageTuple implements JsonSerializable { * @since 26.0.0 * @return array{from: string, fromLabel: string, to: string, toLabel: string} */ + #[\Override] public function jsonSerialize(): array { return [ 'from' => $this->from, diff --git a/lib/public/User/Backend/ABackend.php b/lib/public/User/Backend/ABackend.php index 2fca83e3be8..90be168e235 100644 --- a/lib/public/User/Backend/ABackend.php +++ b/lib/public/User/Backend/ABackend.php @@ -23,6 +23,7 @@ abstract class ABackend implements IUserBackend, UserInterface { * @param int $actions The action to check for * @return bool */ + #[\Override] public function implementsActions($actions): bool { $implements = 0; diff --git a/lib/public/User/Backend/ILimitAwareCountUsersBackend.php b/lib/public/User/Backend/ILimitAwareCountUsersBackend.php index a59c0bd8e04..de7950b9e44 100644 --- a/lib/public/User/Backend/ILimitAwareCountUsersBackend.php +++ b/lib/public/User/Backend/ILimitAwareCountUsersBackend.php @@ -19,5 +19,6 @@ interface ILimitAwareCountUsersBackend extends ICountUsersBackend { * @param int $limit Limit to stop counting users if there are more than $limit. 0 to disable limiting. * @return int|false The number of users (may be limited to $limit) on success false on failure */ + #[\Override] public function countUsers(int $limit = 0): int|false; } diff --git a/lib/public/User/IOutOfOfficeData.php b/lib/public/User/IOutOfOfficeData.php index e3a4e2773bb..8f449758a63 100644 --- a/lib/public/User/IOutOfOfficeData.php +++ b/lib/public/User/IOutOfOfficeData.php @@ -90,5 +90,6 @@ interface IOutOfOfficeData extends JsonSerializable { * * @since 28.0.0 */ + #[\Override] public function jsonSerialize(): array; } diff --git a/lib/public/WorkflowEngine/GenericEntityEvent.php b/lib/public/WorkflowEngine/GenericEntityEvent.php index 5c1c2a63244..7e1b20370df 100644 --- a/lib/public/WorkflowEngine/GenericEntityEvent.php +++ b/lib/public/WorkflowEngine/GenericEntityEvent.php @@ -44,6 +44,7 @@ class GenericEntityEvent implements IEntityEvent { * * @since 18.0.0 */ + #[\Override] public function getDisplayName(): string { return $this->displayName; } @@ -55,6 +56,7 @@ class GenericEntityEvent implements IEntityEvent { * * @since 18.0.0 */ + #[\Override] public function getEventName(): string { return $this->eventName; } diff --git a/lib/unstable/Config/Exceptions/IncorrectTypeException.php b/lib/unstable/Config/Exceptions/IncorrectTypeException.php index 6b91959071a..32f05c55a3f 100644 --- a/lib/unstable/Config/Exceptions/IncorrectTypeException.php +++ b/lib/unstable/Config/Exceptions/IncorrectTypeException.php @@ -15,5 +15,5 @@ use Exception; * @deprecated 32.0.0 use \OCP\Config\Exceptions\IncorrectTypeException * @see \OCP\Config\Exceptions\IncorrectTypeException */ -class IncorrectTypeException extends Exception { +final class IncorrectTypeException extends Exception { } diff --git a/lib/unstable/Config/Exceptions/TypeConflictException.php b/lib/unstable/Config/Exceptions/TypeConflictException.php index 808679ed873..6f6c1fd7e70 100644 --- a/lib/unstable/Config/Exceptions/TypeConflictException.php +++ b/lib/unstable/Config/Exceptions/TypeConflictException.php @@ -15,5 +15,5 @@ use Exception; * @deprecated 32.0.0 use \OCP\Config\Exceptions\TypeConflictException * @see \OCP\Config\Exceptions\TypeConflictException */ -class TypeConflictException extends Exception { +final class TypeConflictException extends Exception { } diff --git a/lib/unstable/Config/Exceptions/UnknownKeyException.php b/lib/unstable/Config/Exceptions/UnknownKeyException.php index 744ce25e48d..b49d0368ae4 100644 --- a/lib/unstable/Config/Exceptions/UnknownKeyException.php +++ b/lib/unstable/Config/Exceptions/UnknownKeyException.php @@ -15,5 +15,5 @@ use Exception; * @deprecated 32.0.0 use \OCP\Config\Exceptions\UnknownKeyException * @see \OCP\Config\Exceptions\UnknownKeyException */ -class UnknownKeyException extends Exception { +final class UnknownKeyException extends Exception { } diff --git a/lib/unstable/Config/Lexicon/ConfigLexiconEntry.php b/lib/unstable/Config/Lexicon/ConfigLexiconEntry.php index 2587cd52c01..b37fda0cc56 100644 --- a/lib/unstable/Config/Lexicon/ConfigLexiconEntry.php +++ b/lib/unstable/Config/Lexicon/ConfigLexiconEntry.php @@ -20,7 +20,7 @@ use NCU\Config\ValueType; * @see \OCP\Config\Lexicon\Entry * @psalm-suppress DeprecatedClass */ -class ConfigLexiconEntry { +final class ConfigLexiconEntry { /** * @experimental 32.0.0 * @deprecated 32.0.0 use \OCP\Config\Lexicon\Entry @@ -145,7 +145,7 @@ class ConfigLexiconEntry { * @see \OCP\Config\Lexicon\Entry */ private function convertFromArray(array $default): string { - return json_encode($default); + return json_encode($default, JSON_THROW_ON_ERROR); } /** diff --git a/lib/unstable/Security/Signature/Exceptions/IdentityNotFoundException.php b/lib/unstable/Security/Signature/Exceptions/IdentityNotFoundException.php index 4b37acd292b..af9247d4225 100644 --- a/lib/unstable/Security/Signature/Exceptions/IdentityNotFoundException.php +++ b/lib/unstable/Security/Signature/Exceptions/IdentityNotFoundException.php @@ -13,5 +13,5 @@ namespace NCU\Security\Signature\Exceptions; * @deprecated 33.0.0 use {@see \OCP\Security\Signature\Exceptions\IdentityNotFoundException} * @psalm-suppress DeprecatedClass */ -class IdentityNotFoundException extends SignatureException { +final class IdentityNotFoundException extends SignatureException { } diff --git a/lib/unstable/Security/Signature/Exceptions/IncomingRequestException.php b/lib/unstable/Security/Signature/Exceptions/IncomingRequestException.php index 16e9209f743..5549c41c1e5 100644 --- a/lib/unstable/Security/Signature/Exceptions/IncomingRequestException.php +++ b/lib/unstable/Security/Signature/Exceptions/IncomingRequestException.php @@ -13,5 +13,5 @@ namespace NCU\Security\Signature\Exceptions; * @deprecated 33.0.0 use {@see \OCP\Security\Signature\Exceptions\IncomingRequestException} * @psalm-suppress DeprecatedClass */ -class IncomingRequestException extends SignatureException { +final class IncomingRequestException extends SignatureException { } diff --git a/lib/unstable/Security/Signature/Exceptions/InvalidKeyOriginException.php b/lib/unstable/Security/Signature/Exceptions/InvalidKeyOriginException.php index d7235ee1683..9967fb3f11e 100644 --- a/lib/unstable/Security/Signature/Exceptions/InvalidKeyOriginException.php +++ b/lib/unstable/Security/Signature/Exceptions/InvalidKeyOriginException.php @@ -13,5 +13,5 @@ namespace NCU\Security\Signature\Exceptions; * @deprecated 33.0.0 use {@see \OCP\Security\Signature\Exceptions\InvalidKeyOriginException} * @psalm-suppress DeprecatedClass */ -class InvalidKeyOriginException extends SignatureException { +final class InvalidKeyOriginException extends SignatureException { } diff --git a/lib/unstable/Security/Signature/Exceptions/InvalidSignatureException.php b/lib/unstable/Security/Signature/Exceptions/InvalidSignatureException.php index 37430c74f2e..3301973224b 100644 --- a/lib/unstable/Security/Signature/Exceptions/InvalidSignatureException.php +++ b/lib/unstable/Security/Signature/Exceptions/InvalidSignatureException.php @@ -13,5 +13,5 @@ namespace NCU\Security\Signature\Exceptions; * @deprecated 33.0.0 use {@see \OCP\Security\Signature\Exceptions\InvalidSignatureException} * @psalm-suppress DeprecatedClass */ -class InvalidSignatureException extends SignatureException { +final class InvalidSignatureException extends SignatureException { } diff --git a/lib/unstable/Security/Signature/Exceptions/SignatoryConflictException.php b/lib/unstable/Security/Signature/Exceptions/SignatoryConflictException.php index dc53fe94726..0accb584923 100644 --- a/lib/unstable/Security/Signature/Exceptions/SignatoryConflictException.php +++ b/lib/unstable/Security/Signature/Exceptions/SignatoryConflictException.php @@ -13,5 +13,5 @@ namespace NCU\Security\Signature\Exceptions; * @deprecated 33.0.0 use {@see \OCP\Security\Signature\Exceptions\SignatoryConflictException} * @psalm-suppress DeprecatedClass */ -class SignatoryConflictException extends SignatoryException { +final class SignatoryConflictException extends SignatoryException { } diff --git a/lib/unstable/Security/Signature/Exceptions/SignatoryNotFoundException.php b/lib/unstable/Security/Signature/Exceptions/SignatoryNotFoundException.php index 0b141d862c2..a9b72d3cc2f 100644 --- a/lib/unstable/Security/Signature/Exceptions/SignatoryNotFoundException.php +++ b/lib/unstable/Security/Signature/Exceptions/SignatoryNotFoundException.php @@ -13,5 +13,5 @@ namespace NCU\Security\Signature\Exceptions; * @deprecated 33.0.0 use {@see \OCP\Security\Signature\Exceptions\SignatoryNotFoundException} * @psalm-suppress DeprecatedClass */ -class SignatoryNotFoundException extends SignatoryException { +final class SignatoryNotFoundException extends SignatoryException { } diff --git a/lib/unstable/Security/Signature/Exceptions/SignatureElementNotFoundException.php b/lib/unstable/Security/Signature/Exceptions/SignatureElementNotFoundException.php index 8930bc0b776..dbf23feb4e9 100644 --- a/lib/unstable/Security/Signature/Exceptions/SignatureElementNotFoundException.php +++ b/lib/unstable/Security/Signature/Exceptions/SignatureElementNotFoundException.php @@ -13,5 +13,5 @@ namespace NCU\Security\Signature\Exceptions; * @deprecated 33.0.0 use {@see \OCP\Security\Signature\Exceptions\SignatureElementNotFoundException} * @psalm-suppress DeprecatedClass */ -class SignatureElementNotFoundException extends SignatureException { +final class SignatureElementNotFoundException extends SignatureException { } diff --git a/lib/unstable/Security/Signature/Exceptions/SignatureNotFoundException.php b/lib/unstable/Security/Signature/Exceptions/SignatureNotFoundException.php index 13c820ddf53..761b04ae228 100644 --- a/lib/unstable/Security/Signature/Exceptions/SignatureNotFoundException.php +++ b/lib/unstable/Security/Signature/Exceptions/SignatureNotFoundException.php @@ -13,5 +13,5 @@ namespace NCU\Security\Signature\Exceptions; * @deprecated 33.0.0 use {@see \OCP\Security\Signature\Exceptions\SignatureNotFoundException} * @psalm-suppress DeprecatedClass */ -class SignatureNotFoundException extends SignatureException { +final class SignatureNotFoundException extends SignatureException { } diff --git a/lib/unstable/Security/Signature/Model/Signatory.php b/lib/unstable/Security/Signature/Model/Signatory.php index f3ae93840ad..de0aeebc9db 100644 --- a/lib/unstable/Security/Signature/Model/Signatory.php +++ b/lib/unstable/Security/Signature/Model/Signatory.php @@ -49,7 +49,7 @@ use OCP\AppFramework\Db\Entity; * @method int getLastUpdated() * @psalm-suppress PropertyNotSetInConstructor */ -class Signatory extends Entity implements JsonSerializable { +final class Signatory extends Entity implements JsonSerializable { protected string $keyId = ''; protected string $keyIdSum = ''; protected string $providerId = ''; @@ -103,7 +103,7 @@ class Signatory extends Entity implements JsonSerializable { // removing /index.php from generated url $path = parse_url($keyId, PHP_URL_PATH); - if (str_starts_with($path, '/index.php/')) { + if ($path !== null && $path !== false && str_starts_with($path, '/index.php/')) { $pos = strpos($keyId, '/index.php'); if ($pos !== false) { $keyId = substr_replace($keyId, '', $pos, 10); @@ -182,6 +182,7 @@ class Signatory extends Entity implements JsonSerializable { * @experimental 31.0.0 * @deprecated 33.0.0 use {@see \OCP\Security\Signature\Model\Signatory} */ + #[\Override] public function jsonSerialize(): array { return [ 'keyId' => $this->getKeyId(), diff --git a/psalm-ncu.xml b/psalm-ncu.xml index f7577435b88..7b5a42c60af 100644 --- a/psalm-ncu.xml +++ b/psalm-ncu.xml @@ -8,9 +8,10 @@ resolveFromConfigFile="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" - xsi:schemaLocation="https://getpsalm.org/schema/config" + xsi:schemaLocation="https://getpsalm.org/schema/config vendor-bin/psalm/vendor/vimeo/psalm/config.xsd" findUnusedBaselineEntry="false" findUnusedCode="false" + phpVersion="8.2" > diff --git a/psalm-ocp.xml b/psalm-ocp.xml index e49f7fd929b..b7ebd5aab69 100644 --- a/psalm-ocp.xml +++ b/psalm-ocp.xml @@ -8,10 +8,11 @@ resolveFromConfigFile="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" - xsi:schemaLocation="https://getpsalm.org/schema/config" - errorBaseline="build/psalm-baseline-ocp.xml" + xsi:schemaLocation="https://getpsalm.org/schema/config vendor-bin/psalm/vendor/vimeo/psalm/config.xsd" + errorBaseline="build/psalm-baseline-ocp.xml" findUnusedBaselineEntry="false" findUnusedCode="false" + strictBinaryOperands="false" > diff --git a/psalm-strict.xml b/psalm-strict.xml index d91fdc69790..95d52600434 100644 --- a/psalm-strict.xml +++ b/psalm-strict.xml @@ -7,7 +7,7 @@ errorLevel="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" - xsi:schemaLocation="https://getpsalm.org/schema/config" + xsi:schemaLocation="https://getpsalm.org/schema/config vendor-bin/psalm/vendor/vimeo/psalm/config.xsd" resolveFromConfigFile="false" findUnusedBaselineEntry="true" findUnusedCode="false" @@ -50,21 +50,11 @@ - - - - - - - - - - diff --git a/psalm.xml b/psalm.xml index ee406c5bcbf..df54ed32464 100644 --- a/psalm.xml +++ b/psalm.xml @@ -12,6 +12,8 @@ errorBaseline="build/psalm-baseline.xml" findUnusedBaselineEntry="true" findUnusedCode="false" + findUnusedIssueHandlerSuppression="false" + strictBinaryOperands="false" phpVersion="8.2" > @@ -69,6 +71,7 @@ + @@ -181,12 +184,6 @@ - - - - - - @@ -211,15 +208,5 @@ - - - - - - - - - - diff --git a/tests/Core/Command/Apps/AppsDisableTest.php b/tests/Core/Command/Apps/AppsDisableTest.php index 26bd1878d0d..a6d34a1e7ea 100644 --- a/tests/Core/Command/Apps/AppsDisableTest.php +++ b/tests/Core/Command/Apps/AppsDisableTest.php @@ -22,6 +22,7 @@ class AppsDisableTest extends TestCase { /** @var CommandTester */ private $commandTester; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Apps/AppsEnableTest.php b/tests/Core/Command/Apps/AppsEnableTest.php index 86f7ca6fcce..ea1e6ff8cb4 100644 --- a/tests/Core/Command/Apps/AppsEnableTest.php +++ b/tests/Core/Command/Apps/AppsEnableTest.php @@ -24,6 +24,7 @@ class AppsEnableTest extends TestCase { /** @var CommandTester */ private $commandTester; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Config/App/DeleteConfigTest.php b/tests/Core/Command/Config/App/DeleteConfigTest.php index 9e43f389214..fced4e4b8a2 100644 --- a/tests/Core/Command/Config/App/DeleteConfigTest.php +++ b/tests/Core/Command/Config/App/DeleteConfigTest.php @@ -25,6 +25,7 @@ class DeleteConfigTest extends TestCase { protected OutputInterface&MockObject $consoleOutput; protected Command $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Config/App/GetConfigTest.php b/tests/Core/Command/Config/App/GetConfigTest.php index 13392cddf55..1e68f76d86f 100644 --- a/tests/Core/Command/Config/App/GetConfigTest.php +++ b/tests/Core/Command/Config/App/GetConfigTest.php @@ -26,6 +26,7 @@ class GetConfigTest extends TestCase { protected OutputInterface&MockObject $consoleOutput; protected Command $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Config/App/SetConfigTest.php b/tests/Core/Command/Config/App/SetConfigTest.php index a5c62368163..6a6f03f6125 100644 --- a/tests/Core/Command/Config/App/SetConfigTest.php +++ b/tests/Core/Command/Config/App/SetConfigTest.php @@ -27,6 +27,7 @@ class SetConfigTest extends TestCase { protected OutputInterface&MockObject $consoleOutput; protected Command $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Config/ImportTest.php b/tests/Core/Command/Config/ImportTest.php index 14cdd714d12..4fef6e9928a 100644 --- a/tests/Core/Command/Config/ImportTest.php +++ b/tests/Core/Command/Config/ImportTest.php @@ -26,6 +26,7 @@ class ImportTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Config/ListConfigsTest.php b/tests/Core/Command/Config/ListConfigsTest.php index e4af55116c0..e5b14dc0643 100644 --- a/tests/Core/Command/Config/ListConfigsTest.php +++ b/tests/Core/Command/Config/ListConfigsTest.php @@ -33,6 +33,7 @@ class ListConfigsTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Config/System/CastHelperTest.php b/tests/Core/Command/Config/System/CastHelperTest.php index 924887daaf7..c47c77ee9f8 100644 --- a/tests/Core/Command/Config/System/CastHelperTest.php +++ b/tests/Core/Command/Config/System/CastHelperTest.php @@ -13,6 +13,7 @@ use Test\TestCase; class CastHelperTest extends TestCase { private CastHelper $castHelper; + #[\Override] protected function setUp(): void { parent::setUp(); $this->castHelper = new CastHelper(); diff --git a/tests/Core/Command/Config/System/DeleteConfigTest.php b/tests/Core/Command/Config/System/DeleteConfigTest.php index b0a3580e1cd..b042c05752f 100644 --- a/tests/Core/Command/Config/System/DeleteConfigTest.php +++ b/tests/Core/Command/Config/System/DeleteConfigTest.php @@ -26,6 +26,7 @@ class DeleteConfigTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Config/System/GetConfigTest.php b/tests/Core/Command/Config/System/GetConfigTest.php index 8b84fd14198..2718d6f38da 100644 --- a/tests/Core/Command/Config/System/GetConfigTest.php +++ b/tests/Core/Command/Config/System/GetConfigTest.php @@ -26,6 +26,7 @@ class GetConfigTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Config/System/SetConfigTest.php b/tests/Core/Command/Config/System/SetConfigTest.php index a99b832c160..78ea61e42e4 100644 --- a/tests/Core/Command/Config/System/SetConfigTest.php +++ b/tests/Core/Command/Config/System/SetConfigTest.php @@ -27,6 +27,7 @@ class SetConfigTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php index 0bc6cbb64cf..38878c871bd 100644 --- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php +++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php @@ -49,6 +49,7 @@ class ChangeKeyStorageRootTest extends TestCase { /** @var UserInterface|\PHPUnit\Framework\MockObject\MockObject */ protected $userInterface; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php index 6d0bc045cdd..009eb36eb7f 100644 --- a/tests/Core/Command/Encryption/DecryptAllTest.php +++ b/tests/Core/Command/Encryption/DecryptAllTest.php @@ -27,6 +27,7 @@ class DecryptAllTest extends TestCase { private MockObject&QuestionHelper $questionHelper; private MockObject&\OC\Encryption\DecryptAll $decryptAll; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Encryption/DisableTest.php b/tests/Core/Command/Encryption/DisableTest.php index a89fd636e47..96310a6c75b 100644 --- a/tests/Core/Command/Encryption/DisableTest.php +++ b/tests/Core/Command/Encryption/DisableTest.php @@ -25,6 +25,7 @@ class DisableTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Encryption/EnableTest.php b/tests/Core/Command/Encryption/EnableTest.php index 0e9655c29c7..234984b1c09 100644 --- a/tests/Core/Command/Encryption/EnableTest.php +++ b/tests/Core/Command/Encryption/EnableTest.php @@ -28,6 +28,7 @@ class EnableTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Encryption/EncryptAllTest.php b/tests/Core/Command/Encryption/EncryptAllTest.php index 15cbe83737d..2787c61c383 100644 --- a/tests/Core/Command/Encryption/EncryptAllTest.php +++ b/tests/Core/Command/Encryption/EncryptAllTest.php @@ -30,6 +30,7 @@ class EncryptAllTest extends TestCase { private EncryptAll $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Encryption/SetDefaultModuleTest.php b/tests/Core/Command/Encryption/SetDefaultModuleTest.php index df38d730db3..af68e5e5b4b 100644 --- a/tests/Core/Command/Encryption/SetDefaultModuleTest.php +++ b/tests/Core/Command/Encryption/SetDefaultModuleTest.php @@ -28,6 +28,7 @@ class SetDefaultModuleTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Group/AddTest.php b/tests/Core/Command/Group/AddTest.php index 24f2d823292..fc1406c77a6 100644 --- a/tests/Core/Command/Group/AddTest.php +++ b/tests/Core/Command/Group/AddTest.php @@ -27,6 +27,7 @@ class AddTest extends TestCase { /** @var OutputInterface|\PHPUnit\Framework\MockObject\MockObject */ private $output; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Group/AddUserTest.php b/tests/Core/Command/Group/AddUserTest.php index 68c8cecdba1..38b74951215 100644 --- a/tests/Core/Command/Group/AddUserTest.php +++ b/tests/Core/Command/Group/AddUserTest.php @@ -32,6 +32,7 @@ class AddUserTest extends TestCase { /** @var OutputInterface|\PHPUnit\Framework\MockObject\MockObject */ private $output; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Group/DeleteTest.php b/tests/Core/Command/Group/DeleteTest.php index 289c6a7c322..92315c4daf4 100644 --- a/tests/Core/Command/Group/DeleteTest.php +++ b/tests/Core/Command/Group/DeleteTest.php @@ -27,6 +27,7 @@ class DeleteTest extends TestCase { /** @var OutputInterface|\PHPUnit\Framework\MockObject\MockObject */ private $output; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Group/InfoTest.php b/tests/Core/Command/Group/InfoTest.php index 87f59d2adc4..8d9cb1c3291 100644 --- a/tests/Core/Command/Group/InfoTest.php +++ b/tests/Core/Command/Group/InfoTest.php @@ -27,6 +27,7 @@ class InfoTest extends TestCase { /** @var OutputInterface|\PHPUnit\Framework\MockObject\MockObject */ private $output; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Group/ListCommandTest.php b/tests/Core/Command/Group/ListCommandTest.php index aaca772d714..2885a6e44b0 100644 --- a/tests/Core/Command/Group/ListCommandTest.php +++ b/tests/Core/Command/Group/ListCommandTest.php @@ -28,6 +28,7 @@ class ListCommandTest extends TestCase { /** @var OutputInterface|\PHPUnit\Framework\MockObject\MockObject */ private $output; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Group/RemoveUserTest.php b/tests/Core/Command/Group/RemoveUserTest.php index 74343e77d3f..851aaa0ba33 100644 --- a/tests/Core/Command/Group/RemoveUserTest.php +++ b/tests/Core/Command/Group/RemoveUserTest.php @@ -32,6 +32,7 @@ class RemoveUserTest extends TestCase { /** @var OutputInterface|\PHPUnit\Framework\MockObject\MockObject */ private $output; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php index 1aaf398b875..19b8044cdf0 100644 --- a/tests/Core/Command/Log/FileTest.php +++ b/tests/Core/Command/Log/FileTest.php @@ -25,6 +25,7 @@ class FileTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Log/ManageTest.php b/tests/Core/Command/Log/ManageTest.php index 8b307048719..66131f9e3b6 100644 --- a/tests/Core/Command/Log/ManageTest.php +++ b/tests/Core/Command/Log/ManageTest.php @@ -25,6 +25,7 @@ class ManageTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Maintenance/DataFingerprintTest.php b/tests/Core/Command/Maintenance/DataFingerprintTest.php index 99004a7a5f5..b8a643cca41 100644 --- a/tests/Core/Command/Maintenance/DataFingerprintTest.php +++ b/tests/Core/Command/Maintenance/DataFingerprintTest.php @@ -28,6 +28,7 @@ class DataFingerprintTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php index b85dcf87bbc..eda4c2fbc65 100644 --- a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php +++ b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php @@ -31,6 +31,7 @@ class UpdateDBTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Maintenance/ModeTest.php b/tests/Core/Command/Maintenance/ModeTest.php index 5a9a90b0197..ec44a770ad6 100644 --- a/tests/Core/Command/Maintenance/ModeTest.php +++ b/tests/Core/Command/Maintenance/ModeTest.php @@ -52,6 +52,7 @@ class ModeTest extends TestCase { * * @return void */ + #[\Override] protected function setUp(): void { parent::setUp(); $this->config = $this->getMockBuilder(IConfig::class) diff --git a/tests/Core/Command/Maintenance/UpdateTheme.php b/tests/Core/Command/Maintenance/UpdateTheme.php index 9c9a2b903a7..626b51d0a20 100644 --- a/tests/Core/Command/Maintenance/UpdateTheme.php +++ b/tests/Core/Command/Maintenance/UpdateTheme.php @@ -31,6 +31,7 @@ class UpdateThemeTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/Preview/CleanupTest.php b/tests/Core/Command/Preview/CleanupTest.php index f1373eff488..5d9d51026a2 100644 --- a/tests/Core/Command/Preview/CleanupTest.php +++ b/tests/Core/Command/Preview/CleanupTest.php @@ -26,6 +26,7 @@ class CleanupTest extends TestCase { private PreviewService&MockObject $previewService; private Cleanup $repair; + #[\Override] protected function setUp(): void { parent::setUp(); $this->rootFolder = $this->createMock(IRootFolder::class); diff --git a/tests/Core/Command/SystemTag/AddTest.php b/tests/Core/Command/SystemTag/AddTest.php index 5f3c7174758..f36bf6c9f14 100644 --- a/tests/Core/Command/SystemTag/AddTest.php +++ b/tests/Core/Command/SystemTag/AddTest.php @@ -28,6 +28,7 @@ class AddTest extends TestCase { /** @var OutputInterface|\PHPUnit\Framework\MockObject\MockObject */ private $output; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/SystemTag/DeleteTest.php b/tests/Core/Command/SystemTag/DeleteTest.php index bf756311000..ee53c8b6d3b 100644 --- a/tests/Core/Command/SystemTag/DeleteTest.php +++ b/tests/Core/Command/SystemTag/DeleteTest.php @@ -27,6 +27,7 @@ class DeleteTest extends TestCase { /** @var OutputInterface|\PHPUnit\Framework\MockObject\MockObject */ private $output; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/SystemTag/EditTest.php b/tests/Core/Command/SystemTag/EditTest.php index b22151e3608..6e87ff5f3e4 100644 --- a/tests/Core/Command/SystemTag/EditTest.php +++ b/tests/Core/Command/SystemTag/EditTest.php @@ -28,6 +28,7 @@ class EditTest extends TestCase { /** @var OutputInterface|\PHPUnit\Framework\MockObject\MockObject */ private $output; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/SystemTag/ListCommandTest.php b/tests/Core/Command/SystemTag/ListCommandTest.php index e1ff8290633..93f8ca458ad 100644 --- a/tests/Core/Command/SystemTag/ListCommandTest.php +++ b/tests/Core/Command/SystemTag/ListCommandTest.php @@ -27,6 +27,7 @@ class ListCommandTest extends TestCase { /** @var OutputInterface|\PHPUnit\Framework\MockObject\MockObject */ private $output; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/TaskProcessing/WorkerCommandTest.php b/tests/Core/Command/TaskProcessing/WorkerCommandTest.php index 3f472548cef..e3b99acae47 100644 --- a/tests/Core/Command/TaskProcessing/WorkerCommandTest.php +++ b/tests/Core/Command/TaskProcessing/WorkerCommandTest.php @@ -26,6 +26,7 @@ class WorkerCommandTest extends TestCase { private LoggerInterface&MockObject $logger; private WorkerCommand $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/TwoFactorAuth/CleanupTest.php b/tests/Core/Command/TwoFactorAuth/CleanupTest.php index 1d4731ff0c2..33d9a86f2c6 100644 --- a/tests/Core/Command/TwoFactorAuth/CleanupTest.php +++ b/tests/Core/Command/TwoFactorAuth/CleanupTest.php @@ -26,6 +26,7 @@ class CleanupTest extends TestCase { /** @var CommandTester */ private $cmd; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/TwoFactorAuth/DisableTest.php b/tests/Core/Command/TwoFactorAuth/DisableTest.php index ab6b10f8964..ab5c3dd365b 100644 --- a/tests/Core/Command/TwoFactorAuth/DisableTest.php +++ b/tests/Core/Command/TwoFactorAuth/DisableTest.php @@ -27,6 +27,7 @@ class DisableTest extends TestCase { /** @var CommandTester */ private $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/TwoFactorAuth/EnableTest.php b/tests/Core/Command/TwoFactorAuth/EnableTest.php index 7c34d6692c5..320782c039f 100644 --- a/tests/Core/Command/TwoFactorAuth/EnableTest.php +++ b/tests/Core/Command/TwoFactorAuth/EnableTest.php @@ -27,6 +27,7 @@ class EnableTest extends TestCase { /** @var CommandTester */ private $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/TwoFactorAuth/EnforceTest.php b/tests/Core/Command/TwoFactorAuth/EnforceTest.php index 03118772377..78804eb5e92 100644 --- a/tests/Core/Command/TwoFactorAuth/EnforceTest.php +++ b/tests/Core/Command/TwoFactorAuth/EnforceTest.php @@ -23,6 +23,7 @@ class EnforceTest extends TestCase { /** @var CommandTester */ private $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/TwoFactorAuth/StateTest.php b/tests/Core/Command/TwoFactorAuth/StateTest.php index f4ca3c4e031..da18a405478 100644 --- a/tests/Core/Command/TwoFactorAuth/StateTest.php +++ b/tests/Core/Command/TwoFactorAuth/StateTest.php @@ -27,6 +27,7 @@ class StateTest extends TestCase { /** @var CommandTester|MockObject */ private $cmd; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/User/AddTest.php b/tests/Core/Command/User/AddTest.php index 748a9b60ef6..98d11b0214c 100644 --- a/tests/Core/Command/User/AddTest.php +++ b/tests/Core/Command/User/AddTest.php @@ -60,6 +60,7 @@ class AddTest extends TestCase { /** @var Add */ private $addCommand; + #[\Override] public function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/User/AuthTokens/DeleteTest.php b/tests/Core/Command/User/AuthTokens/DeleteTest.php index 6692473c240..edde4ded25d 100644 --- a/tests/Core/Command/User/AuthTokens/DeleteTest.php +++ b/tests/Core/Command/User/AuthTokens/DeleteTest.php @@ -25,6 +25,7 @@ class DeleteTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/User/DeleteTest.php b/tests/Core/Command/User/DeleteTest.php index 4e06b0f91fc..ae9694435fb 100644 --- a/tests/Core/Command/User/DeleteTest.php +++ b/tests/Core/Command/User/DeleteTest.php @@ -26,6 +26,7 @@ class DeleteTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/User/DisableTest.php b/tests/Core/Command/User/DisableTest.php index c1bc10dc6bf..5f765a9bee9 100644 --- a/tests/Core/Command/User/DisableTest.php +++ b/tests/Core/Command/User/DisableTest.php @@ -25,6 +25,7 @@ class DisableTest extends TestCase { /** @var Disable */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/User/EnableTest.php b/tests/Core/Command/User/EnableTest.php index b2820de14ef..cf133015cd7 100644 --- a/tests/Core/Command/User/EnableTest.php +++ b/tests/Core/Command/User/EnableTest.php @@ -25,6 +25,7 @@ class EnableTest extends TestCase { /** @var Disable */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/User/LastSeenTest.php b/tests/Core/Command/User/LastSeenTest.php index 64c710eacc5..790ec9d12fa 100644 --- a/tests/Core/Command/User/LastSeenTest.php +++ b/tests/Core/Command/User/LastSeenTest.php @@ -26,6 +26,7 @@ class LastSeenTest extends TestCase { /** @var \Symfony\Component\Console\Command\Command */ protected $command; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/User/ProfileTest.php b/tests/Core/Command/User/ProfileTest.php index ff5568bacfc..259a0d99b92 100644 --- a/tests/Core/Command/User/ProfileTest.php +++ b/tests/Core/Command/User/ProfileTest.php @@ -29,6 +29,7 @@ class ProfileTest extends TestCase { protected InputInterface&MockObject $consoleInput; protected OutputInterface&MockObject $consoleOutput; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Command/User/SettingTest.php b/tests/Core/Command/User/SettingTest.php index 706e5b24742..dac50409357 100644 --- a/tests/Core/Command/User/SettingTest.php +++ b/tests/Core/Command/User/SettingTest.php @@ -25,6 +25,7 @@ class SettingTest extends TestCase { protected InputInterface&MockObject $consoleInput; protected MockObject&OutputInterface $consoleOutput; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/AppPasswordControllerTest.php b/tests/Core/Controller/AppPasswordControllerTest.php index 86bc3c05a1c..123a61efa11 100644 --- a/tests/Core/Controller/AppPasswordControllerTest.php +++ b/tests/Core/Controller/AppPasswordControllerTest.php @@ -61,6 +61,7 @@ class AppPasswordControllerTest extends TestCase { /** @var AppPasswordController */ private $controller; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/AutoCompleteControllerTest.php b/tests/Core/Controller/AutoCompleteControllerTest.php index c5574f78fc1..5196c0e9908 100644 --- a/tests/Core/Controller/AutoCompleteControllerTest.php +++ b/tests/Core/Controller/AutoCompleteControllerTest.php @@ -25,6 +25,7 @@ class AutoCompleteControllerTest extends TestCase { /** @var AutoCompleteController */ protected $controller; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php index 4d5da66014d..368e929605d 100644 --- a/tests/Core/Controller/AvatarControllerTest.php +++ b/tests/Core/Controller/AvatarControllerTest.php @@ -67,6 +67,7 @@ class AvatarControllerTest extends \Test\TestCase { /** @var TimeFactory|\PHPUnit\Framework\MockObject\MockObject */ private $timeFactory; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -116,6 +117,7 @@ class AvatarControllerTest extends \Test\TestCase { $this->avatarFile->method('getMTime')->willReturn(42); } + #[\Override] protected function tearDown(): void { parent::tearDown(); } diff --git a/tests/Core/Controller/CSRFTokenControllerTest.php b/tests/Core/Controller/CSRFTokenControllerTest.php index a401788be8d..b89f06e168a 100644 --- a/tests/Core/Controller/CSRFTokenControllerTest.php +++ b/tests/Core/Controller/CSRFTokenControllerTest.php @@ -25,6 +25,7 @@ class CSRFTokenControllerTest extends TestCase { /** @var CsrfTokenManager|\PHPUnit\Framework\MockObject\MockObject */ private $tokenManager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/ChangePasswordControllerTest.php b/tests/Core/Controller/ChangePasswordControllerTest.php index aae36fb52b8..11fca96db6d 100644 --- a/tests/Core/Controller/ChangePasswordControllerTest.php +++ b/tests/Core/Controller/ChangePasswordControllerTest.php @@ -36,6 +36,7 @@ class ChangePasswordControllerTest extends \Test\TestCase { /** @var ChangePasswordController */ private $controller; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php index 39d915e04bc..f77db8d79e7 100644 --- a/tests/Core/Controller/ClientFlowLoginControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php @@ -58,6 +58,7 @@ class ClientFlowLoginControllerTest extends TestCase { private ClientFlowLoginController $clientFlowLoginController; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php index 556869e25f9..6931c9bd70d 100644 --- a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php @@ -42,6 +42,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { /** @var ClientFlowLoginV2Controller */ private $controller; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/ContactsMenuControllerTest.php b/tests/Core/Controller/ContactsMenuControllerTest.php index 6f8bf9ee610..ea790ea8158 100644 --- a/tests/Core/Controller/ContactsMenuControllerTest.php +++ b/tests/Core/Controller/ContactsMenuControllerTest.php @@ -24,6 +24,7 @@ class ContactsMenuControllerTest extends TestCase { private ContactsMenuController $controller; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/CssControllerTest.php b/tests/Core/Controller/CssControllerTest.php index b4764d6ea3a..7f967bf5d6f 100644 --- a/tests/Core/Controller/CssControllerTest.php +++ b/tests/Core/Controller/CssControllerTest.php @@ -31,6 +31,7 @@ class CssControllerTest extends TestCase { /** @var CssController */ private $controller; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/GuestAvatarControllerTest.php b/tests/Core/Controller/GuestAvatarControllerTest.php index 66a83098130..2d7c1de2460 100644 --- a/tests/Core/Controller/GuestAvatarControllerTest.php +++ b/tests/Core/Controller/GuestAvatarControllerTest.php @@ -52,6 +52,7 @@ class GuestAvatarControllerTest extends \Test\TestCase { /** * Sets up the test environment. */ + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/JsControllerTest.php b/tests/Core/Controller/JsControllerTest.php index 30bc02e8625..11ad58b4dfd 100644 --- a/tests/Core/Controller/JsControllerTest.php +++ b/tests/Core/Controller/JsControllerTest.php @@ -31,6 +31,7 @@ class JsControllerTest extends TestCase { /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */ private $request; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php index ba441ec93ca..7f3333172ff 100644 --- a/tests/Core/Controller/LoginControllerTest.php +++ b/tests/Core/Controller/LoginControllerTest.php @@ -81,6 +81,7 @@ class LoginControllerTest extends TestCase { /** @var IAppManager|MockObject */ private $appManager; + #[\Override] protected function setUp(): void { parent::setUp(); $this->request = $this->createMock(IRequest::class); diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php index bbb5f2c2e54..37b9272695d 100644 --- a/tests/Core/Controller/LostControllerTest.php +++ b/tests/Core/Controller/LostControllerTest.php @@ -72,6 +72,7 @@ class LostControllerTest extends TestCase { /** @var Limiter|MockObject */ private $limiter; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/NavigationControllerTest.php b/tests/Core/Controller/NavigationControllerTest.php index d00976f18ec..25a62404b09 100644 --- a/tests/Core/Controller/NavigationControllerTest.php +++ b/tests/Core/Controller/NavigationControllerTest.php @@ -27,6 +27,7 @@ class NavigationControllerTest extends TestCase { /** @var NavigationController */ private $controller; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/OCSControllerTest.php b/tests/Core/Controller/OCSControllerTest.php index bd7e26d5e8f..fac18e34492 100644 --- a/tests/Core/Controller/OCSControllerTest.php +++ b/tests/Core/Controller/OCSControllerTest.php @@ -36,6 +36,7 @@ class OCSControllerTest extends TestCase { /** @var OCSController */ private $controller; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/OpenMetricsControllerTest.php b/tests/Core/Controller/OpenMetricsControllerTest.php index 7832afeb400..065cb1039f8 100644 --- a/tests/Core/Controller/OpenMetricsControllerTest.php +++ b/tests/Core/Controller/OpenMetricsControllerTest.php @@ -31,6 +31,7 @@ class OpenMetricsControllerTest extends TestCase { private LoggerInterface&MockObject $logger; private OpenMetricsController $controller; + #[\Override] protected function setUp(): void { parent::setUp(); $this->request = $this->createMock(IRequest::class); diff --git a/tests/Core/Controller/PreviewControllerTest.php b/tests/Core/Controller/PreviewControllerTest.php index 5a6cd1fba0a..91fed380d2c 100644 --- a/tests/Core/Controller/PreviewControllerTest.php +++ b/tests/Core/Controller/PreviewControllerTest.php @@ -32,6 +32,7 @@ class PreviewControllerTest extends \Test\TestCase { private IPreview&MockObject $previewManager; private IRequest&MockObject $request; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php index d9ea1ca263f..2d47f7d6519 100644 --- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php +++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php @@ -48,6 +48,7 @@ class TwoFactorChallengeControllerTest extends TestCase { /** @var TwoFactorChallengeController|\PHPUnit\Framework\MockObject\MockObject */ private $controller; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/UserControllerTest.php b/tests/Core/Controller/UserControllerTest.php index 2473f280580..4f0380f6b96 100644 --- a/tests/Core/Controller/UserControllerTest.php +++ b/tests/Core/Controller/UserControllerTest.php @@ -21,6 +21,7 @@ class UserControllerTest extends TestCase { /** @var UserController */ private $controller; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/WellKnownControllerTest.php b/tests/Core/Controller/WellKnownControllerTest.php index 35606dc6384..98a1aa6e8cf 100644 --- a/tests/Core/Controller/WellKnownControllerTest.php +++ b/tests/Core/Controller/WellKnownControllerTest.php @@ -27,6 +27,7 @@ class WellKnownControllerTest extends TestCase { /** @var WellKnownController */ private $controller; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Controller/WipeControllerTest.php b/tests/Core/Controller/WipeControllerTest.php index 5330eb599e6..84adbcb2e8b 100644 --- a/tests/Core/Controller/WipeControllerTest.php +++ b/tests/Core/Controller/WipeControllerTest.php @@ -23,6 +23,7 @@ class WipeControllerTest extends TestCase { /** @var WipeController */ private $controller; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Data/LoginFlowV2CredentialsTest.php b/tests/Core/Data/LoginFlowV2CredentialsTest.php index ffa06f1a451..7f84cce59bf 100644 --- a/tests/Core/Data/LoginFlowV2CredentialsTest.php +++ b/tests/Core/Data/LoginFlowV2CredentialsTest.php @@ -15,6 +15,7 @@ class LoginFlowV2CredentialsTest extends TestCase { /** @var LoginFlowV2Credentials */ private $fixture; + #[\Override] public function setUp(): void { parent::setUp(); diff --git a/tests/Core/Middleware/TwoFactorMiddlewareTest.php b/tests/Core/Middleware/TwoFactorMiddlewareTest.php index 9d4a98b07d0..2101dea06a9 100644 --- a/tests/Core/Middleware/TwoFactorMiddlewareTest.php +++ b/tests/Core/Middleware/TwoFactorMiddlewareTest.php @@ -78,6 +78,7 @@ class TwoFactorMiddlewareTest extends TestCase { private TwoFactorMiddleware $middleware; private LoggerInterface&MockObject $logger; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php index 625b5f3cd11..35f939a275e 100644 --- a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php +++ b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php @@ -42,6 +42,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase { private ITimeFactory&MockObject $timeFactory; private IProvider&MockObject $tokenProvider; + #[\Override] public function setUp(): void { parent::setUp(); diff --git a/tests/lib/Accounts/AccountManagerTest.php b/tests/lib/Accounts/AccountManagerTest.php index 8d66ba15ce1..888ae69f5df 100644 --- a/tests/lib/Accounts/AccountManagerTest.php +++ b/tests/lib/Accounts/AccountManagerTest.php @@ -62,6 +62,7 @@ class AccountManagerTest extends TestCase { private LoggerInterface&MockObject $logger; private IClientService&MockObject $clientService; + #[\Override] protected function setUp(): void { parent::setUp(); $this->connection = Server::get(IDBConnection::class); @@ -96,6 +97,7 @@ class AccountManagerTest extends TestCase { ); } + #[\Override] protected function tearDown(): void { parent::tearDown(); $query = $this->connection->getQueryBuilder(); diff --git a/tests/lib/Accounts/AccountPropertyCollectionTest.php b/tests/lib/Accounts/AccountPropertyCollectionTest.php index 8252e494ed7..dee0a6d9d8c 100644 --- a/tests/lib/Accounts/AccountPropertyCollectionTest.php +++ b/tests/lib/Accounts/AccountPropertyCollectionTest.php @@ -21,6 +21,7 @@ class AccountPropertyCollectionTest extends TestCase { protected const COLLECTION_NAME = 'my_multivalue_property'; + #[\Override] public function setUp(): void { parent::setUp(); diff --git a/tests/lib/Accounts/HooksTest.php b/tests/lib/Accounts/HooksTest.php index 61aba064f22..bfd7fc845d6 100644 --- a/tests/lib/Accounts/HooksTest.php +++ b/tests/lib/Accounts/HooksTest.php @@ -31,6 +31,7 @@ class HooksTest extends TestCase { private AccountManager&MockObject $accountManager; private Hooks $hooks; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Activity/ManagerTest.php b/tests/lib/Activity/ManagerTest.php index 70b6ab1c4f6..dcf37db5c7e 100644 --- a/tests/lib/Activity/ManagerTest.php +++ b/tests/lib/Activity/ManagerTest.php @@ -35,6 +35,7 @@ class ManagerTest extends TestCase { protected IRichTextFormatter&MockObject $richTextFormatter; private ITimeFactory&MockObject $time; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -294,6 +295,7 @@ class ManagerTest extends TestCase { } class NoOpConsumer implements IConsumer { + #[\Override] public function receive(IEvent $event) { } } diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php index 11bc35c14f2..dcb5576df68 100644 --- a/tests/lib/App/AppManagerTest.php +++ b/tests/lib/App/AppManagerTest.php @@ -104,6 +104,7 @@ class AppManagerTest extends TestCase { protected AppManager $manager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/App/AppStore/Bundles/BundleBase.php b/tests/lib/App/AppStore/Bundles/BundleBase.php index 7dba5c32471..4934251faa0 100644 --- a/tests/lib/App/AppStore/Bundles/BundleBase.php +++ b/tests/lib/App/AppStore/Bundles/BundleBase.php @@ -21,6 +21,7 @@ abstract class BundleBase extends TestCase { protected string $bundleName; protected array $bundleAppIds; + #[\Override] protected function setUp(): void { parent::setUp(); $this->l10n = $this->createMock(IL10N::class); diff --git a/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php index d4cc1015b25..a7f552535a9 100644 --- a/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php +++ b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php @@ -24,6 +24,7 @@ class BundleFetcherTest extends TestCase { private IL10N&MockObject $l10n; private BundleFetcher $bundleFetcher; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/App/AppStore/Bundles/EducationBundleTest.php b/tests/lib/App/AppStore/Bundles/EducationBundleTest.php index b6d8c2912ec..690b61226fd 100644 --- a/tests/lib/App/AppStore/Bundles/EducationBundleTest.php +++ b/tests/lib/App/AppStore/Bundles/EducationBundleTest.php @@ -12,6 +12,7 @@ namespace Test\App\AppStore\Bundles; use OC\App\AppStore\Bundles\EducationBundle; class EducationBundleTest extends BundleBase { + #[\Override] protected function setUp(): void { parent::setUp(); $this->bundle = new EducationBundle($this->l10n); diff --git a/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php b/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php index 5b9a8b1e851..2a9c5503e82 100644 --- a/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php +++ b/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php @@ -12,6 +12,7 @@ namespace Test\App\AppStore\Bundles; use OC\App\AppStore\Bundles\EnterpriseBundle; class EnterpriseBundleTest extends BundleBase { + #[\Override] protected function setUp(): void { parent::setUp(); $this->bundle = new EnterpriseBundle($this->l10n); diff --git a/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php b/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php index 27b991445e1..17217a1f8d2 100644 --- a/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php +++ b/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php @@ -12,6 +12,7 @@ namespace Test\App\AppStore\Bundles; use OC\App\AppStore\Bundles\GroupwareBundle; class GroupwareBundleTest extends BundleBase { + #[\Override] protected function setUp(): void { parent::setUp(); $this->bundle = new GroupwareBundle($this->l10n); diff --git a/tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php b/tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php index e44a15624cd..ecde07cce43 100644 --- a/tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php +++ b/tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php @@ -12,6 +12,7 @@ namespace Test\App\AppStore\Bundles; use OC\App\AppStore\Bundles\SocialSharingBundle; class SocialSharingBundleTest extends BundleBase { + #[\Override] protected function setUp(): void { parent::setUp(); $this->bundle = new SocialSharingBundle($this->l10n); diff --git a/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php index 61108fc2a01..49314d51283 100644 --- a/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php @@ -19,6 +19,7 @@ use PHPUnit\Framework\MockObject\MockObject; class AppDiscoverFetcherTest extends FetcherBase { protected CompareVersion&MockObject $compareVersion; + #[\Override] protected function setUp(): void { parent::setUp(); $this->fileName = 'discover.json'; diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php index c6f0df7d2fb..913fb9fb2c0 100644 --- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php @@ -1818,6 +1818,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg== ]; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php index 6918b766b3d..67432e7d9ce 100644 --- a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php @@ -12,6 +12,7 @@ namespace Test\App\AppStore\Fetcher; use OC\App\AppStore\Fetcher\CategoryFetcher; class CategoryFetcherTest extends FetcherBase { + #[\Override] protected function setUp(): void { parent::setUp(); $this->fileName = 'categories.json'; diff --git a/tests/lib/App/AppStore/Fetcher/FetcherBase.php b/tests/lib/App/AppStore/Fetcher/FetcherBase.php index 4784e76d574..55252a33dc0 100644 --- a/tests/lib/App/AppStore/Fetcher/FetcherBase.php +++ b/tests/lib/App/AppStore/Fetcher/FetcherBase.php @@ -38,6 +38,7 @@ abstract class FetcherBase extends TestCase { protected string $fileName; protected string $endpoint; + #[\Override] protected function setUp(): void { parent::setUp(); $this->appDataFactory = $this->createMock(Factory::class); diff --git a/tests/lib/App/AppStore/Version/VersionParserTest.php b/tests/lib/App/AppStore/Version/VersionParserTest.php index b833aceb5c3..de50723870b 100644 --- a/tests/lib/App/AppStore/Version/VersionParserTest.php +++ b/tests/lib/App/AppStore/Version/VersionParserTest.php @@ -16,6 +16,7 @@ use Test\TestCase; class VersionParserTest extends TestCase { private VersionParser $versionParser; + #[\Override] protected function setUp(): void { parent::setUp(); $this->versionParser = new VersionParser(); diff --git a/tests/lib/App/CompareVersionTest.php b/tests/lib/App/CompareVersionTest.php index b2015fae4c8..d7506ffaabb 100644 --- a/tests/lib/App/CompareVersionTest.php +++ b/tests/lib/App/CompareVersionTest.php @@ -16,6 +16,7 @@ use Test\TestCase; class CompareVersionTest extends TestCase { private CompareVersion $compare; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php index f20307c9f27..ec3b55835ba 100644 --- a/tests/lib/App/DependencyAnalyzerTest.php +++ b/tests/lib/App/DependencyAnalyzerTest.php @@ -19,6 +19,7 @@ class DependencyAnalyzerTest extends TestCase { private DependencyAnalyzer $analyser; + #[\Override] protected function setUp(): void { $this->platformMock = $this->getMockBuilder(Platform::class) ->disableOriginalConstructor() diff --git a/tests/lib/App/InfoParserTest.php b/tests/lib/App/InfoParserTest.php index 1465896a8ee..30a4d1057b0 100644 --- a/tests/lib/App/InfoParserTest.php +++ b/tests/lib/App/InfoParserTest.php @@ -17,6 +17,7 @@ use Test\TestCase; class InfoParserTest extends TestCase { private static CappedMemoryCache $cache; + #[\Override] public static function setUpBeforeClass(): void { self::$cache = new CappedMemoryCache(); } diff --git a/tests/lib/AppConfigIntegrationTest.php b/tests/lib/AppConfigIntegrationTest.php index b0e400dd9e3..2064ccf4fbc 100644 --- a/tests/lib/AppConfigIntegrationTest.php +++ b/tests/lib/AppConfigIntegrationTest.php @@ -98,6 +98,7 @@ class AppConfigIntegrationTest extends TestCase { ] ]; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -157,6 +158,7 @@ class AppConfigIntegrationTest extends TestCase { } } + #[\Override] protected function tearDown(): void { $sql = $this->connection->getQueryBuilder(); $sql->delete('appconfig'); diff --git a/tests/lib/AppConfigTest.php b/tests/lib/AppConfigTest.php index bc4cc18a44e..4c75d6637b3 100644 --- a/tests/lib/AppConfigTest.php +++ b/tests/lib/AppConfigTest.php @@ -36,6 +36,7 @@ class AppConfigTest extends TestCase { private CacheFactory&MockObject $cacheFactory; private ICache&MockObject $localCache; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php index f9b7cf50675..7e76c655e6a 100644 --- a/tests/lib/AppFramework/AppTest.php +++ b/tests/lib/AppFramework/AppTest.php @@ -41,6 +41,7 @@ class AppTest extends \Test\TestCase { private $controllerMethod; private $appPath; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -106,6 +107,7 @@ class AppTest extends \Test\TestCase { } + #[\Override] protected function tearDown(): void { rrmdir($this->appPath); parent::tearDown(); diff --git a/tests/lib/AppFramework/Bootstrap/BootContextTest.php b/tests/lib/AppFramework/Bootstrap/BootContextTest.php index 6d001f264b7..0bcaa429660 100644 --- a/tests/lib/AppFramework/Bootstrap/BootContextTest.php +++ b/tests/lib/AppFramework/Bootstrap/BootContextTest.php @@ -20,6 +20,7 @@ class BootContextTest extends TestCase { private BootContext $context; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php b/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php index e187b83b8da..844858ab5f7 100644 --- a/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php +++ b/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php @@ -36,6 +36,7 @@ class CoordinatorTest extends TestCase { private LoggerInterface&MockObject $logger; private Coordinator $coordinator; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -88,9 +89,11 @@ class CoordinatorTest extends TestCase { parent::__construct('test', []); } + #[\Override] public function register(IRegistrationContext $context): void { } + #[\Override] public function boot(IBootContext $context): void { } }; diff --git a/tests/lib/AppFramework/Bootstrap/FunctionInjectorTest.php b/tests/lib/AppFramework/Bootstrap/FunctionInjectorTest.php index f9eb4ca9868..168d95b9aad 100644 --- a/tests/lib/AppFramework/Bootstrap/FunctionInjectorTest.php +++ b/tests/lib/AppFramework/Bootstrap/FunctionInjectorTest.php @@ -20,6 +20,7 @@ interface Foo { class FunctionInjectorTest extends TestCase { private SimpleContainer $container; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php b/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php index d0823b3b669..fa042d7a9de 100644 --- a/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php +++ b/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php @@ -23,6 +23,7 @@ class RegistrationContextTest extends TestCase { private LoggerInterface&MockObject $logger; private RegistrationContext $context; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php index 5975c2e10d6..22caf753749 100644 --- a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php +++ b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php @@ -24,6 +24,7 @@ class AuthPublicShareControllerTest extends \Test\TestCase { private AuthPublicShareController&MockObject $controller; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php index 7e8d311c13a..39f7213ef9e 100644 --- a/tests/lib/AppFramework/Controller/ControllerTest.php +++ b/tests/lib/AppFramework/Controller/ControllerTest.php @@ -43,6 +43,7 @@ class ControllerTest extends \Test\TestCase { private Controller $controller; private Request $request; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php index 7f41a30e55a..06d7ccbefb0 100644 --- a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php +++ b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php @@ -25,14 +25,17 @@ class TestController extends PublicShareController { parent::__construct($appName, $request, $session); } + #[\Override] protected function getPasswordHash(): string { return $this->hash; } + #[\Override] public function isValidToken(): bool { return false; } + #[\Override] protected function isPasswordProtected(): bool { return $this->isProtected; } @@ -42,6 +45,7 @@ class PublicShareControllerTest extends \Test\TestCase { private IRequest&MockObject $request; private ISession&MockObject $session; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Db/EntityTest.php b/tests/lib/AppFramework/Db/EntityTest.php index 8e85fdd8699..1e67e986802 100644 --- a/tests/lib/AppFramework/Db/EntityTest.php +++ b/tests/lib/AppFramework/Db/EntityTest.php @@ -75,6 +75,7 @@ class TestEntity extends Entity { class EntityTest extends \Test\TestCase { private TestEntity $entity; + #[\Override] protected function setUp(): void { parent::setUp(); $this->entity = new TestEntity(); diff --git a/tests/lib/AppFramework/Db/QBMapperDBTest.php b/tests/lib/AppFramework/Db/QBMapperDBTest.php index bf149f1c2e0..24b8f06e6ce 100644 --- a/tests/lib/AppFramework/Db/QBMapperDBTest.php +++ b/tests/lib/AppFramework/Db/QBMapperDBTest.php @@ -67,6 +67,7 @@ class QBMapperDBTest extends TestCase { protected IDBConnection $connection; protected bool $schemaSetup = false; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Db/QBMapperTest.php b/tests/lib/AppFramework/Db/QBMapperTest.php index 0f18ef3f204..f598b53e250 100644 --- a/tests/lib/AppFramework/Db/QBMapperTest.php +++ b/tests/lib/AppFramework/Db/QBMapperTest.php @@ -79,6 +79,7 @@ class QBMapperTest extends \Test\TestCase { /** * @throws \ReflectionException */ + #[\Override] protected function setUp(): void { $this->db = $this->getMockBuilder(IDBConnection::class) ->disableOriginalConstructor() diff --git a/tests/lib/AppFramework/Db/TransactionalTest.php b/tests/lib/AppFramework/Db/TransactionalTest.php index 161f6e2b0a2..de26590ae51 100644 --- a/tests/lib/AppFramework/Db/TransactionalTest.php +++ b/tests/lib/AppFramework/Db/TransactionalTest.php @@ -17,6 +17,7 @@ use Test\TestCase; class TransactionalTest extends TestCase { private IDBConnection&MockObject $db; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php index 4fbe5c8307b..b7f7352e3dd 100644 --- a/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php +++ b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php @@ -26,6 +26,7 @@ use PHPUnit\Framework\MockObject\MockObject; class DIContainerTest extends \Test\TestCase { private DIContainer&MockObject $container; + #[\Override] protected function setUp(): void { parent::setUp(); $this->container = $this->getMockBuilder(DIContainer::class) diff --git a/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php b/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php index f1e1df8bec4..362b99215ef 100644 --- a/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php +++ b/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php @@ -40,6 +40,7 @@ class DIIntergrationTests extends TestCase { private DIContainer $container; private ServerContainer $server; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php b/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php index 17e032d575f..f314aa04a29 100644 --- a/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php +++ b/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php @@ -20,6 +20,7 @@ use OCP\AppFramework\Http\ContentSecurityPolicy; class ContentSecurityPolicyTest extends \Test\TestCase { private ContentSecurityPolicy $contentSecurityPolicy; + #[\Override] protected function setUp(): void { parent::setUp(); $this->contentSecurityPolicy = new ContentSecurityPolicy(); diff --git a/tests/lib/AppFramework/Http/DataResponseTest.php b/tests/lib/AppFramework/Http/DataResponseTest.php index e2f30b54f09..a5e5dd25ee9 100644 --- a/tests/lib/AppFramework/Http/DataResponseTest.php +++ b/tests/lib/AppFramework/Http/DataResponseTest.php @@ -18,6 +18,7 @@ use OCP\Server; class DataResponseTest extends \Test\TestCase { private DataResponse $response; + #[\Override] protected function setUp(): void { parent::setUp(); $this->response = new DataResponse(); diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php index d6fc6e6728f..cfd0bc9821e 100644 --- a/tests/lib/AppFramework/Http/DispatcherTest.php +++ b/tests/lib/AppFramework/Http/DispatcherTest.php @@ -103,6 +103,7 @@ class DispatcherTest extends \Test\TestCase { /** @var ContainerInterface|MockObject */ private $container; + #[\Override] protected function setUp(): void { parent::setUp(); $this->controllerMethod = 'test'; diff --git a/tests/lib/AppFramework/Http/DownloadResponseTest.php b/tests/lib/AppFramework/Http/DownloadResponseTest.php index 08f9b2a0ee2..4472b3b2dd3 100644 --- a/tests/lib/AppFramework/Http/DownloadResponseTest.php +++ b/tests/lib/AppFramework/Http/DownloadResponseTest.php @@ -15,6 +15,7 @@ class ChildDownloadResponse extends DownloadResponse { class DownloadResponseTest extends \Test\TestCase { + #[\Override] protected function setUp(): void { parent::setUp(); } diff --git a/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php index 30b736517a1..3d621e3aa59 100644 --- a/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php +++ b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php @@ -19,6 +19,7 @@ class EmptyContentSecurityPolicyTest extends \Test\TestCase { /** @var EmptyContentSecurityPolicy */ private $contentSecurityPolicy; + #[\Override] protected function setUp(): void { parent::setUp(); $this->contentSecurityPolicy = new EmptyContentSecurityPolicy(); diff --git a/tests/lib/AppFramework/Http/EmptyFeaturePolicyTest.php b/tests/lib/AppFramework/Http/EmptyFeaturePolicyTest.php index 71342485552..ee20b0436d8 100644 --- a/tests/lib/AppFramework/Http/EmptyFeaturePolicyTest.php +++ b/tests/lib/AppFramework/Http/EmptyFeaturePolicyTest.php @@ -14,6 +14,7 @@ class EmptyFeaturePolicyTest extends \Test\TestCase { /** @var EmptyFeaturePolicy */ private $policy; + #[\Override] protected function setUp(): void { parent::setUp(); $this->policy = new EmptyFeaturePolicy(); diff --git a/tests/lib/AppFramework/Http/FeaturePolicyTest.php b/tests/lib/AppFramework/Http/FeaturePolicyTest.php index 6ea990fb111..b91e43157d9 100644 --- a/tests/lib/AppFramework/Http/FeaturePolicyTest.php +++ b/tests/lib/AppFramework/Http/FeaturePolicyTest.php @@ -14,6 +14,7 @@ class FeaturePolicyTest extends \Test\TestCase { /** @var EmptyFeaturePolicy */ private $policy; + #[\Override] protected function setUp(): void { parent::setUp(); $this->policy = new FeaturePolicy(); diff --git a/tests/lib/AppFramework/Http/FileDisplayResponseTest.php b/tests/lib/AppFramework/Http/FileDisplayResponseTest.php index ae9228562a0..e58237657f7 100644 --- a/tests/lib/AppFramework/Http/FileDisplayResponseTest.php +++ b/tests/lib/AppFramework/Http/FileDisplayResponseTest.php @@ -20,6 +20,7 @@ class FileDisplayResponseTest extends \Test\TestCase { private File&MockObject $file; private FileDisplayResponse $response; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Http/HttpTest.php b/tests/lib/AppFramework/Http/HttpTest.php index d3ec8438554..b5566c66318 100644 --- a/tests/lib/AppFramework/Http/HttpTest.php +++ b/tests/lib/AppFramework/Http/HttpTest.php @@ -18,6 +18,7 @@ class HttpTest extends \Test\TestCase { */ private $http; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Http/JSONResponseTest.php b/tests/lib/AppFramework/Http/JSONResponseTest.php index 56f67b23f0d..d0509a40333 100644 --- a/tests/lib/AppFramework/Http/JSONResponseTest.php +++ b/tests/lib/AppFramework/Http/JSONResponseTest.php @@ -17,6 +17,7 @@ class JSONResponseTest extends \Test\TestCase { */ private $json; + #[\Override] protected function setUp(): void { parent::setUp(); $this->json = new JSONResponse(); diff --git a/tests/lib/AppFramework/Http/RedirectResponseTest.php b/tests/lib/AppFramework/Http/RedirectResponseTest.php index f6319782e79..90127b91757 100644 --- a/tests/lib/AppFramework/Http/RedirectResponseTest.php +++ b/tests/lib/AppFramework/Http/RedirectResponseTest.php @@ -17,6 +17,7 @@ class RedirectResponseTest extends \Test\TestCase { */ protected $response; + #[\Override] protected function setUp(): void { parent::setUp(); $this->response = new RedirectResponse('/url'); diff --git a/tests/lib/AppFramework/Http/RequestIdTest.php b/tests/lib/AppFramework/Http/RequestIdTest.php index 9cfd3b1785c..b5850d72fd4 100644 --- a/tests/lib/AppFramework/Http/RequestIdTest.php +++ b/tests/lib/AppFramework/Http/RequestIdTest.php @@ -21,6 +21,7 @@ class RequestIdTest extends \Test\TestCase { /** @var ISecureRandom|MockObject */ protected $secureRandom; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index b03a7f4efe4..ec67ddeb0ad 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -28,6 +28,7 @@ class RequestTest extends \Test\TestCase { /** @var CsrfTokenManager */ protected $csrfTokenManager; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -43,6 +44,7 @@ class RequestTest extends \Test\TestCase { ->getMock(); } + #[\Override] protected function tearDown(): void { stream_wrapper_unregister('fakeinput'); parent::tearDown(); diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php index 4c76695f6e4..57adc0cf3f4 100644 --- a/tests/lib/AppFramework/Http/ResponseTest.php +++ b/tests/lib/AppFramework/Http/ResponseTest.php @@ -20,6 +20,7 @@ class ResponseTest extends \Test\TestCase { */ private $childResponse; + #[\Override] protected function setUp(): void { parent::setUp(); $this->childResponse = new Response(); diff --git a/tests/lib/AppFramework/Http/StreamResponseTest.php b/tests/lib/AppFramework/Http/StreamResponseTest.php index 87f6097a07a..aa5db917a7d 100644 --- a/tests/lib/AppFramework/Http/StreamResponseTest.php +++ b/tests/lib/AppFramework/Http/StreamResponseTest.php @@ -16,6 +16,7 @@ class StreamResponseTest extends \Test\TestCase { /** @var IOutput */ private $output; + #[\Override] protected function setUp(): void { parent::setUp(); $this->output = $this->getMockBuilder('OCP\\AppFramework\\Http\\IOutput') diff --git a/tests/lib/AppFramework/Http/TemplateResponseTest.php b/tests/lib/AppFramework/Http/TemplateResponseTest.php index 28f952e35e3..d95eb043ae5 100644 --- a/tests/lib/AppFramework/Http/TemplateResponseTest.php +++ b/tests/lib/AppFramework/Http/TemplateResponseTest.php @@ -17,6 +17,7 @@ class TemplateResponseTest extends \Test\TestCase { */ private $tpl; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php b/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php index 4fa5de62b0b..b05f38debef 100644 --- a/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php @@ -31,6 +31,7 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase { /** @var IEventDispatcher|MockObject */ private $dispatcher; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/CompressionMiddlewareTest.php b/tests/lib/AppFramework/Middleware/CompressionMiddlewareTest.php index 010ce3fff6d..7eff769b190 100644 --- a/tests/lib/AppFramework/Middleware/CompressionMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/CompressionMiddlewareTest.php @@ -25,6 +25,7 @@ class CompressionMiddlewareTest extends \Test\TestCase { /** @var CompressionMiddleware */ private $middleWare; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php index 727b4d04ec5..3d22106563b 100644 --- a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php +++ b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php @@ -46,6 +46,7 @@ class TestMiddleware extends Middleware { self::$beforeOutputCalled = 0; } + #[\Override] public function beforeController($controller, $methodName) { self::$beforeControllerCalled++; $this->beforeControllerOrder = self::$beforeControllerCalled; @@ -56,6 +57,7 @@ class TestMiddleware extends Middleware { } } + #[\Override] public function afterException($controller, $methodName, \Exception $exception) { self::$afterExceptionCalled++; $this->afterExceptionOrder = self::$afterExceptionCalled; @@ -65,6 +67,7 @@ class TestMiddleware extends Middleware { parent::afterException($controller, $methodName, $exception); } + #[\Override] public function afterController($controller, $methodName, Response $response) { self::$afterControllerCalled++; $this->afterControllerOrder = self::$afterControllerCalled; @@ -74,6 +77,7 @@ class TestMiddleware extends Middleware { return parent::afterController($controller, $methodName, $response); } + #[\Override] public function beforeOutput($controller, $methodName, $output) { self::$beforeOutputCalled++; $this->beforeOutputOrder = self::$beforeOutputCalled; @@ -101,6 +105,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase { */ private $dispatcher; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/MiddlewareTest.php b/tests/lib/AppFramework/Middleware/MiddlewareTest.php index addd9683122..e5619dcda6d 100644 --- a/tests/lib/AppFramework/Middleware/MiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/MiddlewareTest.php @@ -31,6 +31,7 @@ class MiddlewareTest extends \Test\TestCase { /** @var Response */ private $response; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php b/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php index 6e4c847ed24..fbdbaca1bd8 100644 --- a/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php @@ -23,6 +23,7 @@ class NotModifiedMiddlewareTest extends \Test\TestCase { /** @var NotModifiedMiddleware */ private $middleWare; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php index e5c6a417a4b..e4d366ebdaa 100644 --- a/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php @@ -28,6 +28,7 @@ class OCSMiddlewareTest extends \Test\TestCase { */ private $request; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php index e87ee7fd565..ebdb593b8d3 100644 --- a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php @@ -36,6 +36,7 @@ class PublicShareMiddlewareTest extends \Test\TestCase { private $middleware; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php index 4c4ece1b135..097d8d2ba0c 100644 --- a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php @@ -28,6 +28,7 @@ class BruteForceMiddlewareTest extends TestCase { private $logger; private BruteForceMiddleware $bruteForceMiddleware; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php index dfc1c04b637..aaf798198b0 100644 --- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php @@ -32,6 +32,7 @@ class CORSMiddlewareTest extends \Test\TestCase { private CORSMiddlewareController $controller; private LoggerInterface $logger; + #[\Override] protected function setUp(): void { parent::setUp(); $this->reflector = new ControllerMethodReflector(Server::get(LoggerInterface::class)); diff --git a/tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php index b0b41b27cb9..cffbf062330 100644 --- a/tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php @@ -27,6 +27,7 @@ class CSPMiddlewareTest extends \Test\TestCase { /** @var ContentSecurityPolicyNonceManager&MockObject */ private $cspNonceManager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/Security/FeaturePolicyMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/FeaturePolicyMiddlewareTest.php index 55a70d4c040..122c7bbf56a 100644 --- a/tests/lib/AppFramework/Middleware/Security/FeaturePolicyMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/FeaturePolicyMiddlewareTest.php @@ -24,6 +24,7 @@ class FeaturePolicyMiddlewareTest extends \Test\TestCase { /** @var FeaturePolicyManager|MockObject */ private $manager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php index bf0de064d96..c1c7e587fd2 100644 --- a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php @@ -45,6 +45,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase { /** @var Manager&\PHPUnit\Framework\MockObject\MockObject */ private Manager $userManager; + #[\Override] protected function setUp(): void { $this->reflector = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $this->session = $this->createMock(ISession::class); diff --git a/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php index cd2f952d4da..1427d947541 100644 --- a/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php @@ -41,6 +41,7 @@ class RateLimitingMiddlewareTest extends TestCase { private LoggerInterface|MockObject $logger; private RateLimitingMiddleware $rateLimitingMiddleware; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php index f554df1ad5d..b7766f80784 100644 --- a/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php @@ -40,6 +40,7 @@ class SameSiteCookieMiddlewareTest extends TestCase { private ControllerMethodReflector&MockObject $reflector; private LoggerInterface&MockObject $logger; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index fbb76573324..9ff6627eeef 100644 --- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -60,6 +60,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { private IUserSession&MockObject $userSession; private AuthorizedGroupMapper&MockObject $authorizedGroupMapper; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php index bc612c30316..c4fd461943d 100644 --- a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php @@ -25,6 +25,7 @@ class SessionMiddlewareTest extends TestCase { private Controller $controller; private SessionMiddleware $middleware; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/AppFramework/OCS/BaseResponseTest.php b/tests/lib/AppFramework/OCS/BaseResponseTest.php index e04f7856623..3a13c6928c7 100644 --- a/tests/lib/AppFramework/OCS/BaseResponseTest.php +++ b/tests/lib/AppFramework/OCS/BaseResponseTest.php @@ -17,6 +17,7 @@ class ArrayValue implements \JsonSerializable { ) { } + #[\Override] public function jsonSerialize(): mixed { return $this->array; } diff --git a/tests/lib/AppFramework/Routing/RouteParserTest.php b/tests/lib/AppFramework/Routing/RouteParserTest.php index 406c5f1f3a5..53fe7370040 100644 --- a/tests/lib/AppFramework/Routing/RouteParserTest.php +++ b/tests/lib/AppFramework/Routing/RouteParserTest.php @@ -16,6 +16,7 @@ class RouteParserTest extends \Test\TestCase { protected RouteParser $parser; + #[\Override] protected function setUp(): void { $this->parser = new RouteParser(); } diff --git a/tests/lib/AppFramework/Services/AppConfigTest.php b/tests/lib/AppFramework/Services/AppConfigTest.php index 38fa6bdcac6..48ef39a7db1 100644 --- a/tests/lib/AppFramework/Services/AppConfigTest.php +++ b/tests/lib/AppFramework/Services/AppConfigTest.php @@ -24,6 +24,7 @@ class AppConfigTest extends TestCase { private const TEST_APPID = 'appconfig-test'; + #[\Override] protected function setUp(): void { parent::setUp(); $this->config = $this->createMock(IConfig::class); diff --git a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php index d5413f8a862..4bbe825cfb2 100644 --- a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php +++ b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php @@ -36,9 +36,11 @@ class MiddleController extends BaseController { /** * @NoAnnotation */ + #[\Override] public function test2() { } + #[\Override] public function test3() { } diff --git a/tests/lib/AppFramework/Utility/SimpleContainerTest.php b/tests/lib/AppFramework/Utility/SimpleContainerTest.php index 33800c7376f..ad0e0233af9 100644 --- a/tests/lib/AppFramework/Utility/SimpleContainerTest.php +++ b/tests/lib/AppFramework/Utility/SimpleContainerTest.php @@ -62,6 +62,7 @@ class ClassInterfaceConstructor { class SimpleContainerTest extends \Test\TestCase { private $container; + #[\Override] protected function setUp(): void { $this->container = new SimpleContainer(); } diff --git a/tests/lib/AppFramework/Utility/TimeFactoryTest.php b/tests/lib/AppFramework/Utility/TimeFactoryTest.php index 276b2d6da4f..71ac75fa92d 100644 --- a/tests/lib/AppFramework/Utility/TimeFactoryTest.php +++ b/tests/lib/AppFramework/Utility/TimeFactoryTest.php @@ -14,6 +14,7 @@ use OC\AppFramework\Utility\TimeFactory; class TimeFactoryTest extends \Test\TestCase { protected TimeFactory $timeFactory; + #[\Override] protected function setUp(): void { $this->timeFactory = new TimeFactory(); } diff --git a/tests/lib/AppScriptSortTest.php b/tests/lib/AppScriptSortTest.php index c2407705060..f2435537346 100644 --- a/tests/lib/AppScriptSortTest.php +++ b/tests/lib/AppScriptSortTest.php @@ -21,6 +21,7 @@ use Psr\Log\LoggerInterface; class AppScriptSortTest extends \Test\TestCase { private $logger; + #[\Override] protected function setUp(): void { $this->logger = $this->getMockBuilder(LoggerInterface::class) ->disableOriginalConstructor() diff --git a/tests/lib/Archive/TARTest.php b/tests/lib/Archive/TARTest.php index e77f97ac8e1..02ef5992fe5 100644 --- a/tests/lib/Archive/TARTest.php +++ b/tests/lib/Archive/TARTest.php @@ -13,11 +13,13 @@ use OCP\ITempManager; use OCP\Server; class TARTest extends TestBase { + #[\Override] protected function getExisting() { $dir = \OC::$SERVERROOT . '/tests/data'; return new TAR($dir . '/data.tar.gz'); } + #[\Override] protected function getNew() { return new TAR(Server::get(ITempManager::class)->getTemporaryFile('.tar.gz')); } diff --git a/tests/lib/Archive/ZIPTest.php b/tests/lib/Archive/ZIPTest.php index 0996d5abf61..dce11fbf766 100644 --- a/tests/lib/Archive/ZIPTest.php +++ b/tests/lib/Archive/ZIPTest.php @@ -13,11 +13,13 @@ use OCP\ITempManager; use OCP\Server; class ZIPTest extends TestBase { + #[\Override] protected function getExisting() { $dir = \OC::$SERVERROOT . '/tests/data'; return new ZIP($dir . '/data.zip'); } + #[\Override] protected function getNew() { $newZip = Server::get(ITempManager::class)->getTempBaseDir() . '/newArchive.zip'; if (file_exists($newZip)) { diff --git a/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php index e2f957ab69a..288aa448831 100644 --- a/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php +++ b/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php @@ -31,6 +31,7 @@ class RemoteWipeActivityListenerTest extends TestCase { /** @var IEventListener */ private $listener; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php index 1c45add4e31..28e17e11586 100644 --- a/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php +++ b/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php @@ -45,6 +45,7 @@ class RemoteWipeEmailListenerTest extends TestCase { /** @var IEventListener */ private $listener; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php index 53fa502b199..bb49fb9bbbd 100644 --- a/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php +++ b/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php @@ -32,6 +32,7 @@ class RemoteWipeNotificationsListenerTest extends TestCase { /** @var IEventListener */ private $listener; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Listeners/UserDeletedTokenCleanupListenerTest.php b/tests/lib/Authentication/Listeners/UserDeletedTokenCleanupListenerTest.php index 1861a5b2150..0a84a7faafa 100644 --- a/tests/lib/Authentication/Listeners/UserDeletedTokenCleanupListenerTest.php +++ b/tests/lib/Authentication/Listeners/UserDeletedTokenCleanupListenerTest.php @@ -30,6 +30,7 @@ class UserDeletedTokenCleanupListenerTest extends TestCase { /** @var UserDeletedTokenCleanupListener */ private $listener; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Login/ALoginTestCommand.php b/tests/lib/Authentication/Login/ALoginTestCommand.php index da29e74e683..24ff166ae0c 100644 --- a/tests/lib/Authentication/Login/ALoginTestCommand.php +++ b/tests/lib/Authentication/Login/ALoginTestCommand.php @@ -39,6 +39,7 @@ abstract class ALoginTestCommand extends TestCase { /** @var ALoginTestCommand */ protected $cmd; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php b/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php index 5ff2da28946..c4c3dcf5ca8 100644 --- a/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php +++ b/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php @@ -17,6 +17,7 @@ class ClearLostPasswordTokensCommandTest extends ALoginTestCommand { /** @var IConfig|MockObject */ private $config; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Login/CompleteLoginCommandTest.php b/tests/lib/Authentication/Login/CompleteLoginCommandTest.php index 5b08368671f..1457e4763ba 100644 --- a/tests/lib/Authentication/Login/CompleteLoginCommandTest.php +++ b/tests/lib/Authentication/Login/CompleteLoginCommandTest.php @@ -17,6 +17,7 @@ class CompleteLoginCommandTest extends ALoginTestCommand { /** @var Session|MockObject */ private $session; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php b/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php index 668c0a6d6ea..2728fc25479 100644 --- a/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php +++ b/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php @@ -22,6 +22,7 @@ class CreateSessionTokenCommandTest extends ALoginTestCommand { /** @var Session|MockObject */ private $userSession; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php b/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php index 499abafa6e3..1d6c0f3af09 100644 --- a/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php +++ b/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php @@ -20,6 +20,7 @@ class FinishRememberedLoginCommandTest extends ALoginTestCommand { /** @var IConfig|MockObject */ private $config; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php b/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php index 7b011d70673..9c25c15fcc1 100644 --- a/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php +++ b/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php @@ -22,6 +22,7 @@ class LoggedInCheckCommandTest extends ALoginTestCommand { /** @var IEventDispatcher|MockObject */ private $dispatcher; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Login/PreLoginHookCommandTest.php b/tests/lib/Authentication/Login/PreLoginHookCommandTest.php index 0e5096baf55..e253d805d1c 100644 --- a/tests/lib/Authentication/Login/PreLoginHookCommandTest.php +++ b/tests/lib/Authentication/Login/PreLoginHookCommandTest.php @@ -18,6 +18,7 @@ class PreLoginHookCommandTest extends ALoginTestCommand { /** @var IUserManager|MockObject */ private $userManager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Login/SetUserTimezoneCommandTest.php b/tests/lib/Authentication/Login/SetUserTimezoneCommandTest.php index 473d14daddf..b8512694781 100644 --- a/tests/lib/Authentication/Login/SetUserTimezoneCommandTest.php +++ b/tests/lib/Authentication/Login/SetUserTimezoneCommandTest.php @@ -20,6 +20,7 @@ class SetUserTimezoneCommandTest extends ALoginTestCommand { private ISession&MockObject $session; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Login/TwoFactorCommandTest.php b/tests/lib/Authentication/Login/TwoFactorCommandTest.php index a95e4b50cbc..68b161790ed 100644 --- a/tests/lib/Authentication/Login/TwoFactorCommandTest.php +++ b/tests/lib/Authentication/Login/TwoFactorCommandTest.php @@ -28,6 +28,7 @@ class TwoFactorCommandTest extends ALoginTestCommand { /** @var IURLGenerator|MockObject */ private $urlGenerator; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Login/UidLoginCommandTest.php b/tests/lib/Authentication/Login/UidLoginCommandTest.php index daae34e2212..1aed795018a 100644 --- a/tests/lib/Authentication/Login/UidLoginCommandTest.php +++ b/tests/lib/Authentication/Login/UidLoginCommandTest.php @@ -17,6 +17,7 @@ class UidLoginCommandTest extends ALoginTestCommand { /** @var Manager|MockObject */ private $userManager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Login/UpdateLastPasswordConfirmCommandTest.php b/tests/lib/Authentication/Login/UpdateLastPasswordConfirmCommandTest.php index 1a845a05c23..ebff6e2e54b 100644 --- a/tests/lib/Authentication/Login/UpdateLastPasswordConfirmCommandTest.php +++ b/tests/lib/Authentication/Login/UpdateLastPasswordConfirmCommandTest.php @@ -17,6 +17,7 @@ class UpdateLastPasswordConfirmCommandTest extends ALoginTestCommand { /** @var ISession|MockObject */ private $session; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php b/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php index ee4e171d443..917c64d0533 100644 --- a/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php +++ b/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php @@ -22,6 +22,7 @@ class UserDisabledCheckCommandTest extends ALoginTestCommand { /** @var LoggerInterface|MockObject */ private $logger; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/LoginCredentials/CredentialsTest.php b/tests/lib/Authentication/LoginCredentials/CredentialsTest.php index a64ad6c9b76..da567d0b12f 100644 --- a/tests/lib/Authentication/LoginCredentials/CredentialsTest.php +++ b/tests/lib/Authentication/LoginCredentials/CredentialsTest.php @@ -23,6 +23,7 @@ class CredentialsTest extends TestCase { /** @var Credentials */ private $credentials; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/LoginCredentials/StoreTest.php b/tests/lib/Authentication/LoginCredentials/StoreTest.php index aca586b91ec..f7c06f709a9 100644 --- a/tests/lib/Authentication/LoginCredentials/StoreTest.php +++ b/tests/lib/Authentication/LoginCredentials/StoreTest.php @@ -36,6 +36,7 @@ class StoreTest extends TestCase { /** @var Store */ private $store; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Token/ManagerTest.php b/tests/lib/Authentication/Token/ManagerTest.php index 8c238fb1587..d2714cc1925 100644 --- a/tests/lib/Authentication/Token/ManagerTest.php +++ b/tests/lib/Authentication/Token/ManagerTest.php @@ -24,6 +24,7 @@ class ManagerTest extends TestCase { /** @var Manager */ private $manager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php index d64c2dde81d..e1e0fc00740 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php @@ -29,6 +29,7 @@ class PublicKeyTokenMapperTest extends TestCase { /** @var int */ private $time; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php index 51915fc1d4b..1c9dc02f8f1 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php @@ -53,6 +53,7 @@ class PublicKeyTokenProviderTest extends TestCase { /** @var IEventDispatcher */ private $eventDispatcher; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/Token/RemoteWipeTest.php b/tests/lib/Authentication/Token/RemoteWipeTest.php index b1676e90b9d..c5031e25272 100644 --- a/tests/lib/Authentication/Token/RemoteWipeTest.php +++ b/tests/lib/Authentication/Token/RemoteWipeTest.php @@ -35,6 +35,7 @@ class RemoteWipeTest extends TestCase { /** @var RemoteWipe */ private $remoteWipe; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php index 81c01b7b28b..a5734376579 100644 --- a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php @@ -22,6 +22,7 @@ class ProviderUserAssignmentDaoTest extends TestCase { /** @var ProviderUserAssignmentDao */ private $dao; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php index a2bed8a3652..26ed14ac0c9 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php @@ -73,6 +73,7 @@ class ManagerTest extends TestCase { /** @var IEventDispatcher|MockObject */ private $dispatcher; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php b/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php index d2ecd3c509c..cfbb701414c 100644 --- a/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php @@ -27,6 +27,7 @@ class MandatoryTwoFactorTest extends TestCase { /** @var MandatoryTwoFactor */ private $mandatoryTwoFactor; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php index 6eb3b7dfb26..b7d934c6a6d 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php @@ -32,6 +32,7 @@ class ProviderLoaderTest extends TestCase { /** @var ProviderLoader */ private $loader; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php index a1f2a6fa69a..0a060d19b81 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php @@ -30,6 +30,7 @@ class ProviderManagerTest extends TestCase { /** @var ProviderManager */ private $providerManager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php b/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php index 0de94ded006..9751b9120a8 100644 --- a/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php @@ -28,6 +28,7 @@ class RegistryTest extends TestCase { private IEventDispatcher&MockObject $dispatcher; private Registry $registry; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Avatar/AvatarManagerTest.php b/tests/lib/Avatar/AvatarManagerTest.php index 495d7099d59..afbc63ac0e3 100644 --- a/tests/lib/Avatar/AvatarManagerTest.php +++ b/tests/lib/Avatar/AvatarManagerTest.php @@ -48,6 +48,7 @@ class AvatarManagerTest extends \Test\TestCase { /** @var KnownUserService | \PHPUnit\Framework\MockObject\MockObject */ private $knownUserService; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php index 1ca3b8135cc..0bd4637fc47 100644 --- a/tests/lib/Avatar/UserAvatarTest.php +++ b/tests/lib/Avatar/UserAvatarTest.php @@ -28,6 +28,7 @@ class UserAvatarTest extends \Test\TestCase { private IConfig&MockObject $config; private User&MockObject $user; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/BackgroundJob/DummyJobList.php b/tests/lib/BackgroundJob/DummyJobList.php index 26187d82274..db4b8d60368 100644 --- a/tests/lib/BackgroundJob/DummyJobList.php +++ b/tests/lib/BackgroundJob/DummyJobList.php @@ -40,6 +40,7 @@ class DummyJobList extends JobList { * @param IJob|class-string $job * @param mixed $argument */ + #[\Override] public function add($job, $argument = null, ?int $firstCheck = null): void { if (is_string($job)) { /** @var IJob $job */ @@ -52,6 +53,7 @@ class DummyJobList extends JobList { } } + #[\Override] public function scheduleAfter(string $job, int $runAfter, $argument = null): void { $this->add($job, $argument, $runAfter); } @@ -60,6 +62,7 @@ class DummyJobList extends JobList { * @param IJob|string $job * @param mixed $argument */ + #[\Override] public function remove($job, $argument = null): void { foreach ($this->jobs as $index => $listJob) { if (get_class($job) === get_class($listJob) && $job->getArgument() == $listJob->getArgument()) { @@ -69,6 +72,7 @@ class DummyJobList extends JobList { } } + #[\Override] public function removeById(string $id): void { foreach ($this->jobs as $index => $listJob) { if ($listJob->getId() === $id) { @@ -85,6 +89,7 @@ class DummyJobList extends JobList { * @param mixed $argument * @return bool */ + #[\Override] public function has($job, $argument): bool { return array_search($job, $this->jobs) !== false; } @@ -98,6 +103,7 @@ class DummyJobList extends JobList { return $this->jobs; } + #[\Override] public function getJobsIterator($job, ?int $limit, int $offset): iterable { if ($job instanceof IJob) { $jobClass = get_class($job); @@ -120,6 +126,7 @@ class DummyJobList extends JobList { /** * get the next job in the list */ + #[\Override] public function getNext(bool $onlyTimeSensitive = false, ?array $jobClasses = null): ?IJob { if (count($this->jobs) > 0) { if ($this->last < (count($this->jobs) - 1)) { @@ -138,6 +145,7 @@ class DummyJobList extends JobList { * * @param Job $job */ + #[\Override] public function setLastJob(IJob $job): void { $i = array_search($job, $this->jobs); if ($i !== false) { @@ -147,6 +155,7 @@ class DummyJobList extends JobList { } } + #[\Override] public function getById(string $id): ?IJob { foreach ($this->jobs as $job) { if ($job->getId() === $id) { @@ -156,14 +165,17 @@ class DummyJobList extends JobList { return null; } + #[\Override] public function getDetailsById(string $id): ?array { return null; } + #[\Override] public function setLastRun(IJob $job): void { $job->setLastRun(time()); } + #[\Override] public function hasReservedJob(?string $className = null): bool { return isset($this->reserved[$className ?? '']) && $this->reserved[$className ?? '']; } @@ -172,9 +184,11 @@ class DummyJobList extends JobList { $this->reserved[$className ?? ''] = $hasReserved; } + #[\Override] public function setExecutionTime(IJob $job, $timeTaken): void { } + #[\Override] public function resetBackgroundJob(IJob $job): void { } } diff --git a/tests/lib/BackgroundJob/JobListTest.php b/tests/lib/BackgroundJob/JobListTest.php index df3cd451be4..249625684f5 100644 --- a/tests/lib/BackgroundJob/JobListTest.php +++ b/tests/lib/BackgroundJob/JobListTest.php @@ -34,6 +34,7 @@ class JobListTest extends TestCase { protected IConfig&MockObject $config; protected ITimeFactory&MockObject $timeFactory; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/BackgroundJob/JobTest.php b/tests/lib/BackgroundJob/JobTest.php index b67059f0380..e3e15aa84d5 100644 --- a/tests/lib/BackgroundJob/JobTest.php +++ b/tests/lib/BackgroundJob/JobTest.php @@ -17,6 +17,7 @@ class JobTest extends \Test\TestCase { private ITimeFactory $timeFactory; private LoggerInterface $logger; + #[\Override] protected function setUp(): void { parent::setUp(); $this->run = false; diff --git a/tests/lib/BackgroundJob/QueuedJobTest.php b/tests/lib/BackgroundJob/QueuedJobTest.php index 1c0946ff2f2..20a911a7186 100644 --- a/tests/lib/BackgroundJob/QueuedJobTest.php +++ b/tests/lib/BackgroundJob/QueuedJobTest.php @@ -15,6 +15,7 @@ use OCP\Server; class TestQueuedJobNew extends QueuedJob { public bool $ran = false; + #[\Override] public function run($argument) { $this->ran = true; } @@ -23,6 +24,7 @@ class TestQueuedJobNew extends QueuedJob { class QueuedJobTest extends \Test\TestCase { private DummyJobList $jobList; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/BackgroundJob/TestJob.php b/tests/lib/BackgroundJob/TestJob.php index ac18530ac7f..25662710f13 100644 --- a/tests/lib/BackgroundJob/TestJob.php +++ b/tests/lib/BackgroundJob/TestJob.php @@ -31,6 +31,7 @@ class TestJob extends Job { $this->callback = $callback; } + #[\Override] public function run($argument) { $this->testCase->markRun(); $callback = $this->callback; diff --git a/tests/lib/BackgroundJob/TestParallelAwareJob.php b/tests/lib/BackgroundJob/TestParallelAwareJob.php index 6efb1a1fd8d..cd5f10b1300 100644 --- a/tests/lib/BackgroundJob/TestParallelAwareJob.php +++ b/tests/lib/BackgroundJob/TestParallelAwareJob.php @@ -31,6 +31,7 @@ class TestParallelAwareJob extends Job { $this->callback = $callback; } + #[\Override] public function run($argument) { $this->testCase->markRun(); $callback = $this->callback; diff --git a/tests/lib/BackgroundJob/TestTimedJobNew.php b/tests/lib/BackgroundJob/TestTimedJobNew.php index a40c4033655..9cb2f3a9704 100644 --- a/tests/lib/BackgroundJob/TestTimedJobNew.php +++ b/tests/lib/BackgroundJob/TestTimedJobNew.php @@ -20,6 +20,7 @@ class TestTimedJobNew extends TimedJob { $this->setInterval(10); } + #[\Override] public function run($argument) { $this->ran = true; } diff --git a/tests/lib/BackgroundJob/TimedJobTest.php b/tests/lib/BackgroundJob/TimedJobTest.php index d56240eb75e..6e6e208632e 100644 --- a/tests/lib/BackgroundJob/TimedJobTest.php +++ b/tests/lib/BackgroundJob/TimedJobTest.php @@ -15,6 +15,7 @@ class TimedJobTest extends \Test\TestCase { private DummyJobList $jobList; private ITimeFactory $time; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/BinaryFinderTest.php b/tests/lib/BinaryFinderTest.php index fd289ae1940..c0e0ad3dfd6 100644 --- a/tests/lib/BinaryFinderTest.php +++ b/tests/lib/BinaryFinderTest.php @@ -21,6 +21,7 @@ class BinaryFinderTest extends TestCase { private ICacheFactory $cacheFactory; private $oldEnv; + #[\Override] protected function setUp(): void { $this->oldEnv = getenv('PATH'); // BinaryFinder always includes the "PATH" environment variable into the search path, @@ -32,6 +33,7 @@ class BinaryFinderTest extends TestCase { $this->cacheFactory->method('createLocal')->with('findBinaryPath')->willReturn($this->cache); } + #[\Override] protected function tearDown(): void { putenv('PATH=' . $this->oldEnv); } diff --git a/tests/lib/Cache/CappedMemoryCacheTest.php b/tests/lib/Cache/CappedMemoryCacheTest.php index b9731c7cdde..1dd45df3c08 100644 --- a/tests/lib/Cache/CappedMemoryCacheTest.php +++ b/tests/lib/Cache/CappedMemoryCacheTest.php @@ -16,6 +16,7 @@ use OCP\Cache\CappedMemoryCache; * @package Test\Cache */ class CappedMemoryCacheTest extends TestCache { + #[\Override] protected function setUp(): void { parent::setUp(); $this->instance = new CappedMemoryCache(); @@ -37,6 +38,7 @@ class CappedMemoryCacheTest extends TestCache { $this->assertTrue($instance->hasKey('5')); } + #[\Override] public function testClear(): void { $value = 'ipsum lorum'; $this->instance->set('1_value1', $value); diff --git a/tests/lib/Cache/FileCacheTest.php b/tests/lib/Cache/FileCacheTest.php index 9ba19553cf1..8cf5eecf809 100644 --- a/tests/lib/Cache/FileCacheTest.php +++ b/tests/lib/Cache/FileCacheTest.php @@ -52,6 +52,7 @@ class FileCacheTest extends TestCache { //$this->skipUnless(OC_User::isLoggedIn()); } + #[\Override] protected function setUp(): void { parent::setUp(); @@ -81,6 +82,7 @@ class FileCacheTest extends TestCache { $this->instance->set('hack', 'hack'); } + #[\Override] protected function tearDown(): void { if ($this->instance) { $this->instance->remove('hack', 'hack'); diff --git a/tests/lib/Cache/TestCache.php b/tests/lib/Cache/TestCache.php index ec150152816..ac64f1ef635 100644 --- a/tests/lib/Cache/TestCache.php +++ b/tests/lib/Cache/TestCache.php @@ -16,6 +16,7 @@ abstract class TestCache extends \Test\TestCase { */ protected $instance; + #[\Override] protected function tearDown(): void { if ($this->instance) { $this->instance->clear(); diff --git a/tests/lib/Calendar/CalendarEventBuilderTest.php b/tests/lib/Calendar/CalendarEventBuilderTest.php index b01c209cd31..f4eacbfa85d 100644 --- a/tests/lib/Calendar/CalendarEventBuilderTest.php +++ b/tests/lib/Calendar/CalendarEventBuilderTest.php @@ -22,6 +22,7 @@ class CalendarEventBuilderTest extends TestCase { private CalendarEventBuilder $calendarEventBuilder; private ITimeFactory&MockObject $timeFactory; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php index 35f3898e7a6..ce7ce113ce8 100644 --- a/tests/lib/Calendar/ManagerTest.php +++ b/tests/lib/Calendar/ManagerTest.php @@ -68,6 +68,7 @@ class ManagerTest extends TestCase { private VCalendar $vCalendar2a; private VCalendar $vCalendar3a; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Calendar/Resource/ManagerTest.php b/tests/lib/Calendar/Resource/ManagerTest.php index 15977765da7..3c438847288 100644 --- a/tests/lib/Calendar/Resource/ManagerTest.php +++ b/tests/lib/Calendar/Resource/ManagerTest.php @@ -32,6 +32,7 @@ class ManagerTest extends TestCase { /** @var Manager */ private $manager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php b/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php index 6d61cea0d2b..548b87222c5 100644 --- a/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php +++ b/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php @@ -39,6 +39,7 @@ class ResourcesRoomsUpdaterTest extends TestCase { /** @var CalDavBackend|MockObject */ private $calDavBackend; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -60,6 +61,7 @@ class ResourcesRoomsUpdaterTest extends TestCase { ); } + #[\Override] protected function tearDown(): void { $query = self::$realDatabase->getQueryBuilder(); $query->delete('calendar_resources')->executeStatement(); diff --git a/tests/lib/Calendar/Room/ManagerTest.php b/tests/lib/Calendar/Room/ManagerTest.php index e0f2de970ed..808f74fd653 100644 --- a/tests/lib/Calendar/Room/ManagerTest.php +++ b/tests/lib/Calendar/Room/ManagerTest.php @@ -32,6 +32,7 @@ class ManagerTest extends TestCase { /** @var Manager */ private $manager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/CapabilitiesManagerTest.php b/tests/lib/CapabilitiesManagerTest.php index e5bf7b03dee..e7b84e6b82f 100644 --- a/tests/lib/CapabilitiesManagerTest.php +++ b/tests/lib/CapabilitiesManagerTest.php @@ -21,6 +21,7 @@ class CapabilitiesManagerTest extends TestCase { /** @var LoggerInterface */ private $logger; + #[\Override] protected function setUp(): void { parent::setUp(); $this->logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); @@ -144,6 +145,7 @@ class CapabilitiesManagerTest extends TestCase { } class SimpleCapability implements ICapability { + #[\Override] public function getCapabilities() { return [ 'foo' => 1 @@ -152,6 +154,7 @@ class SimpleCapability implements ICapability { } class SimpleCapability2 implements ICapability { + #[\Override] public function getCapabilities() { return [ 'bar' => ['x' => 1] @@ -160,6 +163,7 @@ class SimpleCapability2 implements ICapability { } class SimpleCapability3 implements ICapability { + #[\Override] public function getCapabilities() { return [ 'bar' => ['y' => 2] @@ -168,6 +172,7 @@ class SimpleCapability3 implements ICapability { } class PublicSimpleCapability1 implements IPublicCapability { + #[\Override] public function getCapabilities() { return [ 'foo' => 1 @@ -184,6 +189,7 @@ class NoCapability { } class DeepCapability implements ICapability { + #[\Override] public function getCapabilities() { return [ 'foo' => [ diff --git a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php index 6d52c9a4304..5d8ee161386 100644 --- a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php @@ -36,6 +36,7 @@ class GroupPluginTest extends TestCase { protected int $limit = 2; protected int $offset = 0; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php index d7d4c87c99c..5fc218dc6d8 100644 --- a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php @@ -38,6 +38,7 @@ class LookupPluginTest extends TestCase { /** @var LoggerInterface|MockObject */ protected $logger; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Collaboration/Collaborators/MailPluginTest.php b/tests/lib/Collaboration/Collaborators/MailPluginTest.php index 9a0928a82e9..db2f6b97006 100644 --- a/tests/lib/Collaboration/Collaborators/MailPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/MailPluginTest.php @@ -40,6 +40,7 @@ class MailPluginTest extends TestCase { protected KnownUserService&MockObject $knownUserService; protected IUserSession&MockObject $userSession; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php index 06196d15d09..60906719b02 100644 --- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php +++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php @@ -48,6 +48,7 @@ class RemotePluginTest extends TestCase { /** @var SearchResult */ protected $searchResult; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Collaboration/Collaborators/SearchResultTest.php b/tests/lib/Collaboration/Collaborators/SearchResultTest.php index 687901c47a6..4d495b6a3aa 100644 --- a/tests/lib/Collaboration/Collaborators/SearchResultTest.php +++ b/tests/lib/Collaboration/Collaborators/SearchResultTest.php @@ -20,6 +20,7 @@ class SearchResultTest extends TestCase { /** @var ISearch */ protected $search; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Collaboration/Collaborators/SearchTest.php b/tests/lib/Collaboration/Collaborators/SearchTest.php index 7cff155a0c0..936bb03e532 100644 --- a/tests/lib/Collaboration/Collaborators/SearchTest.php +++ b/tests/lib/Collaboration/Collaborators/SearchTest.php @@ -22,6 +22,7 @@ class SearchTest extends TestCase { /** @var ISearch */ protected $search; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Collaboration/Resources/ProviderManagerTest.php b/tests/lib/Collaboration/Resources/ProviderManagerTest.php index b063d89f06e..15a36647147 100644 --- a/tests/lib/Collaboration/Resources/ProviderManagerTest.php +++ b/tests/lib/Collaboration/Resources/ProviderManagerTest.php @@ -24,6 +24,7 @@ class ProviderManagerTest extends TestCase { /** @var IProviderManager */ protected $providerManager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Command/AsyncBusTestCase.php b/tests/lib/Command/AsyncBusTestCase.php index 1b9aeea9bdc..0a7f6f39c90 100644 --- a/tests/lib/Command/AsyncBusTestCase.php +++ b/tests/lib/Command/AsyncBusTestCase.php @@ -14,6 +14,7 @@ use OCP\Command\ICommand; use Test\TestCase; class SimpleCommand implements ICommand { + #[\Override] public function handle() { AsyncBusTestCase::$lastCommand = 'SimpleCommand'; } @@ -25,6 +26,7 @@ class StateFullCommand implements ICommand { ) { } + #[\Override] public function handle() { AsyncBusTestCase::$lastCommand = $this->state; } @@ -33,6 +35,7 @@ class StateFullCommand implements ICommand { class FilesystemCommand implements ICommand { use FileAccess; + #[\Override] public function handle() { AsyncBusTestCase::$lastCommand = 'FileAccess'; } @@ -70,6 +73,7 @@ abstract class AsyncBusTestCase extends TestCase { */ abstract protected function createBus(); + #[\Override] protected function setUp(): void { self::$lastCommand = ''; } diff --git a/tests/lib/Command/BackgroundModeTest.php b/tests/lib/Command/BackgroundModeTest.php index 8389126fe8e..efd49ab4273 100644 --- a/tests/lib/Command/BackgroundModeTest.php +++ b/tests/lib/Command/BackgroundModeTest.php @@ -22,6 +22,7 @@ class BackgroundModeTest extends TestCase { private Mode $command; + #[\Override] public function setUp(): void { $this->appConfig = $this->createMock(IAppConfig::class); diff --git a/tests/lib/Command/CronBusTest.php b/tests/lib/Command/CronBusTest.php index a4675f10fdb..8205a6b95c7 100644 --- a/tests/lib/Command/CronBusTest.php +++ b/tests/lib/Command/CronBusTest.php @@ -19,16 +19,19 @@ class CronBusTest extends AsyncBusTestCase { private $jobList; + #[\Override] protected function setUp(): void { parent::setUp(); $this->jobList = new DummyJobList(); } + #[\Override] protected function createBus() { return new CronBus($this->jobList); } + #[\Override] protected function runJobs() { $jobs = $this->jobList->getAll(); foreach ($jobs as $job) { diff --git a/tests/lib/Command/Integrity/SignAppTest.php b/tests/lib/Command/Integrity/SignAppTest.php index 237afe3a5b5..65b82739303 100644 --- a/tests/lib/Command/Integrity/SignAppTest.php +++ b/tests/lib/Command/Integrity/SignAppTest.php @@ -26,6 +26,7 @@ class SignAppTest extends TestCase { /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */ private $urlGenerator; + #[\Override] protected function setUp(): void { parent::setUp(); $this->checker = $this->createMock(Checker::class); diff --git a/tests/lib/Command/Integrity/SignCoreTest.php b/tests/lib/Command/Integrity/SignCoreTest.php index 843084eebd9..563e3ef81b5 100644 --- a/tests/lib/Command/Integrity/SignCoreTest.php +++ b/tests/lib/Command/Integrity/SignCoreTest.php @@ -23,6 +23,7 @@ class SignCoreTest extends TestCase { /** @var SignCore */ private $signCore; + #[\Override] protected function setUp(): void { parent::setUp(); $this->checker = $this->createMock(Checker::class); diff --git a/tests/lib/Comments/FakeFactory.php b/tests/lib/Comments/FakeFactory.php index 0c3241078d7..572928b0684 100644 --- a/tests/lib/Comments/FakeFactory.php +++ b/tests/lib/Comments/FakeFactory.php @@ -17,6 +17,7 @@ class FakeFactory implements ICommentsManagerFactory { public function __construct(IServerContainer $serverContainer) { } + #[\Override] public function getManager() { return new FakeManager(); } diff --git a/tests/lib/Comments/FakeManager.php b/tests/lib/Comments/FakeManager.php index eadaee13054..7ee58b2246a 100644 --- a/tests/lib/Comments/FakeManager.php +++ b/tests/lib/Comments/FakeManager.php @@ -18,14 +18,17 @@ use OCP\IUser; * Class FakeManager */ class FakeManager implements ICommentsManager { + #[\Override] public function get($id): IComment { throw new \Exception('Not implemented'); } + #[\Override] public function getTree($id, $limit = 0, $offset = 0): array { return ['comment' => new Comment(), 'replies' => []]; } + #[\Override] public function getForObject( $objectType, $objectId, @@ -36,6 +39,7 @@ class FakeManager implements ICommentsManager { return []; } + #[\Override] public function getForObjectSince( string $objectType, string $objectId, @@ -48,6 +52,7 @@ class FakeManager implements ICommentsManager { return []; } + #[\Override] public function getCommentsWithVerbForObjectSinceComment( string $objectType, string $objectId, @@ -61,111 +66,139 @@ class FakeManager implements ICommentsManager { return []; } + #[\Override] public function getNumberOfCommentsForObject($objectType, $objectId, ?\DateTime $notOlderThan = null, $verb = ''): int { return 0; } + #[\Override] public function getNumberOfCommentsForObjects(string $objectType, array $objectIds, ?\DateTime $notOlderThan = null, string $verb = ''): array { return array_fill_keys($objectIds, 0); } + #[\Override] public function search(string $search, string $objectType, string $objectId, string $verb, int $offset, int $limit = 50): array { return []; } + #[\Override] public function create($actorType, $actorId, $objectType, $objectId): IComment { return new Comment(); } + #[\Override] public function delete($id): bool { return false; } + #[\Override] public function getReactionComment(int $parentId, string $actorType, string $actorId, string $reaction): IComment { return new Comment(); } + #[\Override] public function retrieveAllReactions(int $parentId): array { return []; } + #[\Override] public function retrieveAllReactionsWithSpecificReaction(int $parentId, string $reaction): array { return []; } + #[\Override] public function supportReactions(): bool { return false; } + #[\Override] public function save(IComment $comment): bool { return false; } + #[\Override] public function deleteReferencesOfActor($actorType, $actorId): bool { return false; } + #[\Override] public function deleteCommentsAtObject($objectType, $objectId): bool { return false; } + #[\Override] public function setReadMark($objectType, $objectId, \DateTime $dateTime, IUser $user): bool { return false; } + #[\Override] public function getReadMark($objectType, $objectId, IUser $user): bool { return false; } + #[\Override] public function deleteReadMarksFromUser(IUser $user): bool { return false; } + #[\Override] public function deleteReadMarksOnObject($objectType, $objectId): bool { return false; } + #[\Override] public function registerEventHandler(\Closure $closure): void { } + #[\Override] public function registerDisplayNameResolver($type, \Closure $closure): void { } + #[\Override] public function resolveDisplayName($type, $id): string { return ''; } + #[\Override] public function getNumberOfUnreadCommentsForFolder($folderId, IUser $user): array { return []; } + #[\Override] public function getNumberOfUnreadCommentsForObjects(string $objectType, array $objectIds, IUser $user, $verb = ''): array { return []; } + #[\Override] public function load(): void { } + #[\Override] public function searchForObjects(string $search, string $objectType, array $objectIds, string $verb, int $offset, int $limit = 50): array { return []; } + #[\Override] public function getNumberOfCommentsForObjectSinceComment(string $objectType, string $objectId, int $lastRead, string $verb = ''): int { return 0; } + #[\Override] public function getNumberOfCommentsWithVerbsForObjectSinceComment(string $objectType, string $objectId, int $lastRead, array $verbs): int { return 0; } + #[\Override] public function getLastCommentBeforeDate(string $objectType, string $objectId, \DateTime $beforeDate, string $verb = ''): int { return 0; } + #[\Override] public function getLastCommentDateByActor(string $objectType, string $objectId, string $verb, string $actorType, array $actors): array { return []; } + #[\Override] public function deleteCommentsExpiredAtObject(string $objectType, string $objectId = ''): bool { return true; } diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php index d0cb1e00fe8..40f9846e077 100644 --- a/tests/lib/Comments/ManagerTest.php +++ b/tests/lib/Comments/ManagerTest.php @@ -40,6 +40,7 @@ class ManagerTest extends TestCase { private IDBConnection $connection; private IRootFolder&MockObject $rootFolder; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Config/LexiconTest.php b/tests/lib/Config/LexiconTest.php index 89a821528fc..b540d5b4281 100644 --- a/tests/lib/Config/LexiconTest.php +++ b/tests/lib/Config/LexiconTest.php @@ -34,6 +34,7 @@ class LexiconTest extends TestCase { private ConfigManager $configManager; private IAppManager $appManager; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -49,6 +50,7 @@ class LexiconTest extends TestCase { $this->appManager = Server::get(IAppManager::class); } + #[\Override] protected function tearDown(): void { parent::tearDown(); diff --git a/tests/lib/Config/TestConfigLexicon_I.php b/tests/lib/Config/TestConfigLexicon_I.php index 077a55bb4fa..a7fb9e6d568 100644 --- a/tests/lib/Config/TestConfigLexicon_I.php +++ b/tests/lib/Config/TestConfigLexicon_I.php @@ -18,10 +18,12 @@ use OCP\IAppConfig; class TestConfigLexicon_I implements ILexicon { public const APPID = 'lexicon_test_i'; + #[\Override] public function getStrictness(): Strictness { return Strictness::IGNORE; } + #[\Override] public function getAppConfigs(): array { return [ new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IAppConfig::FLAG_SENSITIVE), @@ -31,6 +33,7 @@ class TestConfigLexicon_I implements ILexicon { ]; } + #[\Override] public function getUserConfigs(): array { return [ new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IUserConfig::FLAG_SENSITIVE), diff --git a/tests/lib/Config/TestLexicon_E.php b/tests/lib/Config/TestLexicon_E.php index ccdc8cdd037..b3992e72d8e 100644 --- a/tests/lib/Config/TestLexicon_E.php +++ b/tests/lib/Config/TestLexicon_E.php @@ -19,10 +19,12 @@ use OCP\IAppConfig; class TestLexicon_E implements ILexicon { public const APPID = 'lexicon_test_e'; + #[\Override] public function getStrictness(): Strictness { return Strictness::EXCEPTION; } + #[\Override] public function getAppConfigs(): array { return [ new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IAppConfig::FLAG_SENSITIVE), @@ -35,6 +37,7 @@ class TestLexicon_E implements ILexicon { ]; } + #[\Override] public function getUserConfigs(): array { return [ new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IUserConfig::FLAG_SENSITIVE), diff --git a/tests/lib/Config/TestLexicon_N.php b/tests/lib/Config/TestLexicon_N.php index 87be2149371..aee68db5032 100644 --- a/tests/lib/Config/TestLexicon_N.php +++ b/tests/lib/Config/TestLexicon_N.php @@ -18,10 +18,12 @@ use OCP\IAppConfig; class TestLexicon_N implements ILexicon { public const APPID = 'lexicon_test_n'; + #[\Override] public function getStrictness(): Strictness { return Strictness::NOTICE; } + #[\Override] public function getAppConfigs(): array { return [ new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IAppConfig::FLAG_SENSITIVE), @@ -29,6 +31,7 @@ class TestLexicon_N implements ILexicon { ]; } + #[\Override] public function getUserConfigs(): array { return [ new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IUserConfig::FLAG_SENSITIVE), diff --git a/tests/lib/Config/TestLexicon_UserIndexed.php b/tests/lib/Config/TestLexicon_UserIndexed.php index 07107db4ec4..e876b834585 100644 --- a/tests/lib/Config/TestLexicon_UserIndexed.php +++ b/tests/lib/Config/TestLexicon_UserIndexed.php @@ -16,15 +16,18 @@ use OCP\Config\ValueType; class TestLexicon_UserIndexed implements ILexicon { public const APPID = 'lexicon_user_indexed'; + #[\Override] public function getStrictness(): Strictness { return Strictness::EXCEPTION; } + #[\Override] public function getAppConfigs(): array { return [ ]; } + #[\Override] public function getUserConfigs(): array { return [ new Entry(key: 'key1', type: ValueType::STRING, defaultRaw: '', definition: 'test key', flags: IUserConfig::FLAG_INDEXED), diff --git a/tests/lib/Config/TestLexicon_UserIndexedRemove.php b/tests/lib/Config/TestLexicon_UserIndexedRemove.php index 36afb1a6269..5cb326d3646 100644 --- a/tests/lib/Config/TestLexicon_UserIndexedRemove.php +++ b/tests/lib/Config/TestLexicon_UserIndexedRemove.php @@ -15,15 +15,18 @@ use OCP\Config\ValueType; class TestLexicon_UserIndexedRemove implements ILexicon { public const APPID = 'lexicon_user_not_indexed'; + #[\Override] public function getStrictness(): Strictness { return Strictness::EXCEPTION; } + #[\Override] public function getAppConfigs(): array { return [ ]; } + #[\Override] public function getUserConfigs(): array { return [ new Entry(key: 'key1', type: ValueType::STRING, defaultRaw: '', definition: 'test key'), diff --git a/tests/lib/Config/TestLexicon_W.php b/tests/lib/Config/TestLexicon_W.php index 32227eb1c80..12833288cb3 100644 --- a/tests/lib/Config/TestLexicon_W.php +++ b/tests/lib/Config/TestLexicon_W.php @@ -18,10 +18,12 @@ use OCP\IAppConfig; class TestLexicon_W implements ILexicon { public const APPID = 'lexicon_test_w'; + #[\Override] public function getStrictness(): Strictness { return Strictness::WARNING; } + #[\Override] public function getAppConfigs(): array { return [ new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IAppConfig::FLAG_SENSITIVE), @@ -30,6 +32,7 @@ class TestLexicon_W implements ILexicon { ]; } + #[\Override] public function getUserConfigs(): array { return [ new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IUserConfig::FLAG_SENSITIVE), diff --git a/tests/lib/Config/UserConfigTest.php b/tests/lib/Config/UserConfigTest.php index a353f738564..95e0c958e23 100644 --- a/tests/lib/Config/UserConfigTest.php +++ b/tests/lib/Config/UserConfigTest.php @@ -174,6 +174,7 @@ class UserConfigTest extends TestCase { ]; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -251,6 +252,7 @@ class UserConfigTest extends TestCase { } } + #[\Override] protected function tearDown(): void { $sql = $this->connection->getQueryBuilder(); $sql->delete('preferences'); diff --git a/tests/lib/ConfigTest.php b/tests/lib/ConfigTest.php index d998a49f0ea..c0a6e4bb53b 100644 --- a/tests/lib/ConfigTest.php +++ b/tests/lib/ConfigTest.php @@ -22,6 +22,7 @@ class ConfigTest extends TestCase { /** @var string */ private $randomTmpDir; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -30,6 +31,7 @@ class ConfigTest extends TestCase { file_put_contents($this->configFile, self::TESTCONTENT); } + #[\Override] protected function tearDown(): void { unlink($this->configFile); parent::tearDown(); diff --git a/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php b/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php index 09e0e11bd5e..8b939928d86 100644 --- a/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php +++ b/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php @@ -14,6 +14,7 @@ use Test\TestCase; class ActionFactoryTest extends TestCase { private ActionFactory $actionFactory; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php index 84de6ec88e2..723e64ce7b0 100644 --- a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php +++ b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php @@ -30,6 +30,7 @@ class ActionProviderStoreTest extends TestCase { private ActionProviderStore $actionProviderStore; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php b/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php index 5e2b416a66b..b2a9ecb362f 100644 --- a/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php +++ b/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php @@ -13,6 +13,7 @@ use Test\TestCase; class LinkActionTest extends TestCase { private LinkAction $action; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php index 795c2c808d7..977d837c6a2 100644 --- a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php +++ b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php @@ -44,6 +44,7 @@ class ContactsStoreTest extends TestCase { /** @var IL10NFactory */ private $l10nFactory; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Contacts/ContactsMenu/EntryTest.php b/tests/lib/Contacts/ContactsMenu/EntryTest.php index 15f5b60b948..c0f07f7bf3b 100644 --- a/tests/lib/Contacts/ContactsMenu/EntryTest.php +++ b/tests/lib/Contacts/ContactsMenu/EntryTest.php @@ -14,6 +14,7 @@ use Test\TestCase; class EntryTest extends TestCase { private Entry $entry; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Contacts/ContactsMenu/ManagerTest.php b/tests/lib/Contacts/ContactsMenu/ManagerTest.php index dd6c634c740..dfa37dd926e 100644 --- a/tests/lib/Contacts/ContactsMenu/ManagerTest.php +++ b/tests/lib/Contacts/ContactsMenu/ManagerTest.php @@ -34,6 +34,7 @@ class ManagerTest extends TestCase { private Manager $manager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php index 648351c2ca9..36ce0b96540 100644 --- a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php +++ b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php @@ -24,6 +24,7 @@ class EMailproviderTest extends TestCase { private EMailProvider $provider; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php index cc53c0bcfcf..a36416ca9ea 100644 --- a/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php +++ b/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php @@ -39,6 +39,7 @@ class LocalTimeProviderTest extends TestCase { private LocalTimeProvider $provider; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/ContactsManagerTest.php b/tests/lib/ContactsManagerTest.php index 32aa1141ff0..cd0c5d7ed8f 100644 --- a/tests/lib/ContactsManagerTest.php +++ b/tests/lib/ContactsManagerTest.php @@ -14,6 +14,7 @@ use OCP\IAddressBook; class ContactsManagerTest extends \Test\TestCase { private ContactsManager $cm; + #[\Override] protected function setUp(): void { parent::setUp(); $this->cm = new ContactsManager(); diff --git a/tests/lib/DB/AdapterTest.php b/tests/lib/DB/AdapterTest.php index 09496871508..23ac53b0f5c 100644 --- a/tests/lib/DB/AdapterTest.php +++ b/tests/lib/DB/AdapterTest.php @@ -15,11 +15,13 @@ class AdapterTest extends TestCase { private string $appId; private $connection; + #[\Override] public function setUp(): void { $this->connection = Server::get(IDBConnection::class); $this->appId = substr(uniqid('test_db_adapter', true), 0, 32); } + #[\Override] public function tearDown(): void { $qb = $this->connection->getQueryBuilder(); diff --git a/tests/lib/DB/Exception/DbalExceptionTest.php b/tests/lib/DB/Exception/DbalExceptionTest.php index eac74291749..8a1aa2adf53 100644 --- a/tests/lib/DB/Exception/DbalExceptionTest.php +++ b/tests/lib/DB/Exception/DbalExceptionTest.php @@ -29,6 +29,7 @@ class DbalExceptionTest extends \Test\TestCase { /** @var TheDriverException */ protected $driverException; + #[\Override] protected function setUp(): void { parent::setUp(); $this->driverException = $this->createMock(TheDriverException::class); diff --git a/tests/lib/DB/MigrationServiceTest.php b/tests/lib/DB/MigrationServiceTest.php index 0142c36ee26..72edd4aa4df 100644 --- a/tests/lib/DB/MigrationServiceTest.php +++ b/tests/lib/DB/MigrationServiceTest.php @@ -37,6 +37,7 @@ class MigrationServiceTest extends \Test\TestCase { private MigrationService $migrationService; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php index 7e6438dd4a0..78d28401383 100644 --- a/tests/lib/DB/MigratorTest.php +++ b/tests/lib/DB/MigratorTest.php @@ -45,6 +45,7 @@ class MigratorTest extends \Test\TestCase { /** @var string */ private $tableNameTmp; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -69,6 +70,7 @@ class MigratorTest extends \Test\TestCase { return strtolower($this->getUniqueID($this->config->getSystemValueString('dbtableprefix', 'oc_') . 'test_')); } + #[\Override] protected function tearDown(): void { // Try to delete if exists (IF EXISTS NOT SUPPORTED IN ORACLE) try { diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php index 7bfa6ed5f41..fc1d7849976 100644 --- a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php +++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php @@ -22,6 +22,7 @@ class ExpressionBuilderDBTest extends TestCase { protected $connection; protected $schemaSetup = false; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php index bbaaf376ca0..3281166d68e 100644 --- a/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php @@ -37,6 +37,7 @@ class ExpressionBuilderTest extends TestCase { protected \Doctrine\DBAL\Connection $internalConnection; protected LoggerInterface&MockObject $logger; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php index 2202e6879f3..f52b4f3bda1 100644 --- a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php @@ -24,6 +24,7 @@ class FunctionBuilderTest extends TestCase { /** @var \Doctrine\DBAL\Connection|IDBConnection */ protected $connection; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/DB/QueryBuilder/Partitioned/JoinConditionTest.php b/tests/lib/DB/QueryBuilder/Partitioned/JoinConditionTest.php index 8f84d6a0d2c..77e78a8b6b7 100644 --- a/tests/lib/DB/QueryBuilder/Partitioned/JoinConditionTest.php +++ b/tests/lib/DB/QueryBuilder/Partitioned/JoinConditionTest.php @@ -18,6 +18,7 @@ use Psr\Log\LoggerInterface; use Test\TestCase; class JoinConditionTest extends TestCase { + #[\Override] protected function setUp(): void { parent::setUp(); } diff --git a/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php b/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php index 8d58ed9779b..2082701f610 100644 --- a/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php @@ -24,6 +24,7 @@ class PartitionedQueryBuilderTest extends TestCase { private ShardConnectionManager $shardConnectionManager; private AutoIncrementHandler $autoIncrementHandler; + #[\Override] protected function setUp(): void { if (PHP_INT_SIZE < 8) { $this->markTestSkipped('Test requires 64bit'); @@ -36,6 +37,7 @@ class PartitionedQueryBuilderTest extends TestCase { $this->setupFileCache(); } + #[\Override] protected function tearDown(): void { // PHP unit also runs tearDown when the test is skipped, but we only initialized when using 64bit // see https://github.com/sebastianbergmann/phpunit/issues/6394 diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php index 0e8f279c9dd..0014ce86420 100644 --- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php @@ -39,6 +39,7 @@ class QueryBuilderTest extends \Test\TestCase { private QueryBuilder $queryBuilder; private IDBConnection $connection; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/DB/QueryBuilder/QuoteHelperTest.php b/tests/lib/DB/QueryBuilder/QuoteHelperTest.php index 6efb55708a1..624781a1e35 100644 --- a/tests/lib/DB/QueryBuilder/QuoteHelperTest.php +++ b/tests/lib/DB/QueryBuilder/QuoteHelperTest.php @@ -18,6 +18,7 @@ class QuoteHelperTest extends \Test\TestCase { /** @var QuoteHelper */ protected $helper; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php b/tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php index 145a0214570..fc32ec650ff 100644 --- a/tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php @@ -24,6 +24,7 @@ class SharedQueryBuilderTest extends TestCase { private IDBConnection $connection; private AutoIncrementHandler $autoIncrementHandler; + #[\Override] protected function setUp(): void { if (PHP_INT_SIZE < 8) { $this->markTestSkipped('Test requires 64bit'); diff --git a/tests/lib/DateTimeFormatterTest.php b/tests/lib/DateTimeFormatterTest.php index 26ff381bf0a..e4fcd07abf8 100644 --- a/tests/lib/DateTimeFormatterTest.php +++ b/tests/lib/DateTimeFormatterTest.php @@ -20,6 +20,7 @@ class DateTimeFormatterTest extends TestCase { protected static $defaultTimeZone; + #[\Override] public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); self::$defaultTimeZone = date_default_timezone_get(); @@ -29,11 +30,13 @@ class DateTimeFormatterTest extends TestCase { self::$oneYear = self::$oneDay * 365; } + #[\Override] public static function tearDownAfterClass(): void { date_default_timezone_set(self::$defaultTimeZone); parent::tearDownAfterClass(); } + #[\Override] protected function setUp(): void { parent::setUp(); $this->formatter = new DateTimeFormatter(new \DateTimeZone('UTC'), Util::getL10N('lib', 'en')); diff --git a/tests/lib/Diagnostics/EventLoggerTest.php b/tests/lib/Diagnostics/EventLoggerTest.php index aca536170db..6a194a2d205 100644 --- a/tests/lib/Diagnostics/EventLoggerTest.php +++ b/tests/lib/Diagnostics/EventLoggerTest.php @@ -17,6 +17,7 @@ use Test\TestCase; class EventLoggerTest extends TestCase { private EventLogger $logger; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Diagnostics/QueryLoggerTest.php b/tests/lib/Diagnostics/QueryLoggerTest.php index 9f869919e51..ed806c7c248 100644 --- a/tests/lib/Diagnostics/QueryLoggerTest.php +++ b/tests/lib/Diagnostics/QueryLoggerTest.php @@ -14,6 +14,7 @@ use Test\TestCase; class QueryLoggerTest extends TestCase { private QueryLogger $logger; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/DirectEditing/ManagerTest.php b/tests/lib/DirectEditing/ManagerTest.php index f519aeb4ce1..2c9b74eb0cf 100644 --- a/tests/lib/DirectEditing/ManagerTest.php +++ b/tests/lib/DirectEditing/ManagerTest.php @@ -28,52 +28,63 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class CreateEmpty extends ACreateEmpty { + #[\Override] public function getId(): string { return 'createEmpty'; } + #[\Override] public function getName(): string { return 'create empty file'; } + #[\Override] public function getExtension(): string { return '.txt'; } + #[\Override] public function getMimetype(): string { return 'text/plain'; } } class Editor implements IEditor { + #[\Override] public function getId(): string { return 'testeditor'; } + #[\Override] public function getName(): string { return 'Test editor'; } + #[\Override] public function getMimetypes(): array { return [ 'text/plain' ]; } + #[\Override] public function getMimetypesOptional(): array { return []; } + #[\Override] public function getCreators(): array { return [ new CreateEmpty() ]; } + #[\Override] public function isSecure(): bool { return false; } + #[\Override] public function open(IToken $token): Response { return new DataResponse('edit page'); } @@ -120,6 +131,7 @@ class ManagerTest extends TestCase { */ private $encryptionManager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/EmojiHelperTest.php b/tests/lib/EmojiHelperTest.php index 9a89a4b299e..692dff143ee 100644 --- a/tests/lib/EmojiHelperTest.php +++ b/tests/lib/EmojiHelperTest.php @@ -17,6 +17,7 @@ class EmojiHelperTest extends TestCase { private IEmojiHelper $helper; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php index 04cfb5b56fe..1434adf6bc5 100644 --- a/tests/lib/Encryption/DecryptAllTest.php +++ b/tests/lib/Encryption/DecryptAllTest.php @@ -42,6 +42,7 @@ class DecryptAllTest extends TestCase { private DecryptAll $instance; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Encryption/EncryptionWrapperTest.php b/tests/lib/Encryption/EncryptionWrapperTest.php index 8d1deacf3fd..b80d1a08af6 100644 --- a/tests/lib/Encryption/EncryptionWrapperTest.php +++ b/tests/lib/Encryption/EncryptionWrapperTest.php @@ -31,6 +31,7 @@ class EncryptionWrapperTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject|ArrayCache */ private $arrayCache; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php index a1e6f6d351a..cf0aa4fc04b 100644 --- a/tests/lib/Encryption/Keys/StorageTest.php +++ b/tests/lib/Encryption/Keys/StorageTest.php @@ -25,6 +25,7 @@ class StorageTest extends TestCase { private array $mkdirStack = []; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Encryption/ManagerTest.php b/tests/lib/Encryption/ManagerTest.php index 6a6e55b1925..5f3d1987dc3 100644 --- a/tests/lib/Encryption/ManagerTest.php +++ b/tests/lib/Encryption/ManagerTest.php @@ -41,6 +41,7 @@ class ManagerTest extends TestCase { /** @var ArrayCache|\PHPUnit\Framework\MockObject\MockObject */ private $arrayCache; + #[\Override] protected function setUp(): void { parent::setUp(); $this->config = $this->createMock(IConfig::class); diff --git a/tests/lib/Encryption/UpdateTest.php b/tests/lib/Encryption/UpdateTest.php index 04ca224c0a1..d357b6036f7 100644 --- a/tests/lib/Encryption/UpdateTest.php +++ b/tests/lib/Encryption/UpdateTest.php @@ -31,6 +31,7 @@ class UpdateTest extends TestCase { private File&MockObject $fileHelper; private LoggerInterface&MockObject $logger; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php index d1fefee872a..e272978862e 100644 --- a/tests/lib/Encryption/UtilTest.php +++ b/tests/lib/Encryption/UtilTest.php @@ -37,6 +37,7 @@ class UtilTest extends TestCase { private $config; private Util $util; + #[\Override] protected function setUp(): void { parent::setUp(); $this->view = $this->getMockBuilder(View::class) diff --git a/tests/lib/ErrorHandlerTest.php b/tests/lib/ErrorHandlerTest.php index 0bec3445d34..5229df71a9c 100644 --- a/tests/lib/ErrorHandlerTest.php +++ b/tests/lib/ErrorHandlerTest.php @@ -20,6 +20,7 @@ class ErrorHandlerTest extends TestCase { private ErrorHandler $errorHandler; private int $errorReporting; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -31,6 +32,7 @@ class ErrorHandlerTest extends TestCase { $this->errorReporting = error_reporting(E_ALL); } + #[\Override] protected function tearDown(): void { error_reporting($this->errorReporting); parent::tearDown(); diff --git a/tests/lib/Federation/CloudIdManagerTest.php b/tests/lib/Federation/CloudIdManagerTest.php index 391baa79960..6f927a12e00 100644 --- a/tests/lib/Federation/CloudIdManagerTest.php +++ b/tests/lib/Federation/CloudIdManagerTest.php @@ -33,6 +33,7 @@ class CloudIdManagerTest extends TestCase { private $cacheFactory; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Federation/CloudIdTest.php b/tests/lib/Federation/CloudIdTest.php index cfda35b545e..aee97261b8e 100644 --- a/tests/lib/Federation/CloudIdTest.php +++ b/tests/lib/Federation/CloudIdTest.php @@ -19,6 +19,7 @@ use Test\TestCase; class CloudIdTest extends TestCase { protected CloudIdManager&MockObject $cloudIdManager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/AppData/AppDataTest.php b/tests/lib/Files/AppData/AppDataTest.php index ed006622504..f7583d4456d 100644 --- a/tests/lib/Files/AppData/AppDataTest.php +++ b/tests/lib/Files/AppData/AppDataTest.php @@ -26,6 +26,7 @@ class AppDataTest extends \Test\TestCase { /** @var IAppData */ private $appData; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/AppData/FactoryTest.php b/tests/lib/Files/AppData/FactoryTest.php index 6092c931091..0d157c5a22e 100644 --- a/tests/lib/Files/AppData/FactoryTest.php +++ b/tests/lib/Files/AppData/FactoryTest.php @@ -21,6 +21,7 @@ class FactoryTest extends \Test\TestCase { /** @var Factory */ private $factory; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php index c2dca753f5a..8d62e449306 100644 --- a/tests/lib/Files/Cache/CacheTest.php +++ b/tests/lib/Files/Cache/CacheTest.php @@ -25,6 +25,7 @@ use OCP\IUserManager; use OCP\Server; class LongId extends Temporary { + #[\Override] public function getId(): string { return 'long:' . str_repeat('foo', 50) . parent::getId(); } @@ -56,6 +57,7 @@ class CacheTest extends \Test\TestCase { */ protected $cache2; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -67,6 +69,7 @@ class CacheTest extends \Test\TestCase { $this->cache2->insert('', ['size' => 0, 'mtime' => 0, 'mimetype' => ICacheEntry::DIRECTORY_MIMETYPE]); } + #[\Override] protected function tearDown(): void { if ($this->cache) { $this->cache->clear(); diff --git a/tests/lib/Files/Cache/FileAccessTest.php b/tests/lib/Files/Cache/FileAccessTest.php index a8ad3c6e7e1..a6d5661d409 100644 --- a/tests/lib/Files/Cache/FileAccessTest.php +++ b/tests/lib/Files/Cache/FileAccessTest.php @@ -24,6 +24,7 @@ class FileAccessTest extends TestCase { private IDBConnection $dbConnection; private FileAccess $fileAccess; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Cache/HomeCacheTest.php b/tests/lib/Files/Cache/HomeCacheTest.php index 1aa8e93173d..23d8ae27894 100644 --- a/tests/lib/Files/Cache/HomeCacheTest.php +++ b/tests/lib/Files/Cache/HomeCacheTest.php @@ -23,6 +23,7 @@ class DummyUser extends User { ) { } + #[\Override] public function getHome(): string { return $this->home; } @@ -30,6 +31,7 @@ class DummyUser extends User { /** * @return string */ + #[\Override] public function getUID(): string { return $this->uid; } @@ -41,6 +43,7 @@ class HomeCacheTest extends TestCase { private ICache $cache; private User $user; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Cache/LocalRootScannerTest.php b/tests/lib/Files/Cache/LocalRootScannerTest.php index 12f785103d1..0b49788d675 100644 --- a/tests/lib/Files/Cache/LocalRootScannerTest.php +++ b/tests/lib/Files/Cache/LocalRootScannerTest.php @@ -18,6 +18,7 @@ class LocalRootScannerTest extends TestCase { /** @var LocalRootStorage */ private $storage; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Cache/MoveFromCacheTraitTest.php b/tests/lib/Files/Cache/MoveFromCacheTraitTest.php index c929ac7ab67..547e48a1963 100644 --- a/tests/lib/Files/Cache/MoveFromCacheTraitTest.php +++ b/tests/lib/Files/Cache/MoveFromCacheTraitTest.php @@ -23,6 +23,7 @@ class FallBackCrossCacheMoveCache extends Cache { */ #[\PHPUnit\Framework\Attributes\Group('DB')] class MoveFromCacheTraitTest extends CacheTest { + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Cache/PropagatorTest.php b/tests/lib/Files/Cache/PropagatorTest.php index 903915029d1..c3ba9e9acb5 100644 --- a/tests/lib/Files/Cache/PropagatorTest.php +++ b/tests/lib/Files/Cache/PropagatorTest.php @@ -17,6 +17,7 @@ use Test\TestCase; class PropagatorTest extends TestCase { private IStorage $storage; + #[\Override] protected function setUp(): void { parent::setUp(); $this->storage = new Temporary(); diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php index e8dbc5006f1..90c059238e3 100644 --- a/tests/lib/Files/Cache/ScannerTest.php +++ b/tests/lib/Files/Cache/ScannerTest.php @@ -31,6 +31,7 @@ class ScannerTest extends TestCase { private Scanner $scanner; private Cache $cache; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -39,6 +40,7 @@ class ScannerTest extends TestCase { $this->cache = new Cache($this->storage); } + #[\Override] protected function tearDown(): void { $this->cache->clear(); diff --git a/tests/lib/Files/Cache/SearchBuilderTest.php b/tests/lib/Files/Cache/SearchBuilderTest.php index aa936598a96..a956de83262 100644 --- a/tests/lib/Files/Cache/SearchBuilderTest.php +++ b/tests/lib/Files/Cache/SearchBuilderTest.php @@ -38,6 +38,7 @@ class SearchBuilderTest extends TestCase { /** @var integer */ private $numericStorageId; + #[\Override] protected function setUp(): void { parent::setUp(); $this->builder = Server::get(IDBConnection::class)->getQueryBuilder(); @@ -74,6 +75,7 @@ class SearchBuilderTest extends TestCase { ->where($this->builder->expr()->eq('storage', new Literal($this->numericStorageId))); } + #[\Override] protected function tearDown(): void { parent::tearDown(); diff --git a/tests/lib/Files/Cache/UpdaterLegacyTest.php b/tests/lib/Files/Cache/UpdaterLegacyTest.php index fb8083d9670..083bb857cfd 100644 --- a/tests/lib/Files/Cache/UpdaterLegacyTest.php +++ b/tests/lib/Files/Cache/UpdaterLegacyTest.php @@ -43,6 +43,7 @@ class UpdaterLegacyTest extends \Test\TestCase { private static $user; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -77,6 +78,7 @@ class UpdaterLegacyTest extends \Test\TestCase { \OC_Hook::clear('OC_Filesystem'); } + #[\Override] protected function tearDown(): void { if ($this->cache) { $this->cache->clear(); diff --git a/tests/lib/Files/Cache/UpdaterTest.php b/tests/lib/Files/Cache/UpdaterTest.php index 94fa42d64a4..a2db97c9a7e 100644 --- a/tests/lib/Files/Cache/UpdaterTest.php +++ b/tests/lib/Files/Cache/UpdaterTest.php @@ -46,6 +46,7 @@ class UpdaterTest extends \Test\TestCase { */ protected $updater; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -56,6 +57,7 @@ class UpdaterTest extends \Test\TestCase { $this->cache = $this->storage->getCache(); } + #[\Override] protected function tearDown(): void { $this->logout(); parent::tearDown(); diff --git a/tests/lib/Files/Cache/WatcherTest.php b/tests/lib/Files/Cache/WatcherTest.php index 203ee78538f..61b78ab1b74 100644 --- a/tests/lib/Files/Cache/WatcherTest.php +++ b/tests/lib/Files/Cache/WatcherTest.php @@ -29,12 +29,14 @@ class WatcherTest extends TestCase { */ private array $storages = []; + #[\Override] protected function setUp(): void { parent::setUp(); $this->loginAsUser(); } + #[\Override] protected function tearDown(): void { foreach ($this->storages as $storage) { $cache = $storage->getCache(); diff --git a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php index f5fecdab92b..5ec38104975 100644 --- a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php +++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php @@ -33,6 +33,7 @@ class CacheJailTest extends CacheTest { */ protected $sourceCache; + #[\Override] protected function setUp(): void { parent::setUp(); $this->storage->mkdir('jail'); @@ -123,6 +124,7 @@ class CacheJailTest extends CacheTest { $this->assertTrue($this->sourceCache->inCache('folder/foobar')); } + #[\Override] public function testGetById(): void { $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => ICacheEntry::DIRECTORY_MIMETYPE]; $id = $this->sourceCache->put('jail/bar', $data1); @@ -137,6 +139,7 @@ class CacheJailTest extends CacheTest { $this->assertEquals('jail/bar', $path); } + #[\Override] public function testGetIncomplete(): void { //not supported $this->addToAssertionCount(1); diff --git a/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php index f763fd1608c..dadcc0beae3 100644 --- a/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php +++ b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php @@ -26,6 +26,7 @@ class CachePermissionsMaskTest extends CacheTest { */ protected $sourceCache; + #[\Override] protected function setUp(): void { parent::setUp(); $this->storage->mkdir('foo'); diff --git a/tests/lib/Files/Config/UserMountCacheTest.php b/tests/lib/Files/Config/UserMountCacheTest.php index badb8f7c45b..ddc18c44f44 100644 --- a/tests/lib/Files/Config/UserMountCacheTest.php +++ b/tests/lib/Files/Config/UserMountCacheTest.php @@ -40,6 +40,7 @@ class UserMountCacheTest extends TestCase { private UserMountCache $cache; private array $fileIds = []; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -76,6 +77,7 @@ class UserMountCacheTest extends TestCase { ); } + #[\Override] protected function tearDown(): void { $builder = $this->connection->getQueryBuilder(); diff --git a/tests/lib/Files/EtagTest.php b/tests/lib/Files/EtagTest.php index d40a6b9ec36..e0329f9000f 100644 --- a/tests/lib/Files/EtagTest.php +++ b/tests/lib/Files/EtagTest.php @@ -37,6 +37,7 @@ class EtagTest extends \Test\TestCase { */ private $userBackend; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -53,6 +54,7 @@ class EtagTest extends \Test\TestCase { Server::get(IUserManager::class)->registerBackend($this->userBackend); } + #[\Override] protected function tearDown(): void { Server::get(IConfig::class)->setSystemValue('datadirectory', $this->datadir); diff --git a/tests/lib/Files/FileInfoTest.php b/tests/lib/Files/FileInfoTest.php index b3d3c9f0fec..733f77fed14 100644 --- a/tests/lib/Files/FileInfoTest.php +++ b/tests/lib/Files/FileInfoTest.php @@ -22,6 +22,7 @@ class FileInfoTest extends TestCase { private $config; + #[\Override] protected function setUp(): void { parent::setUp(); $this->createUser('foo', 'foo'); diff --git a/tests/lib/Files/FilenameValidatorTest.php b/tests/lib/Files/FilenameValidatorTest.php index 5662e8da12a..0a3e3dacbab 100644 --- a/tests/lib/Files/FilenameValidatorTest.php +++ b/tests/lib/Files/FilenameValidatorTest.php @@ -31,6 +31,7 @@ class FilenameValidatorTest extends TestCase { protected IDBConnection&MockObject $database; protected LoggerInterface&MockObject $logger; + #[\Override] protected function setUp(): void { parent::setUp(); $l10n = $this->createMock(IL10N::class); diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php index b838310d28b..56af53584f2 100644 --- a/tests/lib/Files/FilesystemTest.php +++ b/tests/lib/Files/FilesystemTest.php @@ -41,6 +41,7 @@ class DummyMountProvider implements IMountProvider { * @param IStorageFactory $loader * @return IMountPoint[] */ + #[\Override] public function getMountsForUser(IUser $user, IStorageFactory $loader) { return isset($this->mounts[$user->getUID()]) ? $this->mounts[$user->getUID()] : []; } @@ -71,6 +72,7 @@ class FilesystemTest extends \Test\TestCase { return ['datadir' => $dir]; } + #[\Override] protected function setUp(): void { parent::setUp(); $userBackend = new \Test\Util\User\Dummy(); @@ -80,6 +82,7 @@ class FilesystemTest extends \Test\TestCase { $this->loginAsUser(); } + #[\Override] protected function tearDown(): void { foreach ($this->tmpDirs as $dir) { Files::rmdirr($dir); diff --git a/tests/lib/Files/Mount/CacheMountProviderTest.php b/tests/lib/Files/Mount/CacheMountProviderTest.php index 003fc40eafc..d01e5579902 100644 --- a/tests/lib/Files/Mount/CacheMountProviderTest.php +++ b/tests/lib/Files/Mount/CacheMountProviderTest.php @@ -38,6 +38,7 @@ class CacheMountProviderTest extends TestCase { private IUser $user; private IStorageFactory $storageFactory; + #[\Override] protected function setUp(): void { $this->config = $this->createMock(IConfig::class); $this->user = $this->createMock(IUser::class); @@ -45,6 +46,7 @@ class CacheMountProviderTest extends TestCase { stream_wrapper_register('cachemountprovidertest', CacheMountProviderTestStream::class); } + #[\Override] protected function tearDown(): void { stream_wrapper_unregister('cachemountprovidertest'); } diff --git a/tests/lib/Files/Mount/ManagerTest.php b/tests/lib/Files/Mount/ManagerTest.php index aa126684c4f..3abf0dc7d45 100644 --- a/tests/lib/Files/Mount/ManagerTest.php +++ b/tests/lib/Files/Mount/ManagerTest.php @@ -13,6 +13,7 @@ use OC\Files\SetupManagerFactory; use OC\Files\Storage\Temporary; class LongId extends Temporary { + #[\Override] public function getId(): string { return 'long:' . str_repeat('foo', 50) . parent::getId(); } @@ -24,6 +25,7 @@ class ManagerTest extends \Test\TestCase { */ private $manager; + #[\Override] protected function setUp(): void { parent::setUp(); $this->manager = new \OC\Files\Mount\Manager($this->createMock(SetupManagerFactory::class)); diff --git a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php index a9200732a18..f5bba611f46 100644 --- a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php +++ b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php @@ -28,6 +28,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase { /** @var IStorageFactory|\PHPUnit\Framework\MockObject\MockObject */ protected $loader; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -251,24 +252,31 @@ class FakeObjectStore implements IObjectStore { return $this->arguments; } + #[\Override] public function getStorageId() { } + #[\Override] public function readObject($urn) { } + #[\Override] public function writeObject($urn, $stream, ?string $mimetype = null) { } + #[\Override] public function deleteObject($urn) { } + #[\Override] public function objectExists($urn) { } + #[\Override] public function copyObject($from, $to) { } + #[\Override] public function preSignedUrl(string $urn, \DateTimeInterface $expiration): ?string { return null; } diff --git a/tests/lib/Files/Mount/RootMountProviderTest.php b/tests/lib/Files/Mount/RootMountProviderTest.php index 70a02dbce47..8a61dc81034 100644 --- a/tests/lib/Files/Mount/RootMountProviderTest.php +++ b/tests/lib/Files/Mount/RootMountProviderTest.php @@ -22,6 +22,7 @@ use Test\TestCase; class RootMountProviderTest extends TestCase { private StorageFactory $loader; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Node/FileTest.php b/tests/lib/Files/Node/FileTest.php index a7191add2f3..f5d79cc03d7 100644 --- a/tests/lib/Files/Node/FileTest.php +++ b/tests/lib/Files/Node/FileTest.php @@ -26,6 +26,7 @@ use PHPUnit\Framework\MockObject\MockObject; */ #[\PHPUnit\Framework\Attributes\Group('DB')] class FileTest extends NodeTestCase { + #[\Override] protected function createTestNode(IRootFolder $root, View&MockObject $view, string $path, array $data = [], string $internalPath = '', ?IStorage $storage = null): File { if ($data || $internalPath || $storage) { return new File($root, $view, $path, $this->getFileInfo($data, $internalPath, $storage)); @@ -34,14 +35,17 @@ class FileTest extends NodeTestCase { } } + #[\Override] protected function getNodeClass(): string { return File::class; } + #[\Override] protected function getNonExistingNodeClass(): string { return NonExistingFile::class; } + #[\Override] protected function getViewDeleteMethod(): string { return 'unlink'; } diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php index 0fc3115e13f..d3ef1f298c6 100644 --- a/tests/lib/Files/Node/FolderTest.php +++ b/tests/lib/Files/Node/FolderTest.php @@ -50,6 +50,7 @@ use PHPUnit\Framework\MockObject\MockObject; */ #[\PHPUnit\Framework\Attributes\Group('DB')] class FolderTest extends NodeTestCase { + #[\Override] protected function createTestNode(IRootFolder $root, View&MockObject $view, string $path, array $data = [], string $internalPath = '', ?IStorage $storage = null): Folder { $view->expects($this->any()) ->method('getRoot') @@ -61,14 +62,17 @@ class FolderTest extends NodeTestCase { } } + #[\Override] protected function getNodeClass(): string { return Folder::class; } + #[\Override] protected function getNonExistingNodeClass(): string { return NonExistingFolder::class; } + #[\Override] protected function getViewDeleteMethod(): string { return 'rmdir'; } diff --git a/tests/lib/Files/Node/HookConnectorTest.php b/tests/lib/Files/Node/HookConnectorTest.php index 949fcf7be8b..425c94fc9d7 100644 --- a/tests/lib/Files/Node/HookConnectorTest.php +++ b/tests/lib/Files/Node/HookConnectorTest.php @@ -67,6 +67,7 @@ class HookConnectorTest extends TestCase { /** @var string */ private $userId; + #[\Override] protected function setUp(): void { parent::setUp(); $this->userId = $this->getUniqueID(); @@ -95,6 +96,7 @@ class HookConnectorTest extends TestCase { $this->logger = Server::get(LoggerInterface::class); } + #[\Override] protected function tearDown(): void { parent::tearDown(); \OC_Hook::clear('OC_Filesystem'); diff --git a/tests/lib/Files/Node/IntegrationTest.php b/tests/lib/Files/Node/IntegrationTest.php index 32b9a81dff9..a32b4ae1980 100644 --- a/tests/lib/Files/Node/IntegrationTest.php +++ b/tests/lib/Files/Node/IntegrationTest.php @@ -49,6 +49,7 @@ class IntegrationTest extends \Test\TestCase { */ private $view; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -85,6 +86,7 @@ class IntegrationTest extends \Test\TestCase { $manager->removeMount('/' . $user->getUID()); } + #[\Override] protected function tearDown(): void { foreach ($this->storages as $storage) { $storage->getCache()->clear(); diff --git a/tests/lib/Files/Node/NodeTestCase.php b/tests/lib/Files/Node/NodeTestCase.php index 46aa5a206c5..4605b8c6487 100644 --- a/tests/lib/Files/Node/NodeTestCase.php +++ b/tests/lib/Files/Node/NodeTestCase.php @@ -50,6 +50,7 @@ abstract class NodeTestCase extends \Test\TestCase { protected ICacheFactory&MockObject $cacheFactory; protected IAppConfig&MockObject $appConfig; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php index 3821b6943b1..c69b74c08c1 100644 --- a/tests/lib/Files/Node/RootTest.php +++ b/tests/lib/Files/Node/RootTest.php @@ -43,6 +43,7 @@ class RootTest extends \Test\TestCase { protected ICacheFactory&MockObject $cacheFactory; protected IAppConfig&MockObject $appConfig; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/ObjectStore/AzureTest.php b/tests/lib/Files/ObjectStore/AzureTest.php index 76d1d7f1d87..2f52f9e733b 100644 --- a/tests/lib/Files/ObjectStore/AzureTest.php +++ b/tests/lib/Files/ObjectStore/AzureTest.php @@ -13,6 +13,7 @@ use OCP\Server; #[\PHPUnit\Framework\Attributes\Group('PRIMARY-azure')] class AzureTest extends ObjectStoreTestCase { + #[\Override] protected function getInstance() { $config = Server::get(IConfig::class)->getSystemValue('objectstore'); if (!is_array($config) || $config['class'] !== 'OC\\Files\\ObjectStore\\Azure') { @@ -22,6 +23,7 @@ class AzureTest extends ObjectStoreTestCase { return new Azure($config['arguments']); } + #[\Override] public function testFseekSize(): void { $this->markTestSkipped('azure does not support seeking at the moment'); } diff --git a/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php b/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php index b842ec6dfd6..de143efea8b 100644 --- a/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php +++ b/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php @@ -16,30 +16,37 @@ class FailDeleteObjectStore implements IObjectStore { ) { } + #[\Override] public function getStorageId() { return $this->objectStore->getStorageId(); } + #[\Override] public function readObject($urn) { return $this->objectStore->readObject($urn); } + #[\Override] public function writeObject($urn, $stream, ?string $mimetype = null) { return $this->objectStore->writeObject($urn, $stream, $mimetype); } + #[\Override] public function deleteObject($urn) { throw new \Exception(); } + #[\Override] public function objectExists($urn) { return $this->objectStore->objectExists($urn); } + #[\Override] public function copyObject($from, $to) { $this->objectStore->copyObject($from, $to); } + #[\Override] public function preSignedUrl(string $urn, \DateTimeInterface $expiration): ?string { return null; } diff --git a/tests/lib/Files/ObjectStore/FailWriteObjectStore.php b/tests/lib/Files/ObjectStore/FailWriteObjectStore.php index a3cd1e8c92a..1694bac5d79 100644 --- a/tests/lib/Files/ObjectStore/FailWriteObjectStore.php +++ b/tests/lib/Files/ObjectStore/FailWriteObjectStore.php @@ -16,31 +16,38 @@ class FailWriteObjectStore implements IObjectStore { ) { } + #[\Override] public function getStorageId() { return $this->objectStore->getStorageId(); } + #[\Override] public function readObject($urn) { return $this->objectStore->readObject($urn); } + #[\Override] public function writeObject($urn, $stream, ?string $mimetype = null) { // emulate a failed write that didn't throw an error return true; } + #[\Override] public function deleteObject($urn) { $this->objectStore->deleteObject($urn); } + #[\Override] public function objectExists($urn) { return $this->objectStore->objectExists($urn); } + #[\Override] public function copyObject($from, $to) { $this->objectStore->copyObject($from, $to); } + #[\Override] public function preSignedUrl(string $urn, \DateTimeInterface $expiration): ?string { return null; } diff --git a/tests/lib/Files/ObjectStore/LocalTest.php b/tests/lib/Files/ObjectStore/LocalTest.php index f66114966a0..7b3632204bc 100644 --- a/tests/lib/Files/ObjectStore/LocalTest.php +++ b/tests/lib/Files/ObjectStore/LocalTest.php @@ -16,6 +16,7 @@ class LocalTest extends ObjectStoreTestCase { /** * @return IObjectStore */ + #[\Override] protected function getInstance() { $storage = new Temporary(); return new StorageObjectStore($storage); diff --git a/tests/lib/Files/ObjectStore/MapperTest.php b/tests/lib/Files/ObjectStore/MapperTest.php index 1726b0d01fc..e6a5a7f9166 100644 --- a/tests/lib/Files/ObjectStore/MapperTest.php +++ b/tests/lib/Files/ObjectStore/MapperTest.php @@ -15,6 +15,7 @@ class MapperTest extends \Test\TestCase { /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */ private $user; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/ObjectStore/ObjectStoreScannerTest.php b/tests/lib/Files/ObjectStore/ObjectStoreScannerTest.php index f5af264a25e..274961f3df6 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreScannerTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreScannerTest.php @@ -21,6 +21,7 @@ class ObjectStoreScannerTest extends TestCase { private ObjectStoreScanner $scanner; private Scanner $realScanner; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php b/tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php index 6eaffb6961c..2bb9ec07108 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php @@ -19,6 +19,7 @@ class ObjectStoreStorageOverwrite extends ObjectStoreStorage { $this->objectStore = $objectStore; } + #[\Override] public function getObjectStore(): IObjectStore { return $this->objectStore; } diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php index fd9eddcdb45..c896eb37797 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php @@ -25,6 +25,7 @@ class ObjectStoreStorageTest extends Storage { */ private $objectStorage; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -34,6 +35,7 @@ class ObjectStoreStorageTest extends Storage { $this->instance = new ObjectStoreStorageOverwrite($config); } + #[\Override] protected function tearDown(): void { if (is_null($this->instance)) { return; @@ -43,6 +45,7 @@ class ObjectStoreStorageTest extends Storage { parent::tearDown(); } + #[\Override] public function testStat(): void { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; $ctimeStart = time(); @@ -67,10 +70,12 @@ class ObjectStoreStorageTest extends Storage { } } + #[\Override] public function testCheckUpdate(): void { $this->markTestSkipped('Detecting external changes is not supported on object storages'); } + #[\Override] #[\PHPUnit\Framework\Attributes\DataProvider('copyAndMoveProvider')] public function testMove($source, $target): void { $this->initSourceAndTarget($source); @@ -87,6 +92,7 @@ class ObjectStoreStorageTest extends Storage { $this->assertSame($sourceId, $targetId, 'fileid must be stable on move or shares will break'); } + #[\Override] public function testRenameDirectory(): void { $this->instance->mkdir('source'); $this->instance->file_put_contents('source/test1.txt', 'foo'); @@ -116,6 +122,7 @@ class ObjectStoreStorageTest extends Storage { $this->assertSame($sourceId, $targetId, 'fileid must be stable on move or shares will break'); } + #[\Override] public function testRenameOverWriteDirectory(): void { $this->instance->mkdir('source'); $this->instance->file_put_contents('source/test1.txt', 'foo'); @@ -136,6 +143,7 @@ class ObjectStoreStorageTest extends Storage { $this->assertSame($sourceId, $targetId, 'fileid must be stable on move or shares will break'); } + #[\Override] public function testRenameOverWriteDirectoryOverFile(): void { $this->instance->mkdir('source'); $this->instance->file_put_contents('source/test1.txt', 'foo'); diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php index 37cb8f47f2f..145e09b86da 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php @@ -26,6 +26,7 @@ class ObjectStoreStoragesDifferentBucketTest extends StoragesTestCase { */ private $objectStore2; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php index b1a8de10716..b10d3503311 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php @@ -21,6 +21,7 @@ class ObjectStoreStoragesSameBucketTest extends StoragesTestCase { */ private $objectStore; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/ObjectStore/ObjectStoreTestCase.php b/tests/lib/Files/ObjectStore/ObjectStoreTestCase.php index 457d9209c99..86f1927deae 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreTestCase.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreTestCase.php @@ -25,12 +25,14 @@ abstract class ObjectStoreTestCase extends TestCase { $this->cleanup[] = $urn; } + #[\Override] public function setUp(): void { parent::setUp(); $this->instance = $this->getInstance(); } + #[\Override] public function tearDown(): void { if ($this->instance) { foreach ($this->cleanup as $urn) { diff --git a/tests/lib/Files/ObjectStore/PrimaryObjectStoreConfigTest.php b/tests/lib/Files/ObjectStore/PrimaryObjectStoreConfigTest.php index 07e58d56f11..3f1bc633e95 100644 --- a/tests/lib/Files/ObjectStore/PrimaryObjectStoreConfigTest.php +++ b/tests/lib/Files/ObjectStore/PrimaryObjectStoreConfigTest.php @@ -23,6 +23,7 @@ class PrimaryObjectStoreConfigTest extends TestCase { private IAppManager&MockObject $appManager; private PrimaryObjectStoreConfig $objectStoreConfig; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/ObjectStore/S3SSEKMSTest.php b/tests/lib/Files/ObjectStore/S3SSEKMSTest.php index e2320f14a3d..618af2af7f2 100644 --- a/tests/lib/Files/ObjectStore/S3SSEKMSTest.php +++ b/tests/lib/Files/ObjectStore/S3SSEKMSTest.php @@ -33,6 +33,7 @@ class S3SSEKMSTest extends ObjectStoreTestCase { private S3 $instance; + #[\Override] public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); @@ -47,6 +48,7 @@ class S3SSEKMSTest extends ObjectStoreTestCase { } } + #[\Override] protected function getInstance() { if (!isset($this->instance)) { $config = Server::get(IConfig::class)->getSystemValue('objectstore'); diff --git a/tests/lib/Files/ObjectStore/S3Test.php b/tests/lib/Files/ObjectStore/S3Test.php index d00109cc502..44e7d65c7e4 100644 --- a/tests/lib/Files/ObjectStore/S3Test.php +++ b/tests/lib/Files/ObjectStore/S3Test.php @@ -13,6 +13,7 @@ use OCP\IConfig; use OCP\Server; class MultiPartUploadS3 extends S3 { + #[\Override] public function writeObject($urn, $stream, ?string $mimetype = null) { $this->getConnection()->upload($this->bucket, $urn, $stream, 'private', [ 'mup_threshold' => 1, @@ -30,15 +31,18 @@ class NonSeekableStream extends Wrapper { return Wrapper::wrapSource($source, $context, 'nonseek', self::class); } + #[\Override] public function dir_opendir($path, $options) { return false; } + #[\Override] public function stream_open($path, $mode, $options, &$opened_path) { $this->loadContext('nonseek'); return true; } + #[\Override] public function stream_seek($offset, $whence = SEEK_SET) { return false; } @@ -46,12 +50,14 @@ class NonSeekableStream extends Wrapper { #[\PHPUnit\Framework\Attributes\Group('PRIMARY-s3')] class S3Test extends ObjectStoreTestCase { + #[\Override] public function setUp(): void { parent::setUp(); $s3 = $this->getInstance(); $s3->deleteObject('multiparttest'); } + #[\Override] protected function getInstance() { $config = Server::get(IConfig::class)->getSystemValue('objectstore'); if (!is_array($config) || $config['class'] !== S3::class) { diff --git a/tests/lib/Files/ObjectStore/SwiftTest.php b/tests/lib/Files/ObjectStore/SwiftTest.php index a5d97256dd6..b3781fb5bd9 100644 --- a/tests/lib/Files/ObjectStore/SwiftTest.php +++ b/tests/lib/Files/ObjectStore/SwiftTest.php @@ -18,6 +18,7 @@ class SwiftTest extends ObjectStoreTestCase { /** * @return IObjectStore */ + #[\Override] protected function getInstance() { $config = Server::get(IConfig::class)->getSystemValue('objectstore'); if (!is_array($config) || $config['class'] !== 'OC\\Files\\ObjectStore\\Swift') { @@ -27,6 +28,7 @@ class SwiftTest extends ObjectStoreTestCase { return new Swift($config['arguments']); } + #[\Override] public function testFseekSize(): void { $this->markTestSkipped('Swift does not support seeking at the moment'); } diff --git a/tests/lib/Files/PathVerificationTest.php b/tests/lib/Files/PathVerificationTest.php index 6ba9af5d9eb..4e318de209c 100644 --- a/tests/lib/Files/PathVerificationTest.php +++ b/tests/lib/Files/PathVerificationTest.php @@ -27,6 +27,7 @@ class PathVerificationTest extends \Test\TestCase { */ private $view; + #[\Override] protected function setUp(): void { parent::setUp(); $this->view = new View(); diff --git a/tests/lib/Files/Search/QueryOptimizer/CombinedTests.php b/tests/lib/Files/Search/QueryOptimizer/CombinedTests.php index 3590af850c8..2f658970791 100644 --- a/tests/lib/Files/Search/QueryOptimizer/CombinedTests.php +++ b/tests/lib/Files/Search/QueryOptimizer/CombinedTests.php @@ -19,6 +19,7 @@ class CombinedTests extends TestCase { } private QueryOptimizer $optimizer; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Search/QueryOptimizer/FlattenNestedBoolTest.php b/tests/lib/Files/Search/QueryOptimizer/FlattenNestedBoolTest.php index 1d43541a5a0..47bef83772b 100644 --- a/tests/lib/Files/Search/QueryOptimizer/FlattenNestedBoolTest.php +++ b/tests/lib/Files/Search/QueryOptimizer/FlattenNestedBoolTest.php @@ -18,6 +18,7 @@ class FlattenNestedBoolTest extends TestCase { private $optimizer; private $simplifier; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Search/QueryOptimizer/MergeDistributiveOperationsTest.php b/tests/lib/Files/Search/QueryOptimizer/MergeDistributiveOperationsTest.php index 9aaa7030aac..3b50d1aadbf 100644 --- a/tests/lib/Files/Search/QueryOptimizer/MergeDistributiveOperationsTest.php +++ b/tests/lib/Files/Search/QueryOptimizer/MergeDistributiveOperationsTest.php @@ -18,6 +18,7 @@ class MergeDistributiveOperationsTest extends TestCase { private $optimizer; private $simplifier; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Search/QueryOptimizer/OrEqualsToInTest.php b/tests/lib/Files/Search/QueryOptimizer/OrEqualsToInTest.php index d51fe3d0d16..0687bbe1e80 100644 --- a/tests/lib/Files/Search/QueryOptimizer/OrEqualsToInTest.php +++ b/tests/lib/Files/Search/QueryOptimizer/OrEqualsToInTest.php @@ -18,6 +18,7 @@ class OrEqualsToInTest extends TestCase { private $optimizer; private $simplifier; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Search/SearchIntegrationTest.php b/tests/lib/Files/Search/SearchIntegrationTest.php index c1efb839eab..8c0ab15b6ba 100644 --- a/tests/lib/Files/Search/SearchIntegrationTest.php +++ b/tests/lib/Files/Search/SearchIntegrationTest.php @@ -19,6 +19,7 @@ class SearchIntegrationTest extends TestCase { private $cache; private $storage; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/SetupManagerTest.php b/tests/lib/Files/SetupManagerTest.php index 1e9906e51db..33795fc564a 100644 --- a/tests/lib/Files/SetupManagerTest.php +++ b/tests/lib/Files/SetupManagerTest.php @@ -53,6 +53,7 @@ class SetupManagerTest extends TestCase { private string $path; private string $mountPoint; + #[\Override] protected function setUp(): void { $eventLogger = $this->createMock(IEventLogger::class); $eventLogger->method('start'); @@ -652,16 +653,19 @@ class SetupManagerTest extends TestCase { } class SetupManagerTestPartialMountProvider implements IPartialMountProvider { + #[\Override] public function getMountsForUser(IUser $user, IStorageFactory $loader): array { return []; } + #[\Override] public function getMountsForPath(string $path, bool $forChildren, array $mountProviderArgs, IStorageFactory $loader): array { return []; } } class SetupManagerTestFullMountProvider implements IMountProvider { + #[\Override] public function getMountsForUser(IUser $user, IStorageFactory $loader): array { return []; } diff --git a/tests/lib/Files/SimpleFS/SimpleFileTest.php b/tests/lib/Files/SimpleFS/SimpleFileTest.php index 6ce5ddad351..6f6746e7cda 100644 --- a/tests/lib/Files/SimpleFS/SimpleFileTest.php +++ b/tests/lib/Files/SimpleFS/SimpleFileTest.php @@ -19,6 +19,7 @@ class SimpleFileTest extends \Test\TestCase { /** @var SimpleFile */ private $simpleFile; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/SimpleFS/SimpleFolderTest.php b/tests/lib/Files/SimpleFS/SimpleFolderTest.php index 9232bdce42f..5583fa1f596 100644 --- a/tests/lib/Files/SimpleFS/SimpleFolderTest.php +++ b/tests/lib/Files/SimpleFS/SimpleFolderTest.php @@ -32,6 +32,7 @@ class SimpleFolderTest extends \Test\TestCase { private $storage; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Storage/CommonTest.php b/tests/lib/Files/Storage/CommonTest.php index f460d579ce2..8b202c0f30a 100644 --- a/tests/lib/Files/Storage/CommonTest.php +++ b/tests/lib/Files/Storage/CommonTest.php @@ -30,6 +30,7 @@ class CommonTest extends Storage { private string $tmpDir; private IFilenameValidator&MockObject $filenameValidator; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -39,6 +40,7 @@ class CommonTest extends Storage { $this->instance = new \OC\Files\Storage\CommonTest(['datadir' => $this->tmpDir]); } + #[\Override] protected function tearDown(): void { Files::rmdirr($this->tmpDir); $this->restoreService(IFilenameValidator::class); diff --git a/tests/lib/Files/Storage/CopyDirectoryTest.php b/tests/lib/Files/Storage/CopyDirectoryTest.php index f542cc20e4a..6454fe014f2 100644 --- a/tests/lib/Files/Storage/CopyDirectoryTest.php +++ b/tests/lib/Files/Storage/CopyDirectoryTest.php @@ -13,6 +13,7 @@ use OC\Files\Storage\PolyFill\CopyDirectory; use OC\Files\Storage\Temporary; class StorageNoRecursiveCopy extends Temporary { + #[\Override] public function copy(string $source, string $target): bool { if ($this->is_dir($source)) { return false; @@ -33,6 +34,7 @@ class CopyDirectoryStorage extends StorageNoRecursiveCopy { */ #[\PHPUnit\Framework\Attributes\Group('DB')] class CopyDirectoryTest extends Storage { + #[\Override] protected function setUp(): void { parent::setUp(); $this->instance = new CopyDirectoryStorage([]); diff --git a/tests/lib/Files/Storage/HomeTest.php b/tests/lib/Files/Storage/HomeTest.php index be1b435afb9..9e14c5c54d3 100644 --- a/tests/lib/Files/Storage/HomeTest.php +++ b/tests/lib/Files/Storage/HomeTest.php @@ -21,10 +21,12 @@ class DummyUser extends User { ) { } + #[\Override] public function getHome(): string { return $this->home; } + #[\Override] public function getUID(): string { return $this->uid; } @@ -50,6 +52,7 @@ class HomeTest extends Storage { */ private $user; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -59,6 +62,7 @@ class HomeTest extends Storage { $this->instance = new Home(['user' => $this->user]); } + #[\Override] protected function tearDown(): void { Files::rmdirr($this->tmpDir); parent::tearDown(); diff --git a/tests/lib/Files/Storage/LocalTest.php b/tests/lib/Files/Storage/LocalTest.php index 1e05e295ded..d55ac6a888b 100644 --- a/tests/lib/Files/Storage/LocalTest.php +++ b/tests/lib/Files/Storage/LocalTest.php @@ -29,6 +29,7 @@ class LocalTest extends Storage { */ private $tmpDir; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -36,6 +37,7 @@ class LocalTest extends Storage { $this->instance = new Local(['datadir' => $this->tmpDir]); } + #[\Override] protected function tearDown(): void { Files::rmdirr($this->tmpDir); parent::tearDown(); diff --git a/tests/lib/Files/Storage/StoragesTestCase.php b/tests/lib/Files/Storage/StoragesTestCase.php index 565ff1ddfda..3c1f573f852 100644 --- a/tests/lib/Files/Storage/StoragesTestCase.php +++ b/tests/lib/Files/Storage/StoragesTestCase.php @@ -22,6 +22,7 @@ abstract class StoragesTestCase extends TestCase { */ protected $storage2; + #[\Override] protected function tearDown(): void { if (is_null($this->storage1) && is_null($this->storage2)) { return; diff --git a/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php index bc388a0a32b..20699ee55e6 100644 --- a/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php +++ b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php @@ -21,6 +21,7 @@ class AvailabilityTest extends \Test\TestCase { /** @var Availability */ protected $wrapper; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Storage/Wrapper/EncodingTest.php b/tests/lib/Files/Storage/Wrapper/EncodingTest.php index 86ed3b90ac9..d149db916f5 100644 --- a/tests/lib/Files/Storage/Wrapper/EncodingTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncodingTest.php @@ -20,6 +20,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { */ private $sourceStorage; + #[\Override] protected function setUp(): void { parent::setUp(); $this->sourceStorage = new Temporary([]); @@ -28,23 +29,27 @@ class EncodingTest extends \Test\Files\Storage\Storage { ]); } + #[\Override] protected function tearDown(): void { $this->sourceStorage->cleanUp(); parent::tearDown(); } + #[\Override] public static function directoryProvider(): array { $a = parent::directoryProvider(); $a[] = [self::NFC_NAME]; return $a; } + #[\Override] public static function fileNameProvider(): array { $a = parent::fileNameProvider(); $a[] = [self::NFD_NAME . '.txt']; return $a; } + #[\Override] public static function copyAndMoveProvider(): array { $a = parent::copyAndMoveProvider(); $a[] = [self::NFD_NAME . '.txt', self::NFC_NAME . '-renamed.txt']; diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index 8308d64c5a5..cfdf25a590c 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -58,6 +58,7 @@ class EncryptionTest extends Storage { /** dummy unencrypted size */ private int $dummySize = -1; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Storage/Wrapper/JailTest.php b/tests/lib/Files/Storage/Wrapper/JailTest.php index 0043e37ba33..ea30bbb0231 100644 --- a/tests/lib/Files/Storage/Wrapper/JailTest.php +++ b/tests/lib/Files/Storage/Wrapper/JailTest.php @@ -18,6 +18,7 @@ class JailTest extends \Test\Files\Storage\Storage { */ private $sourceStorage; + #[\Override] protected function setUp(): void { parent::setUp(); $this->sourceStorage = new Temporary([]); @@ -28,6 +29,7 @@ class JailTest extends \Test\Files\Storage\Storage { ]); } + #[\Override] protected function tearDown(): void { // test that nothing outside our jail is touched $contents = []; diff --git a/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php b/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php index 5a8261289aa..cc88e63072e 100644 --- a/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php +++ b/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php @@ -22,6 +22,7 @@ class KnownMtimeTest extends Storage { private $clock; private int $fakeTime = 0; + #[\Override] protected function setUp(): void { parent::setUp(); $this->fakeTime = 0; @@ -37,6 +38,7 @@ class KnownMtimeTest extends Storage { $this->instance = $this->getWrappedStorage(); } + #[\Override] protected function tearDown(): void { $this->sourceStorage->cleanUp(); parent::tearDown(); diff --git a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php index 1b4a55b010b..724ab30c73e 100644 --- a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php +++ b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php @@ -21,12 +21,14 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage { */ private $sourceStorage; + #[\Override] protected function setUp(): void { parent::setUp(); $this->sourceStorage = new Temporary([]); $this->instance = $this->getMaskedStorage(Constants::PERMISSION_ALL); } + #[\Override] protected function tearDown(): void { $this->sourceStorage->cleanUp(); parent::tearDown(); diff --git a/tests/lib/Files/Storage/Wrapper/QuotaTest.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php index ce43aa2736e..fc36d7a5c7f 100644 --- a/tests/lib/Files/Storage/Wrapper/QuotaTest.php +++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php @@ -29,6 +29,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { */ private $tmpDir; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -37,6 +38,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { $this->instance = new Quota(['storage' => $storage, 'quota' => 10000000]); } + #[\Override] protected function tearDown(): void { Files::rmdirr($this->tmpDir); parent::tearDown(); diff --git a/tests/lib/Files/Storage/Wrapper/WrapperTest.php b/tests/lib/Files/Storage/Wrapper/WrapperTest.php index 60f139450c7..77dc9bbd6ca 100644 --- a/tests/lib/Files/Storage/Wrapper/WrapperTest.php +++ b/tests/lib/Files/Storage/Wrapper/WrapperTest.php @@ -20,6 +20,7 @@ class WrapperTest extends \Test\Files\Storage\Storage { */ private $tmpDir; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -28,6 +29,7 @@ class WrapperTest extends \Test\Files\Storage\Storage { $this->instance = new Wrapper(['storage' => $storage]); } + #[\Override] protected function tearDown(): void { Files::rmdirr($this->tmpDir); parent::tearDown(); diff --git a/tests/lib/Files/Stream/DummyEncryptionWrapper.php b/tests/lib/Files/Stream/DummyEncryptionWrapper.php index 694ac3a2503..cd7cbea4920 100644 --- a/tests/lib/Files/Stream/DummyEncryptionWrapper.php +++ b/tests/lib/Files/Stream/DummyEncryptionWrapper.php @@ -18,6 +18,7 @@ class DummyEncryptionWrapper extends Encryption { * @param int $position * @return bool */ + #[\Override] protected function parentStreamSeek($position) { return false; } diff --git a/tests/lib/Files/Template/TemplateManagerTest.php b/tests/lib/Files/Template/TemplateManagerTest.php index 431b032594c..cbcaefbbaef 100644 --- a/tests/lib/Files/Template/TemplateManagerTest.php +++ b/tests/lib/Files/Template/TemplateManagerTest.php @@ -37,6 +37,7 @@ class TemplateManagerTest extends TestCase { private TemplateManager $templateManager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php index 6e4a4f4c70c..49fe565b3b4 100644 --- a/tests/lib/Files/Type/DetectionTest.php +++ b/tests/lib/Files/Type/DetectionTest.php @@ -17,6 +17,7 @@ class DetectionTest extends \Test\TestCase { /** @var Detection */ private $detection; + #[\Override] protected function setUp(): void { parent::setUp(); $this->detection = new Detection( diff --git a/tests/lib/Files/Type/LoaderTest.php b/tests/lib/Files/Type/LoaderTest.php index 1c9ffb65a31..f9b30fbefd5 100644 --- a/tests/lib/Files/Type/LoaderTest.php +++ b/tests/lib/Files/Type/LoaderTest.php @@ -17,11 +17,13 @@ class LoaderTest extends TestCase { protected IDBConnection $db; protected Loader $loader; + #[\Override] protected function setUp(): void { $this->db = Server::get(IDBConnection::class); $this->loader = new Loader($this->db); } + #[\Override] protected function tearDown(): void { $deleteMimetypes = $this->db->getQueryBuilder(); $deleteMimetypes->delete('mimetypes') diff --git a/tests/lib/Files/Utils/ScannerTest.php b/tests/lib/Files/Utils/ScannerTest.php index 96d23cd5db8..044c7ac0ca8 100644 --- a/tests/lib/Files/Utils/ScannerTest.php +++ b/tests/lib/Files/Utils/ScannerTest.php @@ -36,6 +36,7 @@ class TestScanner extends Scanner { $this->mounts[] = $mount; } + #[\Override] protected function getMounts($dir) { return $this->mounts; } @@ -54,6 +55,7 @@ class ScannerTest extends \Test\TestCase { */ private $userBackend; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -62,6 +64,7 @@ class ScannerTest extends \Test\TestCase { $this->loginAsUser(); } + #[\Override] protected function tearDown(): void { $this->logout(); Server::get(IUserManager::class)->removeBackend($this->userBackend); diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index 9393680c63f..3169edf0b0f 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -51,22 +51,26 @@ use Test\TestMoveableMountPoint; use Test\Traits\UserTrait; class TemporaryNoTouch extends Temporary { + #[\Override] public function touch(string $path, ?int $mtime = null): bool { return false; } } class TemporaryNoCross extends Temporary { + #[\Override] public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, bool $preserveMtime = false): bool { return Common::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime); } + #[\Override] public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { return Common::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } } class TemporaryNoLocal extends Temporary { + #[\Override] public function instanceOfStorage(string $class): bool { if ($class === '\OC\Files\Storage\Local') { return false; @@ -121,6 +125,7 @@ class ViewTest extends \Test\TestCase { /** @var Storage */ private $tempStorage; + #[\Override] protected function setUp(): void { parent::setUp(); \OC_Hook::clear(); @@ -146,6 +151,7 @@ class ViewTest extends \Test\TestCase { $this->tempStorage = null; } + #[\Override] protected function tearDown(): void { \OC_User::setUserId($this->user); foreach ($this->storages as $storage) { diff --git a/tests/lib/FilesMetadata/FilesMetadataManagerTest.php b/tests/lib/FilesMetadata/FilesMetadataManagerTest.php index a19ff451012..a349065f32f 100644 --- a/tests/lib/FilesMetadata/FilesMetadataManagerTest.php +++ b/tests/lib/FilesMetadata/FilesMetadataManagerTest.php @@ -42,6 +42,7 @@ class FilesMetadataManagerTest extends TestCase { private Folder $userFolder; private array $metadata = []; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/GlobalScale/ConfigTest.php b/tests/lib/GlobalScale/ConfigTest.php index 447b5886ce3..926b666e4b5 100644 --- a/tests/lib/GlobalScale/ConfigTest.php +++ b/tests/lib/GlobalScale/ConfigTest.php @@ -15,6 +15,7 @@ class ConfigTest extends TestCase { /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ private $config; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Group/DatabaseTest.php b/tests/lib/Group/DatabaseTest.php index b8ec53f0d0d..75316e9a673 100644 --- a/tests/lib/Group/DatabaseTest.php +++ b/tests/lib/Group/DatabaseTest.php @@ -21,17 +21,20 @@ class DatabaseTest extends Backend { * get a new unique group name * test cases can override this in order to clean up created groups */ + #[\Override] public function getGroupName($name = null): string { $name = parent::getGroupName($name); $this->groups[] = $name; return $name; } + #[\Override] protected function setUp(): void { parent::setUp(); $this->backend = new Database(); } + #[\Override] protected function tearDown(): void { foreach ($this->groups as $group) { $this->backend->deleteGroup($group); diff --git a/tests/lib/Group/Dummy.php b/tests/lib/Group/Dummy.php index 45e82f1a391..b812e502352 100644 --- a/tests/lib/Group/Dummy.php +++ b/tests/lib/Group/Dummy.php @@ -16,6 +16,7 @@ class Dummy extends Backend { public function __construct() { parent::__construct(static::class); } + #[\Override] protected function setUp(): void { parent::setUp(); $this->backend = new \Test\Util\Group\Dummy(); diff --git a/tests/lib/Group/GroupTest.php b/tests/lib/Group/GroupTest.php index addcc47e832..50181a3ea2a 100644 --- a/tests/lib/Group/GroupTest.php +++ b/tests/lib/Group/GroupTest.php @@ -20,6 +20,7 @@ class GroupTest extends \Test\TestCase { /** @var IEventDispatcher|MockObject */ protected $dispatcher; + #[\Override] protected function setUp(): void { parent::setUp(); $this->dispatcher = $this->createMock(IEventDispatcher::class); diff --git a/tests/lib/Group/HideFromCollaborationTest.php b/tests/lib/Group/HideFromCollaborationTest.php index 5ff7c797508..f23660ead2b 100644 --- a/tests/lib/Group/HideFromCollaborationTest.php +++ b/tests/lib/Group/HideFromCollaborationTest.php @@ -26,6 +26,7 @@ class HideFromCollaborationTest extends TestCase { private IUserManager&MockObject $userManager; private IEventDispatcher&MockObject $dispatcher; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Group/ManagerTest.php b/tests/lib/Group/ManagerTest.php index 8515ef0e3e8..cd4eed51801 100644 --- a/tests/lib/Group/ManagerTest.php +++ b/tests/lib/Group/ManagerTest.php @@ -42,6 +42,7 @@ class ManagerTest extends TestCase { /** @var IRemoteAddress|MockObject */ private $remoteIpAddress; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Group/MetaDataTest.php b/tests/lib/Group/MetaDataTest.php index dee59eab8da..9db0bee3ceb 100644 --- a/tests/lib/Group/MetaDataTest.php +++ b/tests/lib/Group/MetaDataTest.php @@ -18,6 +18,7 @@ class MetaDataTest extends \Test\TestCase { private bool $isAdmin = true; private bool $isDelegatedAdmin = true; + #[\Override] protected function setUp(): void { parent::setUp(); $this->groupManager = $this->getMockBuilder('\OC\Group\Manager') diff --git a/tests/lib/HelperStorageTest.php b/tests/lib/HelperStorageTest.php index 914936c9657..6facd921878 100644 --- a/tests/lib/HelperStorageTest.php +++ b/tests/lib/HelperStorageTest.php @@ -32,6 +32,7 @@ class HelperStorageTest extends \Test\TestCase { private $storage; private bool $savedQuotaIncludeExternalStorage; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -50,6 +51,7 @@ class HelperStorageTest extends \Test\TestCase { $this->storageMock = null; } + #[\Override] protected function tearDown(): void { $this->setIncludeExternalStorage($this->savedQuotaIncludeExternalStorage); $this->user = null; diff --git a/tests/lib/Hooks/BasicEmitterTest.php b/tests/lib/Hooks/BasicEmitterTest.php index 1362d2727d8..7657f7eca9f 100644 --- a/tests/lib/Hooks/BasicEmitterTest.php +++ b/tests/lib/Hooks/BasicEmitterTest.php @@ -40,6 +40,7 @@ class BasicEmitterTest extends \Test\TestCase { */ protected $emitter; + #[\Override] protected function setUp(): void { parent::setUp(); $this->emitter = new DummyEmitter(); diff --git a/tests/lib/Http/Client/ClientTest.php b/tests/lib/Http/Client/ClientTest.php index ed732cdddc3..c6fa45eb318 100644 --- a/tests/lib/Http/Client/ClientTest.php +++ b/tests/lib/Http/Client/ClientTest.php @@ -42,6 +42,7 @@ class ClientTest extends \Test\TestCase { /** @var array */ private $defaultRequestOptions; + #[\Override] protected function setUp(): void { parent::setUp(); $this->config = $this->createMock(IConfig::class); diff --git a/tests/lib/Http/Client/DnsPinMiddlewareTest.php b/tests/lib/Http/Client/DnsPinMiddlewareTest.php index 2699e609c5e..710b40b588c 100644 --- a/tests/lib/Http/Client/DnsPinMiddlewareTest.php +++ b/tests/lib/Http/Client/DnsPinMiddlewareTest.php @@ -26,6 +26,7 @@ use Test\TestCase; class DnsPinMiddlewareTest extends TestCase { private DnsPinMiddleware $dnsPinMiddleware; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Http/Client/NegativeDnsCacheTest.php b/tests/lib/Http/Client/NegativeDnsCacheTest.php index eb0f86f5c7a..35d8de75152 100644 --- a/tests/lib/Http/Client/NegativeDnsCacheTest.php +++ b/tests/lib/Http/Client/NegativeDnsCacheTest.php @@ -21,6 +21,7 @@ class NegativeDnsCacheTest extends \Test\TestCase { /** @var NegativeDnsCache */ private $negativeDnsCache; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Http/Client/ResponseTest.php b/tests/lib/Http/Client/ResponseTest.php index 1acf1eb1cbd..d0a6a2d0376 100644 --- a/tests/lib/Http/Client/ResponseTest.php +++ b/tests/lib/Http/Client/ResponseTest.php @@ -19,6 +19,7 @@ class ResponseTest extends \Test\TestCase { /** @var GuzzleResponse */ private $guzzleResponse; + #[\Override] protected function setUp(): void { parent::setUp(); $this->guzzleResponse = new GuzzleResponse(418); diff --git a/tests/lib/Http/WellKnown/RequestManagerTest.php b/tests/lib/Http/WellKnown/RequestManagerTest.php index 3ab6cb190b2..214c43dea61 100644 --- a/tests/lib/Http/WellKnown/RequestManagerTest.php +++ b/tests/lib/Http/WellKnown/RequestManagerTest.php @@ -39,6 +39,7 @@ class RequestManagerTest extends TestCase { /** @var RequestManager */ private $manager; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -132,6 +133,7 @@ class RequestManagerTest extends TestCase { ->method('getRegistrationContext') ->willReturn($registrationContext); $handler = new class implements IHandler { + #[\Override] public function handle(string $service, IRequestContext $context, ?IResponse $previousResponse): ?IResponse { return (new JrdResponse($service))->addAlias('alias'); } diff --git a/tests/lib/ImageTest.php b/tests/lib/ImageTest.php index fe4b32a07fc..22246f8e437 100644 --- a/tests/lib/ImageTest.php +++ b/tests/lib/ImageTest.php @@ -14,6 +14,7 @@ use OCP\IAppConfig; use OCP\IConfig; class ImageTest extends \Test\TestCase { + #[\Override] public static function tearDownAfterClass(): void { @unlink(OC::$SERVERROOT . '/tests/data/testimage2.png'); @unlink(OC::$SERVERROOT . '/tests/data/testimage2.jpg'); diff --git a/tests/lib/InfoXmlTest.php b/tests/lib/InfoXmlTest.php index 9ef4bdc3178..8798b589a37 100644 --- a/tests/lib/InfoXmlTest.php +++ b/tests/lib/InfoXmlTest.php @@ -21,6 +21,7 @@ use OCP\Server; class InfoXmlTest extends TestCase { private IAppManager $appManager; + #[\Override] protected function setUp(): void { parent::setUp(); $this->appManager = Server::get(IAppManager::class); diff --git a/tests/lib/InitialStateServiceTest.php b/tests/lib/InitialStateServiceTest.php index 9081aa93b84..2a74563f48d 100644 --- a/tests/lib/InitialStateServiceTest.php +++ b/tests/lib/InitialStateServiceTest.php @@ -24,6 +24,7 @@ class InitialStateServiceTest extends TestCase { /** @var MockObject|LoggerInterface|(LoggerInterface&MockObject) */ protected $logger; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -42,6 +43,7 @@ class InitialStateServiceTest extends TestCase { [23], [2.3], [new class implements JsonSerializable { + #[\Override] public function jsonSerialize(): int { return 3; } diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php index c8a69a83eea..5852a114372 100644 --- a/tests/lib/InstallerTest.php +++ b/tests/lib/InstallerTest.php @@ -39,6 +39,7 @@ class InstallerTest extends TestCase { private AppManager&MockObject $appManager; private IFactory&MockObject $l10nFactory; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -70,6 +71,7 @@ class InstallerTest extends TestCase { ); } + #[\Override] protected function tearDown(): void { $installer = Server::get(Installer::class); $installer->removeApp(self::$appid); diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php index 930b0db0700..3e8bb62f4af 100644 --- a/tests/lib/IntegrityCheck/CheckerTest.php +++ b/tests/lib/IntegrityCheck/CheckerTest.php @@ -43,6 +43,7 @@ class CheckerTest extends TestCase { private Checker $checker; + #[\Override] protected function setUp(): void { parent::setUp(); $this->serverVersion = $this->createMock(ServerVersion::class); diff --git a/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php b/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php index caa5ed2e782..c614a712fa5 100644 --- a/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php +++ b/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php @@ -15,6 +15,7 @@ class EnvironmentHelperTest extends TestCase { /** @var EnvironmentHelper */ private $environmentHelper; + #[\Override] protected function setUp(): void { $this->environmentHelper = new EnvironmentHelper(); parent::setUp(); diff --git a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php index b8bec35328d..53bd83d0e50 100644 --- a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php +++ b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php @@ -17,6 +17,7 @@ class FileAccessHelperTest extends TestCase { /** @var FileAccessHelper */ private $fileAccessHelper; + #[\Override] protected function setUp(): void { parent::setUp(); $this->fileAccessHelper = new FileAccessHelper(); diff --git a/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php b/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php index dfd0941bd20..02e9afd142b 100644 --- a/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php +++ b/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php @@ -14,6 +14,7 @@ class ExcludeFileByNameFilterIteratorTest extends TestCase { /** @var ExcludeFileByNameFilterIterator|\PHPUnit\Framework\MockObject\MockObject */ protected $filter; + #[\Override] protected function setUp(): void { parent::setUp(); $this->filter = $this->getMockBuilder(ExcludeFileByNameFilterIterator::class) diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php index d76c7591a07..11744e6f5db 100644 --- a/tests/lib/L10N/FactoryTest.php +++ b/tests/lib/L10N/FactoryTest.php @@ -43,6 +43,7 @@ class FactoryTest extends TestCase { /** @var IAppManager|MockObject */ protected IAppManager $appManager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/L10N/LanguageIteratorTest.php b/tests/lib/L10N/LanguageIteratorTest.php index 4d1c666cc42..42161a5b1e6 100644 --- a/tests/lib/L10N/LanguageIteratorTest.php +++ b/tests/lib/L10N/LanguageIteratorTest.php @@ -20,6 +20,7 @@ class LanguageIteratorTest extends TestCase { /** @var LanguageIterator */ protected $iterator; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/LargeFileHelperGetFileSizeTest.php b/tests/lib/LargeFileHelperGetFileSizeTest.php index 134d5b4307c..0de3cd4e928 100644 --- a/tests/lib/LargeFileHelperGetFileSizeTest.php +++ b/tests/lib/LargeFileHelperGetFileSizeTest.php @@ -25,6 +25,7 @@ class LargeFileHelperGetFileSizeTest extends TestCase { /** @var LargeFileHelper */ protected $helper; + #[\Override] protected function setUp(): void { parent::setUp(); $this->helper = new LargeFileHelper(); diff --git a/tests/lib/LargeFileHelperTest.php b/tests/lib/LargeFileHelperTest.php index 86d0c1387df..f599b78ccb8 100644 --- a/tests/lib/LargeFileHelperTest.php +++ b/tests/lib/LargeFileHelperTest.php @@ -13,6 +13,7 @@ use OC\LargeFileHelper; class LargeFileHelperTest extends TestCase { protected $helper; + #[\Override] protected function setUp(): void { parent::setUp(); $this->helper = new LargeFileHelper; diff --git a/tests/lib/Lock/DBLockingProviderTest.php b/tests/lib/Lock/DBLockingProviderTest.php index 22f6c8f440e..eb277c3530c 100644 --- a/tests/lib/Lock/DBLockingProviderTest.php +++ b/tests/lib/Lock/DBLockingProviderTest.php @@ -39,6 +39,7 @@ class DBLockingProviderTest extends LockingProvider { protected $currentTime; + #[\Override] protected function setUp(): void { $this->currentTime = time(); $this->timeFactory = $this->createMock(ITimeFactory::class); @@ -53,11 +54,13 @@ class DBLockingProviderTest extends LockingProvider { /** * @return ILockingProvider */ + #[\Override] protected function getInstance() { $this->connection = Server::get(IDBConnection::class); return new DBLockingProvider($this->connection, $this->timeFactory, 3600); } + #[\Override] protected function tearDown(): void { $qb = $this->connection->getQueryBuilder(); $qb->delete('file_locks')->executeStatement(); diff --git a/tests/lib/Lock/LockingProvider.php b/tests/lib/Lock/LockingProvider.php index 2827f2c9160..ee897ae5cfb 100644 --- a/tests/lib/Lock/LockingProvider.php +++ b/tests/lib/Lock/LockingProvider.php @@ -23,6 +23,7 @@ abstract class LockingProvider extends TestCase { */ abstract protected function getInstance(); + #[\Override] protected function setUp(): void { parent::setUp(); $this->instance = $this->getInstance(); diff --git a/tests/lib/Lock/MemcacheLockingProviderTest.php b/tests/lib/Lock/MemcacheLockingProviderTest.php index ea7b3c26b3c..492f474c33c 100644 --- a/tests/lib/Lock/MemcacheLockingProviderTest.php +++ b/tests/lib/Lock/MemcacheLockingProviderTest.php @@ -24,12 +24,14 @@ class MemcacheLockingProviderTest extends LockingProvider { /** * @return ILockingProvider */ + #[\Override] protected function getInstance() { $this->memcache = new ArrayCache(); $timeProvider = Server::get(ITimeFactory::class); return new MemcacheLockingProvider($this->memcache, $timeProvider); } + #[\Override] protected function tearDown(): void { $this->memcache->clear(); parent::tearDown(); diff --git a/tests/lib/Lock/NonCachingDBLockingProviderTest.php b/tests/lib/Lock/NonCachingDBLockingProviderTest.php index a3b878177fa..7912e2a9ffe 100644 --- a/tests/lib/Lock/NonCachingDBLockingProviderTest.php +++ b/tests/lib/Lock/NonCachingDBLockingProviderTest.php @@ -20,11 +20,13 @@ class NonCachingDBLockingProviderTest extends DBLockingProviderTest { /** * @return ILockingProvider */ + #[\Override] protected function getInstance() { $this->connection = Server::get(IDBConnection::class); return new DBLockingProvider($this->connection, $this->timeFactory, 3600, false); } + #[\Override] public function testDoubleShared(): void { $this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED); $this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED); diff --git a/tests/lib/Lockdown/Filesystem/NoFSTest.php b/tests/lib/Lockdown/Filesystem/NoFSTest.php index b257a8b29dc..3ff3a217973 100644 --- a/tests/lib/Lockdown/Filesystem/NoFSTest.php +++ b/tests/lib/Lockdown/Filesystem/NoFSTest.php @@ -18,6 +18,7 @@ use Test\Traits\UserTrait; class NoFSTest extends \Test\TestCase { use UserTrait; + #[\Override] protected function tearDown(): void { $token = new PublicKeyToken(); $token->setScope([ @@ -27,6 +28,7 @@ class NoFSTest extends \Test\TestCase { parent::tearDown(); } + #[\Override] protected function setUp(): void { parent::setUp(); $token = new PublicKeyToken(); diff --git a/tests/lib/Lockdown/Filesystem/NullCacheTest.php b/tests/lib/Lockdown/Filesystem/NullCacheTest.php index 505951ea2ef..415f94c812d 100644 --- a/tests/lib/Lockdown/Filesystem/NullCacheTest.php +++ b/tests/lib/Lockdown/Filesystem/NullCacheTest.php @@ -17,6 +17,7 @@ class NulLCacheTest extends \Test\TestCase { /** @var NullCache */ private $cache; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Lockdown/Filesystem/NullStorageTest.php b/tests/lib/Lockdown/Filesystem/NullStorageTest.php index fa019ada4e5..3d32a984dea 100644 --- a/tests/lib/Lockdown/Filesystem/NullStorageTest.php +++ b/tests/lib/Lockdown/Filesystem/NullStorageTest.php @@ -19,6 +19,7 @@ class NullStorageTest extends TestCase { /** @var NullStorage */ private $storage; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Lockdown/LockdownManagerTest.php b/tests/lib/Lockdown/LockdownManagerTest.php index 973dec6d1f2..ae7e8b5b134 100644 --- a/tests/lib/Lockdown/LockdownManagerTest.php +++ b/tests/lib/Lockdown/LockdownManagerTest.php @@ -16,6 +16,7 @@ use Test\TestCase; class LockdownManagerTest extends TestCase { private $sessionCallback; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Log/ExceptionSerializerTest.php b/tests/lib/Log/ExceptionSerializerTest.php index 6d5bc5cf19f..e543c34f1be 100644 --- a/tests/lib/Log/ExceptionSerializerTest.php +++ b/tests/lib/Log/ExceptionSerializerTest.php @@ -16,6 +16,7 @@ use Test\TestCase; class ExceptionSerializerTest extends TestCase { private ExceptionSerializer $serializer; + #[\Override] public function setUp(): void { parent::setUp(); diff --git a/tests/lib/Log/FileTest.php b/tests/lib/Log/FileTest.php index 3f030665fb4..41249105bb4 100644 --- a/tests/lib/Log/FileTest.php +++ b/tests/lib/Log/FileTest.php @@ -25,6 +25,7 @@ class FileTest extends TestCase { /** @var File */ protected $logFile; + #[\Override] protected function setUp(): void { parent::setUp(); $config = Server::get(SystemConfig::class); @@ -34,6 +35,7 @@ class FileTest extends TestCase { $config->setValue('logfile', $config->getValue('datadirectory') . '/logtest.log'); $this->logFile = new File($config->getValue('datadirectory') . '/logtest.log', '', $config); } + #[\Override] protected function tearDown(): void { $config = Server::get(SystemConfig::class); if (isset($this->restore_logfile)) { diff --git a/tests/lib/Log/LogFactoryTest.php b/tests/lib/Log/LogFactoryTest.php index b1adbd0e823..6e6eb9ea563 100644 --- a/tests/lib/Log/LogFactoryTest.php +++ b/tests/lib/Log/LogFactoryTest.php @@ -32,6 +32,7 @@ class LogFactoryTest extends TestCase { /** @var SystemConfig|\PHPUnit\Framework\MockObject\MockObject */ protected $systemConfig; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Log/PsrLoggerAdapterTest.php b/tests/lib/Log/PsrLoggerAdapterTest.php index c11af7a12c2..3e1d5bcb164 100644 --- a/tests/lib/Log/PsrLoggerAdapterTest.php +++ b/tests/lib/Log/PsrLoggerAdapterTest.php @@ -21,6 +21,7 @@ class PsrLoggerAdapterTest extends TestCase { protected Log&MockObject $logger; protected PsrLoggerAdapter $loggerAdapter; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php index 97f5307cfdb..75cc4772aab 100644 --- a/tests/lib/LoggerTest.php +++ b/tests/lib/LoggerTest.php @@ -27,6 +27,7 @@ class LoggerTest extends TestCase implements IWriter { /** @var array */ private array $logs = []; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -200,6 +201,7 @@ class LoggerTest extends TestCase implements IWriter { return $this->logs; } + #[\Override] public function write(string $app, $message, int $level) { $textMessage = $message; if (is_array($message)) { diff --git a/tests/lib/Mail/EMailTemplateTest.php b/tests/lib/Mail/EMailTemplateTest.php index 1912bf060e2..1757446c6e3 100644 --- a/tests/lib/Mail/EMailTemplateTest.php +++ b/tests/lib/Mail/EMailTemplateTest.php @@ -24,6 +24,7 @@ class EMailTemplateTest extends TestCase { /** @var EMailTemplate */ private $emailTemplate; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Mail/EmailValidatorTest.php b/tests/lib/Mail/EmailValidatorTest.php index 7b9298d4d16..6d27b71fe4f 100644 --- a/tests/lib/Mail/EmailValidatorTest.php +++ b/tests/lib/Mail/EmailValidatorTest.php @@ -20,6 +20,7 @@ class EmailValidatorTest extends TestCase { private EmailValidator $emailValidator; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php index 8ed0386ff7d..87c4702f181 100644 --- a/tests/lib/Mail/MailerTest.php +++ b/tests/lib/Mail/MailerTest.php @@ -46,6 +46,7 @@ class MailerTest extends TestCase { private $dispatcher; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php index 18ef9793b5b..2f5a1b3cfa5 100644 --- a/tests/lib/Mail/MessageTest.php +++ b/tests/lib/Mail/MessageTest.php @@ -63,6 +63,7 @@ class MessageTest extends TestCase { ]; } + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Mail/Provider/AddressTest.php b/tests/lib/Mail/Provider/AddressTest.php index dc5e73526eb..7cc4dbb96f0 100644 --- a/tests/lib/Mail/Provider/AddressTest.php +++ b/tests/lib/Mail/Provider/AddressTest.php @@ -16,6 +16,7 @@ class AddressTest extends TestCase { /** @var Address&MockObject */ private Address $address; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Mail/Provider/AttachmentTest.php b/tests/lib/Mail/Provider/AttachmentTest.php index f02b1d54a7b..00e81952742 100644 --- a/tests/lib/Mail/Provider/AttachmentTest.php +++ b/tests/lib/Mail/Provider/AttachmentTest.php @@ -16,6 +16,7 @@ class AttachmentTest extends TestCase { /** @var Attachment&MockObject */ private Attachment $attachment; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Mail/Provider/ManagerTest.php b/tests/lib/Mail/Provider/ManagerTest.php index d3dabc0ea75..95f8501b510 100644 --- a/tests/lib/Mail/Provider/ManagerTest.php +++ b/tests/lib/Mail/Provider/ManagerTest.php @@ -32,6 +32,7 @@ class ManagerTest extends TestCase { /** @var IService&MockObject */ private IService $service; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Mail/Provider/MessageTest.php b/tests/lib/Mail/Provider/MessageTest.php index 6b387e5b010..5998b070fd6 100644 --- a/tests/lib/Mail/Provider/MessageTest.php +++ b/tests/lib/Mail/Provider/MessageTest.php @@ -26,6 +26,7 @@ class MessageTest extends TestCase { /** @var Attachment&MockObject */ private Attachment $attachment2; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Memcache/APCuTest.php b/tests/lib/Memcache/APCuTest.php index 3b113257196..36c97a27243 100644 --- a/tests/lib/Memcache/APCuTest.php +++ b/tests/lib/Memcache/APCuTest.php @@ -13,6 +13,7 @@ use OC\Memcache\APCu; #[\PHPUnit\Framework\Attributes\Group('Memcache')] #[\PHPUnit\Framework\Attributes\Group('APCu')] class APCuTest extends Cache { + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Memcache/ArrayCacheTest.php b/tests/lib/Memcache/ArrayCacheTest.php index d652b51480c..347a2cb5546 100644 --- a/tests/lib/Memcache/ArrayCacheTest.php +++ b/tests/lib/Memcache/ArrayCacheTest.php @@ -13,6 +13,7 @@ use OC\Memcache\ArrayCache; #[\PHPUnit\Framework\Attributes\Group('Memcache')] class ArrayCacheTest extends Cache { + #[\Override] protected function setUp(): void { parent::setUp(); $this->instance = new ArrayCache(''); diff --git a/tests/lib/Memcache/Cache.php b/tests/lib/Memcache/Cache.php index b48f5557faa..a4268a36c53 100644 --- a/tests/lib/Memcache/Cache.php +++ b/tests/lib/Memcache/Cache.php @@ -147,6 +147,7 @@ abstract class Cache extends \Test\Cache\TestCache { $this->assertFalse($this->instance->ncad('foo', 'bar')); } + #[\Override] protected function tearDown(): void { if ($this->instance) { $this->instance->clear(); diff --git a/tests/lib/Memcache/CasTraitTestClass.php b/tests/lib/Memcache/CasTraitTestClass.php index b4c49c7886d..42cb2e193fd 100644 --- a/tests/lib/Memcache/CasTraitTestClass.php +++ b/tests/lib/Memcache/CasTraitTestClass.php @@ -14,12 +14,16 @@ class CasTraitTestClass { use CASTrait; // abstract methods from Memcache + #[\Override] public function set($key, $value, $ttl = 0) { } + #[\Override] public function get($key) { } + #[\Override] public function add($key, $value, $ttl = 0) { } + #[\Override] public function remove($key) { } } diff --git a/tests/lib/Memcache/FactoryTest.php b/tests/lib/Memcache/FactoryTest.php index 338d2888c71..f5a9e521626 100644 --- a/tests/lib/Memcache/FactoryTest.php +++ b/tests/lib/Memcache/FactoryTest.php @@ -19,6 +19,7 @@ class Test_Factory_Available_Cache1 extends NullCache { public function __construct($prefix = '') { } + #[\Override] public static function isAvailable(): bool { return true; } @@ -28,6 +29,7 @@ class Test_Factory_Available_Cache2 extends NullCache { public function __construct($prefix = '') { } + #[\Override] public static function isAvailable(): bool { return true; } @@ -37,6 +39,7 @@ class Test_Factory_Unavailable_Cache1 extends NullCache { public function __construct($prefix = '') { } + #[\Override] public static function isAvailable(): bool { return false; } @@ -46,6 +49,7 @@ class Test_Factory_Unavailable_Cache2 extends NullCache { public function __construct($prefix = '') { } + #[\Override] public static function isAvailable(): bool { return false; } diff --git a/tests/lib/Memcache/MemcachedTest.php b/tests/lib/Memcache/MemcachedTest.php index 54ab47c21b5..ec9513988fd 100644 --- a/tests/lib/Memcache/MemcachedTest.php +++ b/tests/lib/Memcache/MemcachedTest.php @@ -13,6 +13,7 @@ use OC\Memcache\Memcached; #[\PHPUnit\Framework\Attributes\Group('Memcache')] #[\PHPUnit\Framework\Attributes\Group('Memcached')] class MemcachedTest extends Cache { + #[\Override] public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); @@ -25,11 +26,13 @@ class MemcachedTest extends Cache { } } + #[\Override] protected function setUp(): void { parent::setUp(); $this->instance = new Memcached($this->getUniqueID()); } + #[\Override] public function testClear(): void { // Memcached is sometimes broken with clear(), so we don't test it thoroughly $value = 'ipsum lorum'; diff --git a/tests/lib/Memcache/RedisTest.php b/tests/lib/Memcache/RedisTest.php index 18c08b87c98..d410dac6686 100644 --- a/tests/lib/Memcache/RedisTest.php +++ b/tests/lib/Memcache/RedisTest.php @@ -20,6 +20,7 @@ class RedisTest extends Cache { */ protected $instance; + #[\Override] public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); @@ -58,6 +59,7 @@ class RedisTest extends Cache { } } + #[\Override] protected function setUp(): void { parent::setUp(); $this->instance = new Redis($this->getUniqueID()); diff --git a/tests/lib/Migration/BackgroundRepairTest.php b/tests/lib/Migration/BackgroundRepairTest.php index 5bc085eb7ec..11df8f8518e 100644 --- a/tests/lib/Migration/BackgroundRepairTest.php +++ b/tests/lib/Migration/BackgroundRepairTest.php @@ -27,6 +27,7 @@ class TestRepairStep implements IRepairStep { * @return string * @since 9.1.0 */ + #[\Override] public function getName() { return 'A test repair step'; } @@ -38,6 +39,7 @@ class TestRepairStep implements IRepairStep { * @since 9.1.0 * @throws \Exception in case of failure */ + #[\Override] public function run(IOutput $output) { // TODO: Implement run() method. } @@ -52,6 +54,7 @@ class BackgroundRepairTest extends TestCase { private IAppManager $appManager; private Repair $repair; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Migration/MetadataManagerTest.php b/tests/lib/Migration/MetadataManagerTest.php index 43c9a6bcb72..6984d98fe12 100644 --- a/tests/lib/Migration/MetadataManagerTest.php +++ b/tests/lib/Migration/MetadataManagerTest.php @@ -28,6 +28,7 @@ use OCP\Server; class MetadataManagerTest extends \Test\TestCase { private IAppManager $appManager; + #[\Override] protected function setUp(): void { parent::setUp(); $this->appManager = Server::get(IAppManager::class); diff --git a/tests/lib/Mock/Config/MockAppConfig.php b/tests/lib/Mock/Config/MockAppConfig.php index f601bf6dbc5..7d7b70a1ce8 100644 --- a/tests/lib/Mock/Config/MockAppConfig.php +++ b/tests/lib/Mock/Config/MockAppConfig.php @@ -17,103 +17,127 @@ class MockAppConfig implements IAppConfig { ) { } + #[\Override] public function hasKey(string $app, string $key, ?bool $lazy = false): bool { return isset($this->config[$app][$key]); } + #[\Override] public function getValues($app, $key): array { throw new \Exception('not implemented'); } + #[\Override] public function getFilteredValues($app): array { throw new \Exception('not implemented'); } + #[\Override] public function getApps(): array { return array_keys($this->config); } + #[\Override] public function getKeys(string $app): array { return array_keys($this->config[$app] ?? []); } + #[\Override] public function isSensitive(string $app, string $key, ?bool $lazy = false): bool { throw new \Exception('not implemented'); } + #[\Override] public function isLazy(string $app, string $key): bool { throw new \Exception('not implemented'); } + #[\Override] public function getAllValues(string $app, string $prefix = '', bool $filtered = false): array { throw new \Exception('not implemented'); } + #[\Override] public function searchValues(string $key, bool $lazy = false, ?int $typedAs = null): array { throw new \Exception('not implemented'); } + #[\Override] public function getValueString(string $app, string $key, string $default = '', bool $lazy = false): string { return (string)(($this->config[$app] ?? [])[$key] ?? $default); } + #[\Override] public function getValueInt(string $app, string $key, int $default = 0, bool $lazy = false): int { return (int)(($this->config[$app] ?? [])[$key] ?? $default); } + #[\Override] public function getValueFloat(string $app, string $key, float $default = 0, bool $lazy = false): float { return (float)(($this->config[$app] ?? [])[$key] ?? $default); } + #[\Override] public function getValueBool(string $app, string $key, bool $default = false, bool $lazy = false): bool { return (bool)(($this->config[$app] ?? [])[$key] ?? $default); } + #[\Override] public function getValueArray(string $app, string $key, array $default = [], bool $lazy = false): array { return ($this->config[$app] ?? [])[$key] ?? $default; } + #[\Override] public function getValueType(string $app, string $key, ?bool $lazy = null): int { throw new \Exception('not implemented'); } + #[\Override] public function setValueString(string $app, string $key, string $value, bool $lazy = false, bool $sensitive = false): bool { $this->config[$app][$key] = $value; return true; } + #[\Override] public function setValueInt(string $app, string $key, int $value, bool $lazy = false, bool $sensitive = false): bool { $this->config[$app][$key] = $value; return true; } + #[\Override] public function setValueFloat(string $app, string $key, float $value, bool $lazy = false, bool $sensitive = false): bool { $this->config[$app][$key] = $value; return true; } + #[\Override] public function setValueBool(string $app, string $key, bool $value, bool $lazy = false): bool { $this->config[$app][$key] = $value; return true; } + #[\Override] public function setValueArray(string $app, string $key, array $value, bool $lazy = false, bool $sensitive = false): bool { $this->config[$app][$key] = $value; return true; } + #[\Override] public function updateSensitive(string $app, string $key, bool $sensitive): bool { throw new \Exception('not implemented'); } + #[\Override] public function updateLazy(string $app, string $key, bool $lazy): bool { throw new \Exception('not implemented'); } + #[\Override] public function getDetails(string $app, string $key): array { throw new \Exception('not implemented'); } + #[\Override] public function convertTypeToInt(string $type): int { return match (strtolower($type)) { 'mixed' => IAppConfig::VALUE_MIXED, @@ -126,6 +150,7 @@ class MockAppConfig implements IAppConfig { }; } + #[\Override] public function convertTypeToString(int $type): string { $type &= ~self::VALUE_SENSITIVE; @@ -140,29 +165,35 @@ class MockAppConfig implements IAppConfig { }; } + #[\Override] public function deleteKey(string $app, string $key): void { if ($this->hasKey($app, $key)) { unset($this->config[$app][$key]); } } + #[\Override] public function deleteApp(string $app): void { if (isset($this->config[$app])) { unset($this->config[$app]); } } + #[\Override] public function clearCache(bool $reload = false): void { } + #[\Override] public function searchKeys(string $app, string $prefix = '', bool $lazy = false): array { throw new \Exception('not implemented'); } + #[\Override] public function getKeyDetails(string $app, string $key): array { throw new \Exception('not implemented'); } + #[\Override] public function getAppInstalledVersions(bool $onlyEnabled = false): array { throw new \Exception('not implemented'); } diff --git a/tests/lib/Mock/Config/MockUserConfig.php b/tests/lib/Mock/Config/MockUserConfig.php index cc4619ef191..6b62f676748 100644 --- a/tests/lib/Mock/Config/MockUserConfig.php +++ b/tests/lib/Mock/Config/MockUserConfig.php @@ -18,14 +18,17 @@ class MockUserConfig implements IUserConfig { ) { } + #[\Override] public function getUserIds(string $appId = ''): array { return array_keys($this->config); } + #[\Override] public function getApps(string $userId): array { return array_keys($this->config[$userId] ?? []); } + #[\Override] public function getKeys(string $userId, string $app): array { if (isset($this->config[$userId][$app])) { return array_keys($this->config[$userId][$app]); @@ -34,54 +37,67 @@ class MockUserConfig implements IUserConfig { } } + #[\Override] public function hasKey(string $userId, string $app, string $key, ?bool $lazy = false): bool { return isset($this->config[$userId][$app][$key]); } + #[\Override] public function isSensitive(string $userId, string $app, string $key, ?bool $lazy = false): bool { throw new \Exception('not implemented'); } + #[\Override] public function isIndexed(string $userId, string $app, string $key, ?bool $lazy = false): bool { throw new \Exception('not implemented'); } + #[\Override] public function isLazy(string $userId, string $app, string $key): bool { throw new \Exception('not implemented'); } + #[\Override] public function getValues(string $userId, string $app, string $prefix = '', bool $filtered = false): array { throw new \Exception('not implemented'); } + #[\Override] public function getAllValues(string $userId, bool $filtered = false): array { throw new \Exception('not implemented'); } + #[\Override] public function getValuesByApps(string $userId, string $key, bool $lazy = false, ?ValueType $typedAs = null): array { throw new \Exception('not implemented'); } + #[\Override] public function getValuesByUsers(string $app, string $key, ?ValueType $typedAs = null, ?array $userIds = null): array { throw new \Exception('not implemented'); } + #[\Override] public function searchUsersByValueString(string $app, string $key, string $value, bool $caseInsensitive = false): Generator { throw new \Exception('not implemented'); } + #[\Override] public function searchUsersByValueInt(string $app, string $key, int $value): Generator { throw new \Exception('not implemented'); } + #[\Override] public function searchUsersByValues(string $app, string $key, array $values): Generator { throw new \Exception('not implemented'); } + #[\Override] public function searchUsersByValueBool(string $app, string $key, bool $value): Generator { throw new \Exception('not implemented'); } + #[\Override] public function getValueString(string $userId, string $app, string $key, string $default = '', bool $lazy = false): string { if (isset($this->config[$userId][$app])) { return (string)$this->config[$userId][$app][$key]; @@ -90,6 +106,7 @@ class MockUserConfig implements IUserConfig { } } + #[\Override] public function getValueInt(string $userId, string $app, string $key, int $default = 0, bool $lazy = false): int { if (isset($this->config[$userId][$app])) { return (int)$this->config[$userId][$app][$key]; @@ -98,6 +115,7 @@ class MockUserConfig implements IUserConfig { } } + #[\Override] public function getValueFloat(string $userId, string $app, string $key, float $default = 0, bool $lazy = false): float { if (isset($this->config[$userId][$app])) { return (float)$this->config[$userId][$app][$key]; @@ -106,6 +124,7 @@ class MockUserConfig implements IUserConfig { } } + #[\Override] public function getValueBool(string $userId, string $app, string $key, bool $default = false, bool $lazy = false): bool { if (isset($this->config[$userId][$app])) { return (bool)$this->config[$userId][$app][$key]; @@ -114,6 +133,7 @@ class MockUserConfig implements IUserConfig { } } + #[\Override] public function getValueArray(string $userId, string $app, string $key, array $default = [], bool $lazy = false): array { if (isset($this->config[$userId][$app])) { return $this->config[$userId][$app][$key]; @@ -122,87 +142,107 @@ class MockUserConfig implements IUserConfig { } } + #[\Override] public function getValueType(string $userId, string $app, string $key, ?bool $lazy = null): ValueType { throw new \Exception('not implemented'); } + #[\Override] public function getValueFlags(string $userId, string $app, string $key, bool $lazy = false): int { throw new \Exception('not implemented'); } + #[\Override] public function setValueString(string $userId, string $app, string $key, string $value, bool $lazy = false, int $flags = 0): bool { $this->config[$userId][$app][$key] = $value; return true; } + #[\Override] public function setValueInt(string $userId, string $app, string $key, int $value, bool $lazy = false, int $flags = 0): bool { $this->config[$userId][$app][$key] = $value; return true; } + #[\Override] public function setValueFloat(string $userId, string $app, string $key, float $value, bool $lazy = false, int $flags = 0): bool { $this->config[$userId][$app][$key] = $value; return true; } + #[\Override] public function setValueBool(string $userId, string $app, string $key, bool $value, bool $lazy = false): bool { $this->config[$userId][$app][$key] = $value; return true; } + #[\Override] public function setValueArray(string $userId, string $app, string $key, array $value, bool $lazy = false, int $flags = 0): bool { $this->config[$userId][$app][$key] = $value; return true; } + #[\Override] public function updateSensitive(string $userId, string $app, string $key, bool $sensitive): bool { throw new \Exception('not implemented'); } + #[\Override] public function updateGlobalSensitive(string $app, string $key, bool $sensitive): void { throw new \Exception('not implemented'); } + #[\Override] public function updateIndexed(string $userId, string $app, string $key, bool $indexed): bool { throw new \Exception('not implemented'); } + #[\Override] public function updateGlobalIndexed(string $app, string $key, bool $indexed): void { throw new \Exception('not implemented'); } + #[\Override] public function updateLazy(string $userId, string $app, string $key, bool $lazy): bool { throw new \Exception('not implemented'); } + #[\Override] public function updateGlobalLazy(string $app, string $key, bool $lazy): void { throw new \Exception('not implemented'); } + #[\Override] public function getDetails(string $userId, string $app, string $key): array { throw new \Exception('not implemented'); } + #[\Override] public function deleteUserConfig(string $userId, string $app, string $key): void { unset($this->config[$userId][$app][$key]); } + #[\Override] public function deleteKey(string $app, string $key): void { throw new \Exception('not implemented'); } + #[\Override] public function deleteApp(string $app): void { throw new \Exception('not implemented'); } + #[\Override] public function deleteAllUserConfig(string $userId): void { unset($this->config[$userId]); } + #[\Override] public function clearCache(string $userId, bool $reload = false): void { throw new \Exception('not implemented'); } + #[\Override] public function clearCacheAll(): void { throw new \Exception('not implemented'); } diff --git a/tests/lib/NavigationManagerTest.php b/tests/lib/NavigationManagerTest.php index 53d7e81302b..b985b1b2d33 100644 --- a/tests/lib/NavigationManagerTest.php +++ b/tests/lib/NavigationManagerTest.php @@ -45,6 +45,7 @@ class NavigationManagerTest extends TestCase { protected $navigationManager; protected LoggerInterface $logger; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Net/HostnameClassifierTest.php b/tests/lib/Net/HostnameClassifierTest.php index c03afdabe83..656ad4f54a5 100644 --- a/tests/lib/Net/HostnameClassifierTest.php +++ b/tests/lib/Net/HostnameClassifierTest.php @@ -15,6 +15,7 @@ use Test\TestCase; class HostnameClassifierTest extends TestCase { private HostnameClassifier $classifier; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Net/IpAddressClassifierTest.php b/tests/lib/Net/IpAddressClassifierTest.php index 6014eb9dffe..755b9171c79 100644 --- a/tests/lib/Net/IpAddressClassifierTest.php +++ b/tests/lib/Net/IpAddressClassifierTest.php @@ -15,6 +15,7 @@ use Test\TestCase; class IpAddressClassifierTest extends TestCase { private IpAddressClassifier $classifier; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Notification/ActionTest.php b/tests/lib/Notification/ActionTest.php index 0ff364a9e65..7c2986d21e9 100644 --- a/tests/lib/Notification/ActionTest.php +++ b/tests/lib/Notification/ActionTest.php @@ -16,6 +16,7 @@ class ActionTest extends TestCase { /** @var IAction */ protected $action; + #[\Override] protected function setUp(): void { parent::setUp(); $this->action = new Action(); diff --git a/tests/lib/Notification/DummyApp.php b/tests/lib/Notification/DummyApp.php index 7cd99f13fd6..c0414a8adbb 100644 --- a/tests/lib/Notification/DummyApp.php +++ b/tests/lib/Notification/DummyApp.php @@ -17,6 +17,7 @@ class DummyApp implements IApp { * @throws \InvalidArgumentException When the notification is not valid * @since 9.0.0 */ + #[\Override] public function notify(INotification $notification): void { // TODO: Implement notify() method. } @@ -25,6 +26,7 @@ class DummyApp implements IApp { * @param INotification $notification * @since 9.0.0 */ + #[\Override] public function markProcessed(INotification $notification): void { // TODO: Implement markProcessed() method. } @@ -34,6 +36,7 @@ class DummyApp implements IApp { * @return int * @since 9.0.0 */ + #[\Override] public function getCount(INotification $notification): int { // TODO: Implement getCount() method. } diff --git a/tests/lib/Notification/DummyNotifier.php b/tests/lib/Notification/DummyNotifier.php index c536c8483f2..8e9c18ce3be 100644 --- a/tests/lib/Notification/DummyNotifier.php +++ b/tests/lib/Notification/DummyNotifier.php @@ -19,6 +19,7 @@ class DummyNotifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getID(): string { // TODO: Implement getID() method. } @@ -29,6 +30,7 @@ class DummyNotifier implements INotifier { * @return string * @since 17.0.0 */ + #[\Override] public function getName(): string { // TODO: Implement getName() method. } @@ -41,6 +43,7 @@ class DummyNotifier implements INotifier { * @throws AlreadyProcessedException When the notification is not needed anymore and should be deleted * @since 9.0.0 */ + #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { // TODO: Implement prepare() method. } diff --git a/tests/lib/Notification/ManagerTest.php b/tests/lib/Notification/ManagerTest.php index cbd76989d24..95591db6a12 100644 --- a/tests/lib/Notification/ManagerTest.php +++ b/tests/lib/Notification/ManagerTest.php @@ -46,6 +46,7 @@ class ManagerTest extends TestCase { /** @var RegistrationContext|MockObject */ protected $registrationContext; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Notification/NotificationTest.php b/tests/lib/Notification/NotificationTest.php index b09ff2085d4..434ac37e3d7 100644 --- a/tests/lib/Notification/NotificationTest.php +++ b/tests/lib/Notification/NotificationTest.php @@ -23,6 +23,7 @@ class NotificationTest extends TestCase { protected IValidator&MockObject $validator; protected IRichTextFormatter&MockObject $richTextFormatter; + #[\Override] protected function setUp(): void { parent::setUp(); $this->validator = $this->createMock(IValidator::class); diff --git a/tests/lib/OCM/DiscoveryServiceTest.php b/tests/lib/OCM/DiscoveryServiceTest.php index f9ac54c823b..1cf026a64bc 100644 --- a/tests/lib/OCM/DiscoveryServiceTest.php +++ b/tests/lib/OCM/DiscoveryServiceTest.php @@ -31,6 +31,7 @@ class DiscoveryServiceTest extends TestCase { private IConfig $config; private OCMRequestController $requestController; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/OCM/Listeners/LocalOCMDiscoveryTestEvent.php b/tests/lib/OCM/Listeners/LocalOCMDiscoveryTestEvent.php index b2d0e7d09f6..9c7f0618acd 100644 --- a/tests/lib/OCM/Listeners/LocalOCMDiscoveryTestEvent.php +++ b/tests/lib/OCM/Listeners/LocalOCMDiscoveryTestEvent.php @@ -18,6 +18,7 @@ class LocalOCMDiscoveryTestEvent implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof LocalOCMDiscoveryEvent)) { return; diff --git a/tests/lib/OCM/Listeners/OCMEndpointRequestTestEvent.php b/tests/lib/OCM/Listeners/OCMEndpointRequestTestEvent.php index bbe36a529fd..e23d71cf8f1 100644 --- a/tests/lib/OCM/Listeners/OCMEndpointRequestTestEvent.php +++ b/tests/lib/OCM/Listeners/OCMEndpointRequestTestEvent.php @@ -21,6 +21,7 @@ class OCMEndpointRequestTestEvent implements IEventListener { ) { } + #[\Override] public function handle(Event $event): void { if (!($event instanceof OCMEndpointRequestEvent)) { return; diff --git a/tests/lib/OCS/DiscoveryServiceTest.php b/tests/lib/OCS/DiscoveryServiceTest.php index 422c97f4221..82a1b788064 100644 --- a/tests/lib/OCS/DiscoveryServiceTest.php +++ b/tests/lib/OCS/DiscoveryServiceTest.php @@ -23,6 +23,7 @@ class DiscoveryServiceTest extends TestCase { /** @var IDiscoveryService */ private $discoveryService; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/OCS/ProviderTest.php b/tests/lib/OCS/ProviderTest.php index 87e01d8301b..7aedc3e5c09 100644 --- a/tests/lib/OCS/ProviderTest.php +++ b/tests/lib/OCS/ProviderTest.php @@ -21,6 +21,7 @@ class ProviderTest extends \Test\TestCase { /** @var Provider */ private $ocsProvider; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/OpenMetrics/Exporters/ActiveSessionsTest.php b/tests/lib/OpenMetrics/Exporters/ActiveSessionsTest.php index ebbe3b061d3..d4847eb3ba1 100644 --- a/tests/lib/OpenMetrics/Exporters/ActiveSessionsTest.php +++ b/tests/lib/OpenMetrics/Exporters/ActiveSessionsTest.php @@ -17,6 +17,7 @@ use PHPUnit\Framework\Attributes\Group; #[Group('DB')] class ActiveSessionsTest extends ExporterTestCase { + #[\Override] protected function getExporter():IMetricFamily { return new ActiveSessions(Server::get(IDBConnection::class)); } diff --git a/tests/lib/OpenMetrics/Exporters/ActiveUsersTest.php b/tests/lib/OpenMetrics/Exporters/ActiveUsersTest.php index 1a41ee2a43b..9db60180bcf 100644 --- a/tests/lib/OpenMetrics/Exporters/ActiveUsersTest.php +++ b/tests/lib/OpenMetrics/Exporters/ActiveUsersTest.php @@ -17,6 +17,7 @@ use PHPUnit\Framework\Attributes\Group; #[Group('DB')] class ActiveUsersTest extends ExporterTestCase { + #[\Override] protected function getExporter():IMetricFamily { return new ActiveUsers(Server::get(IDBConnection::class)); } diff --git a/tests/lib/OpenMetrics/Exporters/AppEnabledTest.php b/tests/lib/OpenMetrics/Exporters/AppEnabledTest.php index 3dba47768f6..810e1c75863 100644 --- a/tests/lib/OpenMetrics/Exporters/AppEnabledTest.php +++ b/tests/lib/OpenMetrics/Exporters/AppEnabledTest.php @@ -26,6 +26,7 @@ class AppEnabledTest extends ExporterTestCase { 'appA', 'appB', 'appD' ]; + #[\Override] protected function getExporter():IMetricFamily { $this->appManager = $this->createMock(IAppManager::class); $this->appManager->method('getAppInstalledVersions') diff --git a/tests/lib/OpenMetrics/Exporters/ExporterTestCase.php b/tests/lib/OpenMetrics/Exporters/ExporterTestCase.php index 439494e5c4f..1f728da3cef 100644 --- a/tests/lib/OpenMetrics/Exporters/ExporterTestCase.php +++ b/tests/lib/OpenMetrics/Exporters/ExporterTestCase.php @@ -19,6 +19,7 @@ abstract class ExporterTestCase extends TestCase { abstract protected function getExporter(): IMetricFamily; + #[\Override] protected function setUp(): void { parent::setUp(); $this->exporter = $this->getExporter(); diff --git a/tests/lib/OpenMetrics/Exporters/FilesByTypeTest.php b/tests/lib/OpenMetrics/Exporters/FilesByTypeTest.php index 030f9caf9a0..a97c002d5e1 100644 --- a/tests/lib/OpenMetrics/Exporters/FilesByTypeTest.php +++ b/tests/lib/OpenMetrics/Exporters/FilesByTypeTest.php @@ -19,6 +19,7 @@ use PHPUnit\Framework\Attributes\Group; #[Group('DB')] class FilesByTypeTest extends ExporterTestCase { + #[\Override] protected function getExporter():IMetricFamily { return new FilesByType( Server::get(ICacheFactory::class), diff --git a/tests/lib/OpenMetrics/Exporters/InstanceInfoTest.php b/tests/lib/OpenMetrics/Exporters/InstanceInfoTest.php index 6441e6b8838..6c5fef39d1c 100644 --- a/tests/lib/OpenMetrics/Exporters/InstanceInfoTest.php +++ b/tests/lib/OpenMetrics/Exporters/InstanceInfoTest.php @@ -19,6 +19,7 @@ class InstanceInfoTest extends ExporterTestCase { private SystemConfig&MockObject $systemConfig; private ServerVersion&MockObject $serverVersion; + #[\Override] protected function getExporter():IMetricFamily { $this->systemConfig = $this->createMock(SystemConfig::class); $this->serverVersion = $this->createMock(ServerVersion::class); diff --git a/tests/lib/OpenMetrics/Exporters/LogLevelTest.php b/tests/lib/OpenMetrics/Exporters/LogLevelTest.php index 78f2fefbcc8..0cba1233778 100644 --- a/tests/lib/OpenMetrics/Exporters/LogLevelTest.php +++ b/tests/lib/OpenMetrics/Exporters/LogLevelTest.php @@ -15,6 +15,7 @@ use OCP\OpenMetrics\IMetricFamily; use OCP\Server; class LogLevelTest extends ExporterTestCase { + #[\Override] protected function getExporter():IMetricFamily { return new LogLevel(Server::get(IConfig::class)); } diff --git a/tests/lib/OpenMetrics/Exporters/MaintenanceTest.php b/tests/lib/OpenMetrics/Exporters/MaintenanceTest.php index 5509c318eca..34a995baa88 100644 --- a/tests/lib/OpenMetrics/Exporters/MaintenanceTest.php +++ b/tests/lib/OpenMetrics/Exporters/MaintenanceTest.php @@ -13,6 +13,7 @@ use OC\OpenMetrics\Exporters\Maintenance; use OCP\OpenMetrics\IMetricFamily; class MaintenanceTest extends ExporterTestCase { + #[\Override] protected function getExporter():IMetricFamily { return new Maintenance(); } diff --git a/tests/lib/OpenMetrics/Exporters/RunningJobsTest.php b/tests/lib/OpenMetrics/Exporters/RunningJobsTest.php index 55f6c8fdea0..1eb55df456a 100644 --- a/tests/lib/OpenMetrics/Exporters/RunningJobsTest.php +++ b/tests/lib/OpenMetrics/Exporters/RunningJobsTest.php @@ -17,6 +17,7 @@ use PHPUnit\Framework\Attributes\Group; #[Group('DB')] class RunningJobsTest extends ExporterTestCase { + #[\Override] protected function getExporter():IMetricFamily { return new RunningJobs(Server::get(IDBConnection::class)); } diff --git a/tests/lib/OpenMetrics/Exporters/UsersByBackendTest.php b/tests/lib/OpenMetrics/Exporters/UsersByBackendTest.php index 22d472e6c99..c2499443f05 100644 --- a/tests/lib/OpenMetrics/Exporters/UsersByBackendTest.php +++ b/tests/lib/OpenMetrics/Exporters/UsersByBackendTest.php @@ -23,6 +23,7 @@ class UsersByBackendTest extends ExporterTestCase { ]; + #[\Override] protected function getExporter():IMetricFamily { $this->userManager = $this->createMock(IUserManager::class); $this->userManager->method('countUsers') diff --git a/tests/lib/Preview/BackgroundCleanupJobTest.php b/tests/lib/Preview/BackgroundCleanupJobTest.php index 23f0dabba98..fbc532fb52b 100644 --- a/tests/lib/Preview/BackgroundCleanupJobTest.php +++ b/tests/lib/Preview/BackgroundCleanupJobTest.php @@ -41,6 +41,7 @@ class BackgroundCleanupJobTest extends \Test\TestCase { private ITimeFactory $timeFactory; private PreviewService $previewService; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -66,6 +67,7 @@ class BackgroundCleanupJobTest extends \Test\TestCase { $this->previewService = Server::get(PreviewService::class); } + #[\Override] protected function tearDown(): void { if ($this->trashEnabled) { $appManager = Server::get(IAppManager::class); diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php index f1fab3bf0a4..7e1c64e6556 100644 --- a/tests/lib/Preview/GeneratorTest.php +++ b/tests/lib/Preview/GeneratorTest.php @@ -47,6 +47,7 @@ class GeneratorTest extends TestCase { private PreviewMapper&MockObject $previewMapper; private PreviewMigrationService&MockObject $migrationService; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Preview/HEICTest.php b/tests/lib/Preview/HEICTest.php index bac8e1b816f..7d3b2271fb8 100644 --- a/tests/lib/Preview/HEICTest.php +++ b/tests/lib/Preview/HEICTest.php @@ -17,6 +17,7 @@ use OC\Preview\HEIC; */ #[\PHPUnit\Framework\Attributes\Group('DB')] class HEICTest extends Provider { + #[\Override] protected function setUp(): void { if (!in_array('HEIC', \Imagick::queryFormats('HEI*'))) { $this->markTestSkipped('ImageMagick is not HEIC aware. Skipping tests'); diff --git a/tests/lib/Preview/ImageTest.php b/tests/lib/Preview/ImageTest.php index 65cd194277f..e80372957ce 100644 --- a/tests/lib/Preview/ImageTest.php +++ b/tests/lib/Preview/ImageTest.php @@ -18,6 +18,7 @@ use OC\Preview\JPEG; */ #[\PHPUnit\Framework\Attributes\Group('DB')] class ImageTest extends Provider { + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Preview/MP3Test.php b/tests/lib/Preview/MP3Test.php index 4cd41e4a0b0..605c1afc69a 100644 --- a/tests/lib/Preview/MP3Test.php +++ b/tests/lib/Preview/MP3Test.php @@ -18,6 +18,7 @@ use OC\Preview\MP3; */ #[\PHPUnit\Framework\Attributes\Group('DB')] class MP3Test extends Provider { + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Preview/MovieTest.php b/tests/lib/Preview/MovieTest.php index 770e74a4ba9..660f5000ea1 100644 --- a/tests/lib/Preview/MovieTest.php +++ b/tests/lib/Preview/MovieTest.php @@ -24,6 +24,7 @@ class MovieTest extends Provider { protected int $width = 560; protected int $height = 320; + #[\Override] protected function setUp(): void { $binaryFinder = Server::get(IBinaryFinder::class); $movieBinary = $binaryFinder->findBinaryPath('ffmpeg'); diff --git a/tests/lib/Preview/MovieTestRemoteFile.php b/tests/lib/Preview/MovieTestRemoteFile.php index 5a635d34c59..c5848a4efa7 100644 --- a/tests/lib/Preview/MovieTestRemoteFile.php +++ b/tests/lib/Preview/MovieTestRemoteFile.php @@ -31,6 +31,7 @@ class MovieTestRemoteFile extends Provider { protected int $width = 1920; protected int $height = 1080; + #[\Override] protected function setUp(): void { $binaryFinder = Server::get(IBinaryFinder::class); $movieBinary = $binaryFinder->findBinaryPath('ffmpeg'); @@ -43,6 +44,7 @@ class MovieTestRemoteFile extends Provider { } } + #[\Override] #[\PHPUnit\Framework\Attributes\DataProvider('dimensionsDataProvider')] public function testGetThumbnail($widthAdjustment, $heightAdjustment): void { $ratio = round($this->width / $this->height, 2); diff --git a/tests/lib/Preview/OfficeTest.php b/tests/lib/Preview/OfficeTest.php index 1095bdc2e17..2357b7aa614 100644 --- a/tests/lib/Preview/OfficeTest.php +++ b/tests/lib/Preview/OfficeTest.php @@ -20,6 +20,7 @@ use OCP\Server; */ #[\PHPUnit\Framework\Attributes\Group('DB')] class OfficeTest extends Provider { + #[\Override] protected function setUp(): void { $binaryFinder = Server::get(IBinaryFinder::class); $libreofficeBinary = $binaryFinder->findBinaryPath('libreoffice'); diff --git a/tests/lib/Preview/PostscriptTest.php b/tests/lib/Preview/PostscriptTest.php index e5cc15ee7f4..733bae31b5a 100644 --- a/tests/lib/Preview/PostscriptTest.php +++ b/tests/lib/Preview/PostscriptTest.php @@ -16,6 +16,7 @@ use OCP\Server; #[\PHPUnit\Framework\Attributes\RequiresPhpExtension('imagick')] class PostscriptTest extends Provider { + #[\Override] protected function setUp(): void { if (\Imagick::queryFormats('EPS') === false || \Imagick::queryFormats('PS') === false) { $this->markTestSkipped('Imagick does not support postscript.'); diff --git a/tests/lib/Preview/PreviewMapperTest.php b/tests/lib/Preview/PreviewMapperTest.php index 96f68ddf9ee..f7922031cdc 100644 --- a/tests/lib/Preview/PreviewMapperTest.php +++ b/tests/lib/Preview/PreviewMapperTest.php @@ -22,6 +22,7 @@ class PreviewMapperTest extends TestCase { private IDBConnection $connection; private ISnowflakeGenerator $snowflake; + #[\Override] public function setUp(): void { parent::setUp(); $this->previewMapper = Server::get(PreviewMapper::class); @@ -38,6 +39,7 @@ class PreviewMapperTest extends TestCase { $qb->delete('previews')->executeStatement(); } + #[\Override] public function tearDown(): void { $this->previewMapper->deleteAll(); parent::tearDown(); diff --git a/tests/lib/Preview/PreviewMigrationJobTest.php b/tests/lib/Preview/PreviewMigrationJobTest.php index 2fd4fc1c511..0992cdc2c1f 100644 --- a/tests/lib/Preview/PreviewMigrationJobTest.php +++ b/tests/lib/Preview/PreviewMigrationJobTest.php @@ -42,6 +42,7 @@ class PreviewMigrationJobTest extends TestCase { private IMimeTypeDetector&MockObject $mimeTypeDetector; private LoggerInterface&MockObject $logger; + #[\Override] public function setUp(): void { parent::setUp(); $this->previewAppData = Server::get(IAppDataFactory::class)->get('preview'); @@ -91,6 +92,7 @@ class PreviewMigrationJobTest extends TestCase { $this->logger = $this->createMock(LoggerInterface::class); } + #[\Override] public function tearDown(): void { foreach ($this->previewAppData->getDirectoryListing() as $folder) { $folder->delete(); diff --git a/tests/lib/Preview/PreviewServiceTest.php b/tests/lib/Preview/PreviewServiceTest.php index 1ff4d49d037..adc1b54cf81 100644 --- a/tests/lib/Preview/PreviewServiceTest.php +++ b/tests/lib/Preview/PreviewServiceTest.php @@ -22,6 +22,7 @@ class PreviewServiceTest extends TestCase { private PreviewService $previewService; private PreviewMapper $previewMapper; + #[\Override] protected function setUp(): void { parent::setUp(); $this->previewService = Server::get(PreviewService::class); @@ -29,6 +30,7 @@ class PreviewServiceTest extends TestCase { $this->previewService->deleteAll(); } + #[\Override] public function tearDown(): void { $this->previewService->deleteAll(); parent::tearDown(); diff --git a/tests/lib/Preview/Provider.php b/tests/lib/Preview/Provider.php index 5801f5451bf..1d1b473213b 100644 --- a/tests/lib/Preview/Provider.php +++ b/tests/lib/Preview/Provider.php @@ -33,6 +33,7 @@ abstract class Provider extends \Test\TestCase { protected View $rootView; protected Storage $storage; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -55,6 +56,7 @@ abstract class Provider extends \Test\TestCase { $this->userId = $userId; } + #[\Override] protected function tearDown(): void { $this->logout(); diff --git a/tests/lib/Preview/SVGTest.php b/tests/lib/Preview/SVGTest.php index 2fad4720345..f6dc2f2c68c 100644 --- a/tests/lib/Preview/SVGTest.php +++ b/tests/lib/Preview/SVGTest.php @@ -19,6 +19,7 @@ use OCP\Files\File; */ #[\PHPUnit\Framework\Attributes\Group('DB')] class SVGTest extends Provider { + #[\Override] protected function setUp(): void { $checkImagick = new \Imagick(); if (count($checkImagick->queryFormats('SVG')) === 1) { diff --git a/tests/lib/Preview/Storage/LocalPreviewStorageTest.php b/tests/lib/Preview/Storage/LocalPreviewStorageTest.php index 9257ffe5dc5..dbc3cea5342 100644 --- a/tests/lib/Preview/Storage/LocalPreviewStorageTest.php +++ b/tests/lib/Preview/Storage/LocalPreviewStorageTest.php @@ -41,6 +41,7 @@ class LocalPreviewStorageTest extends TestCase { /** File ID used across the single-file tests. */ private const FILE_ID = 1; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -77,6 +78,7 @@ class LocalPreviewStorageTest extends TestCase { ); } + #[\Override] protected function tearDown(): void { $this->removeDir($this->tmpDir); parent::tearDown(); @@ -199,6 +201,7 @@ class LocalPreviewStorageTest extends TestCase { ->willReturn($this->buildQueryBuilderMock([$filecacheRow])); $ucvException = new class('duplicate key') extends DBException { + #[\Override] public function getReason(): int { return self::REASON_UNIQUE_CONSTRAINT_VIOLATION; } @@ -234,6 +237,7 @@ class LocalPreviewStorageTest extends TestCase { ->willReturn($this->buildQueryBuilderMock([$filecacheRow])); $driverException = new class('some driver error') extends DBException { + #[\Override] public function getReason(): int { return self::REASON_DRIVER; } diff --git a/tests/lib/Preview/TXTTest.php b/tests/lib/Preview/TXTTest.php index c1c9952c68b..ec62e652739 100644 --- a/tests/lib/Preview/TXTTest.php +++ b/tests/lib/Preview/TXTTest.php @@ -18,6 +18,7 @@ use OC\Preview\TXT; */ #[\PHPUnit\Framework\Attributes\Group('DB')] class TXTTest extends Provider { + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Profile/Actions/FediverseActionTest.php b/tests/lib/Profile/Actions/FediverseActionTest.php index 7f4c7d96301..5eddb6b9e38 100644 --- a/tests/lib/Profile/Actions/FediverseActionTest.php +++ b/tests/lib/Profile/Actions/FediverseActionTest.php @@ -29,6 +29,7 @@ class FediverseActionTest extends TestCase { private IL10N&MockObject $l10n; private IURLGenerator&MockObject $urlGenerator; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Remote/Api/OCSTest.php b/tests/lib/Remote/Api/OCSTest.php index 89fd45f0791..e89bba91238 100644 --- a/tests/lib/Remote/Api/OCSTest.php +++ b/tests/lib/Remote/Api/OCSTest.php @@ -22,6 +22,7 @@ class OCSTest extends TestCase { /** @var IInstanceFactory */ private $instanceFactory; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Remote/InstanceTest.php b/tests/lib/Remote/InstanceTest.php index 560706e4572..edf0ff0fa3f 100644 --- a/tests/lib/Remote/InstanceTest.php +++ b/tests/lib/Remote/InstanceTest.php @@ -19,6 +19,7 @@ class InstanceTest extends TestCase { /** @var ICache */ private $cache; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Repair/CleanTagsTest.php b/tests/lib/Repair/CleanTagsTest.php index 80d16b9444f..2a535f854e5 100644 --- a/tests/lib/Repair/CleanTagsTest.php +++ b/tests/lib/Repair/CleanTagsTest.php @@ -32,6 +32,7 @@ class CleanTagsTest extends \Test\TestCase { private IUserManager&MockObject $userManager; private IOutput&MockObject $outputMock; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -48,6 +49,7 @@ class CleanTagsTest extends \Test\TestCase { $this->cleanUpTables(); } + #[\Override] protected function tearDown(): void { $this->cleanUpTables(); diff --git a/tests/lib/Repair/ClearFrontendCachesTest.php b/tests/lib/Repair/ClearFrontendCachesTest.php index 3e5927565fe..de19ad19e31 100644 --- a/tests/lib/Repair/ClearFrontendCachesTest.php +++ b/tests/lib/Repair/ClearFrontendCachesTest.php @@ -22,6 +22,7 @@ class ClearFrontendCachesTest extends \Test\TestCase { protected ClearFrontendCaches $repair; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php b/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php index 43203d489e6..ce188fe3fb8 100644 --- a/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php +++ b/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php @@ -21,6 +21,7 @@ class ClearGeneratedAvatarCacheTest extends \Test\TestCase { protected ClearGeneratedAvatarCache $repair; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Repair/NC29/SanitizeAccountPropertiesJobTest.php b/tests/lib/Repair/NC29/SanitizeAccountPropertiesJobTest.php index 2a4f6e9ecf1..2d62601a190 100644 --- a/tests/lib/Repair/NC29/SanitizeAccountPropertiesJobTest.php +++ b/tests/lib/Repair/NC29/SanitizeAccountPropertiesJobTest.php @@ -27,6 +27,7 @@ class SanitizeAccountPropertiesJobTest extends TestCase { private SanitizeAccountPropertiesJob $job; + #[\Override] protected function setUp(): void { $this->userManager = $this->createMock(IUserManager::class); $this->accountManager = $this->createMock(IAccountManager::class); diff --git a/tests/lib/Repair/NC29/SanitizeAccountPropertiesTest.php b/tests/lib/Repair/NC29/SanitizeAccountPropertiesTest.php index d0d33eb2817..652873a299f 100644 --- a/tests/lib/Repair/NC29/SanitizeAccountPropertiesTest.php +++ b/tests/lib/Repair/NC29/SanitizeAccountPropertiesTest.php @@ -18,6 +18,7 @@ class SanitizeAccountPropertiesTest extends TestCase { private IJobList&MockObject $jobList; private SanitizeAccountProperties $repairStep; + #[\Override] protected function setUp(): void { $this->jobList = $this->createMock(IJobList::class); diff --git a/tests/lib/Repair/OldGroupMembershipSharesTest.php b/tests/lib/Repair/OldGroupMembershipSharesTest.php index 6eb1a63fd4e..ad681d1af1a 100644 --- a/tests/lib/Repair/OldGroupMembershipSharesTest.php +++ b/tests/lib/Repair/OldGroupMembershipSharesTest.php @@ -28,6 +28,7 @@ class OldGroupMembershipSharesTest extends \Test\TestCase { private IDBConnection $connection; private IGroupManager&MockObject $groupManager; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -39,6 +40,7 @@ class OldGroupMembershipSharesTest extends \Test\TestCase { $this->deleteAllShares(); } + #[\Override] protected function tearDown(): void { $this->deleteAllShares(); diff --git a/tests/lib/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php b/tests/lib/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php index fc88ee5d226..77036dc73c3 100644 --- a/tests/lib/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php +++ b/tests/lib/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php @@ -27,6 +27,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase { private IUserManager&MockObject $userManager; private CleanPreviewsBackgroundJob $job; + #[\Override] public function setUp(): void { parent::setUp(); diff --git a/tests/lib/Repair/Owncloud/CleanPreviewsTest.php b/tests/lib/Repair/Owncloud/CleanPreviewsTest.php index 6e86ee71762..243e04149d2 100644 --- a/tests/lib/Repair/Owncloud/CleanPreviewsTest.php +++ b/tests/lib/Repair/Owncloud/CleanPreviewsTest.php @@ -22,6 +22,7 @@ class CleanPreviewsTest extends TestCase { private IAppConfig&MockObject $appConfig; private CleanPreviews $repair; + #[\Override] public function setUp(): void { parent::setUp(); diff --git a/tests/lib/Repair/Owncloud/UpdateLanguageCodesTest.php b/tests/lib/Repair/Owncloud/UpdateLanguageCodesTest.php index 7773fac7f59..79c379b7a49 100644 --- a/tests/lib/Repair/Owncloud/UpdateLanguageCodesTest.php +++ b/tests/lib/Repair/Owncloud/UpdateLanguageCodesTest.php @@ -28,6 +28,7 @@ class UpdateLanguageCodesTest extends TestCase { protected IDBConnection $connection; private IConfig&MockObject $config; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Repair/RepairCollationTest.php b/tests/lib/Repair/RepairCollationTest.php index 969c5b57b7f..c29e44778aa 100644 --- a/tests/lib/Repair/RepairCollationTest.php +++ b/tests/lib/Repair/RepairCollationTest.php @@ -22,6 +22,7 @@ class TestCollationRepair extends Collation { /** * @return string[] */ + #[\Override] public function getAllNonUTF8BinTables(IDBConnection $connection): array { return parent::getAllNonUTF8BinTables($connection); } @@ -42,6 +43,7 @@ class RepairCollationTest extends TestCase { private LoggerInterface&MockObject $logger; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -59,6 +61,7 @@ class RepairCollationTest extends TestCase { $this->repair = new TestCollationRepair($this->config, $this->logger, $this->connection, false); } + #[\Override] protected function tearDown(): void { $this->connection = Server::get(ConnectionAdapter::class); if ($this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_MYSQL) { diff --git a/tests/lib/Repair/RepairDavSharesTest.php b/tests/lib/Repair/RepairDavSharesTest.php index d0c1c2abca5..bbe92b01529 100644 --- a/tests/lib/Repair/RepairDavSharesTest.php +++ b/tests/lib/Repair/RepairDavSharesTest.php @@ -30,6 +30,7 @@ class RepairDavSharesTest extends TestCase { private IGroupManager&MockObject $groupManager; private RepairDavShares $repair; + #[\Override] public function setUp(): void { parent::setUp(); diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php index 3ffb1726e19..615247ab011 100644 --- a/tests/lib/Repair/RepairInvalidSharesTest.php +++ b/tests/lib/Repair/RepairInvalidSharesTest.php @@ -29,6 +29,7 @@ class RepairInvalidSharesTest extends TestCase { private RepairInvalidShares $repair; private IDBConnection $connection; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -46,6 +47,7 @@ class RepairInvalidSharesTest extends TestCase { $this->repair = new RepairInvalidShares($config, $this->connection); } + #[\Override] protected function tearDown(): void { $this->deleteAllShares(); diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php index 40272c18c72..b403f5879d3 100644 --- a/tests/lib/Repair/RepairMimeTypesTest.php +++ b/tests/lib/Repair/RepairMimeTypesTest.php @@ -31,6 +31,7 @@ class RepairMimeTypesTest extends \Test\TestCase { private IMimeTypeLoader $mimetypeLoader; private IDBConnection $db; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -61,6 +62,7 @@ class RepairMimeTypesTest extends \Test\TestCase { ); } + #[\Override] protected function tearDown(): void { $this->storage->getCache()->clear(); diff --git a/tests/lib/RepairTest.php b/tests/lib/RepairTest.php index fd1f6b42e41..04f07d792c5 100644 --- a/tests/lib/RepairTest.php +++ b/tests/lib/RepairTest.php @@ -25,10 +25,12 @@ class TestRepairStep implements IRepairStep { ) { } + #[\Override] public function getName() { return 'Test Name'; } + #[\Override] public function run(IOutput $out) { if ($this->warning) { $out->warning('Simulated warning'); @@ -44,6 +46,7 @@ class RepairTest extends TestCase { /** @var string[] */ private array $outputArray = []; + #[\Override] protected function setUp(): void { parent::setUp(); $dispatcher = Server::get(IEventDispatcher::class); diff --git a/tests/lib/Route/RouterTest.php b/tests/lib/Route/RouterTest.php index 05ebc90806b..0537372050c 100644 --- a/tests/lib/Route/RouterTest.php +++ b/tests/lib/Route/RouterTest.php @@ -29,6 +29,7 @@ class RouterTest extends TestCase { private Router $router; private IAppManager&MockObject $appManager; + #[\Override] protected function setUp(): void { parent::setUp(); /** @var LoggerInterface $logger */ diff --git a/tests/lib/Search/SearchComposerTest.php b/tests/lib/Search/SearchComposerTest.php index f8cf1410fad..87f0c0b39fc 100644 --- a/tests/lib/Search/SearchComposerTest.php +++ b/tests/lib/Search/SearchComposerTest.php @@ -33,6 +33,7 @@ class SearchComposerTest extends TestCase { private IAppConfig&MockObject $appConfig; private SearchComposer $searchComposer; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/Bruteforce/Backend/MemoryCacheBackendTest.php b/tests/lib/Security/Bruteforce/Backend/MemoryCacheBackendTest.php index e0289fa7ca9..c8483fcb86e 100644 --- a/tests/lib/Security/Bruteforce/Backend/MemoryCacheBackendTest.php +++ b/tests/lib/Security/Bruteforce/Backend/MemoryCacheBackendTest.php @@ -26,6 +26,7 @@ class MemoryCacheBackendTest extends TestCase { private $cache; private IBackend $backend; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/Bruteforce/CapabilitiesTest.php b/tests/lib/Security/Bruteforce/CapabilitiesTest.php index 438a24f2240..f5174baed18 100644 --- a/tests/lib/Security/Bruteforce/CapabilitiesTest.php +++ b/tests/lib/Security/Bruteforce/CapabilitiesTest.php @@ -24,6 +24,7 @@ class CapabilitiesTest extends TestCase { /** @var IThrottler|\PHPUnit\Framework\MockObject\MockObject */ private $throttler; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php index 669db4a2a2c..a7e2fda91ec 100644 --- a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php +++ b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php @@ -25,6 +25,7 @@ class ContentSecurityPolicyManagerTest extends TestCase { /** @var ContentSecurityPolicyManager */ private $contentSecurityPolicyManager; + #[\Override] protected function setUp(): void { parent::setUp(); $this->dispatcher = Server::get(IEventDispatcher::class); diff --git a/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php b/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php index 3765311155a..d0b063d49f1 100644 --- a/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php +++ b/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php @@ -24,6 +24,7 @@ class ContentSecurityPolicyNonceManagerTest extends TestCase { /** @var ContentSecurityPolicyNonceManager */ private $nonceManager; + #[\Override] protected function setUp(): void { $this->CSRFTokenManager = $this->createMock(CsrfTokenManager::class); $this->request = $this->createMock(Request::class); diff --git a/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php b/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php index 76fc3c281a9..c5b057d96aa 100644 --- a/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php +++ b/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php @@ -19,6 +19,7 @@ class CsrfTokenGeneratorTest extends \Test\TestCase { /** @var CsrfTokenGenerator */ private $csrfTokenGenerator; + #[\Override] protected function setUp(): void { parent::setUp(); $this->random = $this->getMockBuilder('\OCP\Security\ISecureRandom') diff --git a/tests/lib/Security/CSRF/CsrfTokenManagerTest.php b/tests/lib/Security/CSRF/CsrfTokenManagerTest.php index bc8291a0eac..9990e630c89 100644 --- a/tests/lib/Security/CSRF/CsrfTokenManagerTest.php +++ b/tests/lib/Security/CSRF/CsrfTokenManagerTest.php @@ -23,6 +23,7 @@ class CsrfTokenManagerTest extends \Test\TestCase { /** @var SessionStorage */ private $storageInterface; + #[\Override] protected function setUp(): void { parent::setUp(); $this->tokenGenerator = $this->getMockBuilder('\OC\Security\CSRF\CsrfTokenGenerator') diff --git a/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php index ec65732944d..022c3cda595 100644 --- a/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php +++ b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php @@ -19,6 +19,7 @@ class SessionStorageTest extends \Test\TestCase { /** @var SessionStorage */ private $sessionStorage; + #[\Override] protected function setUp(): void { parent::setUp(); $this->session = $this->getMockBuilder(ISession::class) diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php index 04262b62818..50911cab3f1 100644 --- a/tests/lib/Security/CertificateManagerTest.php +++ b/tests/lib/Security/CertificateManagerTest.php @@ -35,6 +35,7 @@ class CertificateManagerTest extends \Test\TestCase { private string $username; private ISecureRandom&MockObject $random; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -70,6 +71,7 @@ class CertificateManagerTest extends \Test\TestCase { ); } + #[\Override] protected function tearDown(): void { $user = Server::get(IUserManager::class)->get($this->username); if ($user !== null) { diff --git a/tests/lib/Security/CertificateTest.php b/tests/lib/Security/CertificateTest.php index ed2a3713e2c..02b67e14a68 100644 --- a/tests/lib/Security/CertificateTest.php +++ b/tests/lib/Security/CertificateTest.php @@ -20,6 +20,7 @@ class CertificateTest extends \Test\TestCase { /** @var Certificate That contains an expired certificate */ protected $expiredCertificate; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/CryptoTest.php b/tests/lib/Security/CryptoTest.php index 0f8575ab0b5..d9898e4090e 100644 --- a/tests/lib/Security/CryptoTest.php +++ b/tests/lib/Security/CryptoTest.php @@ -26,6 +26,7 @@ class CryptoTest extends \Test\TestCase { /** @var Crypto */ protected $crypto; + #[\Override] protected function setUp(): void { parent::setUp(); $this->crypto = new Crypto(Server::get(IConfig::class)); diff --git a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php index 01624cb92d3..c20c2a8d072 100644 --- a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php +++ b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php @@ -22,6 +22,7 @@ class FeaturePolicyManagerTest extends TestCase { /** @var FeaturePolicyManager */ private $manager; + #[\Override] protected function setUp(): void { parent::setUp(); $this->dispatcher = Server::get(IEventDispatcher::class); diff --git a/tests/lib/Security/HasherTest.php b/tests/lib/Security/HasherTest.php index 33130f86a73..b1dd1822690 100644 --- a/tests/lib/Security/HasherTest.php +++ b/tests/lib/Security/HasherTest.php @@ -106,6 +106,7 @@ class HasherTest extends \Test\TestCase { /** @var IConfig */ protected $config; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/IdentityProof/KeyTest.php b/tests/lib/Security/IdentityProof/KeyTest.php index 572bfbea619..732a4df5ddd 100644 --- a/tests/lib/Security/IdentityProof/KeyTest.php +++ b/tests/lib/Security/IdentityProof/KeyTest.php @@ -16,6 +16,7 @@ class KeyTest extends TestCase { /** @var Key */ private $key; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/IdentityProof/ManagerTest.php b/tests/lib/Security/IdentityProof/ManagerTest.php index 608b1cd4c30..db75252d192 100644 --- a/tests/lib/Security/IdentityProof/ManagerTest.php +++ b/tests/lib/Security/IdentityProof/ManagerTest.php @@ -35,6 +35,7 @@ class ManagerTest extends TestCase { private ICacheFactory&MockObject $cacheFactory; private ICache&MockObject $cache; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/IdentityProof/SignerTest.php b/tests/lib/Security/IdentityProof/SignerTest.php index 6dc73c072e4..41565f3a5a8 100644 --- a/tests/lib/Security/IdentityProof/SignerTest.php +++ b/tests/lib/Security/IdentityProof/SignerTest.php @@ -74,6 +74,7 @@ gQIDAQAB /** @var Signer */ private $signer; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/Ip/BruteforceAllowListTest.php b/tests/lib/Security/Ip/BruteforceAllowListTest.php index 1454b779c1b..da6fc41644e 100644 --- a/tests/lib/Security/Ip/BruteforceAllowListTest.php +++ b/tests/lib/Security/Ip/BruteforceAllowListTest.php @@ -30,6 +30,7 @@ class BruteforceAllowListTest extends TestCase { /** @var BruteforceAllowList */ private $allowList; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/Ip/RemoteAddressTest.php b/tests/lib/Security/Ip/RemoteAddressTest.php index a6619cffe8e..19464b6bb77 100644 --- a/tests/lib/Security/Ip/RemoteAddressTest.php +++ b/tests/lib/Security/Ip/RemoteAddressTest.php @@ -17,6 +17,7 @@ class RemoteAddressTest extends \Test\TestCase { private IConfig $config; private IRequest $request; + #[\Override] protected function setUp(): void { parent::setUp(); $this->config = $this->createMock(IConfig::class); diff --git a/tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php b/tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php index 24e3ab1a209..1b08092c362 100644 --- a/tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php +++ b/tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php @@ -28,6 +28,7 @@ class MemoryCacheBackendTest extends TestCase { /** @var MemoryCacheBackend */ private $memoryCache; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/RateLimiting/LimiterTest.php b/tests/lib/Security/RateLimiting/LimiterTest.php index b19d5c6feba..88ad895cd4f 100644 --- a/tests/lib/Security/RateLimiting/LimiterTest.php +++ b/tests/lib/Security/RateLimiting/LimiterTest.php @@ -24,6 +24,7 @@ class LimiterTest extends TestCase { private ILimiter $limiter; private LoggerInterface $logger; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/RemoteHostValidatorIntegrationTest.php b/tests/lib/Security/RemoteHostValidatorIntegrationTest.php index f5af0897f2c..d10a28a6f85 100644 --- a/tests/lib/Security/RemoteHostValidatorIntegrationTest.php +++ b/tests/lib/Security/RemoteHostValidatorIntegrationTest.php @@ -23,6 +23,7 @@ class RemoteHostValidatorIntegrationTest extends TestCase { private IConfig $config; private RemoteHostValidator $validator; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/RemoteHostValidatorTest.php b/tests/lib/Security/RemoteHostValidatorTest.php index b048b9dafd1..e9e29174554 100644 --- a/tests/lib/Security/RemoteHostValidatorTest.php +++ b/tests/lib/Security/RemoteHostValidatorTest.php @@ -28,6 +28,7 @@ class RemoteHostValidatorTest extends TestCase { private LoggerInterface $logger; private RemoteHostValidator $validator; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/SecureRandomTest.php b/tests/lib/Security/SecureRandomTest.php index 954fd85eaf1..13804a55f6c 100644 --- a/tests/lib/Security/SecureRandomTest.php +++ b/tests/lib/Security/SecureRandomTest.php @@ -35,6 +35,7 @@ class SecureRandomTest extends \Test\TestCase { /** @var SecureRandom */ protected $rng; + #[\Override] protected function setUp(): void { parent::setUp(); $this->rng = new SecureRandom(); diff --git a/tests/lib/Security/TrustedDomainHelperTest.php b/tests/lib/Security/TrustedDomainHelperTest.php index 8b671a93d06..ce2675c9750 100644 --- a/tests/lib/Security/TrustedDomainHelperTest.php +++ b/tests/lib/Security/TrustedDomainHelperTest.php @@ -20,6 +20,7 @@ class TrustedDomainHelperTest extends \Test\TestCase { /** @var IConfig */ protected $config; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/VerificationToken/VerificationTokenTest.php b/tests/lib/Security/VerificationToken/VerificationTokenTest.php index 7123cc8b013..ed5890afba5 100644 --- a/tests/lib/Security/VerificationToken/VerificationTokenTest.php +++ b/tests/lib/Security/VerificationToken/VerificationTokenTest.php @@ -34,6 +34,7 @@ class VerificationTokenTest extends TestCase { /** @var IJobList|MockObject */ protected $jobList; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/ServerTest.php b/tests/lib/ServerTest.php index 2587845cbd1..965dbb57f96 100644 --- a/tests/lib/ServerTest.php +++ b/tests/lib/ServerTest.php @@ -26,6 +26,7 @@ class ServerTest extends \Test\TestCase { protected $server; + #[\Override] protected function setUp(): void { parent::setUp(); $config = new Config(\OC::$configDir); diff --git a/tests/lib/Session/CryptoSessionDataTest.php b/tests/lib/Session/CryptoSessionDataTest.php index a30a3297094..e236d56d188 100644 --- a/tests/lib/Session/CryptoSessionDataTest.php +++ b/tests/lib/Session/CryptoSessionDataTest.php @@ -20,6 +20,7 @@ class CryptoSessionDataTest extends Session { /** @var ISession */ protected $wrappedSession; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Session/CryptoWrappingTest.php b/tests/lib/Session/CryptoWrappingTest.php index f377365b6e7..54d9345c803 100644 --- a/tests/lib/Session/CryptoWrappingTest.php +++ b/tests/lib/Session/CryptoWrappingTest.php @@ -23,6 +23,7 @@ class CryptoWrappingTest extends TestCase { /** @var CryptoSessionData */ protected $instance; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Session/MemoryTest.php b/tests/lib/Session/MemoryTest.php index 40977f1f3fb..d5691a541cd 100644 --- a/tests/lib/Session/MemoryTest.php +++ b/tests/lib/Session/MemoryTest.php @@ -12,6 +12,7 @@ use OC\Session\Memory; use OCP\Session\Exceptions\SessionNotAvailableException; class MemoryTest extends Session { + #[\Override] protected function setUp(): void { parent::setUp(); $this->instance = new Memory(); diff --git a/tests/lib/Session/Session.php b/tests/lib/Session/Session.php index 1e2e9370825..7b55cd39f62 100644 --- a/tests/lib/Session/Session.php +++ b/tests/lib/Session/Session.php @@ -14,6 +14,7 @@ abstract class Session extends \Test\TestCase { */ protected $instance; + #[\Override] protected function tearDown(): void { $this->instance->clear(); parent::tearDown(); diff --git a/tests/lib/Settings/DeclarativeManagerTest.php b/tests/lib/Settings/DeclarativeManagerTest.php index 59411e1f825..fc9fbe2379a 100644 --- a/tests/lib/Settings/DeclarativeManagerTest.php +++ b/tests/lib/Settings/DeclarativeManagerTest.php @@ -254,6 +254,7 @@ class DeclarativeManagerTest extends TestCase { public static bool $testSetInternalValueAfterChange = false; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php index 91277cc7f1e..4aa866502e2 100644 --- a/tests/lib/Settings/ManagerTest.php +++ b/tests/lib/Settings/ManagerTest.php @@ -44,6 +44,7 @@ class ManagerTest extends TestCase { /** @var ISubAdmin|MockObject */ private $subAdmin; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/SetupCheck/CheckServerResponseTraitTest.php b/tests/lib/SetupCheck/CheckServerResponseTraitTest.php index 3f7b498bfeb..64e1b499c4b 100644 --- a/tests/lib/SetupCheck/CheckServerResponseTraitTest.php +++ b/tests/lib/SetupCheck/CheckServerResponseTraitTest.php @@ -28,6 +28,7 @@ class CheckServerResponseTraitTest extends TestCase { private CheckServerResponseTraitImplementation $trait; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php index 1a48803ecd6..a5a867c1288 100644 --- a/tests/lib/SetupTest.php +++ b/tests/lib/SetupTest.php @@ -31,6 +31,7 @@ class SetupTest extends \Test\TestCase { protected Installer $installer; protected IEventDispatcher $eventDispatcher; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index aa5454bbe38..e21dddfca4b 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -84,6 +84,7 @@ class DefaultShareProviderTest extends \Test\TestCase { protected IShareManager&MockObject $shareManager; + #[\Override] protected function setUp(): void { $this->dbConn = Server::get(IDBConnection::class); $this->userManager = $this->createMock(IUserManager::class); @@ -121,6 +122,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ); } + #[\Override] protected function tearDown(): void { $this->dbConn->getQueryBuilder()->delete('share')->executeStatement(); $this->dbConn->getQueryBuilder()->delete('filecache')->runAcrossAllShards()->executeStatement(); diff --git a/tests/lib/Share20/LegacyHooksTest.php b/tests/lib/Share20/LegacyHooksTest.php index 091bd5fb8dc..b0e56e69039 100644 --- a/tests/lib/Share20/LegacyHooksTest.php +++ b/tests/lib/Share20/LegacyHooksTest.php @@ -46,6 +46,7 @@ class LegacyHooksTest extends TestCase { private IEventDispatcher $eventDispatcher; private IShareManager $manager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index e2ecbc45c0d..be9e817e8fb 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -104,6 +104,7 @@ class ManagerTest extends \Test\TestCase { protected IAppConfig&MockObject $appConfig; protected IDBConnection&MockObject $connection; + #[\Override] protected function setUp(): void { $this->logger = $this->createMock(LoggerInterface::class); $this->config = $this->createMock(IConfig::class); @@ -5193,6 +5194,7 @@ class DummyFactory implements IProviderFactory { * @param string $id * @return IShareProvider */ + #[\Override] public function getProvider($id) { return $this->provider; } @@ -5201,6 +5203,7 @@ class DummyFactory implements IProviderFactory { * @param int $shareType * @return IShareProvider */ + #[\Override] public function getProviderForType($shareType) { return $this->provider; } @@ -5208,10 +5211,12 @@ class DummyFactory implements IProviderFactory { /** * @return IShareProvider[] */ + #[\Override] public function getAllProviders() { return [$this->provider]; } + #[\Override] public function registerProvider(string $shareProvier): void { } } @@ -5227,10 +5232,12 @@ class DummyFactory2 extends DummyFactory { $this->provider2 = $provider; } + #[\Override] public function getAllProviders() { return [$this->provider, $this->provider2]; } + #[\Override] public function registerProvider(string $shareProvier): void { } } diff --git a/tests/lib/Share20/ShareByMailProviderTest.php b/tests/lib/Share20/ShareByMailProviderTest.php index c2fd0a77ee9..bcc6c8a4977 100644 --- a/tests/lib/Share20/ShareByMailProviderTest.php +++ b/tests/lib/Share20/ShareByMailProviderTest.php @@ -88,6 +88,7 @@ class ShareByMailProviderTest extends TestCase { /** @var SettingsManager|MockObject */ private $settingsManager; + #[\Override] protected function setUp(): void { $this->dbConn = Server::get(IDBConnection::class); $this->userManager = $this->createMock(IUserManager::class); @@ -128,6 +129,7 @@ class ShareByMailProviderTest extends TestCase { ); } + #[\Override] protected function tearDown(): void { $this->dbConn->getQueryBuilder()->delete('share')->executeStatement(); $this->dbConn->getQueryBuilder()->delete('filecache')->runAcrossAllShards()->executeStatement(); diff --git a/tests/lib/Share20/ShareHelperTest.php b/tests/lib/Share20/ShareHelperTest.php index 3928843cf7d..2a07a83dc14 100644 --- a/tests/lib/Share20/ShareHelperTest.php +++ b/tests/lib/Share20/ShareHelperTest.php @@ -20,6 +20,7 @@ class ShareHelperTest extends TestCase { /** @var ShareHelper */ private $helper; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Share20/ShareTest.php b/tests/lib/Share20/ShareTest.php index af843479b06..c3f198503f2 100644 --- a/tests/lib/Share20/ShareTest.php +++ b/tests/lib/Share20/ShareTest.php @@ -25,6 +25,7 @@ class ShareTest extends \Test\TestCase { protected IUserManager&MockObject $userManager; protected IShare $share; + #[\Override] protected function setUp(): void { $this->rootFolder = $this->createMock(IRootFolder::class); $this->userManager = $this->createMock(IUserManager::class); diff --git a/tests/lib/Snowflake/APCuTest.php b/tests/lib/Snowflake/APCuTest.php index 646f70ff01a..ab797a5e9b4 100644 --- a/tests/lib/Snowflake/APCuTest.php +++ b/tests/lib/Snowflake/APCuTest.php @@ -17,6 +17,7 @@ use OC\Snowflake\APCuSequence; class APCuTest extends ISequenceBase { private string $path; + #[\Override] public function setUp():void { $this->sequence = new APCuSequence(); } diff --git a/tests/lib/Snowflake/DecoderTest.php b/tests/lib/Snowflake/DecoderTest.php index 2c111a1b46f..4a1ea423c8b 100644 --- a/tests/lib/Snowflake/DecoderTest.php +++ b/tests/lib/Snowflake/DecoderTest.php @@ -17,6 +17,7 @@ use Test\TestCase; class DecoderTest extends TestCase { private SnowflakeDecoder $decoder; + #[\Override] public function setUp():void { $this->decoder = new SnowflakeDecoder(); } diff --git a/tests/lib/Snowflake/FileSequenceTest.php b/tests/lib/Snowflake/FileSequenceTest.php index 08e6357f363..ed3f4e79a9f 100644 --- a/tests/lib/Snowflake/FileSequenceTest.php +++ b/tests/lib/Snowflake/FileSequenceTest.php @@ -18,6 +18,7 @@ use OCP\ITempManager; class FileSequenceTest extends ISequenceBase { private string $path; + #[\Override] public function setUp():void { $tempManager = $this->createMock(ITempManager::class); $this->path = sys_get_temp_dir(); @@ -25,6 +26,7 @@ class FileSequenceTest extends ISequenceBase { $this->sequence = new FileSequence($tempManager); } + #[\Override] public function tearDown():void { $lockDirectory = $this->path . '/' . FileSequence::LOCK_FILE_DIRECTORY; foreach (glob($lockDirectory . '/*') as $file) { diff --git a/tests/lib/Snowflake/GeneratorTest.php b/tests/lib/Snowflake/GeneratorTest.php index 6d073e31343..4b1fdcb804d 100644 --- a/tests/lib/Snowflake/GeneratorTest.php +++ b/tests/lib/Snowflake/GeneratorTest.php @@ -28,6 +28,7 @@ class GeneratorTest extends TestCase { private IConfig&MockObject $config; private ISequence&MockObject $sequence; + #[\Override] public function setUp():void { $this->decoder = new SnowflakeDecoder(); diff --git a/tests/lib/SubAdminTest.php b/tests/lib/SubAdminTest.php index 1446cab040d..0086415019f 100644 --- a/tests/lib/SubAdminTest.php +++ b/tests/lib/SubAdminTest.php @@ -39,6 +39,7 @@ class SubAdminTest extends \Test\TestCase { /** @var IGroup[] */ private $groups; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -84,6 +85,7 @@ class SubAdminTest extends \Test\TestCase { ->executeStatement(); } + #[\Override] protected function tearDown(): void { foreach ($this->users as $user) { $user->delete(); diff --git a/tests/lib/Support/CrashReport/RegistryTest.php b/tests/lib/Support/CrashReport/RegistryTest.php index adf7579b202..2355d6c7322 100644 --- a/tests/lib/Support/CrashReport/RegistryTest.php +++ b/tests/lib/Support/CrashReport/RegistryTest.php @@ -20,6 +20,7 @@ use Test\TestCase; class RegistryTest extends TestCase { private Registry $registry; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Support/Subscription/DummySubscription.php b/tests/lib/Support/Subscription/DummySubscription.php index 4513bf278f6..58aea78434a 100644 --- a/tests/lib/Support/Subscription/DummySubscription.php +++ b/tests/lib/Support/Subscription/DummySubscription.php @@ -28,6 +28,7 @@ class DummySubscription implements ISubscription { /** * @inheritDoc */ + #[\Override] public function hasValidSubscription(): bool { return $this->hasValidSubscription; } @@ -35,10 +36,12 @@ class DummySubscription implements ISubscription { /** * @inheritDoc */ + #[\Override] public function hasExtendedSupport(): bool { return $this->hasExtendedSupport; } + #[\Override] public function isHardUserLimitReached(): bool { return $this->isHardUserLimitReached; } diff --git a/tests/lib/Support/Subscription/RegistryTest.php b/tests/lib/Support/Subscription/RegistryTest.php index 52014200932..0be3d350142 100644 --- a/tests/lib/Support/Subscription/RegistryTest.php +++ b/tests/lib/Support/Subscription/RegistryTest.php @@ -30,6 +30,7 @@ class RegistryTest extends TestCase { private MockObject&LoggerInterface $logger; private MockObject&IManager $notificationManager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/SystemTag/SystemTagManagerTest.php b/tests/lib/SystemTag/SystemTagManagerTest.php index f5c9645a51e..ad9e0a81abd 100644 --- a/tests/lib/SystemTag/SystemTagManagerTest.php +++ b/tests/lib/SystemTag/SystemTagManagerTest.php @@ -37,6 +37,7 @@ class SystemTagManagerTest extends TestCase { private IAppConfig $appConfig; private IEventDispatcher $dispatcher; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -57,6 +58,7 @@ class SystemTagManagerTest extends TestCase { $this->pruneTagsTables(); } + #[\Override] protected function tearDown(): void { $this->pruneTagsTables(); \OC::$CLI = true; diff --git a/tests/lib/SystemTag/SystemTagObjectMapperTest.php b/tests/lib/SystemTag/SystemTagObjectMapperTest.php index 5542d046d88..d0efd419770 100644 --- a/tests/lib/SystemTag/SystemTagObjectMapperTest.php +++ b/tests/lib/SystemTag/SystemTagObjectMapperTest.php @@ -65,6 +65,7 @@ class SystemTagObjectMapperTest extends TestCase { */ private $tag3; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -106,6 +107,7 @@ class SystemTagObjectMapperTest extends TestCase { $this->tagMapper->assignTags('3', 'anothertype', $this->tag1->getId()); } + #[\Override] protected function tearDown(): void { $this->pruneTagsTables(); parent::tearDown(); diff --git a/tests/lib/TagsTest.php b/tests/lib/TagsTest.php index 6dc43300dfc..e2ef9eb25c0 100644 --- a/tests/lib/TagsTest.php +++ b/tests/lib/TagsTest.php @@ -36,6 +36,7 @@ class TagsTest extends \Test\TestCase { protected TagMapper $tagMapper; protected TagManager $tagMgr; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -83,6 +84,7 @@ class TagsTest extends \Test\TestCase { ); } + #[\Override] protected function tearDown(): void { $conn = Server::get(IDBConnection::class); $conn->executeQuery('DELETE FROM `*PREFIX*vcategory_to_object`'); diff --git a/tests/lib/Talk/BrokerTest.php b/tests/lib/Talk/BrokerTest.php index dc901047b92..cad0d14b7b2 100644 --- a/tests/lib/Talk/BrokerTest.php +++ b/tests/lib/Talk/BrokerTest.php @@ -30,6 +30,7 @@ class BrokerTest extends TestCase { private Broker $broker; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/TaskProcessing/TaskProcessingTest.php b/tests/lib/TaskProcessing/TaskProcessingTest.php index 6cc382b670d..a65e4d5e163 100644 --- a/tests/lib/TaskProcessing/TaskProcessingTest.php +++ b/tests/lib/TaskProcessing/TaskProcessingTest.php @@ -62,24 +62,29 @@ use Test\BackgroundJob\DummyJobList; class AudioToImage implements ITaskType { public const ID = 'test:audiotoimage'; + #[\Override] public function getId(): string { return self::ID; } + #[\Override] public function getName(): string { return self::class; } + #[\Override] public function getDescription(): string { return self::class; } + #[\Override] public function getInputShape(): array { return [ 'audio' => new ShapeDescriptor('Audio', 'The audio', EShapeType::Audio), ]; } + #[\Override] public function getOutputShape(): array { return [ 'spectrogram' => new ShapeDescriptor('Spectrogram', 'The audio spectrogram', EShapeType::Image), @@ -88,54 +93,66 @@ class AudioToImage implements ITaskType { } class AsyncProvider implements IProvider { + #[\Override] public function getId(): string { return 'test:sync:success'; } + #[\Override] public function getName(): string { return self::class; } + #[\Override] public function getTaskTypeId(): string { return AudioToImage::ID; } + #[\Override] public function getExpectedRuntime(): int { return 10; } + #[\Override] public function getOptionalInputShape(): array { return [ 'optionalKey' => new ShapeDescriptor('optional Key', 'AN optional key', EShapeType::Text), ]; } + #[\Override] public function getOptionalOutputShape(): array { return [ 'optionalKey' => new ShapeDescriptor('optional Key', 'AN optional key', EShapeType::Text), ]; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } @@ -144,58 +161,71 @@ class AsyncProvider implements IProvider { class SuccessfulSyncProvider implements IProvider, ISynchronousProvider { public const ID = 'test:sync:success'; + #[\Override] public function getId(): string { return self::ID; } + #[\Override] public function getName(): string { return self::class; } + #[\Override] public function getTaskTypeId(): string { return TextToText::ID; } + #[\Override] public function getExpectedRuntime(): int { return 10; } + #[\Override] public function getOptionalInputShape(): array { return [ 'optionalKey' => new ShapeDescriptor('optional Key', 'AN optional key', EShapeType::Text), ]; } + #[\Override] public function getOptionalOutputShape(): array { return [ 'optionalKey' => new ShapeDescriptor('optional Key', 'AN optional key', EShapeType::Text), ]; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { return ['output' => $input['input']]; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } @@ -205,58 +235,71 @@ class SuccessfulSyncProvider implements IProvider, ISynchronousProvider { class FailingSyncProvider implements IProvider, ISynchronousProvider { public const ERROR_MESSAGE = 'Failure'; + #[\Override] public function getId(): string { return 'test:sync:fail'; } + #[\Override] public function getName(): string { return self::class; } + #[\Override] public function getTaskTypeId(): string { return TextToText::ID; } + #[\Override] public function getExpectedRuntime(): int { return 10; } + #[\Override] public function getOptionalInputShape(): array { return [ 'optionalKey' => new ShapeDescriptor('optional Key', 'AN optional key', EShapeType::Text), ]; } + #[\Override] public function getOptionalOutputShape(): array { return [ 'optionalKey' => new ShapeDescriptor('optional Key', 'AN optional key', EShapeType::Text), ]; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { throw new ProcessingException(self::ERROR_MESSAGE); } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } @@ -266,116 +309,142 @@ class FailingSyncProvider implements IProvider, ISynchronousProvider { class FailingSyncProviderWithUserFacingError implements IProvider, ISynchronousProvider { public const ERROR_MESSAGE = 'Failure'; public const USER_FACING_ERROR_MESSAGE = 'User-facing Failure'; + #[\Override] public function getId(): string { return 'test:sync:fail:user-facing'; } + #[\Override] public function getName(): string { return self::class; } + #[\Override] public function getTaskTypeId(): string { return TextToText::ID; } + #[\Override] public function getExpectedRuntime(): int { return 10; } + #[\Override] public function getOptionalInputShape(): array { return [ 'optionalKey' => new ShapeDescriptor('optional Key', 'AN optional key', EShapeType::Text), ]; } + #[\Override] public function getOptionalOutputShape(): array { return [ 'optionalKey' => new ShapeDescriptor('optional Key', 'AN optional key', EShapeType::Text), ]; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { throw new UserFacingProcessingException(self::ERROR_MESSAGE, userFacingMessage: self::USER_FACING_ERROR_MESSAGE); } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } } class BrokenSyncProvider implements IProvider, ISynchronousProvider { + #[\Override] public function getId(): string { return 'test:sync:broken-output'; } + #[\Override] public function getName(): string { return self::class; } + #[\Override] public function getTaskTypeId(): string { return TextToText::ID; } + #[\Override] public function getExpectedRuntime(): int { return 10; } + #[\Override] public function getOptionalInputShape(): array { return [ 'optionalKey' => new ShapeDescriptor('optional Key', 'AN optional key', EShapeType::Text), ]; } + #[\Override] public function getOptionalOutputShape(): array { return [ 'optionalKey' => new ShapeDescriptor('optional Key', 'AN optional key', EShapeType::Text), ]; } + #[\Override] public function process(?string $userId, array $input, callable $reportProgress): array { return []; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } @@ -384,15 +453,18 @@ class BrokenSyncProvider implements IProvider, ISynchronousProvider { class SuccessfulTextProcessingSummaryProvider implements \OCP\TextProcessing\IProvider { public bool $ran = false; + #[\Override] public function getName(): string { return 'TEST Vanilla LLM Provider'; } + #[\Override] public function process(string $prompt): string { $this->ran = true; return $prompt . ' Summarize'; } + #[\Override] public function getTaskType(): string { return SummaryTaskType::class; } @@ -401,15 +473,18 @@ class SuccessfulTextProcessingSummaryProvider implements \OCP\TextProcessing\IPr class FailingTextProcessingSummaryProvider implements \OCP\TextProcessing\IProvider { public bool $ran = false; + #[\Override] public function getName(): string { return 'TEST Vanilla LLM Provider'; } + #[\Override] public function process(string $prompt): string { $this->ran = true; throw new \Exception('ERROR'); } + #[\Override] public function getTaskType(): string { return SummaryTaskType::class; } @@ -418,14 +493,17 @@ class FailingTextProcessingSummaryProvider implements \OCP\TextProcessing\IProvi class SuccessfulTextToImageProvider implements \OCP\TextToImage\IProvider { public bool $ran = false; + #[\Override] public function getId(): string { return 'test:successful'; } + #[\Override] public function getName(): string { return 'TEST Provider'; } + #[\Override] public function generate(string $prompt, array $resources): void { $this->ran = true; foreach ($resources as $resource) { @@ -433,6 +511,7 @@ class SuccessfulTextToImageProvider implements \OCP\TextToImage\IProvider { } } + #[\Override] public function getExpectedRuntime(): int { return 1; } @@ -441,19 +520,23 @@ class SuccessfulTextToImageProvider implements \OCP\TextToImage\IProvider { class FailingTextToImageProvider implements \OCP\TextToImage\IProvider { public bool $ran = false; + #[\Override] public function getId(): string { return 'test:failing'; } + #[\Override] public function getName(): string { return 'TEST Provider'; } + #[\Override] public function generate(string $prompt, array $resources): void { $this->ran = true; throw new \RuntimeException('ERROR'); } + #[\Override] public function getExpectedRuntime(): int { return 1; } @@ -463,39 +546,51 @@ class ExternalProvider implements IProvider { public const ID = 'event:external:provider'; public const TASK_TYPE_ID = 'event:external:tasktype'; + #[\Override] public function getId(): string { return self::ID; } + #[\Override] public function getName(): string { return 'External Provider via Event'; } + #[\Override] public function getTaskTypeId(): string { return self::TASK_TYPE_ID; } + #[\Override] public function getExpectedRuntime(): int { return 5; } + #[\Override] public function getOptionalInputShape(): array { return []; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } @@ -506,43 +601,56 @@ class ExternalTriggerableProvider implements ITriggerableProvider { public const ID = 'event:external:provider:triggerable'; public const TASK_TYPE_ID = TextToText::ID; + #[\Override] public function getId(): string { return self::ID; } + #[\Override] public function getName(): string { return 'External Triggerable Provider via Event'; } + #[\Override] public function getTaskTypeId(): string { return self::TASK_TYPE_ID; } + #[\Override] public function trigger(): void { } + #[\Override] public function getExpectedRuntime(): int { return 5; } + #[\Override] public function getOptionalInputShape(): array { return []; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } @@ -553,39 +661,51 @@ class ConflictingExternalProvider implements IProvider { public const ID = 'test:sync:success'; public const TASK_TYPE_ID = 'event:external:tasktype'; // Can be different task type + #[\Override] public function getId(): string { return self::ID; } + #[\Override] public function getName(): string { return 'Conflicting External Provider'; } + #[\Override] public function getTaskTypeId(): string { return self::TASK_TYPE_ID; } + #[\Override] public function getExpectedRuntime(): int { return 50; } + #[\Override] public function getOptionalInputShape(): array { return []; } + #[\Override] public function getOptionalOutputShape(): array { return []; } + #[\Override] public function getInputShapeEnumValues(): array { return []; } + #[\Override] public function getInputShapeDefaults(): array { return []; } + #[\Override] public function getOptionalInputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalInputShapeDefaults(): array { return []; } + #[\Override] public function getOutputShapeEnumValues(): array { return []; } + #[\Override] public function getOptionalOutputShapeEnumValues(): array { return []; } @@ -594,18 +714,23 @@ class ConflictingExternalProvider implements IProvider { class ExternalTaskType implements ITaskType { public const ID = 'event:external:tasktype'; + #[\Override] public function getId(): string { return self::ID; } + #[\Override] public function getName(): string { return 'External Task Type via Event'; } + #[\Override] public function getDescription(): string { return 'A task type added via event'; } + #[\Override] public function getInputShape(): array { return ['external_input' => new ShapeDescriptor('Ext In', '', EShapeType::Text)]; } + #[\Override] public function getOutputShape(): array { return ['external_output' => new ShapeDescriptor('Ext Out', '', EShapeType::Text)]; } @@ -615,18 +740,23 @@ class ConflictingExternalTaskType implements ITaskType { // Same ID as built-in TextToText public const ID = TextToText::ID; + #[\Override] public function getId(): string { return self::ID; } + #[\Override] public function getName(): string { return 'Conflicting External Task Type'; } + #[\Override] public function getDescription(): string { return 'Overrides built-in TextToText'; } + #[\Override] public function getInputShape(): array { return ['override_input' => new ShapeDescriptor('Override In', '', EShapeType::Number)]; } + #[\Override] public function getOutputShape(): array { return ['override_output' => new ShapeDescriptor('Override Out', '', EShapeType::Number)]; } @@ -651,6 +781,7 @@ class TaskProcessingTest extends \Test\TestCase { public const TEST_USER = 'testuser'; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/TempManagerTest.php b/tests/lib/TempManagerTest.php index f29b7aa6316..e63ad7d3cd9 100644 --- a/tests/lib/TempManagerTest.php +++ b/tests/lib/TempManagerTest.php @@ -17,6 +17,7 @@ use Psr\Log\LoggerInterface; class TempManagerTest extends \Test\TestCase { protected $baseDir = null; + #[\Override] protected function setUp(): void { parent::setUp(); @@ -26,6 +27,7 @@ class TempManagerTest extends \Test\TestCase { } } + #[\Override] protected function tearDown(): void { if ($this->baseDir !== null) { Files::rmdirr($this->baseDir); diff --git a/tests/lib/Template/CSSResourceLocatorTest.php b/tests/lib/Template/CSSResourceLocatorTest.php index 2db9899d0f9..69cb2b51e2e 100644 --- a/tests/lib/Template/CSSResourceLocatorTest.php +++ b/tests/lib/Template/CSSResourceLocatorTest.php @@ -34,6 +34,7 @@ class CSSResourceLocatorTest extends \Test\TestCase { private ITimeFactory&MockObject $timeFactory; private AppConfig&MockObject $appConfig; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Template/JSCombinerTest.php b/tests/lib/Template/JSCombinerTest.php index 52ed7e7056c..3d0b6bc445a 100644 --- a/tests/lib/Template/JSCombinerTest.php +++ b/tests/lib/Template/JSCombinerTest.php @@ -34,6 +34,7 @@ class JSCombinerTest extends \Test\TestCase { private JSCombiner $jsCombiner; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Template/JSResourceLocatorTest.php b/tests/lib/Template/JSResourceLocatorTest.php index 599346e03d8..cd0c2ab968b 100644 --- a/tests/lib/Template/JSResourceLocatorTest.php +++ b/tests/lib/Template/JSResourceLocatorTest.php @@ -28,6 +28,7 @@ class JSResourceLocatorTest extends \Test\TestCase { private LoggerInterface&MockObject $logger; private IAppManager&MockObject $appManager; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Template/ResourceLocatorTest.php b/tests/lib/Template/ResourceLocatorTest.php index c4bda7af93a..ab5c780ec61 100644 --- a/tests/lib/Template/ResourceLocatorTest.php +++ b/tests/lib/Template/ResourceLocatorTest.php @@ -20,6 +20,7 @@ class ResourceLocatorTest extends \Test\TestCase { private LoggerInterface&MockObject $logger; private IConfig&MockObject $config; + #[\Override] protected function setUp(): void { parent::setUp(); $this->logger = $this->createMock(LoggerInterface::class); diff --git a/tests/lib/TemplateFunctionsTest.php b/tests/lib/TemplateFunctionsTest.php index 3afb1e4e343..f3beb9261b9 100644 --- a/tests/lib/TemplateFunctionsTest.php +++ b/tests/lib/TemplateFunctionsTest.php @@ -9,6 +9,7 @@ namespace Test; class TemplateFunctionsTest extends \Test\TestCase { + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/TemplateLayoutTest.php b/tests/lib/TemplateLayoutTest.php index 5d988182324..788e46074ba 100644 --- a/tests/lib/TemplateLayoutTest.php +++ b/tests/lib/TemplateLayoutTest.php @@ -33,6 +33,7 @@ class TemplateLayoutTest extends \Test\TestCase { private TemplateLayout $templateLayout; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index c40c05b3de7..aed919a1e6f 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -45,6 +45,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { private static bool $wasDatabaseAllowed = false; protected array $services = []; + #[\Override] protected function onNotSuccessfulTest(\Throwable $t): never { $this->restoreAllServices(); @@ -124,6 +125,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { }); } + #[\Override] protected function setUp(): void { // overwrite the command bus with one we can run ourselves $this->commandBus = new QueueBus(); @@ -152,6 +154,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { } } + #[\Override] protected function tearDown(): void { $this->restoreAllServices(); @@ -275,6 +278,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { return $methods; } + #[\Override] public static function tearDownAfterClass(): void { if (!self::$wasDatabaseAllowed && self::$realDatabase !== null) { // in case an error is thrown in a test, PHPUnit jumps straight to tearDownAfterClass, diff --git a/tests/lib/TextProcessing/TextProcessingTest.php b/tests/lib/TextProcessing/TextProcessingTest.php index c25e5005467..5d80174d7ec 100644 --- a/tests/lib/TextProcessing/TextProcessingTest.php +++ b/tests/lib/TextProcessing/TextProcessingTest.php @@ -40,15 +40,18 @@ use Test\BackgroundJob\DummyJobList; class SuccessfulSummaryProvider implements IProvider { public bool $ran = false; + #[\Override] public function getName(): string { return 'TEST Vanilla LLM Provider'; } + #[\Override] public function process(string $prompt): string { $this->ran = true; return $prompt . ' Summarize'; } + #[\Override] public function getTaskType(): string { return SummaryTaskType::class; } @@ -57,15 +60,18 @@ class SuccessfulSummaryProvider implements IProvider { class FailingSummaryProvider implements IProvider { public bool $ran = false; + #[\Override] public function getName(): string { return 'TEST Vanilla LLM Provider'; } + #[\Override] public function process(string $prompt): string { $this->ran = true; throw new \Exception('ERROR'); } + #[\Override] public function getTaskType(): string { return SummaryTaskType::class; } @@ -74,15 +80,18 @@ class FailingSummaryProvider implements IProvider { class FreePromptProvider implements IProvider { public bool $ran = false; + #[\Override] public function getName(): string { return 'TEST Free Prompt Provider'; } + #[\Override] public function process(string $prompt): string { $this->ran = true; return $prompt . ' Free Prompt'; } + #[\Override] public function getTaskType(): string { return FreePromptTaskType::class; } @@ -101,6 +110,7 @@ class TextProcessingTest extends \Test\TestCase { private array $tasksDb; private IJobList $jobList; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Traits/UserTrait.php b/tests/lib/Traits/UserTrait.php index f80adb76be8..67db6b18e52 100644 --- a/tests/lib/Traits/UserTrait.php +++ b/tests/lib/Traits/UserTrait.php @@ -22,6 +22,7 @@ class DummyUser extends User { parent::__construct($this->uid, null, Server::get(IEventDispatcher::class)); } + #[\Override] public function getUID(): string { return $this->uid; } diff --git a/tests/lib/Updater/ReleaseMetadataTest.php b/tests/lib/Updater/ReleaseMetadataTest.php index e93d9fe64be..8fd744c5749 100644 --- a/tests/lib/Updater/ReleaseMetadataTest.php +++ b/tests/lib/Updater/ReleaseMetadataTest.php @@ -15,6 +15,7 @@ use PHPUnit\Framework\MockObject\MockObject; class ReleaseMetadataTest extends \Test\TestCase { private IClientService|MockObject $clientService; + #[\Override] protected function setUp(): void { parent::setUp(); $this->clientService = $this->createMock(IClientService::class); diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php index d8bce811898..3fdae38e363 100644 --- a/tests/lib/Updater/VersionCheckTest.php +++ b/tests/lib/Updater/VersionCheckTest.php @@ -29,6 +29,7 @@ class VersionCheckTest extends \Test\TestCase { private LoggerInterface&MockObject $logger; private ITimeFactory&MockObject $timeFactory; + #[\Override] protected function setUp(): void { parent::setUp(); $this->serverVersion = $this->createMock(ServerVersion::class); diff --git a/tests/lib/UpdaterTest.php b/tests/lib/UpdaterTest.php index c7717327ca9..059b4edeb34 100644 --- a/tests/lib/UpdaterTest.php +++ b/tests/lib/UpdaterTest.php @@ -36,6 +36,7 @@ class UpdaterTest extends TestCase { private $installer; private IAppManager&MockObject $appManager; + #[\Override] protected function setUp(): void { parent::setUp(); $this->serverVersion = $this->createMock(ServerVersion::class); diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php index b482ea1c11f..a3d36b00b34 100644 --- a/tests/lib/UrlGeneratorTest.php +++ b/tests/lib/UrlGeneratorTest.php @@ -37,6 +37,7 @@ class UrlGeneratorTest extends \Test\TestCase { /** @var string */ private $originalWebRoot; + #[\Override] protected function setUp(): void { parent::setUp(); $this->config = $this->createMock(IConfig::class); @@ -54,6 +55,7 @@ class UrlGeneratorTest extends \Test\TestCase { $this->originalWebRoot = \OC::$WEBROOT; } + #[\Override] protected function tearDown(): void { // Reset webRoot \OC::$WEBROOT = $this->originalWebRoot; diff --git a/tests/lib/User/AvailabilityCoordinatorTest.php b/tests/lib/User/AvailabilityCoordinatorTest.php index 09c1528912b..8244ec427e6 100644 --- a/tests/lib/User/AvailabilityCoordinatorTest.php +++ b/tests/lib/User/AvailabilityCoordinatorTest.php @@ -31,6 +31,7 @@ class AvailabilityCoordinatorTest extends TestCase { private LoggerInterface $logger; private MockObject|TimezoneService $timezoneService; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/User/DatabaseTest.php b/tests/lib/User/DatabaseTest.php index eae3aed0af5..aed21e05825 100644 --- a/tests/lib/User/DatabaseTest.php +++ b/tests/lib/User/DatabaseTest.php @@ -29,12 +29,14 @@ class DatabaseTest extends Backend { /** @var Database */ protected $backend; + #[\Override] public function getUser() { $user = parent::getUser(); $this->users[] = $user; return $user; } + #[\Override] protected function setUp(): void { parent::setUp(); @@ -43,6 +45,7 @@ class DatabaseTest extends Backend { $this->backend = new Database($this->eventDispatcher); } + #[\Override] protected function tearDown(): void { if (!isset($this->users)) { return; @@ -109,6 +112,7 @@ class DatabaseTest extends Backend { $this->assertTrue($this->backend->userExists($user1)); } + #[\Override] public function testSearch(): void { parent::testSearch(); diff --git a/tests/lib/User/Dummy.php b/tests/lib/User/Dummy.php index 4b59bc5a4f5..ef8f695929f 100644 --- a/tests/lib/User/Dummy.php +++ b/tests/lib/User/Dummy.php @@ -12,6 +12,7 @@ class Dummy extends Backend { public function __construct() { parent::__construct(static::class); } + #[\Override] protected function setUp(): void { parent::setUp(); $this->backend = new \Test\Util\User\Dummy(); diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php index f606ac4d805..f174951ed0b 100644 --- a/tests/lib/User/ManagerTest.php +++ b/tests/lib/User/ManagerTest.php @@ -34,6 +34,7 @@ class ManagerTest extends TestCase { private ICache&MockObject $cache; private LoggerInterface&MockObject $logger; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php index 84d5bc898a0..d21522f0c2a 100644 --- a/tests/lib/User/SessionTest.php +++ b/tests/lib/User/SessionTest.php @@ -69,6 +69,7 @@ class SessionTest extends \Test\TestCase { /** @var IEventDispatcher|MockObject */ private $dispatcher; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php index 750b99db420..76bcac21c01 100644 --- a/tests/lib/User/UserTest.php +++ b/tests/lib/User/UserTest.php @@ -32,6 +32,7 @@ use Test\TestCase; class UserTest extends TestCase { protected IEventDispatcher $dispatcher; + #[\Override] protected function setUp(): void { parent::setUp(); $this->dispatcher = Server::get(IEventDispatcher::class); diff --git a/tests/lib/Util/Group/Dummy.php b/tests/lib/Util/Group/Dummy.php index fab94cdc645..0680bfc262b 100644 --- a/tests/lib/Util/Group/Dummy.php +++ b/tests/lib/Util/Group/Dummy.php @@ -29,6 +29,7 @@ class Dummy extends ABackend implements ICreateGroupBackend, IDeleteGroupBackend * Tries to create a new group. If the group name already exists, false will * be returned. */ + #[\Override] public function createGroup(string $gid): bool { if (!isset($this->groups[$gid])) { $this->groups[$gid] = []; @@ -45,6 +46,7 @@ class Dummy extends ABackend implements ICreateGroupBackend, IDeleteGroupBackend * * Deletes a group and removes it from the group_user-table */ + #[\Override] public function deleteGroup(string $gid): bool { if (isset($this->groups[$gid])) { unset($this->groups[$gid]); @@ -62,6 +64,7 @@ class Dummy extends ABackend implements ICreateGroupBackend, IDeleteGroupBackend * * Checks whether the user is member of a group or not. */ + #[\Override] public function inGroup($uid, $gid) { if (isset($this->groups[$gid])) { return (array_search($uid, $this->groups[$gid]) !== false); @@ -78,6 +81,7 @@ class Dummy extends ABackend implements ICreateGroupBackend, IDeleteGroupBackend * * Adds a user to a group. */ + #[\Override] public function addToGroup(string $uid, string $gid): bool { if (isset($this->groups[$gid])) { if (array_search($uid, $this->groups[$gid]) === false) { @@ -99,6 +103,7 @@ class Dummy extends ABackend implements ICreateGroupBackend, IDeleteGroupBackend * * removes the user from a group. */ + #[\Override] public function removeFromGroup(string $uid, string $gid): bool { if (isset($this->groups[$gid])) { if (($index = array_search($uid, $this->groups[$gid])) !== false) { @@ -120,6 +125,7 @@ class Dummy extends ABackend implements ICreateGroupBackend, IDeleteGroupBackend * This function fetches all groups a user belongs to. It does not check * if the user exists at all. */ + #[\Override] public function getUserGroups($uid) { $groups = []; $allGroups = array_keys($this->groups); @@ -138,6 +144,7 @@ class Dummy extends ABackend implements ICreateGroupBackend, IDeleteGroupBackend * @param int $offset * @return array an array of group names */ + #[\Override] public function getGroups($search = '', $limit = -1, $offset = 0) { if (empty($search)) { return array_keys($this->groups); @@ -159,6 +166,7 @@ class Dummy extends ABackend implements ICreateGroupBackend, IDeleteGroupBackend * @param int $offset * @return array an array of user IDs */ + #[\Override] public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { if (isset($this->groups[$gid])) { if (empty($search)) { @@ -204,6 +212,7 @@ class Dummy extends ABackend implements ICreateGroupBackend, IDeleteGroupBackend * @param int $offset * @return int */ + #[\Override] public function countUsersInGroup(string $gid, string $search = ''): int { if (isset($this->groups[$gid])) { if (empty($search)) { @@ -220,6 +229,7 @@ class Dummy extends ABackend implements ICreateGroupBackend, IDeleteGroupBackend return 0; } + #[\Override] public function groupExists($gid) { return isset($this->groups[$gid]); } diff --git a/tests/lib/Util/User/Dummy.php b/tests/lib/Util/User/Dummy.php index 4a85f92981c..0ebb0455667 100644 --- a/tests/lib/Util/User/Dummy.php +++ b/tests/lib/Util/User/Dummy.php @@ -27,6 +27,7 @@ class Dummy extends Backend implements IUserBackend { } } + #[\Override] public function deleteUser($uid): bool { if (isset($this->users[$uid])) { unset($this->users[$uid]); @@ -60,6 +61,7 @@ class Dummy extends Backend implements IUserBackend { return false; } + #[\Override] public function getUsers($search = '', $limit = null, $offset = null): array { if (empty($search)) { return array_keys($this->users); @@ -73,10 +75,12 @@ class Dummy extends Backend implements IUserBackend { return $result; } + #[\Override] public function userExists($uid): bool { return isset($this->users[$uid]); } + #[\Override] public function hasUserListings(): bool { return true; } @@ -90,10 +94,12 @@ class Dummy extends Backend implements IUserBackend { return true; } + #[\Override] public function getDisplayName($uid): string { return $this->displayNames[$uid] ?? $uid; } + #[\Override] public function getBackendName(): string { return 'Dummy'; } diff --git a/tests/lib/UtilCheckServerTest.php b/tests/lib/UtilCheckServerTest.php index 210085ff1dd..fade2f6d341 100644 --- a/tests/lib/UtilCheckServerTest.php +++ b/tests/lib/UtilCheckServerTest.php @@ -40,6 +40,7 @@ class UtilCheckServerTest extends \Test\TestCase { return $config; } + #[\Override] protected function setUp(): void { parent::setUp(); @@ -49,6 +50,7 @@ class UtilCheckServerTest extends \Test\TestCase { Server::get(ISession::class)->set('checkServer_succeeded', false); } + #[\Override] protected function tearDown(): void { // clean up @unlink($this->datadir . '/.ncdata'); diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index d74129d8681..1e493eb2a76 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -174,6 +174,7 @@ class UtilTest extends \Test\TestCase { $this->assertNotEmpty($errors); } + #[\Override] protected function setUp(): void { parent::setUp(); @@ -181,6 +182,7 @@ class UtilTest extends \Test\TestCase { self::invokePrivate(Util::class, 'scripts', [[]]); self::invokePrivate(Util::class, 'scriptDeps', [[]]); } + #[\Override] protected function tearDown(): void { parent::tearDown(); diff --git a/vendor-bin/psalm/composer.json b/vendor-bin/psalm/composer.json index 385aa00bc1a..78da32f7fb6 100644 --- a/vendor-bin/psalm/composer.json +++ b/vendor-bin/psalm/composer.json @@ -1,10 +1,10 @@ { "require": { - "vimeo/psalm": "^5.9" + "vimeo/psalm": "^6.16" }, "config": { "platform": { - "php": "8.2" + "php": "8.2.27" }, "allow-plugins": { "composer/package-versions-deprecated": true diff --git a/vendor-bin/psalm/composer.lock b/vendor-bin/psalm/composer.lock index 2101e58472b..0e9b269c8ea 100644 --- a/vendor-bin/psalm/composer.lock +++ b/vendor-bin/psalm/composer.lock @@ -4,47 +4,40 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3c3342f1efd61cbab152269740efd448", + "content-hash": "7591b157e86a8c10c3360618317e822c", "packages": [ { "name": "amphp/amp", - "version": "v2.6.4", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/amphp/amp.git", - "reference": "ded3d9be08f526089eb7ee8d9f16a9768f9dec2d" + "reference": "fa0ab33a6f47a82929c38d03ca47ebb71086a93f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/ded3d9be08f526089eb7ee8d9f16a9768f9dec2d", - "reference": "ded3d9be08f526089eb7ee8d9f16a9768f9dec2d", + "url": "https://api.github.com/repos/amphp/amp/zipball/fa0ab33a6f47a82929c38d03ca47ebb71086a93f", + "reference": "fa0ab33a6f47a82929c38d03ca47ebb71086a93f", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" }, "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1", - "ext-json": "*", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^7 | ^8 | ^9", - "react/promise": "^2", - "vimeo/psalm": "^3.12" + "amphp/php-cs-fixer-config": "^2", + "phpunit/phpunit": "^9", + "psalm/phar": "5.23.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, "autoload": { "files": [ - "lib/functions.php", - "lib/Internal/functions.php" + "src/functions.php", + "src/Future/functions.php", + "src/Internal/functions.php" ], "psr-4": { - "Amp\\": "lib" + "Amp\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -52,10 +45,6 @@ "MIT" ], "authors": [ - { - "name": "Daniel Lowrey", - "email": "rdlowrey@php.net" - }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" @@ -67,6 +56,10 @@ { "name": "Niklas Keller", "email": "me@kelunik.com" + }, + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" } ], "description": "A non-blocking concurrency framework for PHP applications.", @@ -83,9 +76,8 @@ "promise" ], "support": { - "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/amp/issues", - "source": "https://github.com/amphp/amp/tree/v2.6.4" + "source": "https://github.com/amphp/amp/tree/v3.1.1" }, "funding": [ { @@ -93,41 +85,45 @@ "type": "github" } ], - "time": "2024-03-21T18:52:26+00:00" + "time": "2025-08-27T21:42:00+00:00" }, { "name": "amphp/byte-stream", - "version": "v1.8.2", + "version": "v2.1.2", "source": { "type": "git", "url": "https://github.com/amphp/byte-stream.git", - "reference": "4f0e968ba3798a423730f567b1b50d3441c16ddc" + "reference": "55a6bd071aec26fa2a3e002618c20c35e3df1b46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/byte-stream/zipball/4f0e968ba3798a423730f567b1b50d3441c16ddc", - "reference": "4f0e968ba3798a423730f567b1b50d3441c16ddc", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/55a6bd071aec26fa2a3e002618c20c35e3df1b46", + "reference": "55a6bd071aec26fa2a3e002618c20c35e3df1b46", "shasum": "" }, "require": { - "amphp/amp": "^2", - "php": ">=7.1" + "amphp/amp": "^3", + "amphp/parser": "^1.1", + "amphp/pipeline": "^1", + "amphp/serialization": "^1", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2.3" }, "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1.4", - "friendsofphp/php-cs-fixer": "^2.3", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^6 || ^7 || ^8", - "psalm/phar": "^3.11.4" + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "5.22.1" }, "type": "library", "autoload": { "files": [ - "lib/functions.php" + "src/functions.php", + "src/Internal/functions.php" ], "psr-4": { - "Amp\\ByteStream\\": "lib" + "Amp\\ByteStream\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -156,7 +152,7 @@ ], "support": { "issues": "https://github.com/amphp/byte-stream/issues", - "source": "https://github.com/amphp/byte-stream/tree/v1.8.2" + "source": "https://github.com/amphp/byte-stream/tree/v2.1.2" }, "funding": [ { @@ -164,20 +160,681 @@ "type": "github" } ], - "time": "2024-04-13T18:00:56+00:00" + "time": "2025-03-16T17:10:27+00:00" }, { - "name": "composer/pcre", - "version": "3.3.1", + "name": "amphp/cache", + "version": "v2.0.1", "source": { "type": "git", - "url": "https://github.com/composer/pcre.git", - "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4" + "url": "https://github.com/amphp/cache.git", + "reference": "46912e387e6aa94933b61ea1ead9cf7540b7797c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/63aaeac21d7e775ff9bc9d45021e1745c97521c4", - "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4", + "url": "https://api.github.com/repos/amphp/cache/zipball/46912e387e6aa94933b61ea1ead9cf7540b7797c", + "reference": "46912e387e6aa94933b61ea1ead9cf7540b7797c", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/serialization": "^1", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Amp\\Cache\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + } + ], + "description": "A fiber-aware cache API based on Amp and Revolt.", + "homepage": "https://amphp.org/cache", + "support": { + "issues": "https://github.com/amphp/cache/issues", + "source": "https://github.com/amphp/cache/tree/v2.0.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-04-19T03:38:06+00:00" + }, + { + "name": "amphp/dns", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/dns.git", + "reference": "78eb3db5fc69bf2fc0cb503c4fcba667bc223c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/dns/zipball/78eb3db5fc69bf2fc0cb503c4fcba667bc223c71", + "reference": "78eb3db5fc69bf2fc0cb503c4fcba667bc223c71", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/cache": "^2", + "amphp/parser": "^1", + "amphp/process": "^2", + "daverandom/libdns": "^2.0.2", + "ext-filter": "*", + "ext-json": "*", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "5.20" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Amp\\Dns\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Wright", + "email": "addr@daverandom.com" + }, + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + } + ], + "description": "Async DNS resolution for Amp.", + "homepage": "https://github.com/amphp/dns", + "keywords": [ + "amp", + "amphp", + "async", + "client", + "dns", + "resolve" + ], + "support": { + "issues": "https://github.com/amphp/dns/issues", + "source": "https://github.com/amphp/dns/tree/v2.4.0" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2025-01-19T15:43:40+00:00" + }, + { + "name": "amphp/parallel", + "version": "v2.3.3", + "source": { + "type": "git", + "url": "https://github.com/amphp/parallel.git", + "reference": "296b521137a54d3a02425b464e5aee4c93db2c60" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/parallel/zipball/296b521137a54d3a02425b464e5aee4c93db2c60", + "reference": "296b521137a54d3a02425b464e5aee4c93db2c60", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/cache": "^2", + "amphp/parser": "^1", + "amphp/pipeline": "^1", + "amphp/process": "^2", + "amphp/serialization": "^1", + "amphp/socket": "^2", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.18" + }, + "type": "library", + "autoload": { + "files": [ + "src/Context/functions.php", + "src/Context/Internal/functions.php", + "src/Ipc/functions.php", + "src/Worker/functions.php" + ], + "psr-4": { + "Amp\\Parallel\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Stephen Coakley", + "email": "me@stephencoakley.com" + } + ], + "description": "Parallel processing component for Amp.", + "homepage": "https://github.com/amphp/parallel", + "keywords": [ + "async", + "asynchronous", + "concurrent", + "multi-processing", + "multi-threading" + ], + "support": { + "issues": "https://github.com/amphp/parallel/issues", + "source": "https://github.com/amphp/parallel/tree/v2.3.3" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2025-11-15T06:23:42+00:00" + }, + { + "name": "amphp/parser", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/amphp/parser.git", + "reference": "3cf1f8b32a0171d4b1bed93d25617637a77cded7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/parser/zipball/3cf1f8b32a0171d4b1bed93d25617637a77cded7", + "reference": "3cf1f8b32a0171d4b1bed93d25617637a77cded7", + "shasum": "" + }, + "require": { + "php": ">=7.4" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Amp\\Parser\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A generator parser to make streaming parsers simple.", + "homepage": "https://github.com/amphp/parser", + "keywords": [ + "async", + "non-blocking", + "parser", + "stream" + ], + "support": { + "issues": "https://github.com/amphp/parser/issues", + "source": "https://github.com/amphp/parser/tree/v1.1.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-03-21T19:16:53+00:00" + }, + { + "name": "amphp/pipeline", + "version": "v1.2.3", + "source": { + "type": "git", + "url": "https://github.com/amphp/pipeline.git", + "reference": "7b52598c2e9105ebcddf247fc523161581930367" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/pipeline/zipball/7b52598c2e9105ebcddf247fc523161581930367", + "reference": "7b52598c2e9105ebcddf247fc523161581930367", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "php": ">=8.1", + "revolt/event-loop": "^1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.18" + }, + "type": "library", + "autoload": { + "psr-4": { + "Amp\\Pipeline\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Asynchronous iterators and operators.", + "homepage": "https://amphp.org/pipeline", + "keywords": [ + "amp", + "amphp", + "async", + "io", + "iterator", + "non-blocking" + ], + "support": { + "issues": "https://github.com/amphp/pipeline/issues", + "source": "https://github.com/amphp/pipeline/tree/v1.2.3" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2025-03-16T16:33:53+00:00" + }, + { + "name": "amphp/process", + "version": "v2.0.3", + "source": { + "type": "git", + "url": "https://github.com/amphp/process.git", + "reference": "52e08c09dec7511d5fbc1fb00d3e4e79fc77d58d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/process/zipball/52e08c09dec7511d5fbc1fb00d3e4e79fc77d58d", + "reference": "52e08c09dec7511d5fbc1fb00d3e4e79fc77d58d", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.4" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Amp\\Process\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A fiber-aware process manager based on Amp and Revolt.", + "homepage": "https://amphp.org/process", + "support": { + "issues": "https://github.com/amphp/process/issues", + "source": "https://github.com/amphp/process/tree/v2.0.3" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-04-19T03:13:44+00:00" + }, + { + "name": "amphp/serialization", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/serialization.git", + "reference": "fdf2834d78cebb0205fb2672676c1b1eb84371f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/serialization/zipball/fdf2834d78cebb0205fb2672676c1b1eb84371f0", + "reference": "fdf2834d78cebb0205fb2672676c1b1eb84371f0", + "shasum": "" + }, + "require": { + "php": ">=7.4" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "ext-json": "*", + "ext-zlib": "*", + "phpunit/phpunit": "^9", + "psalm/phar": "6.16.1" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Amp\\Serialization\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Serialization tools for IPC and data storage in PHP.", + "homepage": "https://github.com/amphp/serialization", + "keywords": [ + "async", + "asynchronous", + "serialization", + "serialize" + ], + "support": { + "issues": "https://github.com/amphp/serialization/issues", + "source": "https://github.com/amphp/serialization/tree/v1.1.0" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2026-04-05T15:59:53+00:00" + }, + { + "name": "amphp/socket", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/socket.git", + "reference": "dadb63c5d3179fd83803e29dfeac27350e619314" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/socket/zipball/dadb63c5d3179fd83803e29dfeac27350e619314", + "reference": "dadb63c5d3179fd83803e29dfeac27350e619314", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/dns": "^2", + "ext-openssl": "*", + "kelunik/certificate": "^1.1", + "league/uri": "^7", + "league/uri-interfaces": "^7", + "php": ">=8.1", + "revolt/event-loop": "^1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "amphp/process": "^2", + "phpunit/phpunit": "^9", + "psalm/phar": "6.16.1" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php", + "src/Internal/functions.php", + "src/SocketAddress/functions.php" + ], + "psr-4": { + "Amp\\Socket\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@gmail.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Non-blocking socket connection / server implementations based on Amp and Revolt.", + "homepage": "https://github.com/amphp/socket", + "keywords": [ + "amp", + "async", + "encryption", + "non-blocking", + "sockets", + "tcp", + "tls" + ], + "support": { + "issues": "https://github.com/amphp/socket/issues", + "source": "https://github.com/amphp/socket/tree/v2.4.0" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2026-04-19T15:09:56+00:00" + }, + { + "name": "amphp/sync", + "version": "v2.3.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/sync.git", + "reference": "217097b785130d77cfcc58ff583cf26cd1770bf1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/sync/zipball/217097b785130d77cfcc58ff583cf26cd1770bf1", + "reference": "217097b785130d77cfcc58ff583cf26cd1770bf1", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/pipeline": "^1", + "amphp/serialization": "^1", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "5.23" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Amp\\Sync\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Stephen Coakley", + "email": "me@stephencoakley.com" + } + ], + "description": "Non-blocking synchronization primitives for PHP based on Amp and Revolt.", + "homepage": "https://github.com/amphp/sync", + "keywords": [ + "async", + "asynchronous", + "mutex", + "semaphore", + "synchronization" + ], + "support": { + "issues": "https://github.com/amphp/sync/issues", + "source": "https://github.com/amphp/sync/tree/v2.3.0" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-08-03T19:31:26+00:00" + }, + { + "name": "composer/pcre", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", "shasum": "" }, "require": { @@ -187,19 +844,19 @@ "phpstan/phpstan": "<1.11.10" }, "require-dev": { - "phpstan/phpstan": "^1.11.10", - "phpstan/phpstan-strict-rules": "^1.1", + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", "phpunit/phpunit": "^8 || ^9" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - }, "phpstan": { "includes": [ "extension.neon" ] + }, + "branch-alias": { + "dev-main": "3.x-dev" } }, "autoload": { @@ -227,7 +884,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.3.1" + "source": "https://github.com/composer/pcre/tree/3.3.2" }, "funding": [ { @@ -243,28 +900,28 @@ "type": "tidelift" } ], - "time": "2024-08-27T18:44:43+00:00" + "time": "2024-11-12T16:29:46+00:00" }, { "name": "composer/semver", - "version": "3.4.2", + "version": "3.4.4", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6" + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c51258e759afdb17f1fd1fe83bc12baaef6309d6", - "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6", + "url": "https://api.github.com/repos/composer/semver/zipball/198166618906cb2de69b95d7d47e5fa8aa1b2b95", + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^1.4", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" }, "type": "library", "extra": { @@ -308,7 +965,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.4.2" + "source": "https://github.com/composer/semver/tree/3.4.4" }, "funding": [ { @@ -318,13 +975,9 @@ { "url": "https://github.com/composer", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" } ], - "time": "2024-07-12T11:35:52+00:00" + "time": "2025-08-20T19:15:30+00:00" }, { "name": "composer/xdebug-handler", @@ -392,6 +1045,102 @@ ], "time": "2024-05-06T16:37:16+00:00" }, + { + "name": "danog/advanced-json-rpc", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/danog/php-advanced-json-rpc.git", + "reference": "ae703ea7b4811797a10590b6078de05b3b33dd91" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/danog/php-advanced-json-rpc/zipball/ae703ea7b4811797a10590b6078de05b3b33dd91", + "reference": "ae703ea7b4811797a10590b6078de05b3b33dd91", + "shasum": "" + }, + "require": { + "netresearch/jsonmapper": "^5", + "php": ">=8.1", + "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0 || ^6" + }, + "replace": { + "felixfbecker/php-advanced-json-rpc": "^3" + }, + "require-dev": { + "phpunit/phpunit": "^9" + }, + "type": "library", + "autoload": { + "psr-4": { + "AdvancedJsonRpc\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + }, + { + "name": "Daniil Gentili", + "email": "daniil@daniil.it" + } + ], + "description": "A more advanced JSONRPC implementation", + "support": { + "issues": "https://github.com/danog/php-advanced-json-rpc/issues", + "source": "https://github.com/danog/php-advanced-json-rpc/tree/v3.2.3" + }, + "time": "2026-01-12T21:07:10+00:00" + }, + { + "name": "daverandom/libdns", + "version": "v2.1.0", + "source": { + "type": "git", + "url": "https://github.com/DaveRandom/LibDNS.git", + "reference": "b84c94e8fe6b7ee4aecfe121bfe3b6177d303c8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/DaveRandom/LibDNS/zipball/b84c94e8fe6b7ee4aecfe121bfe3b6177d303c8a", + "reference": "b84c94e8fe6b7ee4aecfe121bfe3b6177d303c8a", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "Required for IDN support" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "LibDNS\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "DNS protocol implementation written in pure PHP", + "keywords": [ + "dns" + ], + "support": { + "issues": "https://github.com/DaveRandom/LibDNS/issues", + "source": "https://github.com/DaveRandom/LibDNS/tree/v2.1.0" + }, + "time": "2024-04-12T12:12:48+00:00" + }, { "name": "dnoegel/php-xdg-base-dir", "version": "v0.1.1", @@ -431,29 +1180,30 @@ }, { "name": "doctrine/deprecations", - "version": "1.1.3", + "version": "1.1.6", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", - "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, + "conflict": { + "phpunit/phpunit": "<=7.5 || >=14" + }, "require-dev": { - "doctrine/coding-standard": "^9", - "phpstan/phpstan": "1.4.10 || 1.10.15", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psalm/plugin-phpunit": "0.18.4", - "psr/log": "^1 || ^2 || ^3", - "vimeo/psalm": "4.30.0 || 5.12.0" + "doctrine/coding-standard": "^9 || ^12 || ^14", + "phpstan/phpstan": "1.4.10 || 2.1.30", + "phpstan/phpstan-phpunit": "^1.0 || ^2", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12.4 || ^13.0", + "psr/log": "^1 || ^2 || ^3" }, "suggest": { "psr/log": "Allows logging deprecations via PSR-3 logger implementation" @@ -461,7 +1211,7 @@ "type": "library", "autoload": { "psr-4": { - "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + "Doctrine\\Deprecations\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -472,67 +1222,22 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.3" + "source": "https://github.com/doctrine/deprecations/tree/1.1.6" }, - "time": "2024-01-30T19:34:25+00:00" - }, - { - "name": "felixfbecker/advanced-json-rpc", - "version": "v3.2.1", - "source": { - "type": "git", - "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", - "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/b5f37dbff9a8ad360ca341f3240dc1c168b45447", - "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447", - "shasum": "" - }, - "require": { - "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "php": "^7.1 || ^8.0", - "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0" - }, - "require-dev": { - "phpunit/phpunit": "^7.0 || ^8.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "AdvancedJsonRpc\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Felix Becker", - "email": "felix.b@outlook.com" - } - ], - "description": "A more advanced JSONRPC implementation", - "support": { - "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", - "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1" - }, - "time": "2021-06-11T22:34:44+00:00" + "time": "2026-02-07T07:09:04+00:00" }, { "name": "felixfbecker/language-server-protocol", - "version": "v1.5.2", + "version": "v1.5.3", "source": { "type": "git", "url": "https://github.com/felixfbecker/php-language-server-protocol.git", - "reference": "6e82196ffd7c62f7794d778ca52b69feec9f2842" + "reference": "a9e113dbc7d849e35b8776da39edaf4313b7b6c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/6e82196ffd7c62f7794d778ca52b69feec9f2842", - "reference": "6e82196ffd7c62f7794d778ca52b69feec9f2842", + "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/a9e113dbc7d849e35b8776da39edaf4313b7b6c9", + "reference": "a9e113dbc7d849e35b8776da39edaf4313b7b6c9", "shasum": "" }, "require": { @@ -573,22 +1278,22 @@ ], "support": { "issues": "https://github.com/felixfbecker/php-language-server-protocol/issues", - "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/v1.5.2" + "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/v1.5.3" }, - "time": "2022-03-02T22:36:06+00:00" + "time": "2024-04-30T00:40:11+00:00" }, { "name": "fidry/cpu-core-counter", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/theofidry/cpu-core-counter.git", - "reference": "8520451a140d3f46ac33042715115e290cf5785f" + "reference": "db9508f7b1474469d9d3c53b86f817e344732678" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/8520451a140d3f46ac33042715115e290cf5785f", - "reference": "8520451a140d3f46ac33042715115e290cf5785f", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/db9508f7b1474469d9d3c53b86f817e344732678", + "reference": "db9508f7b1474469d9d3c53b86f817e344732678", "shasum": "" }, "require": { @@ -598,10 +1303,10 @@ "fidry/makefile": "^0.2.0", "fidry/php-cs-fixer-config": "^1.1.2", "phpstan/extension-installer": "^1.2.0", - "phpstan/phpstan": "^1.9.2", - "phpstan/phpstan-deprecation-rules": "^1.0.0", - "phpstan/phpstan-phpunit": "^1.2.2", - "phpstan/phpstan-strict-rules": "^1.4.4", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-deprecation-rules": "^2.0.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", "phpunit/phpunit": "^8.5.31 || ^9.5.26", "webmozarts/strict-phpunit": "^7.5" }, @@ -628,7 +1333,7 @@ ], "support": { "issues": "https://github.com/theofidry/cpu-core-counter/issues", - "source": "https://github.com/theofidry/cpu-core-counter/tree/1.2.0" + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.3.0" }, "funding": [ { @@ -636,20 +1341,260 @@ "type": "github" } ], - "time": "2024-08-06T10:04:20+00:00" + "time": "2025-08-14T07:29:31+00:00" }, { - "name": "netresearch/jsonmapper", - "version": "v4.5.0", + "name": "kelunik/certificate", + "version": "v1.1.3", "source": { "type": "git", - "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "8e76efb98ee8b6afc54687045e1b8dba55ac76e5" + "url": "https://github.com/kelunik/certificate.git", + "reference": "7e00d498c264d5eb4f78c69f41c8bd6719c0199e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8e76efb98ee8b6afc54687045e1b8dba55ac76e5", - "reference": "8e76efb98ee8b6afc54687045e1b8dba55ac76e5", + "url": "https://api.github.com/repos/kelunik/certificate/zipball/7e00d498c264d5eb4f78c69f41c8bd6719c0199e", + "reference": "7e00d498c264d5eb4f78c69f41c8bd6719c0199e", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "php": ">=7.0" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "phpunit/phpunit": "^6 | 7 | ^8 | ^9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Kelunik\\Certificate\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Access certificate details and transform between different formats.", + "keywords": [ + "DER", + "certificate", + "certificates", + "openssl", + "pem", + "x509" + ], + "support": { + "issues": "https://github.com/kelunik/certificate/issues", + "source": "https://github.com/kelunik/certificate/tree/v1.1.3" + }, + "time": "2023-02-03T21:26:53+00:00" + }, + { + "name": "league/uri", + "version": "7.8.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri.git", + "reference": "08cf38e3924d4f56238125547b5720496fac8fd4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/08cf38e3924d4f56238125547b5720496fac8fd4", + "reference": "08cf38e3924d4f56238125547b5720496fac8fd4", + "shasum": "" + }, + "require": { + "league/uri-interfaces": "^7.8.1", + "php": "^8.1", + "psr/http-factory": "^1" + }, + "conflict": { + "league/uri-schemes": "^1.0" + }, + "suggest": { + "ext-bcmath": "to improve IPV4 host parsing", + "ext-dom": "to convert the URI into an HTML anchor tag", + "ext-fileinfo": "to create Data URI from file contennts", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "ext-uri": "to use the PHP native URI class", + "jeremykendall/php-domain-parser": "to further parse the URI host and resolve its Public Suffix and Top Level Domain", + "league/uri-components": "to provide additional tools to manipulate URI objects components", + "league/uri-polyfill": "to backport the PHP URI extension for older versions of PHP", + "php-64bit": "to improve IPV4 host parsing", + "rowbot/url": "to handle URLs using the WHATWG URL Living Standard specification", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "URI manipulation library", + "homepage": "https://uri.thephpleague.com", + "keywords": [ + "URN", + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "middleware", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc2141", + "rfc3986", + "rfc3987", + "rfc6570", + "rfc8141", + "uri", + "uri-template", + "url", + "ws" + ], + "support": { + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri/tree/7.8.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2026-03-15T20:22:25+00:00" + }, + { + "name": "league/uri-interfaces", + "version": "7.8.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri-interfaces.git", + "reference": "85d5c77c5d6d3af6c54db4a78246364908f3c928" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/85d5c77c5d6d3af6c54db4a78246364908f3c928", + "reference": "85d5c77c5d6d3af6c54db4a78246364908f3c928", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "php": "^8.1", + "psr/http-message": "^1.1 || ^2.0" + }, + "suggest": { + "ext-bcmath": "to improve IPV4 host parsing", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "php-64bit": "to improve IPV4 host parsing", + "rowbot/url": "to handle URLs using the WHATWG URL Living Standard specification", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "Common tools for parsing and resolving RFC3987/RFC3986 URI", + "homepage": "https://uri.thephpleague.com", + "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc3986", + "rfc3987", + "rfc6570", + "uri", + "url", + "ws" + ], + "support": { + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.8.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2026-03-08T20:05:35+00:00" + }, + { + "name": "netresearch/jsonmapper", + "version": "v5.0.1", + "source": { + "type": "git", + "url": "https://github.com/cweiske/jsonmapper.git", + "reference": "980674efdda65913492d29a8fd51c82270dd37bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/980674efdda65913492d29a8fd51c82270dd37bb", + "reference": "980674efdda65913492d29a8fd51c82270dd37bb", "shasum": "" }, "require": { @@ -685,31 +1630,33 @@ "support": { "email": "cweiske@cweiske.de", "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/v4.5.0" + "source": "https://github.com/cweiske/jsonmapper/tree/v5.0.1" }, - "time": "2024-09-08T10:13:13+00:00" + "time": "2026-02-22T16:28:03+00:00" }, { "name": "nikic/php-parser", - "version": "v4.19.1", + "version": "v5.7.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b" + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4e1b88d21c69391150ace211e9eaf05810858d0b", - "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82", + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.1" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -717,7 +1664,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.x-dev" } }, "autoload": { @@ -741,9 +1688,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0" }, - "time": "2024-03-17T08:10:35+00:00" + "time": "2025-12-06T11:56:16+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -800,16 +1747,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.1", + "version": "6.0.3", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" + "reference": "7bae67520aa9f5ecc506d646810bd40d9da54582" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", - "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/7bae67520aa9f5ecc506d646810bd40d9da54582", + "reference": "7bae67520aa9f5ecc506d646810bd40d9da54582", "shasum": "" }, "require": { @@ -817,18 +1764,19 @@ "ext-filter": "*", "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.7", - "phpstan/phpdoc-parser": "^1.7", - "webmozart/assert": "^1.9.1" + "phpdocumentor/type-resolver": "^2.0", + "phpstan/phpdoc-parser": "^2.0", + "webmozart/assert": "^1.9.1 || ^2" }, "require-dev": { - "mockery/mockery": "~1.3.5", + "mockery/mockery": "~1.3.5 || ~1.6.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", "phpstan/phpstan-mockery": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^5.13" + "psalm/phar": "^5.26", + "shipmonk/dead-code-detector": "^0.5.1" }, "type": "library", "extra": { @@ -858,44 +1806,44 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/6.0.3" }, - "time": "2024-05-21T05:55:05+00:00" + "time": "2026-03-18T20:49:53+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.8.2", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "153ae662783729388a584b4361f2545e4d841e3c" + "reference": "327a05bbee54120d4786a0dc67aad30226ad4cf9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c", - "reference": "153ae662783729388a584b4361f2545e4d841e3c", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/327a05bbee54120d4786a0dc67aad30226ad4cf9", + "reference": "327a05bbee54120d4786a0dc67aad30226ad4cf9", "shasum": "" }, "require": { "doctrine/deprecations": "^1.0", - "php": "^7.3 || ^8.0", + "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.0", - "phpstan/phpdoc-parser": "^1.13" + "phpstan/phpdoc-parser": "^2.0" }, "require-dev": { "ext-tokenizer": "*", "phpbench/phpbench": "^1.2", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-phpunit": "^1.1", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-phpunit": "^2.0", "phpunit/phpunit": "^9.5", - "rector/rector": "^0.13.9", - "vimeo/psalm": "^4.25" + "psalm/phar": "^4" }, "type": "library", "extra": { "branch-alias": { - "dev-1.x": "1.x-dev" + "dev-1.x": "1.x-dev", + "dev-2.x": "2.x-dev" } }, "autoload": { @@ -916,36 +1864,36 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/2.0.0" }, - "time": "2024-02-23T11:10:43+00:00" + "time": "2026-01-06T21:53:42+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.30.1", + "version": "2.3.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "51b95ec8670af41009e2b2b56873bad96682413e" + "reference": "a004701b11273a26cd7955a61d67a7f1e525a45a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/51b95ec8670af41009e2b2b56873bad96682413e", - "reference": "51b95ec8670af41009e2b2b56873bad96682413e", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/a004701b11273a26cd7955a61d67a7f1e525a45a", + "reference": "a004701b11273a26cd7955a61d67a7f1e525a45a", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "doctrine/annotations": "^2.0", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^5.3.0", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.5", - "phpstan/phpstan-phpunit": "^1.1", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6", "symfony/process": "^5.2" }, "type": "library", @@ -963,9 +1911,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.2" }, - "time": "2024-09-07T20:13:05+00:00" + "time": "2026-01-25T14:56:51+00:00" }, { "name": "psr/container", @@ -1020,6 +1968,114 @@ }, "time": "2021-11-05T16:47:00+00:00" }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00" + }, + { + "name": "psr/http-message", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "time": "2023-04-04T09:54:51+00:00" + }, { "name": "psr/log", "version": "3.0.2", @@ -1071,30 +2127,102 @@ "time": "2024-09-11T13:17:53+00:00" }, { - "name": "sebastian/diff", - "version": "5.1.1", + "name": "revolt/event-loop", + "version": "v1.0.8", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e" + "url": "https://github.com/revoltphp/event-loop.git", + "reference": "b6fc06dce8e9b523c9946138fa5e62181934f91c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e", - "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e", + "url": "https://api.github.com/repos/revoltphp/event-loop/zipball/b6fc06dce8e9b523c9946138fa5e62181934f91c", + "reference": "b6fc06dce8e9b523c9946138fa5e62181934f91c", "shasum": "" }, "require": { "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^10.0", - "symfony/process": "^6.4" + "ext-json": "*", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.15" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.1-dev" + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Revolt\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "ceesjank@gmail.com" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Rock-solid event loop for concurrent PHP applications.", + "keywords": [ + "async", + "asynchronous", + "concurrency", + "event", + "event-loop", + "non-blocking", + "scheduler" + ], + "support": { + "issues": "https://github.com/revoltphp/event-loop/issues", + "source": "https://github.com/revoltphp/event-loop/tree/v1.0.8" + }, + "time": "2025-08-27T21:33:23+00:00" + }, + { + "name": "sebastian/diff", + "version": "6.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" } }, "autoload": { @@ -1127,7 +2255,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1" + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" }, "funding": [ { @@ -1135,20 +2263,20 @@ "type": "github" } ], - "time": "2024-03-02T07:15:17+00:00" + "time": "2024-07-03T04:53:05+00:00" }, { "name": "spatie/array-to-xml", - "version": "3.3.0", + "version": "3.4.4", "source": { "type": "git", "url": "https://github.com/spatie/array-to-xml.git", - "reference": "f56b220fe2db1ade4c88098d83413ebdfc3bf876" + "reference": "88b2f3852a922dd73177a68938f8eb2ec70c7224" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/f56b220fe2db1ade4c88098d83413ebdfc3bf876", - "reference": "f56b220fe2db1ade4c88098d83413ebdfc3bf876", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/88b2f3852a922dd73177a68938f8eb2ec70c7224", + "reference": "88b2f3852a922dd73177a68938f8eb2ec70c7224", "shasum": "" }, "require": { @@ -1191,7 +2319,7 @@ "xml" ], "support": { - "source": "https://github.com/spatie/array-to-xml/tree/3.3.0" + "source": "https://github.com/spatie/array-to-xml/tree/3.4.4" }, "funding": [ { @@ -1203,51 +2331,51 @@ "type": "github" } ], - "time": "2024-05-01T10:20:27+00:00" + "time": "2025-12-15T09:00:41+00:00" }, { "name": "symfony/console", - "version": "v6.4.11", + "version": "v7.4.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "42686880adaacdad1835ee8fc2a9ec5b7bd63998" + "reference": "1e92e39c51f95b88e3d66fa2d9f06d1fb45dd707" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/42686880adaacdad1835ee8fc2a9ec5b7bd63998", - "reference": "42686880adaacdad1835ee8fc2a9ec5b7bd63998", + "url": "https://api.github.com/repos/symfony/console/zipball/1e92e39c51f95b88e3d66fa2d9f06d1fb45dd707", + "reference": "1e92e39c51f95b88e3d66fa2d9f06d1fb45dd707", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^5.4|^6.0|^7.0" + "symfony/string": "^7.2|^8.0" }, "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/dotenv": "<5.4", - "symfony/event-dispatcher": "<5.4", - "symfony/lock": "<5.4", - "symfony/process": "<5.4" + "symfony/dependency-injection": "<6.4", + "symfony/dotenv": "<6.4", + "symfony/event-dispatcher": "<6.4", + "symfony/lock": "<6.4", + "symfony/process": "<6.4" }, "provide": { "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", - "symfony/http-foundation": "^6.4|^7.0", - "symfony/http-kernel": "^6.4|^7.0", - "symfony/lock": "^5.4|^6.0|^7.0", - "symfony/messenger": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/var-dumper": "^5.4|^6.0|^7.0" + "symfony/config": "^6.4|^7.0|^8.0", + "symfony/dependency-injection": "^6.4|^7.0|^8.0", + "symfony/event-dispatcher": "^6.4|^7.0|^8.0", + "symfony/http-foundation": "^6.4|^7.0|^8.0", + "symfony/http-kernel": "^6.4|^7.0|^8.0", + "symfony/lock": "^6.4|^7.0|^8.0", + "symfony/messenger": "^6.4|^7.0|^8.0", + "symfony/process": "^6.4|^7.0|^8.0", + "symfony/stopwatch": "^6.4|^7.0|^8.0", + "symfony/var-dumper": "^6.4|^7.0|^8.0" }, "type": "library", "autoload": { @@ -1281,7 +2409,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.11" + "source": "https://github.com/symfony/console/tree/v7.4.8" }, "funding": [ { @@ -1292,25 +2420,29 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-08-15T22:48:29+00:00" + "time": "2026-03-30T13:54:39+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.5.0", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", "shasum": "" }, "require": { @@ -1318,12 +2450,12 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" } }, "autoload": { @@ -1348,7 +2480,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" }, "funding": [ { @@ -1364,29 +2496,29 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/filesystem", - "version": "v6.4.9", + "version": "v7.4.8", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "b51ef8059159330b74a4d52f68e671033c0fe463" + "reference": "58b9790d12f9670b7f53a1c1738febd3108970a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/b51ef8059159330b74a4d52f68e671033c0fe463", - "reference": "b51ef8059159330b74a4d52f68e671033c0fe463", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/58b9790d12f9670b7f53a1c1738febd3108970a5", + "reference": "58b9790d12f9670b7f53a1c1738febd3108970a5", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.8" }, "require-dev": { - "symfony/process": "^5.4|^6.4|^7.0" + "symfony/process": "^6.4|^7.0|^8.0" }, "type": "library", "autoload": { @@ -1414,7 +2546,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.4.9" + "source": "https://github.com/symfony/filesystem/tree/v7.4.8" }, "funding": [ { @@ -1425,25 +2557,29 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-06-28T09:49:33+00:00" + "time": "2026-03-24T13:12:05+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.31.0", + "version": "v1.37.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" + "reference": "141046a8f9477948ff284fa65be2095baafb94f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/141046a8f9477948ff284fa65be2095baafb94f2", + "reference": "141046a8f9477948ff284fa65be2095baafb94f2", "shasum": "" }, "require": { @@ -1458,8 +2594,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1493,7 +2629,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.37.0" }, "funding": [ { @@ -1504,25 +2640,29 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2026-04-10T16:19:22+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.31.0", + "version": "v1.37.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" + "reference": "4864388bfbd3001ce88e234fab652acd91fdc57e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", - "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/4864388bfbd3001ce88e234fab652acd91fdc57e", + "reference": "4864388bfbd3001ce88e234fab652acd91fdc57e", "shasum": "" }, "require": { @@ -1534,8 +2674,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1571,7 +2711,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.37.0" }, "funding": [ { @@ -1582,16 +2722,20 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2026-04-26T13:13:48+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.31.0", + "version": "v1.37.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -1612,8 +2756,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1652,7 +2796,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.37.0" }, "funding": [ { @@ -1663,6 +2807,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -1672,19 +2820,20 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.31.0", + "version": "v1.37.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + "reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6a21eb99c6973357967f6ce3708cd55a6bec6315", + "reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315", "shasum": "" }, "require": { + "ext-iconv": "*", "php": ">=7.2" }, "provide": { @@ -1696,8 +2845,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1732,7 +2881,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.37.0" }, "funding": [ { @@ -1743,25 +2892,109 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2026-04-10T17:25:58+00:00" }, { - "name": "symfony/service-contracts", - "version": "v3.5.0", + "name": "symfony/polyfill-php84", + "version": "v1.37.0", "source": { "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" + "url": "https://github.com/symfony/polyfill-php84.git", + "reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/88486db2c389b290bf87ff1de7ebc1e13e42bb06", + "reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php84\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php84/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-10T18:47:49+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v3.6.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/45112560a3ba2d715666a509a0bc9521d10b6c43", + "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43", "shasum": "" }, "require": { @@ -1774,12 +3007,12 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" } }, "autoload": { @@ -1815,7 +3048,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.6.1" }, "funding": [ { @@ -1826,31 +3059,36 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2025-07-15T11:30:57+00:00" }, { "name": "symfony/string", - "version": "v6.4.11", + "version": "v7.4.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "5bc3eb632cf9c8dbfd6529d89be9950d1518883b" + "reference": "114ac57257d75df748eda23dd003878080b8e688" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/5bc3eb632cf9c8dbfd6529d89be9950d1518883b", - "reference": "5bc3eb632cf9c8dbfd6529d89be9950d1518883b", + "url": "https://api.github.com/repos/symfony/string/zipball/114ac57257d75df748eda23dd003878080b8e688", + "reference": "114ac57257d75df748eda23dd003878080b8e688", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3.0", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-grapheme": "~1.33", "symfony/polyfill-intl-normalizer": "~1.0", "symfony/polyfill-mbstring": "~1.0" }, @@ -1858,11 +3096,11 @@ "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^5.4|^6.0|^7.0", - "symfony/http-client": "^5.4|^6.0|^7.0", - "symfony/intl": "^6.2|^7.0", + "symfony/emoji": "^7.1|^8.0", + "symfony/http-client": "^6.4|^7.0|^8.0", + "symfony/intl": "^6.4|^7.0|^8.0", "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^5.4|^6.0|^7.0" + "symfony/var-exporter": "^6.4|^7.0|^8.0" }, "type": "library", "autoload": { @@ -1901,7 +3139,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.11" + "source": "https://github.com/symfony/string/tree/v7.4.8" }, "funding": [ { @@ -1912,33 +3150,39 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-08-12T09:55:28+00:00" + "time": "2026-03-24T13:12:05+00:00" }, { "name": "vimeo/psalm", - "version": "5.26.1", + "version": "6.16.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "d747f6500b38ac4f7dfc5edbcae6e4b637d7add0" + "reference": "f1f5de594dc76faf8784e02d3dc4716c91c6f6ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/d747f6500b38ac4f7dfc5edbcae6e4b637d7add0", - "reference": "d747f6500b38ac4f7dfc5edbcae6e4b637d7add0", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/f1f5de594dc76faf8784e02d3dc4716c91c6f6ac", + "reference": "f1f5de594dc76faf8784e02d3dc4716c91c6f6ac", "shasum": "" }, "require": { - "amphp/amp": "^2.4.2", - "amphp/byte-stream": "^1.5", + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/parallel": "^2.3", "composer-runtime-api": "^2", "composer/semver": "^1.4 || ^2.0 || ^3.0", "composer/xdebug-handler": "^2.0 || ^3.0", + "danog/advanced-json-rpc": "^3.1", "dnoegel/php-xdg-base-dir": "^0.1.1", "ext-ctype": "*", "ext-dom": "*", @@ -1947,27 +3191,26 @@ "ext-mbstring": "*", "ext-simplexml": "*", "ext-tokenizer": "*", - "felixfbecker/advanced-json-rpc": "^3.1", - "felixfbecker/language-server-protocol": "^1.5.2", + "felixfbecker/language-server-protocol": "^1.5.3", "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1 || ^1.0.0", - "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "nikic/php-parser": "^4.17", - "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", - "sebastian/diff": "^4.0 || ^5.0 || ^6.0", + "netresearch/jsonmapper": "^5.0", + "nikic/php-parser": "^5.0.0", + "php": "~8.1.31 || ~8.2.27 || ~8.3.16 || ~8.4.3 || ~8.5.0", + "sebastian/diff": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0", "spatie/array-to-xml": "^2.17.0 || ^3.0", - "symfony/console": "^4.1.6 || ^5.0 || ^6.0 || ^7.0", - "symfony/filesystem": "^5.4 || ^6.0 || ^7.0" - }, - "conflict": { - "nikic/php-parser": "4.17.0" + "symfony/console": "^6.0 || ^7.0 || ^8.0", + "symfony/filesystem": "~6.3.12 || ~6.4.3 || ^7.0.3 || ^8.0", + "symfony/polyfill-php84": "^1.31.0" }, "provide": { "psalm/psalm": "self.version" }, "require-dev": { - "amphp/phpunit-util": "^2.0", + "amphp/phpunit-util": "^3", "bamarni/composer-bin-plugin": "^1.4", "brianium/paratest": "^6.9", + "danog/class-finder": "^0.4.8", + "dg/bypass-finals": "^1.5", "ext-curl": "*", "mockery/mockery": "^1.5", "nunomaduro/mock-final-classes": "^1.1", @@ -1975,10 +3218,10 @@ "phpstan/phpdoc-parser": "^1.6", "phpunit/phpunit": "^9.6", "psalm/plugin-mockery": "^1.1", - "psalm/plugin-phpunit": "^0.18", + "psalm/plugin-phpunit": "^0.19", "slevomat/coding-standard": "^8.4", "squizlabs/php_codesniffer": "^3.6", - "symfony/process": "^4.4 || ^5.0 || ^6.0 || ^7.0" + "symfony/process": "^6.0 || ^7.0 || ^8.0" }, "suggest": { "ext-curl": "In order to send data to shepherd", @@ -1989,16 +3232,19 @@ "psalm-language-server", "psalm-plugin", "psalm-refactor", + "psalm-review", "psalter" ], "type": "project", "extra": { "branch-alias": { - "dev-master": "5.x-dev", - "dev-4.x": "4.x-dev", - "dev-3.x": "3.x-dev", + "dev-1.x": "1.x-dev", "dev-2.x": "2.x-dev", - "dev-1.x": "1.x-dev" + "dev-3.x": "3.x-dev", + "dev-4.x": "4.x-dev", + "dev-5.x": "5.x-dev", + "dev-6.x": "6.x-dev", + "dev-master": "7.x-dev" } }, "autoload": { @@ -2013,6 +3259,10 @@ "authors": [ { "name": "Matthew Brown" + }, + { + "name": "Daniil Gentili", + "email": "daniil@daniil.it" } ], "description": "A static analysis tool for finding errors in PHP applications", @@ -2027,37 +3277,37 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-09-08T18:53:08+00:00" + "time": "2026-03-19T10:56:09+00:00" }, { "name": "webmozart/assert", - "version": "1.11.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" + "reference": "eb0d790f735ba6cff25c683a85a1da0eadeff9e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/eb0d790f735ba6cff25c683a85a1da0eadeff9e4", + "reference": "eb0d790f735ba6cff25c683a85a1da0eadeff9e4", "shasum": "" }, "require": { "ext-ctype": "*", - "php": "^7.2 || ^8.0" + "ext-date": "*", + "ext-filter": "*", + "php": "^8.2" }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" + "suggest": { + "ext-intl": "", + "ext-simplexml": "", + "ext-spl": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.10-dev" + "dev-feature/2-0": "2.0-dev" } }, "autoload": { @@ -2073,6 +3323,10 @@ { "name": "Bernhard Schussek", "email": "bschussek@gmail.com" + }, + { + "name": "Woody Gilk", + "email": "woody.gilk@gmail.com" } ], "description": "Assertions to validate method input/output with nice error messages.", @@ -2083,9 +3337,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.11.0" + "source": "https://github.com/webmozarts/assert/tree/2.3.0" }, - "time": "2022-06-03T18:03:27+00:00" + "time": "2026-04-11T10:33:05+00:00" } ], "packages-dev": [], @@ -2097,7 +3351,7 @@ "platform": {}, "platform-dev": {}, "platform-overrides": { - "php": "8.2" + "php": "8.2.27" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.9.0" }