diff --git a/composer.json b/composer.json index 6c2acde..99bbe3d 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ }, "require-dev": { "nextcloud/coding-standard": "^1.5.0", + "nextcloud/ocp": "^34.0", "phpunit/phpunit": "^11.5", "psalm/phar": "^6.16" }, @@ -31,9 +32,10 @@ "lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l", "cs:check": "php-cs-fixer fix --dry-run --diff", "cs:fix": "php-cs-fixer fix", - "psalm": "psalm --no-cache --threads=$(nproc)", + "psalm": "php ./vendor/bin/psalm.phar --config=psalm.xml --no-cache --threads=$(nproc)", "psalm:dev": "@psalm", - "psalm:baseline": "psalm --threads=1 --update-baseline", + "psalm:baseline": "php ./vendor/bin/psalm.phar --config=psalm.xml --threads=1 --update-baseline", + "psalm:fix": "php ./vendor/bin/psalm.phar --config=psalm.xml --alter --no-cache --threads=1", "test:unit": "phpunit -c tests/php/phpunit.xml --testsuite 'Unit Tests'", "test:integration:db": "phpunit -c tests/php/phpunit.xml --testsuite 'Database Tests'", "test:integration:dav": "phpunit -c tests/php/phpunit.xml --testsuite 'Dav Tests'" diff --git a/composer.lock b/composer.lock index 9f3db95..07d547d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "394259a1ba096378c0851c976b62c71c", + "content-hash": "c0a5ed2d1332c9d282267bb8885958da", "packages": [], "packages-dev": [ { @@ -164,6 +164,55 @@ }, "time": "2026-05-19T18:30:09+00:00" }, + { + "name": "nextcloud/ocp", + "version": "v34.0.0", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-deps/ocp.git", + "reference": "1ce31d2ac587e22269fedd9d5b231c4380d8c5af" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/1ce31d2ac587e22269fedd9d5b231c4380d8c5af", + "reference": "1ce31d2ac587e22269fedd9d5b231c4380d8c5af", + "shasum": "" + }, + "require": { + "php": "~8.1 || ~8.2 || ~8.3 || ~8.4 || ~8.5", + "psr/clock": "^1.0", + "psr/container": "^2.0.2", + "psr/event-dispatcher": "^1.0", + "psr/http-client": "^1.0.3", + "psr/log": "^3.0.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-stable34": "34.0.0-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + }, + { + "name": "Joas Schilling", + "email": "coding@schilljs.com" + } + ], + "description": "Composer package containing Nextcloud's public OCP API and the unstable NCU API", + "support": { + "issues": "https://github.com/nextcloud-deps/ocp/issues", + "source": "https://github.com/nextcloud-deps/ocp/tree/v34.0.0" + }, + "time": "2026-06-04T02:37:14+00:00" + }, { "name": "nikic/php-parser", "version": "v5.7.0", @@ -884,6 +933,312 @@ }, "time": "2026-03-19T11:11:23+00:00" }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+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", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.2" + }, + "time": "2024-09-11T13:17:53+00:00" + }, { "name": "sebastian/cli-parser", "version": "3.0.2", @@ -1975,15 +2330,15 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=8.2 <=8.5" }, - "platform-dev": [], + "platform-dev": {}, "platform-overrides": { "php": "8.2" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 23453bf..4617b86 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -30,6 +30,7 @@ public function __construct(array $urlParams = []) { parent::__construct(self::APP_ID, $urlParams); } + #[\Override] public function register(IRegistrationContext $context): void { // register event handlers @@ -38,6 +39,7 @@ public function register(IRegistrationContext $context): void { } + #[\Override] public function boot(IBootContext $context): void { } diff --git a/lib/Commands/Connect.php b/lib/Commands/Connect.php index 198a90c..16b016d 100644 --- a/lib/Commands/Connect.php +++ b/lib/Commands/Connect.php @@ -21,6 +21,9 @@ use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\Question; +/** + * @psalm-api + */ class Connect extends Command { public function __construct( diff --git a/lib/Commands/Debug.php b/lib/Commands/Debug.php index 045ad19..1cb8844 100644 --- a/lib/Commands/Debug.php +++ b/lib/Commands/Debug.php @@ -17,6 +17,9 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +/** + * @psalm-api + */ class Debug extends Command { public function __construct( private IUserManager $userManager, diff --git a/lib/Commands/Disconnect.php b/lib/Commands/Disconnect.php index b97f447..8697639 100644 --- a/lib/Commands/Disconnect.php +++ b/lib/Commands/Disconnect.php @@ -17,6 +17,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +/** + * @psalm-api + */ class Disconnect extends Command { public function __construct( diff --git a/lib/Commands/Harmonize.php b/lib/Commands/Harmonize.php index 1de40cf..cd12a8f 100644 --- a/lib/Commands/Harmonize.php +++ b/lib/Commands/Harmonize.php @@ -16,6 +16,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +/** + * @psalm-api + */ class Harmonize extends Command { public function __construct( diff --git a/lib/Commands/Show.php b/lib/Commands/Show.php index f7011c7..7e5516c 100644 --- a/lib/Commands/Show.php +++ b/lib/Commands/Show.php @@ -17,6 +17,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +/** + * @psalm-api + */ class Show extends Command { public function __construct( diff --git a/lib/Controller/AdminConfigurationController.php b/lib/Controller/AdminConfigurationController.php index 073103f..599e621 100644 --- a/lib/Controller/AdminConfigurationController.php +++ b/lib/Controller/AdminConfigurationController.php @@ -15,6 +15,9 @@ use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; +/** + * @psalm-api + */ class AdminConfigurationController extends Controller { private ConfigurationService $ConfigurationService; diff --git a/lib/Controller/AdminTemplateController.php b/lib/Controller/AdminTemplateController.php index d3aba89..b066e33 100644 --- a/lib/Controller/AdminTemplateController.php +++ b/lib/Controller/AdminTemplateController.php @@ -17,6 +17,9 @@ use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; +/** + * @psalm-api + */ class AdminTemplateController extends Controller { public function __construct( diff --git a/lib/Controller/UserConfigurationController.php b/lib/Controller/UserConfigurationController.php index 266debe..7c467b0 100644 --- a/lib/Controller/UserConfigurationController.php +++ b/lib/Controller/UserConfigurationController.php @@ -19,6 +19,9 @@ use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; +/** + * @psalm-api + */ class UserConfigurationController extends Controller { public function __construct( diff --git a/lib/Events/UserDeletedListener.php b/lib/Events/UserDeletedListener.php index 4b11d3f..8f02b38 100644 --- a/lib/Events/UserDeletedListener.php +++ b/lib/Events/UserDeletedListener.php @@ -17,6 +17,9 @@ use OCP\User\Events\UserDeletedEvent; use Psr\Log\LoggerInterface; +/** + * @psalm-api + */ class UserDeletedListener implements IEventListener { public function __construct( @@ -26,6 +29,7 @@ public function __construct( ) { } + #[\Override] public function handle(Event $event): void { if ($event instanceof UserDeletedEvent) { diff --git a/lib/Migration/DefaultServiceTemplates.php b/lib/Migration/DefaultServiceTemplates.php index a1805a4..b59be0c 100644 --- a/lib/Migration/DefaultServiceTemplates.php +++ b/lib/Migration/DefaultServiceTemplates.php @@ -13,6 +13,9 @@ use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; +/** + * @psalm-api + */ class DefaultServiceTemplates implements IRepairStep { public function __construct( @@ -20,6 +23,7 @@ public function __construct( ) { } + #[\Override] public function getName(): string { return 'Create or update default Dav Connector service templates'; } @@ -27,6 +31,7 @@ public function getName(): string { /** * @return void */ + #[\Override] public function run(IOutput $output) { // load the default service templates from file $defaultTemplates = json_decode(file_get_contents(__DIR__ . '/Defaults/ServiceTemplates.json'), true); diff --git a/lib/Migration/Version0010Date20260501000001.php b/lib/Migration/Version0010Date20260501000001.php index d0cc7e8..cf78239 100644 --- a/lib/Migration/Version0010Date20260501000001.php +++ b/lib/Migration/Version0010Date20260501000001.php @@ -16,6 +16,9 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +/** + * @psalm-api + */ class Version0010Date20260501000001 extends SimpleMigrationStep { public function __construct( @@ -29,6 +32,7 @@ public function __construct( * @param array $options * @return null|ISchemaWrapper */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version0010Date20260501000002.php b/lib/Migration/Version0010Date20260501000002.php index dd95f2a..0e65957 100644 --- a/lib/Migration/Version0010Date20260501000002.php +++ b/lib/Migration/Version0010Date20260501000002.php @@ -15,6 +15,9 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +/** + * @psalm-api + */ class Version0010Date20260501000002 extends SimpleMigrationStep { /** @@ -23,6 +26,7 @@ class Version0010Date20260501000002 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/lib/Migration/Version0010Date20260501000003.php b/lib/Migration/Version0010Date20260501000003.php index 27c3e0c..3cf4dc2 100644 --- a/lib/Migration/Version0010Date20260501000003.php +++ b/lib/Migration/Version0010Date20260501000003.php @@ -15,6 +15,9 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +/** + * @psalm-api + */ class Version0010Date20260501000003 extends SimpleMigrationStep { /** @@ -23,6 +26,7 @@ class Version0010Date20260501000003 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/lib/Migration/Version0010Date20260501000004.php b/lib/Migration/Version0010Date20260501000004.php index 7c73321..d6b68e4 100644 --- a/lib/Migration/Version0010Date20260501000004.php +++ b/lib/Migration/Version0010Date20260501000004.php @@ -15,6 +15,9 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +/** + * @psalm-api + */ class Version0010Date20260501000004 extends SimpleMigrationStep { /** @@ -23,6 +26,7 @@ class Version0010Date20260501000004 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/lib/Migration/Version0010Date20260501000005.php b/lib/Migration/Version0010Date20260501000005.php index d82d390..20e9590 100644 --- a/lib/Migration/Version0010Date20260501000005.php +++ b/lib/Migration/Version0010Date20260501000005.php @@ -15,6 +15,9 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +/** + * @psalm-api + */ class Version0010Date20260501000005 extends SimpleMigrationStep { /** @@ -23,6 +26,7 @@ class Version0010Date20260501000005 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/lib/Migration/Version0010Date20260501000006.php b/lib/Migration/Version0010Date20260501000006.php index 0e3949e..1289e84 100644 --- a/lib/Migration/Version0010Date20260501000006.php +++ b/lib/Migration/Version0010Date20260501000006.php @@ -15,6 +15,9 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +/** + * @psalm-api + */ class Version0010Date20260501000006 extends SimpleMigrationStep { /** @@ -23,6 +26,7 @@ class Version0010Date20260501000006 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/lib/Models/BaseCollection.php b/lib/Models/BaseCollection.php index c2a12a6..df542d5 100644 --- a/lib/Models/BaseCollection.php +++ b/lib/Models/BaseCollection.php @@ -26,6 +26,7 @@ private function validate($value): bool { }; } + #[\Override] public function append($value): void { if (!$this->validate($value)) { throw new \InvalidArgumentException( @@ -35,6 +36,7 @@ public function append($value): void { parent::append($value); } + #[\Override] public function offsetSet($key, $value): void { if (!$this->validate($value)) { throw new \InvalidArgumentException( diff --git a/lib/Providers/DAV/Calendar/Hybrid/Provider.php b/lib/Providers/DAV/Calendar/Hybrid/Provider.php index 246643d..a3f3288 100644 --- a/lib/Providers/DAV/Calendar/Hybrid/Provider.php +++ b/lib/Providers/DAV/Calendar/Hybrid/Provider.php @@ -19,6 +19,9 @@ use OCA\DAVC\Store\Local\ServicesStore; use OCP\Calendar\ICalendarProvider as ICalendarProvider1; +/** + * @psalm-api + */ class Provider implements ICalendarProvider1, ICalendarProvider2 { protected array $_CollectionCache = []; protected LocalEventsService $localService; diff --git a/lib/Providers/DAV/Contacts/Hybrid/Provider.php b/lib/Providers/DAV/Contacts/Hybrid/Provider.php index ded998f..1fdc4c7 100644 --- a/lib/Providers/DAV/Contacts/Hybrid/Provider.php +++ b/lib/Providers/DAV/Contacts/Hybrid/Provider.php @@ -18,6 +18,9 @@ use OCA\DAVC\Service\Remote\RemoteFactory; use OCA\DAVC\Store\Local\ServicesStore; +/** + * @psalm-api + */ class Provider implements IAddressBookProvider { protected array $_CollectionCache = []; protected LocalContactsService $localService; diff --git a/lib/Service/ConfigurationService.php b/lib/Service/ConfigurationService.php index 3b110cf..a76e110 100644 --- a/lib/Service/ConfigurationService.php +++ b/lib/Service/ConfigurationService.php @@ -320,7 +320,7 @@ public function depositSystemValue(string $key, string $value): void { /** * Destroy single system configuration parameter - * + * * @return void */ public function destroySystemValue(string $key): void { diff --git a/lib/Service/Remote/RemoteClient.php b/lib/Service/Remote/RemoteClient.php index a9672c8..0df1a24 100644 --- a/lib/Service/Remote/RemoteClient.php +++ b/lib/Service/Remote/RemoteClient.php @@ -692,14 +692,17 @@ public function __construct( ) { } + #[\Override] public function getBody() { return $this->body; } + #[\Override] public function getStatusCode(): int { return $this->statusCode; } + #[\Override] public function getHeader(string $key): string { $headers = $this->headers[$key] ?? []; @@ -710,6 +713,7 @@ public function getHeader(string $key): string { return (string)$headers[0]; } + #[\Override] public function getHeaders(): array { return $this->headers; } diff --git a/lib/Settings/AdminSection.php b/lib/Settings/AdminSection.php index f99aea5..bf218f7 100644 --- a/lib/Settings/AdminSection.php +++ b/lib/Settings/AdminSection.php @@ -13,6 +13,9 @@ use OCP\IURLGenerator; use OCP\Settings\IIconSection; +/** + * @psalm-api + */ class AdminSection implements IIconSection { /** @var IL10N */ @@ -31,6 +34,7 @@ public function __construct(IURLGenerator $urlGenerator, IL10N $l) { * * @returns string */ + #[\Override] public function getID(): string { return 'integration-davc'; } @@ -41,6 +45,7 @@ public function getID(): string { * * @return string */ + #[\Override] public function getName(): string { return $this->l->t('DAV Connector'); } @@ -50,6 +55,7 @@ public function getName(): string { * the settings navigation. The sections are arranged in ascending order of * the priority values. It is required to return a value between 0 and 99. */ + #[\Override] public function getPriority(): int { return 80; } @@ -57,6 +63,7 @@ public function getPriority(): int { /** * @return ?string The relative path to a an icon describing the section */ + #[\Override] public function getIcon(): ?string { return $this->urlGenerator->imagePath('core', 'categories/integration.svg'); } diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php index 53de9f0..37ee1cb 100644 --- a/lib/Settings/AdminSettings.php +++ b/lib/Settings/AdminSettings.php @@ -16,6 +16,9 @@ use OCP\Settings\ISettings; use OCP\Util; +/** + * @psalm-api + */ class AdminSettings implements ISettings { public function __construct( @@ -27,6 +30,7 @@ public function __construct( /** * @return TemplateResponse */ + #[\Override] public function getForm(): TemplateResponse { Util::addScript(Application::APP_ID, Application::APP_ID . '-AdminSettings'); @@ -38,10 +42,12 @@ public function getForm(): TemplateResponse { return new TemplateResponse(Application::APP_ID, 'AdminSettings'); } + #[\Override] public function getSection(): string { return 'integration-davc'; } + #[\Override] public function getPriority(): int { return 10; } diff --git a/lib/Settings/UserSection.php b/lib/Settings/UserSection.php index 7cd6941..802840a 100644 --- a/lib/Settings/UserSection.php +++ b/lib/Settings/UserSection.php @@ -13,6 +13,9 @@ use OCP\IURLGenerator; use OCP\Settings\IIconSection; +/** + * @psalm-api + */ class UserSection implements IIconSection { /** @var IL10N */ @@ -31,6 +34,7 @@ public function __construct(IURLGenerator $urlGenerator, IL10N $l) { * * @returns string */ + #[\Override] public function getID(): string { return 'connected-accounts'; //or a generic id if feasible } @@ -41,6 +45,7 @@ public function getID(): string { * * @return string */ + #[\Override] public function getName(): string { return $this->l->t('Connected accounts'); } @@ -50,6 +55,7 @@ public function getName(): string { * the settings navigation. The sections are arranged in ascending order of * the priority values. It is required to return a value between 0 and 99. */ + #[\Override] public function getPriority(): int { return 70; } @@ -57,6 +63,7 @@ public function getPriority(): int { /** * @return ?string The relative path to a an icon describing the section */ + #[\Override] public function getIcon(): ?string { return $this->urlGenerator->imagePath('core', 'categories/integration.svg'); } diff --git a/lib/Settings/UserSettings.php b/lib/Settings/UserSettings.php index 67ae875..c9a8bcb 100644 --- a/lib/Settings/UserSettings.php +++ b/lib/Settings/UserSettings.php @@ -16,6 +16,9 @@ use OCP\Settings\ISettings; use OCP\Util; +/** + * @psalm-api + */ class UserSettings implements ISettings { public function __construct( @@ -28,6 +31,7 @@ public function __construct( /** * @return TemplateResponse */ + #[\Override] public function getForm(): TemplateResponse { Util::addScript(Application::APP_ID, Application::APP_ID . '-UserSettings'); @@ -43,10 +47,12 @@ public function getForm(): TemplateResponse { return new TemplateResponse(Application::APP_ID, 'UserSettings'); } + #[\Override] public function getSection(): string { return 'connected-accounts'; } + #[\Override] public function getPriority(): int { return 20; } diff --git a/lib/Store/Common/Filters/FilterBase.php b/lib/Store/Common/Filters/FilterBase.php index 5dd623a..1dad079 100644 --- a/lib/Store/Common/Filters/FilterBase.php +++ b/lib/Store/Common/Filters/FilterBase.php @@ -20,6 +20,7 @@ class FilterBase implements IFilter { * * @return array */ + #[\Override] public function attributes(): array { return $this->attributes; } @@ -28,6 +29,7 @@ public function attributes(): array { * * @since 1.0.0 */ + #[\Override] public function comparators(): FilterComparisonOperator { return new FilterComparisonOperator; } @@ -36,6 +38,7 @@ public function comparators(): FilterComparisonOperator { * * @since 1.0.0 */ + #[\Override] public function conjunctions(): FilterConjunctionOperator { return new FilterConjunctionOperator; } @@ -45,6 +48,7 @@ public function conjunctions(): FilterConjunctionOperator { * @since 1.0.0 * */ + #[\Override] public function condition(string $attribute, mixed $value, FilterComparisonOperator $comparator = FilterComparisonOperator::EQ, FilterConjunctionOperator $conjunction = FilterConjunctionOperator::AND): void { if (!isset($this->properties[$attribute])) { $this->conditions[] = [ @@ -62,6 +66,7 @@ public function condition(string $attribute, mixed $value, FilterComparisonOpera * * @return array */ + #[\Override] public function conditions(): array { return $this->conditions; } diff --git a/lib/Store/Common/Range/RangeDate.php b/lib/Store/Common/Range/RangeDate.php index f4ae953..288431a 100644 --- a/lib/Store/Common/Range/RangeDate.php +++ b/lib/Store/Common/Range/RangeDate.php @@ -34,6 +34,7 @@ public function __construct( * * @since 1.0.0 */ + #[\Override] public function type(): string { return 'date'; } @@ -42,6 +43,7 @@ public function type(): string { * * @since 1.0.0 */ + #[\Override] public function getStart(): DateTimeInterface { return $this->start; } @@ -50,6 +52,7 @@ public function getStart(): DateTimeInterface { * * @since 1.0.0 */ + #[\Override] public function setStart(DateTimeInterface $value): void { $this->start = $value; } @@ -58,6 +61,7 @@ public function setStart(DateTimeInterface $value): void { * * @since 1.0.0 */ + #[\Override] public function getEnd(): DateTimeInterface { return $this->end; } @@ -66,6 +70,7 @@ public function getEnd(): DateTimeInterface { * * @since 1.0.0 */ + #[\Override] public function setEnd(DateTimeInterface $value): void { $this->end = $value; } diff --git a/lib/Store/Common/Range/RangeTallyAbsolute.php b/lib/Store/Common/Range/RangeTallyAbsolute.php index 87a66ea..3a805f8 100644 --- a/lib/Store/Common/Range/RangeTallyAbsolute.php +++ b/lib/Store/Common/Range/RangeTallyAbsolute.php @@ -21,6 +21,7 @@ public function __construct( * * @since 1.0.0 */ + #[\Override] public function type(): string { return 'tally'; } @@ -29,6 +30,7 @@ public function type(): string { * * @since 1.0.0 */ + #[\Override] public function anchor(): RangeAnchorType { return RangeAnchorType::ABSOLUTE; } @@ -37,6 +39,7 @@ public function anchor(): RangeAnchorType { * * @since 1.0.0 */ + #[\Override] public function getPosition(): string|int { return $this->position; } @@ -45,6 +48,7 @@ public function getPosition(): string|int { * * @since 1.0.0 */ + #[\Override] public function setPosition(string|int $value): void { $this->position = $value; } @@ -53,6 +57,7 @@ public function setPosition(string|int $value): void { * * @since 1.0.0 */ + #[\Override] public function getCount(): int { return $this->count; } @@ -61,6 +66,7 @@ public function getCount(): int { * * @since 1.0.0 */ + #[\Override] public function setCount(int $value): void { $this->count = $value; } diff --git a/lib/Store/Common/Range/RangeTallyRelative.php b/lib/Store/Common/Range/RangeTallyRelative.php index 2b263c2..583976f 100644 --- a/lib/Store/Common/Range/RangeTallyRelative.php +++ b/lib/Store/Common/Range/RangeTallyRelative.php @@ -21,6 +21,7 @@ public function __construct( * * @since 1.0.0 */ + #[\Override] public function type(): string { return 'tally'; } @@ -29,6 +30,7 @@ public function type(): string { * * @since 1.0.0 */ + #[\Override] public function anchor(): RangeAnchorType { return RangeAnchorType::RELATIVE; } @@ -37,6 +39,7 @@ public function anchor(): RangeAnchorType { * * @since 1.0.0 */ + #[\Override] public function getPosition(): string|int { return $this->position; } @@ -45,6 +48,7 @@ public function getPosition(): string|int { * * @since 1.0.0 */ + #[\Override] public function setPosition(string|int $value): void { $this->position = $value; } @@ -53,6 +57,7 @@ public function setPosition(string|int $value): void { * * @since 1.0.0 */ + #[\Override] public function getCount(): int { return $this->count; } @@ -61,6 +66,7 @@ public function getCount(): int { * * @since 1.0.0 */ + #[\Override] public function setCount(int $value): void { $this->count = $value; } diff --git a/lib/Store/Common/Sort/ISort.php b/lib/Store/Common/Sort/ISort.php index 7e540c0..be0f67d 100644 --- a/lib/Store/Common/Sort/ISort.php +++ b/lib/Store/Common/Sort/ISort.php @@ -20,7 +20,7 @@ public function attributes(): array; /** * add a sorting condition - * + * * @param string $attribute attribute name * @param bool $direction true for ascending, false for descending */ diff --git a/lib/Store/Common/Sort/SortBase.php b/lib/Store/Common/Sort/SortBase.php index bcc6410..9e95493 100644 --- a/lib/Store/Common/Sort/SortBase.php +++ b/lib/Store/Common/Sort/SortBase.php @@ -14,10 +14,12 @@ class SortBase implements ISort { protected array $attributes = []; protected array $conditions = []; + #[\Override] public function attributes(): array { return $this->attributes; } + #[\Override] public function condition(string $attribute, bool $direction): void { if (isset($this->attributes[$attribute])) { $this->conditions[$attribute] = [ @@ -27,6 +29,7 @@ public function condition(string $attribute, bool $direction): void { } } + #[\Override] public function conditions(): array { return $this->conditions; } diff --git a/lib/Store/Local/BaseStore.php b/lib/Store/Local/BaseStore.php index 4864a52..842c68c 100644 --- a/lib/Store/Local/BaseStore.php +++ b/lib/Store/Local/BaseStore.php @@ -125,7 +125,7 @@ public function collectionListFilter(): IFilter { /** * retrieve instance of collection sort - * + * * @return CollectionSort */ public function collectionListSort(): ISort { @@ -134,7 +134,7 @@ public function collectionListSort(): ISort { /** * retrieve collections for specific user from data store - * + * * @param string $uid user id * * @return array @@ -149,7 +149,7 @@ public function collectionListByUser(string $uid): array { /** * retrieve collections for specific user from data store - * + * * @param int $sid service id * * @return array diff --git a/lib/Store/Local/CollectionEntity.php b/lib/Store/Local/CollectionEntity.php index dd6c52d..2542623 100644 --- a/lib/Store/Local/CollectionEntity.php +++ b/lib/Store/Local/CollectionEntity.php @@ -64,6 +64,7 @@ public function __construct() { $this->addType('permissions', Types::JSON); } + #[\Override] public function jsonSerialize(): array { return [ 'id' => $this->id, diff --git a/lib/Store/Local/ContactStore.php b/lib/Store/Local/ContactStore.php index 41b71f7..7c4c686 100644 --- a/lib/Store/Local/ContactStore.php +++ b/lib/Store/Local/ContactStore.php @@ -28,10 +28,12 @@ public function __construct(IDBConnection $store) { } + #[\Override] public function collectionListFilter(): CollectionFilter { return new CollectionFilter(); } + #[\Override] public function entityListFilter(): ContactFilter { return new ContactFilter(); } diff --git a/lib/Store/Local/EventStore.php b/lib/Store/Local/EventStore.php index 2e64060..447b1bc 100644 --- a/lib/Store/Local/EventStore.php +++ b/lib/Store/Local/EventStore.php @@ -40,6 +40,7 @@ public function __construct(IDBConnection $store) { * * @return array of entities */ + #[\Override] public function entityList(?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null, ?array $elements = null): array { // evaluate if specific elements where requested if (!is_array($elements)) { @@ -104,10 +105,12 @@ public function entityList(?IFilter $filter = null, ?ISort $sort = null, ?IRange } } + #[\Override] public function collectionListFilter(): CollectionFilter { return new CollectionFilter(); } + #[\Override] public function entityListFilter(): EventFilter { return new EventFilter(); } diff --git a/lib/Store/Local/ServiceEntity.php b/lib/Store/Local/ServiceEntity.php index 7f9fd4d..fcddeb0 100644 --- a/lib/Store/Local/ServiceEntity.php +++ b/lib/Store/Local/ServiceEntity.php @@ -107,6 +107,7 @@ class ServiceEntity extends Entity implements JsonSerializable { protected ?string $contactsMode = null; protected ?string $eventsMode = null; + #[\Override] public function jsonSerialize(): array { return [ 'id' => $this->id, diff --git a/lib/Tasks/HarmonizationLauncher.php b/lib/Tasks/HarmonizationLauncher.php index e9eab52..1220f89 100644 --- a/lib/Tasks/HarmonizationLauncher.php +++ b/lib/Tasks/HarmonizationLauncher.php @@ -33,6 +33,7 @@ public function __construct( /** * @param array{uid?: string, sid?: int|string} $argument */ + #[\Override] protected function run($argument): void { if (!is_array($argument) || !isset($argument['uid'], $argument['sid'])) { $this->logger->warning('HarmonizationLauncher invoked without uid/sid', [ diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 0000000..32e6a7c --- /dev/null +++ b/psalm.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +