From 22913ca0997ea285d9c496d5350d108ce3a2da92 Mon Sep 17 00:00:00 2001 From: SebastianKrupinski Date: Wed, 26 Aug 2026 19:02:49 -0400 Subject: [PATCH 1/2] chore: implement rector Signed-off-by: SebastianKrupinski --- composer.json | 2 + rector.php | 32 ++ vendor-bin/rector/composer.json | 11 + vendor-bin/rector/composer.lock | 624 ++++++++++++++++++++++++++++++++ 4 files changed, 669 insertions(+) create mode 100644 rector.php create mode 100644 vendor-bin/rector/composer.json create mode 100644 vendor-bin/rector/composer.lock diff --git a/composer.json b/composer.json index 5b4696809e..3cbfa3bfab 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,8 @@ "cs:check": "php-cs-fixer fix --dry-run --diff", "cs:check:force": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --dry-run --diff", "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l", + "rector:apply": "rector && composer cs:fix", + "rector:check": "rector --dry-run", "test:unit": "phpunit -c phpunit.xml --fail-on-warning", "test:unit:coverage": "phpunit --coverage-clover coverage.xml -c phpunit.xml --fail-on-warning ", "test:unit:dev": "phpunit -c phpunit.xml --fail-on-warning --stop-on-error --stop-on-failure", diff --git a/rector.php b/rector.php new file mode 100644 index 0000000000..dfe6b95b23 --- /dev/null +++ b/rector.php @@ -0,0 +1,32 @@ +withPaths([ + __DIR__ . '/appinfo/routes.php', + __DIR__ . '/lib', + __DIR__ . '/tests/unit', + ]) + ->withAutoloadPaths([ + __DIR__ . '/vendor-bin/rector/vendor/nextcloud/ocp/OCP', + ]) + ->withImportNames(importShortClasses: false) + ->withPhpVersion(PhpVersion::PHP_82) + ->withRules([ + TypedPropertyFromStrictConstructorRector::class, + ]) + ->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [ + 'inline_public' => true, + 'rename_property' => true, + ]); diff --git a/vendor-bin/rector/composer.json b/vendor-bin/rector/composer.json new file mode 100644 index 0000000000..f3f50616e9 --- /dev/null +++ b/vendor-bin/rector/composer.json @@ -0,0 +1,11 @@ +{ + "config": { + "platform": { + "php": "8.1" + }, + "sort-packages": true + }, + "require-dev": { + "nextcloud/rector": "^0.5.2" + } +} diff --git a/vendor-bin/rector/composer.lock b/vendor-bin/rector/composer.lock new file mode 100644 index 0000000000..8f080ccdde --- /dev/null +++ b/vendor-bin/rector/composer.lock @@ -0,0 +1,624 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "5cbd7aefd3533652aadb0e4563b2b049", + "packages": [], + "packages-dev": [ + { + "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": "nextcloud/rector", + "version": "v0.5.2", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-libraries/rector.git", + "reference": "9967d62256cd7507f1104491fb2c427456481b56" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-libraries/rector/zipball/9967d62256cd7507f1104491fb2c427456481b56", + "reference": "9967d62256cd7507f1104491fb2c427456481b56", + "shasum": "" + }, + "require": { + "nextcloud/ocp": ">=27", + "php": "^8.1", + "rector/rector": "^2.0.4", + "webmozart/assert": "^1.11" + }, + "require-dev": { + "phpunit/phpunit": "^10.5", + "ramsey/devtools": "^2.0" + }, + "type": "library", + "extra": { + "captainhook": { + "force-install": true + }, + "ramsey/devtools": { + "memory-limit": "-1", + "command-prefix": "dev" + }, + "ramsey/conventional-commits": { + "configFile": "conventional-commits.json" + } + }, + "autoload": { + "psr-4": { + "OCP\\": "vendor/nextcloud/ocp/OCP", + "Nextcloud\\Rector\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at", + "homepage": "https://wuc.me" + } + ], + "description": "Rector upgrade rules for Nextcloud", + "keywords": [ + "nextcloud", + "refactoring" + ], + "support": { + "issues": "https://github.com/nextcloud-libraries/rector/issues", + "source": "https://github.com/nextcloud-libraries/rector/tree/v0.5.2" + }, + "time": "2026-06-15T06:39:12+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "2.2.9", + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/13d6b4f347bad222da436580c8304fa6f83e6bd0", + "reference": "13d6b4f347bad222da436580c8304fa6f83e6bd0", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ondřej Mirtes" + }, + { + "name": "Markus Staab" + }, + { + "name": "Vincent Langlet" + } + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2026-08-22T07:38:16+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": "rector/rector", + "version": "2.6.3", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "7e46709996a4b3dc59e1d6ecbb6a38ace335bd58" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/7e46709996a4b3dc59e1d6ecbb6a38ace335bd58", + "reference": "7e46709996a4b3dc59e1d6ecbb6a38ace335bd58", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0", + "phpstan/phpstan": "^2.2.6" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "suggest": { + "ext-dom": "To manipulate phpunit.xml via the custom-rule command" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "homepage": "https://getrector.com/", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/2.6.3" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2026-08-18T22:01:18+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.12.1", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "9be6926d8b485f55b9229203f962b51ed377ba68" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/9be6926d8b485f55b9229203f962b51ed377ba68", + "reference": "9be6926d8b485f55b9229203f962b51ed377ba68", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-date": "*", + "ext-filter": "*", + "php": "^7.2 || ^8.0" + }, + "suggest": { + "ext-intl": "", + "ext-simplexml": "", + "ext-spl": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.12.1" + }, + "time": "2025-10-29T15:56:20+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": {}, + "platform-dev": {}, + "platform-overrides": { + "php": "8.1" + }, + "plugin-api-version": "2.6.0" +} From fe0597592e5d165321bd46af88c5c2e6bd3c08ca Mon Sep 17 00:00:00 2001 From: SebastianKrupinski Date: Wed, 26 Aug 2026 19:03:57 -0400 Subject: [PATCH 2/2] chore: apply rector Signed-off-by: SebastianKrupinski --- REUSE.toml | 6 ++++++ lib/Cron/SocialUpdateRegistration.php | 2 +- lib/Dav/PatchPlugin.php | 7 ++++--- lib/Service/Social/CompositeSocialProvider.php | 2 +- lib/Service/Social/DiasporaProvider.php | 6 ++---- lib/Service/Social/FacebookProvider.php | 3 +-- lib/Service/Social/InstagramProvider.php | 13 +++++-------- lib/Service/Social/MastodonProvider.php | 3 +-- lib/Service/Social/TelegramProvider.php | 13 +++++-------- lib/Service/Social/XingProvider.php | 3 +-- lib/Service/SocialApiService.php | 2 +- 11 files changed, 28 insertions(+), 32 deletions(-) diff --git a/REUSE.toml b/REUSE.toml index b0f64241a6..65dbcdedcd 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -5,6 +5,12 @@ SPDX-PackageName = "contacts" SPDX-PackageSupplier = "Nextcloud " SPDX-PackageDownloadLocation = "https://github.com/nextcloud/contacts" +[[annotations]] +path = ["vendor-bin/rector/composer.json", "vendor-bin/rector/composer.lock"] +precedence = "aggregate" +SPDX-FileCopyrightText = "2026 Nextcloud GmbH and Nextcloud contributors" +SPDX-License-Identifier = "AGPL-3.0-or-later" + [[annotations]] path = ["l10n/**.js", "l10n/**.json", "js/**.js.map", "js/**.js"] precedence = "aggregate" diff --git a/lib/Cron/SocialUpdateRegistration.php b/lib/Cron/SocialUpdateRegistration.php index dff5a9da58..e4f6eb4308 100644 --- a/lib/Cron/SocialUpdateRegistration.php +++ b/lib/Cron/SocialUpdateRegistration.php @@ -19,7 +19,7 @@ use OCP\IUserManager; class SocialUpdateRegistration extends TimedJob { - private $appName; + private string $appName; /** * RegisterSocialUpdate constructor. diff --git a/lib/Dav/PatchPlugin.php b/lib/Dav/PatchPlugin.php index 9b488ec78a..060406c32e 100644 --- a/lib/Dav/PatchPlugin.php +++ b/lib/Dav/PatchPlugin.php @@ -11,6 +11,7 @@ use Sabre\CardDAV\Card; use Sabre\DAV; +use Sabre\DAV\Exception\BadRequest; use Sabre\DAV\Server; use Sabre\DAV\ServerPlugin; use Sabre\HTTP\RequestInterface; @@ -91,7 +92,7 @@ public function httpPatch(RequestInterface $request, ResponseInterface $response // Init property name & value $propertyName = $request->getHeader('X-Property'); if (is_null($propertyName)) { - throw new DAV\Exception\BadRequest('No valid "X-Property" found in the headers'); + throw new BadRequest('No valid "X-Property" found in the headers'); } $propertyData = $request->getHeader('X-Property-Replace'); @@ -100,7 +101,7 @@ public function httpPatch(RequestInterface $request, ResponseInterface $response $propertyData = $request->getHeader('X-Property-Append'); $method = self::METHOD_APPEND; if (is_null($propertyData)) { - throw new DAV\Exception\BadRequest('No valid "X-Property-Append" or "X-Property-Replace" found in the headers'); + throw new BadRequest('No valid "X-Property-Append" or "X-Property-Replace" found in the headers'); } } @@ -112,7 +113,7 @@ public function httpPatch(RequestInterface $request, ResponseInterface $response // We cannot know which one to update in that case if (count($properties) > 1) { - throw new DAV\Exception\BadRequest('The specified property appear more than once'); + throw new BadRequest('The specified property appear more than once'); } // Init if not in the vcard diff --git a/lib/Service/Social/CompositeSocialProvider.php b/lib/Service/Social/CompositeSocialProvider.php index 08a8f5b63d..df016500a2 100644 --- a/lib/Service/Social/CompositeSocialProvider.php +++ b/lib/Service/Social/CompositeSocialProvider.php @@ -12,7 +12,7 @@ */ class CompositeSocialProvider { /** @var ISocialProvider[] */ - private $providers; + private array $providers; public function __construct(InstagramProvider $instagramProvider, MastodonProvider $mastodonProvider, diff --git a/lib/Service/Social/DiasporaProvider.php b/lib/Service/Social/DiasporaProvider.php index ef547a228f..0243c5959b 100644 --- a/lib/Service/Social/DiasporaProvider.php +++ b/lib/Service/Social/DiasporaProvider.php @@ -11,11 +11,9 @@ use OCP\Http\Client\IClientService; class DiasporaProvider implements ISocialProvider { - /** @var IClient */ - private $httpClient; + private IClient $httpClient; - /** @var bool */ - private $looping; + private bool $looping; /** @var string */ public $name = 'diaspora'; diff --git a/lib/Service/Social/FacebookProvider.php b/lib/Service/Social/FacebookProvider.php index 0591dd482a..302aed3057 100644 --- a/lib/Service/Social/FacebookProvider.php +++ b/lib/Service/Social/FacebookProvider.php @@ -11,8 +11,7 @@ use OCP\Http\Client\IClientService; class FacebookProvider implements ISocialProvider { - /** @var IClient */ - private $httpClient; + private IClient $httpClient; /** @var string */ public $name = 'facebook'; diff --git a/lib/Service/Social/InstagramProvider.php b/lib/Service/Social/InstagramProvider.php index 88293b98c1..10795c09b1 100644 --- a/lib/Service/Social/InstagramProvider.php +++ b/lib/Service/Social/InstagramProvider.php @@ -13,19 +13,16 @@ use Psr\Log\LoggerInterface; class InstagramProvider implements ISocialProvider { - /** @var IClient */ - private $httpClient; - - /** @var LoggerInterface */ - private $logger; + private IClient $httpClient; /** @var string */ public $name = 'instagram'; - public function __construct(IClientService $httpClient, - LoggerInterface $logger) { + public function __construct( + IClientService $httpClient, + private LoggerInterface $logger, + ) { $this->httpClient = $httpClient->newClient(); - $this->logger = $logger; } /** diff --git a/lib/Service/Social/MastodonProvider.php b/lib/Service/Social/MastodonProvider.php index 1763e8b11c..d8494aa14d 100644 --- a/lib/Service/Social/MastodonProvider.php +++ b/lib/Service/Social/MastodonProvider.php @@ -11,8 +11,7 @@ use OCP\Http\Client\IClientService; class MastodonProvider implements ISocialProvider { - /** @var IClient */ - private $httpClient; + private IClient $httpClient; /** @var string */ public $name = 'mastodon'; diff --git a/lib/Service/Social/TelegramProvider.php b/lib/Service/Social/TelegramProvider.php index ec43a34ea8..74075fbd2a 100644 --- a/lib/Service/Social/TelegramProvider.php +++ b/lib/Service/Social/TelegramProvider.php @@ -13,19 +13,16 @@ use Psr\Log\LoggerInterface; class TelegramProvider implements ISocialProvider { - /** @var IClient */ - private $httpClient; - - /** @var LoggerInterface */ - private $logger; + private IClient $httpClient; /** @var string */ public $name = 'telegram'; - public function __construct(IClientService $httpClient, - LoggerInterface $logger) { + public function __construct( + IClientService $httpClient, + private LoggerInterface $logger, + ) { $this->httpClient = $httpClient->newClient(); - $this->logger = $logger; } /** diff --git a/lib/Service/Social/XingProvider.php b/lib/Service/Social/XingProvider.php index 2c9a8e305c..c9bb6774e6 100644 --- a/lib/Service/Social/XingProvider.php +++ b/lib/Service/Social/XingProvider.php @@ -11,8 +11,7 @@ use OCP\Http\Client\IClientService; class XingProvider implements ISocialProvider { - /** @var IClient */ - private $httpClient; + private IClient $httpClient; /** @var string */ public $name = 'xing'; diff --git a/lib/Service/SocialApiService.php b/lib/Service/SocialApiService.php index 5af2607f62..6f05911e0b 100644 --- a/lib/Service/SocialApiService.php +++ b/lib/Service/SocialApiService.php @@ -32,7 +32,7 @@ class SocialApiService { 'image/jpeg', 'image/gif' ]; - private $appName; + private string $appName; public function __construct( private CompositeSocialProvider $socialProvider,