From be80ca5d0fc9bd77f4c7c8fd7c986d378b79cc13 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 15 Apr 2022 13:01:18 +0200 Subject: [PATCH] Update to php 7.4 type hinting Using rector Signed-off-by: Carl Schwan --- composer.json | 5 +- composer.lock | 125 +++++++++++++++++- lib/Command/AccountCreate.php | 40 +----- lib/Command/AccountFollowing.php | 39 +----- lib/Command/CacheRefresh.php | 48 +------ lib/Command/CheckInstall.php | 24 ++-- lib/Command/ExtendedBase.php | 6 +- lib/Command/Fediverse.php | 12 +- lib/Command/MigrateAlpha3.php | 21 +-- lib/Command/NoteBoost.php | 12 +- lib/Command/NoteCreate.php | 18 +-- lib/Command/NoteLike.php | 12 +- lib/Command/QueueProcess.php | 15 +-- lib/Command/QueueStatus.php | 9 +- lib/Command/Reset.php | 12 +- lib/Command/StreamDetails.php | 9 +- lib/Command/Timeline.php | 18 +-- lib/Controller/ActivityPubController.php | 33 ++--- lib/Controller/ApiController.php | 36 ++--- lib/Controller/ConfigController.php | 9 +- lib/Controller/LocalController.php | 39 ++---- lib/Controller/OAuthController.php | 24 ++-- lib/Controller/OStatusController.php | 18 +-- lib/Controller/QueueController.php | 9 +- lib/Controller/SocialPubController.php | 21 +-- lib/Cron/Cache.php | 12 +- lib/Cron/Chunk.php | 6 +- lib/Cron/Queue.php | 12 +- lib/Db/CoreRequestBuilder.php | 3 +- lib/Db/SocialQueryBuilder.php | 3 +- lib/Interfaces/Activity/AcceptInterface.php | 3 +- lib/Interfaces/Activity/AddInterface.php | 3 +- lib/Interfaces/Activity/BlockInterface.php | 3 +- lib/Interfaces/Activity/CreateInterface.php | 3 +- lib/Interfaces/Activity/DeleteInterface.php | 3 +- lib/Interfaces/Activity/RejectInterface.php | 3 +- lib/Interfaces/Activity/RemoveInterface.php | 3 +- lib/Interfaces/Activity/UndoInterface.php | 3 +- lib/Interfaces/Activity/UpdateInterface.php | 3 +- lib/Interfaces/Actor/PersonInterface.php | 18 +-- .../SocialAppNotificationInterface.php | 12 +- lib/Interfaces/Object/AnnounceInterface.php | 15 +-- lib/Interfaces/Object/DocumentInterface.php | 6 +- lib/Interfaces/Object/FollowInterface.php | 18 +-- lib/Interfaces/Object/LikeInterface.php | 12 +- lib/Interfaces/Object/NoteInterface.php | 15 +-- lib/Migration/CheckInstallation.php | 3 +- .../Version0003Date20200611000001.php | 3 +- .../Version0003Date20200823023900.php | 3 +- .../Version0003Date20200823023911.php | 3 +- .../Version0003Date20200921103342.php | 3 +- lib/Model/ActivityPub/ACore.php | 21 +-- lib/Model/ActivityPub/Actor/Person.php | 75 ++++------- lib/Model/ActivityPub/Item.php | 80 ++++------- lib/Model/ActivityPub/Object/Document.php | 24 ++-- lib/Model/ActivityPub/Object/Follow.php | 9 +- lib/Model/ActivityPub/Object/Note.php | 6 +- lib/Model/ActivityPub/OrderedCollection.php | 6 +- lib/Model/ActivityPub/Stream.php | 39 ++---- lib/Model/Client/Options/CoreOptions.php | 3 +- lib/Model/Client/Options/TimelineOptions.php | 27 ++-- lib/Model/Client/SocialClient.php | 45 ++----- lib/Model/Instance.php | 51 +++---- lib/Model/InstancePath.php | 9 +- lib/Model/LinkedDataSignature.php | 24 ++-- lib/Model/Post.php | 22 ++- lib/Model/RequestQueue.php | 30 ++--- lib/Model/StreamAction.php | 12 +- lib/Model/StreamDetails.php | 13 +- lib/Model/StreamQueue.php | 21 +-- lib/Model/Test.php | 12 +- lib/Notification/Notifier.php | 15 +-- lib/Providers/ContactsMenuProvider.php | 15 +-- lib/Search/UnifiedSearchProvider.php | 30 ++--- lib/Service/ActivityService.php | 27 ++-- lib/Service/ActorService.php | 15 +-- lib/Service/BoostService.php | 21 +-- lib/Service/CacheActorService.php | 18 +-- lib/Service/CacheDocumentService.php | 12 +- lib/Service/CheckService.php | 39 ++---- lib/Service/ClientService.php | 6 +- lib/Service/ConfigService.php | 21 +-- lib/Service/CurlService.php | 9 +- lib/Service/DetailsService.php | 12 +- lib/Service/DocumentService.php | 21 +-- lib/Service/FediverseService.php | 6 +- lib/Service/FollowService.php | 18 +-- lib/Service/HashtagService.php | 12 +- lib/Service/ImportService.php | 6 +- lib/Service/InstanceService.php | 6 +- lib/Service/LikeService.php | 21 +-- lib/Service/PostService.php | 18 +-- lib/Service/PushService.php | 13 +- lib/Service/RequestQueueService.php | 9 +- lib/Service/SearchService.php | 12 +- lib/Service/SignatureService.php | 15 +-- lib/Service/StreamActionService.php | 6 +- lib/Service/StreamQueueService.php | 18 +-- lib/Service/StreamService.php | 24 ++-- lib/Service/TestService.php | 9 +- lib/Service/UpdateService.php | 15 +-- lib/hostmeta.php | 3 +- rector.php | 31 +++++ tests/SocialTest.php | 3 +- 104 files changed, 684 insertions(+), 1139 deletions(-) create mode 100644 rector.php diff --git a/composer.json b/composer.json index bc4315ce..82ee931f 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "config": { "platform": { - "php": "7.0.0" + "php": "7.4.0" }, "optimize-autoloader": true, "classmap-authoritative": true, @@ -29,7 +29,8 @@ }, "require-dev": { "jakub-onderka/php-parallel-lint": "^1.0", - "phpunit/phpunit": "^6.4" + "phpunit/phpunit": "^6.4", + "rector/rector": "^0.12.20" }, "repositories": [ { diff --git a/composer.lock b/composer.lock index 302f8fc2..a8353537 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": "773474981fdf7ef0b2f1bcf58cf1b2ec", + "content-hash": "405966d6d5e0478e4540a9f1e26734fc", "packages": [ { "name": "daita/my-small-php-tools", @@ -607,6 +607,65 @@ ], "time": "2020-03-05T15:02:03+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.5.5", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "d77a607667f29ae099c0686f99664bd451fd23df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d77a607667f29ae099c0686f99664bd451fd23df", + "reference": "d77a607667f29ae099c0686f99664bd451fd23df", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/1.5.5" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpstan", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2022-04-14T12:20:26+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "5.3.2", @@ -1001,6 +1060,66 @@ "abandoned": true, "time": "2018-08-09T05:50:03+00:00" }, + { + "name": "rector/rector", + "version": "0.12.20", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "cfa8d3e236a6e1a41d69712a84d434dfdf70e560" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/cfa8d3e236a6e1a41d69712a84d434dfdf70e560", + "reference": "cfa8d3e236a6e1a41d69712a84d434dfdf70e560", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.5" + }, + "conflict": { + "phpstan/phpdoc-parser": "<1.2", + "rector/rector-cakephp": "*", + "rector/rector-doctrine": "*", + "rector/rector-laravel": "*", + "rector/rector-nette": "*", + "rector/rector-phpoffice": "*", + "rector/rector-phpunit": "*", + "rector/rector-prefixed": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.12-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/0.12.20" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2022-04-06T12:55:14+00:00" + }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.2", @@ -1766,7 +1885,7 @@ "platform": [], "platform-dev": [], "platform-overrides": { - "php": "7.0.0" + "php": "7.4.0" }, - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.2.0" } diff --git a/lib/Command/AccountCreate.php b/lib/Command/AccountCreate.php index c42d4757..90a07351 100644 --- a/lib/Command/AccountCreate.php +++ b/lib/Command/AccountCreate.php @@ -45,33 +45,12 @@ use Symfony\Component\Console\Output\OutputInterface; class AccountCreate extends Base { + private IUserManager $userManager; + private AccountService $accountService; + private CacheActorService $cacheActorService; + private ConfigService $configService; + private MiscService $miscService; - - /** @var IUserManager */ - private $userManager; - - /** @var AccountService */ - private $accountService; - - /** @var CacheActorService */ - private $cacheActorService; - - /** @var ConfigService */ - private $configService; - - /** @var MiscService */ - private $miscService; - - - /** - * CacheUpdate constructor. - * - * @param IUserManager $userManager - * @param AccountService $accountService - * @param CacheActorService $cacheActorService - * @param ConfigService $configService - * @param MiscService $miscService - */ public function __construct( IUserManager $userManager, AccountService $accountService, CacheActorService $cacheActorService, ConfigService $configService, MiscService $miscService @@ -86,10 +65,6 @@ class AccountCreate extends Base { $this->miscService = $miscService; } - - /** - * - */ protected function configure() { parent::configure(); $this->setName('social:account:create') @@ -98,11 +73,7 @@ class AccountCreate extends Base { ->setDescription('Create a new social account'); } - /** - * @param InputInterface $input - * @param OutputInterface $output - * * @throws Exception */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -118,6 +89,5 @@ class AccountCreate extends Base { $this->accountService->createActor($userId, $handle); } - } diff --git a/lib/Command/AccountFollowing.php b/lib/Command/AccountFollowing.php index 5833ef11..e38669e2 100644 --- a/lib/Command/AccountFollowing.php +++ b/lib/Command/AccountFollowing.php @@ -45,33 +45,12 @@ use Symfony\Component\Console\Output\OutputInterface; class AccountFollowing extends Base { + private AccountService $accountService; + private CacheActorService $cacheActorService; + private FollowService $followService; + private ConfigService $configService; + private MiscService $miscService; - - /** @var AccountService */ - private $accountService; - - /** @var CacheActorService */ - private $cacheActorService; - - /** @var FollowService */ - private $followService; - - /** @var ConfigService */ - private $configService; - - /** @var MiscService */ - private $miscService; - - - /** - * CacheUpdate constructor. - * - * @param AccountService $accountService - * @param CacheActorService $cacheActorService - * @param FollowService $followService - * @param ConfigService $configService - * @param MiscService $miscService - */ public function __construct( AccountService $accountService, CacheActorService $cacheActorService, FollowService $followService, ConfigService $configService, MiscService $miscService @@ -85,10 +64,6 @@ class AccountFollowing extends Base { $this->miscService = $miscService; } - - /** - * - */ protected function configure() { parent::configure(); $this->setName('social:account:following') @@ -99,11 +74,7 @@ class AccountFollowing extends Base { ->setDescription('Following a new account'); } - /** - * @param InputInterface $input - * @param OutputInterface $output - * * @throws Exception */ protected function execute(InputInterface $input, OutputInterface $output) { diff --git a/lib/Command/CacheRefresh.php b/lib/Command/CacheRefresh.php index 349edc4f..9b9c0d6c 100644 --- a/lib/Command/CacheRefresh.php +++ b/lib/Command/CacheRefresh.php @@ -44,41 +44,14 @@ use Symfony\Component\Console\Output\OutputInterface; class CacheRefresh extends Base { + private AccountService $accountService; + private CacheActorService $cacheActorService; + private DocumentService $documentService; + private HashtagService $hashtagService; - - /** @var AccountService */ - private $accountService; - - /** @var CacheActorService */ - private $cacheActorService; - - /** @var DocumentService */ - private $documentService; - - /** @var HashtagService */ - private $hashtagService; - - /** @var ConfigService */ - private $configService; - - /** @var MiscService */ - private $miscService; - - - /** - * CacheUpdate constructor. - * - * @param AccountService $accountService - * @param CacheActorService $cacheActorService - * @param DocumentService $documentService - * @param HashtagService $hashtagService - * @param ConfigService $configService - * @param MiscService $miscService - */ public function __construct( AccountService $accountService, CacheActorService $cacheActorService, - DocumentService $documentService, HashtagService $hashtagService, - ConfigService $configService, MiscService $miscService + DocumentService $documentService, HashtagService $hashtagService ) { parent::__construct(); @@ -86,25 +59,15 @@ class CacheRefresh extends Base { $this->cacheActorService = $cacheActorService; $this->documentService = $documentService; $this->hashtagService = $hashtagService; - $this->configService = $configService; - $this->miscService = $miscService; } - - /** - * - */ protected function configure() { parent::configure(); $this->setName('social:cache:refresh') ->setDescription('Update the cache'); } - /** - * @param InputInterface $input - * @param OutputInterface $output - * * @throws Exception */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -127,6 +90,5 @@ class CacheRefresh extends Base { $result = $this->hashtagService->manageHashtags(); $output->writeLn($result . ' hashtags updated'); } - } diff --git a/lib/Command/CheckInstall.php b/lib/Command/CheckInstall.php index 84bc805b..3c4855bd 100644 --- a/lib/Command/CheckInstall.php +++ b/lib/Command/CheckInstall.php @@ -56,32 +56,24 @@ class CheckInstall extends Base { use TArrayTools; - /** @var IUserManager */ - private $userManager; + private IUserManager $userManager; - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var StreamDestRequest */ - private $streamDestRequest; + private StreamDestRequest $streamDestRequest; - /** @var StreamTagsRequest */ - private $streamTagsRequest; + private StreamTagsRequest $streamTagsRequest; - /** @var CheckService */ - private $checkService; + private CheckService $checkService; /** @var */ private $configService; - /** @var PushService */ - private $pushService; + private PushService $pushService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Command/ExtendedBase.php b/lib/Command/ExtendedBase.php index 743c6fb5..0f186c47 100644 --- a/lib/Command/ExtendedBase.php +++ b/lib/Command/ExtendedBase.php @@ -44,11 +44,9 @@ use Symfony\Component\Console\Output\OutputInterface; class ExtendedBase extends Base { - /** @var OutputInterface */ - protected $output; + protected ?OutputInterface $output = null; - /** @var bool */ - protected $asJson = false; + protected bool $asJson = false; /** diff --git a/lib/Command/Fediverse.php b/lib/Command/Fediverse.php index ac8ce4ab..65de1a14 100644 --- a/lib/Command/Fediverse.php +++ b/lib/Command/Fediverse.php @@ -51,18 +51,14 @@ use Symfony\Component\Console\Output\OutputInterface; class Fediverse extends Base { - /** @var FediverseService */ - private $fediverseService; + private FediverseService $fediverseService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; - /** @var OutputInterface */ - private $output; + private ?OutputInterface $output = null; /** diff --git a/lib/Command/MigrateAlpha3.php b/lib/Command/MigrateAlpha3.php index a794a91c..b2ec3ba4 100644 --- a/lib/Command/MigrateAlpha3.php +++ b/lib/Command/MigrateAlpha3.php @@ -53,27 +53,20 @@ class MigrateAlpha3 extends Base { use TArrayTools; - /** @var IDBConnection */ - private $dbConnection; + private IDBConnection $dbConnection; - /** @var CoreRequestBuilder */ - private $coreRequestBuilder; + private CoreRequestBuilder $coreRequestBuilder; - /** @var CheckService */ - private $checkService; + private CheckService $checkService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; - /** @var array */ - private $done = []; + private array $done = []; - /** @var array */ - public $tables = [ + public array $tables = [ 'social_a2_actions' => [ ['id_prim'], 'social_3_action', diff --git a/lib/Command/NoteBoost.php b/lib/Command/NoteBoost.php index 499672ce..828f9c67 100644 --- a/lib/Command/NoteBoost.php +++ b/lib/Command/NoteBoost.php @@ -50,17 +50,13 @@ use Symfony\Component\Console\Output\OutputInterface; */ class NoteBoost extends Base { - /** @var StreamService */ - private $streamService; + private StreamService $streamService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var BoostService */ - private $boostService; + private BoostService $boostService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Command/NoteCreate.php b/lib/Command/NoteCreate.php index d54d9c30..9fb8cc97 100644 --- a/lib/Command/NoteCreate.php +++ b/lib/Command/NoteCreate.php @@ -54,23 +54,17 @@ use Symfony\Component\Console\Output\OutputInterface; class NoteCreate extends Base { - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var ActivityService */ - private $activityService; + private ActivityService $activityService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var PostService */ - private $postService; + private PostService $postService; - /** @var CurlService */ - private $curlService; + private CurlService $curlService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Command/NoteLike.php b/lib/Command/NoteLike.php index 6c45bb95..87d36112 100644 --- a/lib/Command/NoteLike.php +++ b/lib/Command/NoteLike.php @@ -51,17 +51,13 @@ use Symfony\Component\Console\Output\OutputInterface; class NoteLike extends Base { - /** @var StreamService */ - private $streamService; + private StreamService $streamService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var LikeService */ - private $likeService; + private LikeService $likeService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Command/QueueProcess.php b/lib/Command/QueueProcess.php index ef36d8e0..b696efd2 100644 --- a/lib/Command/QueueProcess.php +++ b/lib/Command/QueueProcess.php @@ -45,20 +45,15 @@ use Symfony\Component\Console\Output\OutputInterface; class QueueProcess extends Base { - /** @var ActivityService */ - private $activityService; + private ActivityService $activityService; - /** @var StreamQueueService */ - private $streamQueueService; + private StreamQueueService $streamQueueService; - /** @var RequestQueueService */ - private $requestQueueService; + private RequestQueueService $requestQueueService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Command/QueueStatus.php b/lib/Command/QueueStatus.php index baa85c0b..d3eaade2 100644 --- a/lib/Command/QueueStatus.php +++ b/lib/Command/QueueStatus.php @@ -43,14 +43,11 @@ use Symfony\Component\Console\Output\OutputInterface; class QueueStatus extends Base { - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var RequestQueueService */ - private $requestQueueService; + private RequestQueueService $requestQueueService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Command/Reset.php b/lib/Command/Reset.php index f81de329..b864296e 100644 --- a/lib/Command/Reset.php +++ b/lib/Command/Reset.php @@ -47,17 +47,13 @@ use Symfony\Component\Console\Question\Question; class Reset extends Base { - /** @var CoreRequestBuilder */ - private $coreRequestBuilder; + private CoreRequestBuilder $coreRequestBuilder; - /** @var CheckService */ - private $checkService; + private CheckService $checkService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Command/StreamDetails.php b/lib/Command/StreamDetails.php index 3d8a5956..e5bc52ff 100644 --- a/lib/Command/StreamDetails.php +++ b/lib/Command/StreamDetails.php @@ -52,14 +52,11 @@ use Symfony\Component\Console\Output\OutputInterface; class StreamDetails extends ExtendedBase { - /** @var StreamService */ - private $streamService; + private StreamService $streamService; - /** @var DetailsService */ - private $detailsService; + private DetailsService $detailsService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Command/Timeline.php b/lib/Command/Timeline.php index 8330afd0..4913f249 100644 --- a/lib/Command/Timeline.php +++ b/lib/Command/Timeline.php @@ -52,24 +52,18 @@ use Symfony\Component\Console\Output\OutputInterface; */ class Timeline extends ExtendedBase { - /** @var IUserManager */ - private $userManager; + private IUserManager $userManager; - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; - /** @var int */ - private $count; + private ?int $count = null; /** diff --git a/lib/Controller/ActivityPubController.php b/lib/Controller/ActivityPubController.php index 0462b3da..6a92e309 100644 --- a/lib/Controller/ActivityPubController.php +++ b/lib/Controller/ActivityPubController.php @@ -69,38 +69,27 @@ class ActivityPubController extends Controller { use TNC20Logger; - /** @var SocialPubController */ - private $socialPubController; + private SocialPubController $socialPubController; - /** @var FediverseService */ - private $fediverseService; + private FediverseService $fediverseService; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var SignatureService */ - private $signatureService; + private SignatureService $signatureService; - /** @var StreamQueueService */ - private $streamQueueService; + private StreamQueueService $streamQueueService; - /** @var ImportService */ - private $importService; + private ImportService $importService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var FollowService */ - private $followService; + private FollowService $followService; - /** @var StreamService */ - private $streamService; + private StreamService $streamService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index a0b7bc0a..5d9d2f19 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -67,42 +67,30 @@ class ApiController extends Controller { use TNCDataResponse; - /** @var IUserSession */ - private $userSession; + private IUserSession $userSession; - /** @var InstanceService */ - private $instanceService; + private InstanceService $instanceService; - /** @var ClientService */ - private $clientService; + private ClientService $clientService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var FollowService */ - private $followService; + private FollowService $followService; - /** @var StreamService */ - private $streamService; + private StreamService $streamService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; - /** @var string */ - private $bearer = ''; + private string $bearer = ''; - /** @var SocialClient */ - private $client; + private ?SocialClient $client = null; - /** @var Person */ - private $viewer; + private ?Person $viewer = null; /** diff --git a/lib/Controller/ConfigController.php b/lib/Controller/ConfigController.php index 3009f1d1..4a200bcc 100644 --- a/lib/Controller/ConfigController.php +++ b/lib/Controller/ConfigController.php @@ -44,14 +44,11 @@ class ConfigController extends Controller { use TNCDataResponse; - /** @var TestService */ - private $testService; + private TestService $testService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; public function __construct( diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php index 1021d334..3c6f9750 100644 --- a/lib/Controller/LocalController.php +++ b/lib/Controller/LocalController.php @@ -72,45 +72,32 @@ class LocalController extends Controller { use TNCDataResponse; - /** @var string */ - private $userId; + private string $userId; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var HashtagService */ - private $hashtagService; + private HashtagService $hashtagService; - /** @var FollowService */ - private $followService; + private FollowService $followService; - /** @var BoostService */ - private $boostService; + private BoostService $boostService; - /** @var LikeService */ - private $likeService; + private LikeService $likeService; - /** @var PostService */ - private $postService; + private PostService $postService; - /** @var StreamService */ - private $streamService; + private StreamService $streamService; - /** @var SearchService */ - private $searchService; + private SearchService $searchService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var DocumentService */ - private $documentService; + private DocumentService $documentService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; - /** @var Person */ - private $viewer; + private ?Person $viewer = null; /** diff --git a/lib/Controller/OAuthController.php b/lib/Controller/OAuthController.php index 23a22c88..d8786a44 100644 --- a/lib/Controller/OAuthController.php +++ b/lib/Controller/OAuthController.php @@ -58,29 +58,21 @@ class OAuthController extends Controller { use TNCDataResponse; - /** @var IUserSession */ - private $userSession; + private IUserSession $userSession; - /** @var IURLGenerator */ - private $urlGenerator; + private IURLGenerator $urlGenerator; - /** @var InstanceService */ - private $instanceService; + private InstanceService $instanceService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var ClientService */ - private $clientService; + private ClientService $clientService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Controller/OStatusController.php b/lib/Controller/OStatusController.php index 07cd4a92..6aca8901 100644 --- a/lib/Controller/OStatusController.php +++ b/lib/Controller/OStatusController.php @@ -58,22 +58,16 @@ class OStatusController extends Controller { use TArrayTools; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var CurlService */ - private $curlService; + private CurlService $curlService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; - /** @var IUserManager */ - private $userSession; - /** @var IInitialStateService */ - private $initialStateService; + private IUserManager $userSession; + private IInitialStateService $initialStateService; /** diff --git a/lib/Controller/QueueController.php b/lib/Controller/QueueController.php index f562ee64..f6134216 100644 --- a/lib/Controller/QueueController.php +++ b/lib/Controller/QueueController.php @@ -51,14 +51,11 @@ class QueueController extends Controller { use TAsync; - /** @var RequestQueueService */ - private $requestQueueService; + private RequestQueueService $requestQueueService; - /** @var ActivityService */ - private $activityService; + private ActivityService $activityService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Controller/SocialPubController.php b/lib/Controller/SocialPubController.php index 8fada3ae..73698e57 100644 --- a/lib/Controller/SocialPubController.php +++ b/lib/Controller/SocialPubController.php @@ -65,26 +65,19 @@ class SocialPubController extends Controller { use TNCDataResponse; - /** @var string */ - private $userId; + private string $userId; - /** @var IL10N */ - private $l10n; + private IL10N $l10n; - /** @var NavigationController */ - private $navigationController; + private NavigationController $navigationController; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var StreamService */ - private $streamService; + private StreamService $streamService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; /** diff --git a/lib/Cron/Cache.php b/lib/Cron/Cache.php index afd05be6..5ccf28f1 100644 --- a/lib/Cron/Cache.php +++ b/lib/Cron/Cache.php @@ -49,17 +49,13 @@ use OCP\AppFramework\QueryException; class Cache extends TimedJob { - /** @var AccountService */ - private $accountService; + private ?AccountService $accountService = null; - /** @var CacheActorService */ - private $cacheActorService; + private ?CacheActorService $cacheActorService = null; - /** @var DocumentService */ - private $documentService; + private ?DocumentService $documentService = null; - /** @var HashtagService */ - private $hashtagService; + private ?HashtagService $hashtagService = null; /** diff --git a/lib/Cron/Chunk.php b/lib/Cron/Chunk.php index 7cfaba9d..e32903ce 100644 --- a/lib/Cron/Chunk.php +++ b/lib/Cron/Chunk.php @@ -45,11 +45,9 @@ use OCP\AppFramework\QueryException; */ class Chunk extends TimedJob { - /** @var ConfigService */ - private $configService; + private ?ConfigService $configService = null; - /** @var MiscService */ - private $miscService; + private ?MiscService $miscService = null; /** diff --git a/lib/Cron/Queue.php b/lib/Cron/Queue.php index b915a78d..d3a49cc7 100644 --- a/lib/Cron/Queue.php +++ b/lib/Cron/Queue.php @@ -49,17 +49,13 @@ use OCP\AppFramework\QueryException; class Queue extends TimedJob { - /** @var ActivityService */ - private $activityService; + private ?ActivityService $activityService = null; - /** @var RequestQueueService */ - private $requestQueueService; + private ?RequestQueueService $requestQueueService = null; - /** @var StreamQueueService */ - private $streamQueueService; + private ?StreamQueueService $streamQueueService = null; - /** @var MiscService */ - private $miscService; + private ?MiscService $miscService = null; /** diff --git a/lib/Db/CoreRequestBuilder.php b/lib/Db/CoreRequestBuilder.php index 2c18d6ba..c5a1ee1c 100644 --- a/lib/Db/CoreRequestBuilder.php +++ b/lib/Db/CoreRequestBuilder.php @@ -79,8 +79,7 @@ class CoreRequestBuilder { const TABLE_CLIENT_TOKEN = 'social_3_client_token'; - /** @var array */ - private $tables = [ + private array $tables = [ self::TABLE_REQUEST_QUEUE, self::TABLE_ACTORS, self::TABLE_STREAM, diff --git a/lib/Db/SocialQueryBuilder.php b/lib/Db/SocialQueryBuilder.php index 2dec5bb9..66caef66 100644 --- a/lib/Db/SocialQueryBuilder.php +++ b/lib/Db/SocialQueryBuilder.php @@ -39,8 +39,7 @@ namespace OCA\Social\Db; class SocialQueryBuilder extends SocialFiltersQueryBuilder { - /** @var int */ - private $format = 1; + private int $format = 1; /** diff --git a/lib/Interfaces/Activity/AcceptInterface.php b/lib/Interfaces/Activity/AcceptInterface.php index 32dff8e3..cba9eb77 100644 --- a/lib/Interfaces/Activity/AcceptInterface.php +++ b/lib/Interfaces/Activity/AcceptInterface.php @@ -42,8 +42,7 @@ use OCA\Social\Service\MiscService; class AcceptInterface implements IActivityPubInterface { - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Activity/AddInterface.php b/lib/Interfaces/Activity/AddInterface.php index e861f069..ae5c50c0 100644 --- a/lib/Interfaces/Activity/AddInterface.php +++ b/lib/Interfaces/Activity/AddInterface.php @@ -42,8 +42,7 @@ use OCA\Social\Service\MiscService; class AddInterface implements IActivityPubInterface { - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Activity/BlockInterface.php b/lib/Interfaces/Activity/BlockInterface.php index 958d0b00..7859e0a9 100644 --- a/lib/Interfaces/Activity/BlockInterface.php +++ b/lib/Interfaces/Activity/BlockInterface.php @@ -42,8 +42,7 @@ use OCA\Social\Service\MiscService; class BlockInterface implements IActivityPubInterface { - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Activity/CreateInterface.php b/lib/Interfaces/Activity/CreateInterface.php index a9555032..2adcbac6 100644 --- a/lib/Interfaces/Activity/CreateInterface.php +++ b/lib/Interfaces/Activity/CreateInterface.php @@ -42,8 +42,7 @@ use OCA\Social\Service\MiscService; class CreateInterface implements IActivityPubInterface { - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Activity/DeleteInterface.php b/lib/Interfaces/Activity/DeleteInterface.php index e0952733..00de37b5 100644 --- a/lib/Interfaces/Activity/DeleteInterface.php +++ b/lib/Interfaces/Activity/DeleteInterface.php @@ -42,8 +42,7 @@ use OCA\Social\Service\MiscService; class DeleteInterface implements IActivityPubInterface { - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Activity/RejectInterface.php b/lib/Interfaces/Activity/RejectInterface.php index d287c238..27065a27 100644 --- a/lib/Interfaces/Activity/RejectInterface.php +++ b/lib/Interfaces/Activity/RejectInterface.php @@ -42,8 +42,7 @@ use OCA\Social\Service\MiscService; class RejectInterface implements IActivityPubInterface { - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Activity/RemoveInterface.php b/lib/Interfaces/Activity/RemoveInterface.php index 92a4d7fb..bc99ba87 100644 --- a/lib/Interfaces/Activity/RemoveInterface.php +++ b/lib/Interfaces/Activity/RemoveInterface.php @@ -42,8 +42,7 @@ use OCA\Social\Service\MiscService; class RemoveInterface implements IActivityPubInterface { - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Activity/UndoInterface.php b/lib/Interfaces/Activity/UndoInterface.php index a5b03c9b..d7f3816f 100644 --- a/lib/Interfaces/Activity/UndoInterface.php +++ b/lib/Interfaces/Activity/UndoInterface.php @@ -42,8 +42,7 @@ use OCA\Social\Service\MiscService; class UndoInterface implements IActivityPubInterface { - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Activity/UpdateInterface.php b/lib/Interfaces/Activity/UpdateInterface.php index a99fc5f2..7cc805a8 100644 --- a/lib/Interfaces/Activity/UpdateInterface.php +++ b/lib/Interfaces/Activity/UpdateInterface.php @@ -42,8 +42,7 @@ use OCA\Social\Service\MiscService; class UpdateInterface implements IActivityPubInterface { - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Actor/PersonInterface.php b/lib/Interfaces/Actor/PersonInterface.php index f37aa450..3c79652b 100644 --- a/lib/Interfaces/Actor/PersonInterface.php +++ b/lib/Interfaces/Actor/PersonInterface.php @@ -58,23 +58,17 @@ class PersonInterface implements IActivityPubInterface { use TArrayTools; - /** @var CacheActorsRequest */ - private $cacheActorsRequest; + private CacheActorsRequest $cacheActorsRequest; - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var FollowsRequest */ - private $followsRequest; + private FollowsRequest $followsRequest; - /** @var ActorService */ - private $actorService; + private ActorService $actorService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Internal/SocialAppNotificationInterface.php b/lib/Interfaces/Internal/SocialAppNotificationInterface.php index 2ae45b9b..8c720948 100644 --- a/lib/Interfaces/Internal/SocialAppNotificationInterface.php +++ b/lib/Interfaces/Internal/SocialAppNotificationInterface.php @@ -45,17 +45,13 @@ use OCA\Social\Service\MiscService; class SocialAppNotificationInterface implements IActivityPubInterface { - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var CurlService */ - private $curlService; + private CurlService $curlService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Object/AnnounceInterface.php b/lib/Interfaces/Object/AnnounceInterface.php index 92ac256e..6bf9b16b 100644 --- a/lib/Interfaces/Object/AnnounceInterface.php +++ b/lib/Interfaces/Object/AnnounceInterface.php @@ -77,20 +77,15 @@ class AnnounceInterface implements IActivityPubInterface { use TArrayTools; - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var ActionsRequest */ - private $actionsRequest; + private ActionsRequest $actionsRequest; - /** @var StreamQueueService */ - private $streamQueueService; + private StreamQueueService $streamQueueService; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Object/DocumentInterface.php b/lib/Interfaces/Object/DocumentInterface.php index 8427ab56..8e1f9b41 100644 --- a/lib/Interfaces/Object/DocumentInterface.php +++ b/lib/Interfaces/Object/DocumentInterface.php @@ -45,11 +45,9 @@ use OCA\Social\Service\MiscService; class DocumentInterface implements IActivityPubInterface { - /** @var CacheDocumentsRequest */ - protected $cacheDocumentsRequest; + protected CacheDocumentsRequest $cacheDocumentsRequest; - /** @var MiscService */ - protected $miscService; + protected MiscService $miscService; /** diff --git a/lib/Interfaces/Object/FollowInterface.php b/lib/Interfaces/Object/FollowInterface.php index fb5d3c20..8cee835f 100644 --- a/lib/Interfaces/Object/FollowInterface.php +++ b/lib/Interfaces/Object/FollowInterface.php @@ -71,23 +71,17 @@ use OCA\Social\Service\MiscService; class FollowInterface implements IActivityPubInterface { - /** @var FollowsRequest */ - private $followsRequest; + private FollowsRequest $followsRequest; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var ActivityService */ - private $activityService; + private ActivityService $activityService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Object/LikeInterface.php b/lib/Interfaces/Object/LikeInterface.php index a97451a9..c4a2199f 100644 --- a/lib/Interfaces/Object/LikeInterface.php +++ b/lib/Interfaces/Object/LikeInterface.php @@ -61,17 +61,13 @@ use OCA\Social\Service\MiscService; */ class LikeInterface implements IActivityPubInterface { - /** @var ActionsRequest */ - private $actionsRequest; + private ActionsRequest $actionsRequest; - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Interfaces/Object/NoteInterface.php b/lib/Interfaces/Object/NoteInterface.php index 4210dd0a..30fb2923 100644 --- a/lib/Interfaces/Object/NoteInterface.php +++ b/lib/Interfaces/Object/NoteInterface.php @@ -49,20 +49,15 @@ use OCA\Social\Service\PushService; class NoteInterface implements IActivityPubInterface { - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var CurlService */ - private $curlService; + private CurlService $curlService; - /** @var PushService */ - private $pushService; + private PushService $pushService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Migration/CheckInstallation.php b/lib/Migration/CheckInstallation.php index 094f6896..ffed2485 100644 --- a/lib/Migration/CheckInstallation.php +++ b/lib/Migration/CheckInstallation.php @@ -44,8 +44,7 @@ use OCP\Migration\IRepairStep; class CheckInstallation implements IRepairStep { - /** @var CheckService */ - protected $checkService; + protected CheckService $checkService; /** diff --git a/lib/Migration/Version0003Date20200611000001.php b/lib/Migration/Version0003Date20200611000001.php index 847d2eb0..bfdd0d89 100644 --- a/lib/Migration/Version0003Date20200611000001.php +++ b/lib/Migration/Version0003Date20200611000001.php @@ -48,8 +48,7 @@ use OCP\Migration\SimpleMigrationStep; class Version0003Date20200611000001 extends SimpleMigrationStep { - /** @var IDBConnection */ - private $connection; + private IDBConnection $connection; /** diff --git a/lib/Migration/Version0003Date20200823023900.php b/lib/Migration/Version0003Date20200823023900.php index 33cba364..843575bb 100644 --- a/lib/Migration/Version0003Date20200823023900.php +++ b/lib/Migration/Version0003Date20200823023900.php @@ -49,8 +49,7 @@ use OCP\Migration\SimpleMigrationStep; class Version0003Date20200823023900 extends SimpleMigrationStep { - /** @var IDBConnection */ - private $connection; + private IDBConnection $connection; /** diff --git a/lib/Migration/Version0003Date20200823023911.php b/lib/Migration/Version0003Date20200823023911.php index 39c37e2c..f309cebc 100644 --- a/lib/Migration/Version0003Date20200823023911.php +++ b/lib/Migration/Version0003Date20200823023911.php @@ -49,8 +49,7 @@ use OCP\Migration\SimpleMigrationStep; class Version0003Date20200823023911 extends SimpleMigrationStep { - /** @var IDBConnection */ - private $connection; + private IDBConnection $connection; /** diff --git a/lib/Migration/Version0003Date20200921103342.php b/lib/Migration/Version0003Date20200921103342.php index 62665570..cdbee9e2 100644 --- a/lib/Migration/Version0003Date20200921103342.php +++ b/lib/Migration/Version0003Date20200921103342.php @@ -47,8 +47,7 @@ use OCP\Migration\SimpleMigrationStep; class Version0003Date20200921103342 extends SimpleMigrationStep { - /** @var IDBConnection */ - private $connection; + private IDBConnection $connection; /** diff --git a/lib/Model/ActivityPub/ACore.php b/lib/Model/ActivityPub/ACore.php index 2e00e0dc..593ee7b8 100644 --- a/lib/Model/ActivityPub/ACore.php +++ b/lib/Model/ActivityPub/ACore.php @@ -71,26 +71,19 @@ class ACore extends Item implements JsonSerializable { /** @var null Item */ private $parent = null; - /** @var string */ - private $requestToken = ''; + private string $requestToken = ''; - /** @var array */ - private $entries = []; + private array $entries = []; - /** @var ACore */ - private $object = null; + private ?\OCA\Social\Model\ActivityPub\ACore $object = null; - /** @var Document */ - private $icon = null; + private ?Document $icon = null; - /** @var bool */ - private $displayW3ContextSecurity = false; + private bool $displayW3ContextSecurity = false; - /** @var LinkedDataSignature */ - private $signature = null; + private ?LinkedDataSignature $signature = null; - /** @var int */ - private $format = self::FORMAT_ACTIVITYPUB; + private int $format = self::FORMAT_ACTIVITYPUB; /** diff --git a/lib/Model/ActivityPub/Actor/Person.php b/lib/Model/ActivityPub/Actor/Person.php index e55030ec..4ff61823 100644 --- a/lib/Model/ActivityPub/Actor/Person.php +++ b/lib/Model/ActivityPub/Actor/Person.php @@ -64,80 +64,55 @@ class Person extends ACore implements IQueryRow, JsonSerializable { const LINK_LOCAL = 'local'; - /** @var string */ - private $userId = ''; + private string $userId = ''; - /** @var string */ - private $name = ''; + private string $name = ''; - /** @var string */ - private $preferredUsername = ''; + private string $preferredUsername = ''; - /** @var string */ - private $displayName = ''; + private string $displayName = ''; - /** @var string */ - private $description = ''; + private string $description = ''; - /** @var string */ - private $publicKey = ''; + private string $publicKey = ''; - /** @var string */ - private $privateKey = ''; + private string $privateKey = ''; - /** @var int */ - private $creation = 0; + private int $creation = 0; - /** @var string */ - private $account = ''; + private string $account = ''; - /** @var string */ - private $following = ''; + private string $following = ''; - /** @var string */ - private $followers = ''; + private string $followers = ''; - /** @var string */ - private $inbox = ''; + private string $inbox = ''; - /** @var string */ - private $outbox = ''; + private string $outbox = ''; - /** @var string */ - private $sharedInbox = ''; + private string $sharedInbox = ''; - /** @var string */ - private $featured = ''; + private string $featured = ''; - /** @var string */ - private $avatar = ''; + private string $avatar = ''; - /** @var string */ - private $header = ''; + private string $header = ''; - /** @var bool */ - private $locked = false; + private bool $locked = false; - /** @var bool */ - private $bot = false; + private bool $bot = false; - /** @var bool */ - private $discoverable = false; + private bool $discoverable = false; - /** @var string */ - private $privacy = 'public'; + private string $privacy = 'public'; - /** @var bool */ - private $sensitive = false; + private bool $sensitive = false; - /** @var string */ - private $language = 'en'; + private string $language = 'en'; - /** @var int */ - private $avatarVersion = -1; + private int $avatarVersion = -1; - /** @var string */ - private $viewerLink = ''; + private string $viewerLink = ''; /** * Person constructor. diff --git a/lib/Model/ActivityPub/Item.php b/lib/Model/ActivityPub/Item.php index 7cfd21b4..3c531b89 100644 --- a/lib/Model/ActivityPub/Item.php +++ b/lib/Model/ActivityPub/Item.php @@ -41,86 +41,60 @@ class Item { use TArrayTools; - /** @var string */ - private $urlSocial = ''; + private string $urlSocial = ''; - /** @var string */ - private $urlCloud = ''; + private string $urlCloud = ''; - /** @var string */ - private $address = ''; + private string $address = ''; - /** @var string */ - private $id = ''; + private string $id = ''; - /** @var int */ - private $nid = 0; + private int $nid = 0; - /** @var string */ - private $type = ''; + private string $type = ''; - /** @var string */ - private $subType = ''; + private string $subType = ''; - /** @var string */ - private $url = ''; + private string $url = ''; - /** @var string */ - private $attributedTo = ''; + private string $attributedTo = ''; - /** @var string */ - private $summary = ''; + private string $summary = ''; /** @var InstancePath[] */ - private $instancePaths = []; + private array $instancePaths = []; - /** @var string */ - private $to = ''; + private string $to = ''; - /** @var array */ - private $toArray = []; + private array $toArray = []; - /** @var array */ - private $cc = []; + private array $cc = []; - /** @var array */ - private $bcc = []; + private array $bcc = []; - /** @var string */ - private $published = ''; + private string $published = ''; - /** @var array */ - private $tags = []; + private array $tags = []; - /** @var Person */ - private $actor = null; + private ?Person $actor = null; - /** @var string */ - private $actorId = ''; + private string $actorId = ''; - /** @var string */ - private $iconId = ''; + private string $iconId = ''; - /** @var string */ - private $objectId = ''; + private string $objectId = ''; - /** @var bool */ - private $completeDetails = false; + private bool $completeDetails = false; - /** @var string */ - private $source = ''; + private string $source = ''; - /** @var bool */ - private $local = false; + private bool $local = false; - /** @var string */ - private $origin = ''; + private string $origin = ''; - /** @var int */ - private $originSource = 0; + private int $originSource = 0; - /** @var int */ - private $originCreationTime = 0; + private int $originCreationTime = 0; /** diff --git a/lib/Model/ActivityPub/Object/Document.php b/lib/Model/ActivityPub/Object/Document.php index 512cc5b9..8cc9991d 100644 --- a/lib/Model/ActivityPub/Object/Document.php +++ b/lib/Model/ActivityPub/Object/Document.php @@ -50,29 +50,21 @@ class Document extends ACore implements JsonSerializable { const TYPE = 'Document'; - /** @var string */ - private $mediaType = ''; + private string $mediaType = ''; - /** @var string */ - private $mimeType = ''; + private string $mimeType = ''; - /** @var string */ - private $localCopy = ''; + private string $localCopy = ''; - /** @var string */ - private $resizedCopy = ''; + private string $resizedCopy = ''; - /** @var int */ - private $caching = 0; + private int $caching = 0; - /** @var bool */ - private $public = false; + private bool $public = false; - /** @var int */ - private $error = 0; + private int $error = 0; - /** @var string */ - private $parentId = ''; + private string $parentId = ''; /** * Document constructor. diff --git a/lib/Model/ActivityPub/Object/Follow.php b/lib/Model/ActivityPub/Object/Follow.php index 1bd179be..be265557 100644 --- a/lib/Model/ActivityPub/Object/Follow.php +++ b/lib/Model/ActivityPub/Object/Follow.php @@ -47,14 +47,11 @@ class Follow extends ACore implements JsonSerializable, IQueryRow { const TYPE = 'Follow'; - /** @var string */ - private $followId = ''; + private string $followId = ''; - /** @var string */ - private $followIdPrim = ''; + private string $followIdPrim = ''; - /** @var bool */ - private $accepted = false; + private bool $accepted = false; /** diff --git a/lib/Model/ActivityPub/Object/Note.php b/lib/Model/ActivityPub/Object/Note.php index 7026e36a..e7003bfb 100644 --- a/lib/Model/ActivityPub/Object/Note.php +++ b/lib/Model/ActivityPub/Object/Note.php @@ -46,11 +46,9 @@ class Note extends Stream implements JsonSerializable { const TYPE = 'Note'; - /** @var array */ - private $attachments = []; + private array $attachments = []; - /** @var array */ - private $hashtags = []; + private array $hashtags = []; /** diff --git a/lib/Model/ActivityPub/OrderedCollection.php b/lib/Model/ActivityPub/OrderedCollection.php index 0a2a0382..bed56d5b 100644 --- a/lib/Model/ActivityPub/OrderedCollection.php +++ b/lib/Model/ActivityPub/OrderedCollection.php @@ -45,11 +45,9 @@ class OrderedCollection extends ACore implements JsonSerializable { const TYPE = 'OrderedCollection'; - /** @var int */ - private $totalItems = 0; + private int $totalItems = 0; - /** @var string */ - private $first = ''; + private string $first = ''; /** * Activity constructor. diff --git a/lib/Model/ActivityPub/Stream.php b/lib/Model/ActivityPub/Stream.php index 68b187a7..c0f57684 100644 --- a/lib/Model/ActivityPub/Stream.php +++ b/lib/Model/ActivityPub/Stream.php @@ -62,44 +62,31 @@ class Stream extends ACore implements IQueryRow, JsonSerializable { const TYPE_ANNOUNCE = 'announce'; - /** @var string */ - private $activityId = ''; + private string $activityId = ''; - /** @var string */ - private $content = ''; + private string $content = ''; - /** @var string */ - private $spoilerText = ''; + private string $spoilerText = ''; - /** @var string */ - private $language = 'en'; + private string $language = 'en'; - /** @var string */ - private $attributedTo = ''; + private string $attributedTo = ''; - /** @var string */ - private $inReplyTo = ''; + private string $inReplyTo = ''; - /** @var bool */ - private $sensitive = false; + private bool $sensitive = false; - /** @var string */ - private $conversation = ''; + private string $conversation = ''; - /** @var Cache */ - private $cache = null; + private ?Cache $cache = null; - /** @var int */ - private $publishedTime = 0; + private int $publishedTime = 0; - /** @var StreamAction */ - private $action = null; + private ?StreamAction $action = null; - /** @var string */ - private $timeline = ''; + private string $timeline = ''; - /** @var bool */ - private $filterDuplicate = false; + private bool $filterDuplicate = false; /** diff --git a/lib/Model/Client/Options/CoreOptions.php b/lib/Model/Client/Options/CoreOptions.php index d53c3937..9ce89c47 100644 --- a/lib/Model/Client/Options/CoreOptions.php +++ b/lib/Model/Client/Options/CoreOptions.php @@ -42,8 +42,7 @@ use OCA\Social\Model\ActivityPub\ACore; class CoreOptions { - /** @var int */ - private $format = ACore::FORMAT_ACTIVITYPUB; + private int $format = ACore::FORMAT_ACTIVITYPUB; /** diff --git a/lib/Model/Client/Options/TimelineOptions.php b/lib/Model/Client/Options/TimelineOptions.php index 3b3b6db4..f5ceac73 100644 --- a/lib/Model/Client/Options/TimelineOptions.php +++ b/lib/Model/Client/Options/TimelineOptions.php @@ -47,32 +47,23 @@ class TimelineOptions extends CoreOptions implements JsonSerializable { use TArrayTools; - /** @var string */ - private $timeline = ''; + private string $timeline = ''; - /** @var bool */ - private $local = false; + private bool $local = false; - /** @var bool */ - private $remote = false; + private bool $remote = false; - /** @var bool */ - private $onlyMedia = false; + private bool $onlyMedia = false; - /** @var int */ - private $minId = 0; + private int $minId = 0; - /** @var int */ - private $maxId = 0; + private int $maxId = 0; - /** @var int */ - private $sinceId = 0; + private int $sinceId = 0; - /** @var int */ - private $limit = 20; + private int $limit = 20; - /** @var bool */ - private $inverted = false; + private bool $inverted = false; /** diff --git a/lib/Model/Client/SocialClient.php b/lib/Model/Client/SocialClient.php index 72d7a910..796b4f2a 100644 --- a/lib/Model/Client/SocialClient.php +++ b/lib/Model/Client/SocialClient.php @@ -49,50 +49,33 @@ class SocialClient implements IQueryRow, JsonSerializable { use TArrayTools; - /** @var int */ - private $id = 0; + private int $id = 0; - /** @var string */ - private $appName = ''; + private string $appName = ''; - /** @var string */ - private $appWebsite = ''; + private string $appWebsite = ''; - /** @var array */ - private $appRedirectUris = []; + private array $appRedirectUris = []; - /** @var string */ - private $appClientId = ''; + private string $appClientId = ''; - /** @var string */ - private $appClientSecret = ''; + private string $appClientSecret = ''; - /** @var array */ - private $appScopes = []; + private array $appScopes = []; - /** @var array */ - private $authScopes = []; + private array $authScopes = []; - /** @var string */ - private $authAccount = ''; + private string $authAccount = ''; - /** @var string */ - private $authUserId = ''; + private string $authUserId = ''; - /** @var string */ - private $authCode = ''; + private string $authCode = ''; -// /** @var string */ -// private $authRedirectUri = ''; +private int $lastUpdate = -1; - /** @var int */ - private $lastUpdate = -1; + private string $token = ''; - /** @var string */ - private $token = ''; - - /** @var int */ - private $creation = -1; + private int $creation = -1; // /** @var array */ // private $tokenScopes = []; diff --git a/lib/Model/Instance.php b/lib/Model/Instance.php index 65550556..31bd7b7e 100644 --- a/lib/Model/Instance.php +++ b/lib/Model/Instance.php @@ -47,56 +47,39 @@ class Instance implements IQueryRow, JsonSerializable { use TArrayTools; - /** @var bool */ - private $local = false; + private bool $local = false; - /** @var string */ - private $uri = ''; + private string $uri = ''; - /** @var string */ - private $title = ''; + private string $title = ''; - /** @var string */ - private $version = ''; + private string $version = ''; - /** @var string */ - private $shortDescription = ''; + private string $shortDescription = ''; - /** @var string */ - private $description = ''; + private string $description = ''; - /** @var string */ - private $email = ''; + private string $email = ''; - /** @var array */ - private $urls = []; + private array $urls = []; - /** @var array */ - private $stats = []; + private array $stats = []; - /** @var array */ - private $usage = []; + private array $usage = []; - /** @var string */ - private $image = ''; + private string $image = ''; - /** @var array */ - private $languages = []; + private array $languages = []; - /** @var bool */ - private $registrations = false; + private bool $registrations = false; - /** @var bool */ - private $approvalRequired = false; + private bool $approvalRequired = false; - /** @var bool */ - private $invitesEnabled = false; + private bool $invitesEnabled = false; - /** @var Person */ - private $contactAccount; + private ?Person $contactAccount = null; - /** @var string */ - private $accountPrim; + private ?string $accountPrim = null; /** diff --git a/lib/Model/InstancePath.php b/lib/Model/InstancePath.php index ba7606b0..3a438fb0 100644 --- a/lib/Model/InstancePath.php +++ b/lib/Model/InstancePath.php @@ -56,14 +56,11 @@ class InstancePath implements JsonSerializable { const PRIORITY_HIGH = 3; const PRIORITY_TOP = 4; - /** @var string */ - private $uri = ''; + private string $uri = ''; - /** @var int */ - private $type = 0; + private int $type = 0; - /** @var int */ - private $priority = 0; + private int $priority = 0; /** diff --git a/lib/Model/LinkedDataSignature.php b/lib/Model/LinkedDataSignature.php index a0aa8b51..7d1a49e4 100644 --- a/lib/Model/LinkedDataSignature.php +++ b/lib/Model/LinkedDataSignature.php @@ -47,29 +47,21 @@ class LinkedDataSignature implements JsonSerializable { use TArrayTools; - /** @var string */ - private $type = ''; + private string $type = ''; - /** @var string */ - private $creator = ''; + private string $creator = ''; - /** @var string */ - private $created = ''; + private string $created = ''; - /** @var string */ - private $nonce = ''; + private string $nonce = ''; - /** @var string */ - private $signatureValue = ''; + private string $signatureValue = ''; - /** @var string */ - private $privateKey = ''; + private string $privateKey = ''; - /** @var string */ - private $publicKey = ''; + private string $publicKey = ''; - /** @var array */ - private $object = []; + private array $object = []; /** diff --git a/lib/Model/Post.php b/lib/Model/Post.php index 0fb87f96..36929ba2 100644 --- a/lib/Model/Post.php +++ b/lib/Model/Post.php @@ -47,29 +47,23 @@ class Post implements JsonSerializable { use TArrayTools; - /** @var Person */ - private $actor; + private Person $actor; - /** @var array */ - private $to = []; + private array $to = []; - /** @var string */ - private $replyTo = ''; + private string $replyTo = ''; - /** @var string */ - private $content = ''; + private string $content = ''; - /** @var string */ - private $type = ''; + private string $type = ''; - /** @var array */ - private $hashtags = []; + private array $hashtags = []; /** @var string[] */ - private $attachments = []; + private array $attachments = []; /** @var Document[] */ - private $documents = []; + private array $documents = []; /** * Post constructor. diff --git a/lib/Model/RequestQueue.php b/lib/Model/RequestQueue.php index 97084ffe..72c9ef2d 100644 --- a/lib/Model/RequestQueue.php +++ b/lib/Model/RequestQueue.php @@ -55,35 +55,25 @@ class RequestQueue implements JsonSerializable { const STATUS_SUCCESS = 9; - /** @var integer */ - private $id = 0; + private int $id = 0; - /** @var string */ - private $token = ''; + private string $token = ''; - /** @var string */ - private $author = ''; + private string $author = ''; - /** @var string */ - private $activity = ''; + private string $activity = ''; - /** @var InstancePath */ - private $instance; + private ?InstancePath $instance = null; - /** @var int */ - private $priority = 0; + private int $priority = 0; - /** @var int */ - private $status = 0; + private int $status = 0; - /** @var int */ - private $tries = 0; + private int $tries = 0; - /** @var int */ - private $last = 0; + private int $last = 0; - /** @var int */ - private $timeout = 5; + private int $timeout = 5; /** diff --git a/lib/Model/StreamAction.php b/lib/Model/StreamAction.php index 798e1d86..6eec5cb2 100644 --- a/lib/Model/StreamAction.php +++ b/lib/Model/StreamAction.php @@ -53,17 +53,13 @@ class StreamAction implements JsonSerializable { const REPLIED = 'replied'; - /** @var integer */ - private $id = 0; + private int $id = 0; - /** @var string */ - private $actorId = ''; + private string $actorId = ''; - /** @var string */ - private $streamId = ''; + private string $streamId = ''; - /** @var array */ - private $values = []; + private array $values = []; /** diff --git a/lib/Model/StreamDetails.php b/lib/Model/StreamDetails.php index a028406f..7421baa3 100644 --- a/lib/Model/StreamDetails.php +++ b/lib/Model/StreamDetails.php @@ -48,20 +48,17 @@ class StreamDetails implements JsonSerializable { use TArrayTools; - /** @var Stream */ - private $stream; + private Stream $stream; /** @var Person[] */ - private $homeViewers = []; + private array $homeViewers = []; /** @var Person[] */ - private $directViewers = []; + private array $directViewers = []; - /** @var bool */ - private $public = false; + private bool $public = false; - /** @var bool */ - private $federated = false; + private bool $federated = false; /** diff --git a/lib/Model/StreamQueue.php b/lib/Model/StreamQueue.php index f7d24620..8d98487a 100644 --- a/lib/Model/StreamQueue.php +++ b/lib/Model/StreamQueue.php @@ -56,26 +56,19 @@ class StreamQueue implements JsonSerializable { const STATUS_SUCCESS = 9; - /** @var integer */ - private $id = 0; + private int $id = 0; - /** @var string */ - private $token = ''; + private string $token = ''; - /** @var string */ - private $streamId = ''; + private string $streamId = ''; - /** @var string */ - private $type = ''; + private string $type = ''; - /** @var int */ - private $status = 0; + private int $status = 0; - /** @var int */ - private $tries = 0; + private int $tries = 0; - /** @var int */ - private $last = 0; + private int $last = 0; /** diff --git a/lib/Model/Test.php b/lib/Model/Test.php index 87be284c..de9b5ec9 100644 --- a/lib/Model/Test.php +++ b/lib/Model/Test.php @@ -51,17 +51,13 @@ class Test extends SimpleDataStore implements JsonSerializable { const SEVERITY_MANDATORY = 'mandatory'; - /** @var string */ - private $name; + private string $name; - /** @var string */ - private $severity; + private string $severity; - /** @var bool */ - private $success = false; + private bool $success = false; - /** @var array */ - private $messages = []; + private array $messages = []; /** diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 49414c98..b07660e7 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -49,20 +49,15 @@ use OCP\Notification\INotifier; class Notifier implements INotifier { - /** @var IL10N */ - private $l10n; + private IL10N $l10n; - /** @var IFactory */ - protected $factory; + protected IFactory $factory; - /** @var IManager */ - protected $contactsManager; + protected IManager $contactsManager; - /** @var IURLGenerator */ - protected $url; + protected IURLGenerator $url; - /** @var ICloudIdManager */ - protected $cloudIdManager; + protected ICloudIdManager $cloudIdManager; public function __construct( diff --git a/lib/Providers/ContactsMenuProvider.php b/lib/Providers/ContactsMenuProvider.php index b09de3c3..5c4ab929 100644 --- a/lib/Providers/ContactsMenuProvider.php +++ b/lib/Providers/ContactsMenuProvider.php @@ -51,20 +51,15 @@ use OCP\IUserManager; class ContactsMenuProvider implements IProvider { - /** @var IActionFactory */ - private $actionFactory; + private IActionFactory $actionFactory; - /** @var IURLGenerator */ - private $urlGenerator; + private IURLGenerator $urlGenerator; - /** @var IUserManager */ - private $userManager; + private IUserManager $userManager; - /** @var IL10N */ - private $l10n; + private IL10N $l10n; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; /** diff --git a/lib/Search/UnifiedSearchProvider.php b/lib/Search/UnifiedSearchProvider.php index 13eae127..0674e960 100644 --- a/lib/Search/UnifiedSearchProvider.php +++ b/lib/Search/UnifiedSearchProvider.php @@ -66,36 +66,26 @@ class UnifiedSearchProvider implements IProvider { use TNC20Logger; - /** @var IL10N */ - private $l10n; + private IL10N $l10n; - /** @var IURLGenerator */ - private $urlGenerator; + private IURLGenerator $urlGenerator; - /** @var StreamService */ - private $streamService; + private StreamService $streamService; - /** @var FollowService */ - private $followService; + private FollowService $followService; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var SearchService */ - private $searchService; + private SearchService $searchService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; - /** @var Person */ - private $viewer; + private ?Person $viewer = null; /** diff --git a/lib/Service/ActivityService.php b/lib/Service/ActivityService.php index 9e2d5f38..a1927cd0 100644 --- a/lib/Service/ActivityService.php +++ b/lib/Service/ActivityService.php @@ -76,33 +76,24 @@ class ActivityService { const TIMEOUT_SERVICE = 30; - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var FollowsRequest */ - private $followsRequest; + private FollowsRequest $followsRequest; - /** @var SignatureService */ - private $signatureService; + private SignatureService $signatureService; - /** @var RequestQueueService */ - private $requestQueueService; + private RequestQueueService $requestQueueService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var CurlService */ - private $curlService; + private CurlService $curlService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; - /** @var array */ - private $failInstances; + private ?array $failInstances = null; /** diff --git a/lib/Service/ActorService.php b/lib/Service/ActorService.php index a8fe47d1..ad95f85e 100644 --- a/lib/Service/ActorService.php +++ b/lib/Service/ActorService.php @@ -52,20 +52,15 @@ class ActorService { use TArrayTools; - /** @var CacheActorsRequest */ - private $cacheActorsRequest; + private CacheActorsRequest $cacheActorsRequest; - /** @var CacheDocumentsRequest */ - private $cacheDocumentsRequest; + private CacheDocumentsRequest $cacheDocumentsRequest; - /** @var CurlService */ - private $curlService; + private CurlService $curlService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/BoostService.php b/lib/Service/BoostService.php index 499d2c50..cfeff9ab 100644 --- a/lib/Service/BoostService.php +++ b/lib/Service/BoostService.php @@ -57,26 +57,19 @@ class BoostService { use TStringTools; - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var StreamService */ - private $streamService; + private StreamService $streamService; - /** @var SignatureService */ - private $signatureService; + private SignatureService $signatureService; - /** @var ActivityService */ - private $activityService; + private ActivityService $activityService; - /** @var StreamActionService */ - private $streamActionService; + private StreamActionService $streamActionService; - /** @var StreamQueueService */ - private $streamQueueService; + private StreamQueueService $streamQueueService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/CacheActorService.php b/lib/Service/CacheActorService.php index bfb594e8..b2c99c8d 100644 --- a/lib/Service/CacheActorService.php +++ b/lib/Service/CacheActorService.php @@ -66,23 +66,17 @@ class CacheActorService { use TNC20Logger; - /** @var IURLGenerator */ - private $urlGenerator; + private \OCP\IURLGenerator $urlGenerator; - /** @var CacheActorsRequest */ - private $cacheActorsRequest; + private CacheActorsRequest $cacheActorsRequest; - /** @var CurlService */ - private $curlService; + private CurlService $curlService; - /** @var FediverseService */ - private $fediverseService; + private FediverseService $fediverseService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/CacheDocumentService.php b/lib/Service/CacheDocumentService.php index 358cc81b..38ba2a25 100644 --- a/lib/Service/CacheDocumentService.php +++ b/lib/Service/CacheDocumentService.php @@ -64,17 +64,13 @@ class CacheDocumentService { const RESIZED_WIDTH = 280; const RESIZED_HEIGHT = 180; - /** @var IAppData */ - private $appData; + private IAppData $appData; - /** @var CurlService */ - private $curlService; + private CurlService $curlService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/CheckService.php b/lib/Service/CheckService.php index 9d19bb5b..aeebb9fe 100644 --- a/lib/Service/CheckService.php +++ b/lib/Service/CheckService.php @@ -64,44 +64,31 @@ class CheckService { const CACHE_PREFIX = 'social_check_'; - /** @var IUserManager */ - private $userManager; + private IUserManager $userManager; - /** @var ICache */ - private $cache; + private ICache $cache; - /** @var IConfig */ - private $config; + private IConfig $config; - /** @var IClientService */ - private $clientService; + private IClientService $clientService; - /** @var IRequest */ - private $request; + private IRequest $request; - /** @var IURLGenerator */ - private $urlGenerator; + private IURLGenerator $urlGenerator; - /** @var FollowsRequest */ - private $followRequest; + private FollowsRequest $followRequest; - /** @var CacheActorsRequest */ - private $cacheActorsRequest; + private CacheActorsRequest $cacheActorsRequest; - /** @var StreamDestRequest */ - private $streamDestRequest; + private StreamDestRequest $streamDestRequest; - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/ClientService.php b/lib/Service/ClientService.php index 9c02ebe2..93f63b47 100644 --- a/lib/Service/ClientService.php +++ b/lib/Service/ClientService.php @@ -57,11 +57,9 @@ class ClientService { use TStringTools; - /** @var ClientRequest */ - private $clientRequest; + private ClientRequest $clientRequest; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index 38cac425..af075f45 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -72,8 +72,7 @@ class ConfigService { const BACKGROUND_SERVICE = 3; const BACKGROUND_FULL_SERVICE = 4; - /** @var array */ - public $defaults = [ + public array $defaults = [ self::CLOUD_URL => '', self::SOCIAL_URL => '', self::SOCIAL_ADDRESS => '', @@ -85,27 +84,21 @@ class ConfigService { self::DATABASE_CHUNK_SIZE => 10000 ]; - /** @var array */ - public $accessTypeList = [ + public array $accessTypeList = [ 'BLACKLIST' => 'all_but', 'WHITELIST' => 'none_but' ]; - /** @var string */ - private $userId; + private string $userId; - /** @var IConfig */ - private $config; + private IConfig $config; - /** @var IRequest */ - private $request; + private IRequest $request; - /** @var IURLGenerator */ - private $urlGenerator; + private IURLGenerator $urlGenerator; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/CurlService.php b/lib/Service/CurlService.php index a3b3b45a..1613d440 100644 --- a/lib/Service/CurlService.php +++ b/lib/Service/CurlService.php @@ -68,14 +68,11 @@ class CurlService { const USER_AGENT = 'Nextcloud Social'; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var FediverseService */ - private $fediverseService; + private FediverseService $fediverseService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/DetailsService.php b/lib/Service/DetailsService.php index 189220a6..e20f1a1d 100644 --- a/lib/Service/DetailsService.php +++ b/lib/Service/DetailsService.php @@ -44,17 +44,13 @@ use OCA\Social\Model\StreamDetails; */ class DetailsService { - /** @var StreamService */ - private $streamService; + private StreamService $streamService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var FollowService */ - private $followService; + private FollowService $followService; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; /** diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php index d164d87e..383ed56d 100644 --- a/lib/Service/DocumentService.php +++ b/lib/Service/DocumentService.php @@ -67,26 +67,19 @@ class DocumentService { const ERROR_PERMISSION = 3; - /** @var IURLGenerator */ - private $urlGenerator; + private \OCP\IURLGenerator $urlGenerator; - /** @var CacheDocumentsRequest */ - private $cacheDocumentsRequest; + private CacheDocumentsRequest $cacheDocumentsRequest; - /** @var ActorsRequest */ - private $actorRequest; + private ActorsRequest $actorRequest; - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var CacheDocumentService */ - private $cacheService; + private CacheDocumentService $cacheService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/FediverseService.php b/lib/Service/FediverseService.php index d903977e..42917545 100644 --- a/lib/Service/FediverseService.php +++ b/lib/Service/FediverseService.php @@ -43,11 +43,9 @@ use OCA\Social\Exceptions\UnauthorizedFediverseException; class FediverseService { - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/FollowService.php b/lib/Service/FollowService.php index e9d4bd59..e3acbb90 100644 --- a/lib/Service/FollowService.php +++ b/lib/Service/FollowService.php @@ -62,24 +62,18 @@ class FollowService { use TArrayTools; - /** @var FollowsRequest */ - private $followsRequest; + private FollowsRequest $followsRequest; - /** @var ActivityService */ - private $activityService; + private ActivityService $activityService; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; - /** @var Person */ - private $viewer = null; + private ?Person $viewer = null; /** diff --git a/lib/Service/HashtagService.php b/lib/Service/HashtagService.php index 1a5973da..0225615b 100644 --- a/lib/Service/HashtagService.php +++ b/lib/Service/HashtagService.php @@ -55,17 +55,13 @@ class HashtagService { use TArrayTools; - /** @var HashtagsRequest */ - private $hashtagsRequest; + private HashtagsRequest $hashtagsRequest; - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/ImportService.php b/lib/Service/ImportService.php index de25268a..0d08d916 100644 --- a/lib/Service/ImportService.php +++ b/lib/Service/ImportService.php @@ -50,11 +50,9 @@ class ImportService { use TStringTools; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/InstanceService.php b/lib/Service/InstanceService.php index 0a974407..555f150c 100644 --- a/lib/Service/InstanceService.php +++ b/lib/Service/InstanceService.php @@ -46,11 +46,9 @@ class InstanceService { private $instancesRequest; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; public function __construct( diff --git a/lib/Service/LikeService.php b/lib/Service/LikeService.php index 11f89b4b..48ee873b 100644 --- a/lib/Service/LikeService.php +++ b/lib/Service/LikeService.php @@ -60,26 +60,19 @@ class LikeService { use TStringTools; - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var StreamService */ - private $streamService; + private StreamService $streamService; - /** @var SignatureService */ - private $signatureService; + private SignatureService $signatureService; - /** @var ActivityService */ - private $activityService; + private ActivityService $activityService; - /** @var StreamActionService */ - private $streamActionService; + private StreamActionService $streamActionService; - /** @var StreamQueueService */ - private $streamQueueService; + private StreamQueueService $streamQueueService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/PostService.php b/lib/Service/PostService.php index 1b1f1fe2..b9909fd4 100644 --- a/lib/Service/PostService.php +++ b/lib/Service/PostService.php @@ -57,23 +57,17 @@ use OCP\Files\NotPermittedException; class PostService { - /** @var StreamService */ - private $streamService; + private StreamService $streamService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var ActivityService */ - private $activityService; + private ActivityService $activityService; - /** @var CacheDocumentService */ - private $cacheDocumentService; + private CacheDocumentService $cacheDocumentService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/PushService.php b/lib/Service/PushService.php index 4986ab15..e2616d17 100644 --- a/lib/Service/PushService.php +++ b/lib/Service/PushService.php @@ -53,18 +53,11 @@ class PushService { use TAsync; -// -// /** @var IPushManager */ -// private $pushManager; +private DetailsService $detailsService; - /** @var DetailsService */ - private $detailsService; + private StreamService $streamService; - /** @var StreamService */ - private $streamService; - - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/RequestQueueService.php b/lib/Service/RequestQueueService.php index ee5b1754..e0ce53dd 100644 --- a/lib/Service/RequestQueueService.php +++ b/lib/Service/RequestQueueService.php @@ -47,14 +47,11 @@ class RequestQueueService { use TArrayTools; - /** @var RequestQueueRequest */ - private $requestQueueRequest; + private RequestQueueRequest $requestQueueRequest; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/SearchService.php b/lib/Service/SearchService.php index 3ae3df86..bf7897be 100644 --- a/lib/Service/SearchService.php +++ b/lib/Service/SearchService.php @@ -55,17 +55,13 @@ class SearchService { const SEARCH_ALL = 7; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var HashtagService */ - private $hashtagService; + private HashtagService $hashtagService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/SignatureService.php b/lib/Service/SignatureService.php index 2b1c94aa..171ba685 100644 --- a/lib/Service/SignatureService.php +++ b/lib/Service/SignatureService.php @@ -83,20 +83,15 @@ class SignatureService { const DATE_DELAY = 300; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var ActorsRequest */ - private $actorsRequest; + private ActorsRequest $actorsRequest; - /** @var CurlService */ - private $curlService; + private CurlService $curlService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/StreamActionService.php b/lib/Service/StreamActionService.php index cc8d8354..d0ffc914 100644 --- a/lib/Service/StreamActionService.php +++ b/lib/Service/StreamActionService.php @@ -43,11 +43,9 @@ use OCA\Social\Model\StreamAction; class StreamActionService { - /** @var StreamActionsRequest */ - private $streamActionsRequest; + private StreamActionsRequest $streamActionsRequest; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/StreamQueueService.php b/lib/Service/StreamQueueService.php index e51319dc..f59d735a 100644 --- a/lib/Service/StreamQueueService.php +++ b/lib/Service/StreamQueueService.php @@ -62,23 +62,17 @@ use OCA\Social\Model\StreamQueue; class StreamQueueService { - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var StreamQueueRequest */ - private $streamQueueRequest; + private StreamQueueRequest $streamQueueRequest; - /** @var ImportService */ - private $importService; + private ImportService $importService; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var CurlService */ - private $curlService; + private CurlService $curlService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/StreamService.php b/lib/Service/StreamService.php index c8f21513..d8f576f4 100644 --- a/lib/Service/StreamService.php +++ b/lib/Service/StreamService.php @@ -58,29 +58,21 @@ use OCA\Social\Model\InstancePath; class StreamService { - /** @var StreamRequest */ - private $streamRequest; + private StreamRequest $streamRequest; - /** @var ActivityService */ - private $activityService; + private ActivityService $activityService; - /** @var AccountService */ - private $accountService; + private AccountService $accountService; - /** @var SignatureService */ - private $signatureService; + private SignatureService $signatureService; - /** @var StreamQueueService */ - private $streamQueueService; + private StreamQueueService $streamQueueService; - /** @var CacheActorService */ - private $cacheActorService; + private CacheActorService $cacheActorService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/TestService.php b/lib/Service/TestService.php index 3fce8a3a..47b81f8c 100644 --- a/lib/Service/TestService.php +++ b/lib/Service/TestService.php @@ -55,14 +55,11 @@ class TestService { use TArrayTools; - /** @var CurlService */ - private $curlService; + private CurlService $curlService; - /** @var ConfigService */ - private $configService; + private ConfigService $configService; - /** @var MiscService */ - private $miscService; + private MiscService $miscService; /** diff --git a/lib/Service/UpdateService.php b/lib/Service/UpdateService.php index 6a36bd19..c7a46dc5 100644 --- a/lib/Service/UpdateService.php +++ b/lib/Service/UpdateService.php @@ -39,21 +39,16 @@ use OCP\Notification\INotification; class UpdateService { - /** @var IUserManager */ - private $userManager; + private IUserManager $userManager; - /** @var IGroupManager */ - private $groupManager; + private IGroupManager $groupManager; - /** @var ITimeFactory */ - private $time; + private ITimeFactory $time; - /** @var INotificationManager */ - private $notificationManager; + private INotificationManager $notificationManager; - /** @var string */ - private $updateId = 'alpha3'; + private string $updateId = 'alpha3'; /** diff --git a/lib/hostmeta.php b/lib/hostmeta.php index ef130a3f..16a1253d 100644 --- a/lib/hostmeta.php +++ b/lib/hostmeta.php @@ -29,6 +29,7 @@ declare(strict_types=1); namespace OCA\Social; +use OCA\Social\Exceptions\SocialAppConfigException; use Exception; use OC; use OCA\Social\Service\ConfigService; @@ -57,5 +58,5 @@ try { echo '' . "\n"; echo ' ' . "\n"; echo '' . "\n"; -} catch (Exceptions\SocialAppConfigException $e) { +} catch (SocialAppConfigException $e) { } diff --git a/rector.php b/rector.php new file mode 100644 index 00000000..0bc3f121 --- /dev/null +++ b/rector.php @@ -0,0 +1,31 @@ +parameters(); + $parameters->set(Option::PATHS, [ + __DIR__ . '/lib', + __DIR__ . '/tests/', + ]); + + $parameters->set(Option::BOOTSTRAP_FILES, [ + __DIR__ . '/vendor/autoload.php', + __DIR__ . '/../../lib/composer/autoload.php', + __DIR__ . '/../../3rdparty/autoload.php', + ]); + + $parameters->set(Option::AUTO_IMPORT_NAMES, true); + $parameters->set(Option::IMPORT_SHORT_CLASSES, false); + + $services = $containerConfigurator->services(); + $services->set(TypedPropertyRector::class) + ->configure([ + TypedPropertyRector::INLINE_PUBLIC => true, + ]); +}; diff --git a/tests/SocialTest.php b/tests/SocialTest.php index 2a81f648..6d38ce5c 100644 --- a/tests/SocialTest.php +++ b/tests/SocialTest.php @@ -1,13 +1,14 @@