diff --git a/lib/ContactsMenu/Providers/DetailsProvider.php b/lib/ContactsMenu/Providers/DetailsProvider.php index 6988edb9..5f949ae4 100644 --- a/lib/ContactsMenu/Providers/DetailsProvider.php +++ b/lib/ContactsMenu/Providers/DetailsProvider.php @@ -49,9 +49,9 @@ class DetailsProvider implements IProvider { * @param IActionFactory $actionFactory */ public function __construct(IURLGenerator $urlGenerator, - IActionFactory $actionFactory, - IL10N $l10n, - IManager $manager) { + IActionFactory $actionFactory, + IL10N $l10n, + IManager $manager) { $this->actionFactory = $actionFactory; $this->urlGenerator = $urlGenerator; $this->l10n = $l10n; diff --git a/lib/Controller/ContactsController.php b/lib/Controller/ContactsController.php index 7b42e5ac..6deffb77 100644 --- a/lib/Controller/ContactsController.php +++ b/lib/Controller/ContactsController.php @@ -38,8 +38,8 @@ class ContactsController extends Controller { private $urlGenerator; public function __construct(IRequest $request, - IL10N $l10n, - IURLGenerator $urlGenerator) { + IL10N $l10n, + IURLGenerator $urlGenerator) { parent::__construct(Application::APP_ID, $request); $this->l10n = $l10n; diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 6680d000..0d052ad6 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -25,12 +25,12 @@ namespace OCA\Contacts\Controller; use OC\App\CompareVersion; -use OCP\App\IAppManager; -use OCP\AppFramework\Controller; -use OCP\AppFramework\Http\TemplateResponse; - use OCA\Contacts\AppInfo\Application; use OCA\Contacts\Service\SocialApiService; +use OCP\App\IAppManager; + +use OCP\AppFramework\Controller; +use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use OCP\IInitialStateService; use OCP\IRequest; @@ -61,13 +61,13 @@ class PageController extends Controller { private $compareVersion; public function __construct(IRequest $request, - IConfig $config, - IInitialStateService $initialStateService, - IFactory $languageFactory, - IUserSession $userSession, - SocialApiService $socialApiService, - IAppManager $appManager, - CompareVersion $compareVersion) { + IConfig $config, + IInitialStateService $initialStateService, + IFactory $languageFactory, + IUserSession $userSession, + SocialApiService $socialApiService, + IAppManager $appManager, + CompareVersion $compareVersion) { parent::__construct(Application::APP_ID, $request); $this->config = $config; diff --git a/lib/Controller/SocialApiController.php b/lib/Controller/SocialApiController.php index b09eafdb..9849ca9c 100644 --- a/lib/Controller/SocialApiController.php +++ b/lib/Controller/SocialApiController.php @@ -45,9 +45,9 @@ class SocialApiController extends ApiController { private $socialApiService; public function __construct(IRequest $request, - IConfig $config, - IUserSession $userSession, - SocialApiService $socialApiService) { + IConfig $config, + IUserSession $userSession, + SocialApiService $socialApiService) { parent::__construct(Application::APP_ID, $request); $this->config = $config; diff --git a/lib/Cron/SocialUpdate.php b/lib/Cron/SocialUpdate.php index 4c0bd8e6..feb5376f 100644 --- a/lib/Cron/SocialUpdate.php +++ b/lib/Cron/SocialUpdate.php @@ -43,9 +43,9 @@ class SocialUpdate extends QueuedJob { private $userManager; public function __construct(ITimeFactory $time, - SocialApiService $social, - IJobList $jobList, - IUserManager $userManager) { + SocialApiService $social, + IJobList $jobList, + IUserManager $userManager) { parent::__construct($time); $this->social = $social; $this->jobList = $jobList; diff --git a/lib/Cron/SocialUpdateRegistration.php b/lib/Cron/SocialUpdateRegistration.php index 72e4c887..ba19c558 100644 --- a/lib/Cron/SocialUpdateRegistration.php +++ b/lib/Cron/SocialUpdateRegistration.php @@ -33,8 +33,8 @@ use OCA\Contacts\AppInfo\Application; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; use OCP\BackgroundJob\TimedJob; -use OCP\IUser; use OCP\IConfig; +use OCP\IUser; use OCP\IUserManager; use function method_exists; @@ -58,10 +58,10 @@ class SocialUpdateRegistration extends TimedJob { * @param IJobList $jobList */ public function __construct( - ITimeFactory $time, - IUserManager $userManager, - IConfig $config, - IJobList $jobList) { + ITimeFactory $time, + IUserManager $userManager, + IConfig $config, + IJobList $jobList) { parent::__construct($time); $this->appName = Application::APP_ID; diff --git a/lib/Service/Social/CompositeSocialProvider.php b/lib/Service/Social/CompositeSocialProvider.php index 7ca3f388..0f1d98e5 100644 --- a/lib/Service/Social/CompositeSocialProvider.php +++ b/lib/Service/Social/CompositeSocialProvider.php @@ -31,13 +31,13 @@ class CompositeSocialProvider { private $providers; public function __construct(InstagramProvider $instagramProvider, - MastodonProvider $mastodonProvider, - // FacebookProvider $facebookProvider, - TumblrProvider $tumblrProvider, - DiasporaProvider $diasporaProvider, - XingProvider $xingProvider, - TelegramProvider $telegramProvider, - GravatarProvider $gravatarProvider) { + MastodonProvider $mastodonProvider, + // FacebookProvider $facebookProvider, + TumblrProvider $tumblrProvider, + DiasporaProvider $diasporaProvider, + XingProvider $xingProvider, + TelegramProvider $telegramProvider, + GravatarProvider $gravatarProvider) { // This determines the priority of known providers $this->providers = [ $instagramProvider->name => $instagramProvider, diff --git a/lib/Service/Social/InstagramProvider.php b/lib/Service/Social/InstagramProvider.php index 1b046f87..0b30ce77 100644 --- a/lib/Service/Social/InstagramProvider.php +++ b/lib/Service/Social/InstagramProvider.php @@ -42,7 +42,7 @@ class InstagramProvider implements ISocialProvider { public $name = 'instagram'; public function __construct(IClientService $httpClient, - LoggerInterface $logger) { + LoggerInterface $logger) { $this->httpClient = $httpClient->newClient(); $this->logger = $logger; } diff --git a/lib/Service/Social/MastodonProvider.php b/lib/Service/Social/MastodonProvider.php index b4b71924..b81f0686 100644 --- a/lib/Service/Social/MastodonProvider.php +++ b/lib/Service/Social/MastodonProvider.php @@ -150,7 +150,7 @@ class MastodonProvider implements ISocialProvider { } $masto_user = trim($masto_user, '/'); $masto_server = trim($masto_server, '/'); - return array($masto_user, $masto_server); + return [$masto_user, $masto_server]; } catch (\Exception $e) { return null; } diff --git a/lib/Service/Social/TelegramProvider.php b/lib/Service/Social/TelegramProvider.php index 56bb6f50..c15b0a5a 100644 --- a/lib/Service/Social/TelegramProvider.php +++ b/lib/Service/Social/TelegramProvider.php @@ -41,7 +41,7 @@ class TelegramProvider implements ISocialProvider { public $name = 'telegram'; public function __construct(IClientService $httpClient, - LoggerInterface $logger) { + LoggerInterface $logger) { $this->httpClient = $httpClient->newClient(); $this->logger = $logger; } diff --git a/lib/Service/SocialApiService.php b/lib/Service/SocialApiService.php index 1c6e4827..2ff7d67f 100644 --- a/lib/Service/SocialApiService.php +++ b/lib/Service/SocialApiService.php @@ -64,15 +64,15 @@ class SocialApiService { private $imageResizer; public function __construct( - CompositeSocialProvider $socialProvider, - IManager $manager, - IConfig $config, - IClientService $clientService, - IL10N $l10n, - IURLGenerator $urlGen, - CardDavBackend $davBackend, - ITimeFactory $timeFactory, - ImageResizer $imageResizer) { + CompositeSocialProvider $socialProvider, + IManager $manager, + IConfig $config, + IClientService $clientService, + IL10N $l10n, + IURLGenerator $urlGen, + CardDavBackend $davBackend, + ITimeFactory $timeFactory, + ImageResizer $imageResizer) { $this->appName = Application::APP_ID; $this->socialProvider = $socialProvider; $this->manager = $manager; @@ -136,7 +136,7 @@ class SocialApiService { * * @returns {IAddressBook} the corresponding addressbook or null */ - protected function getAddressBook(string $addressbookId, IManager $manager = null) : ?IAddressBook { + protected function getAddressBook(string $addressbookId, ?IManager $manager = null) : ?IAddressBook { $addressBook = null; if ($manager === null) { $manager = $this->manager; @@ -367,7 +367,7 @@ class SocialApiService { * * @returns {JSONResponse} JSONResponse with the list of changed and failed contacts */ - public function updateAddressbooks(string $userId, string $offsetBook = null, string $offsetContact = null, string $network = null) : JSONResponse { + public function updateAddressbooks(string $userId, ?string $offsetBook = null, ?string $offsetContact = null, ?string $network = null) : JSONResponse { // double check! $syncAllowedByAdmin = $this->config->getAppValue($this->appName, 'allowSocialSync', 'yes'); $bgSyncEnabledByUser = $this->config->getUserValue($userId, $this->appName, 'enableSocialSync', 'no'); diff --git a/tests/unit/Controller/ContactsControllerTest.php b/tests/unit/Controller/ContactsControllerTest.php index e618bba9..9265ccc0 100644 --- a/tests/unit/Controller/ContactsControllerTest.php +++ b/tests/unit/Controller/ContactsControllerTest.php @@ -23,12 +23,12 @@ namespace OCA\Contacts\Controller; -use PHPUnit\Framework\MockObject\MockObject; +use ChristophWurst\Nextcloud\Testing\TestCase; +use OCP\AppFramework\Http\RedirectResponse; use OCP\IL10N; use OCP\IRequest; use OCP\IURLGenerator; -use ChristophWurst\Nextcloud\Testing\TestCase; -use OCP\AppFramework\Http\RedirectResponse; +use PHPUnit\Framework\MockObject\MockObject; class ContactsControllerTest extends TestCase { private $controller; diff --git a/tests/unit/Service/Social/DiasporaProviderTest.php b/tests/unit/Service/Social/DiasporaProviderTest.php index e2361395..508fb599 100644 --- a/tests/unit/Service/Social/DiasporaProviderTest.php +++ b/tests/unit/Service/Social/DiasporaProviderTest.php @@ -24,10 +24,10 @@ namespace OCA\Contacts\Service\Social; -use OCP\Http\Client\IClient; -use OCP\Http\Client\IResponse; -use OCP\Http\Client\IClientService; use ChristophWurst\Nextcloud\Testing\TestCase; +use OCP\Http\Client\IClient; +use OCP\Http\Client\IClientService; +use OCP\Http\Client\IResponse; use PHPUnit\Framework\MockObject\MockObject; class DiasporaProviderTest extends TestCase { diff --git a/tests/unit/Service/Social/FacebookProviderTest.php b/tests/unit/Service/Social/FacebookProviderTest.php index 2537bd3b..3131a4f9 100644 --- a/tests/unit/Service/Social/FacebookProviderTest.php +++ b/tests/unit/Service/Social/FacebookProviderTest.php @@ -24,10 +24,10 @@ namespace OCA\Contacts\Service\Social; -use OCP\Http\Client\IClient; -use OCP\Http\Client\IResponse; -use OCP\Http\Client\IClientService; use ChristophWurst\Nextcloud\Testing\TestCase; +use OCP\Http\Client\IClient; +use OCP\Http\Client\IClientService; +use OCP\Http\Client\IResponse; use PHPUnit\Framework\MockObject\MockObject; class FacebookProviderTest extends TestCase { diff --git a/tests/unit/Service/Social/InstagramProviderTest.php b/tests/unit/Service/Social/InstagramProviderTest.php index cba8de91..77bcd5c9 100644 --- a/tests/unit/Service/Social/InstagramProviderTest.php +++ b/tests/unit/Service/Social/InstagramProviderTest.php @@ -24,12 +24,12 @@ namespace OCA\Contacts\Service\Social; -use OCP\Http\Client\IClient; -use OCP\Http\Client\IResponse; -use OCP\Http\Client\IClientService; -use Psr\Log\LoggerInterface; use ChristophWurst\Nextcloud\Testing\TestCase; +use OCP\Http\Client\IClient; +use OCP\Http\Client\IClientService; +use OCP\Http\Client\IResponse; use PHPUnit\Framework\MockObject\MockObject; +use Psr\Log\LoggerInterface; class InstagramProviderTest extends TestCase { private $provider; diff --git a/tests/unit/Service/Social/MastodonProviderTest.php b/tests/unit/Service/Social/MastodonProviderTest.php index 802364d1..3a9cf064 100644 --- a/tests/unit/Service/Social/MastodonProviderTest.php +++ b/tests/unit/Service/Social/MastodonProviderTest.php @@ -24,10 +24,10 @@ namespace OCA\Contacts\Service\Social; -use OCP\Http\Client\IClient; -use OCP\Http\Client\IResponse; -use OCP\Http\Client\IClientService; use ChristophWurst\Nextcloud\Testing\TestCase; +use OCP\Http\Client\IClient; +use OCP\Http\Client\IClientService; +use OCP\Http\Client\IResponse; use PHPUnit\Framework\MockObject\MockObject; class MastodonProviderTest extends TestCase { diff --git a/tests/unit/Service/Social/TelegramProviderTest.php b/tests/unit/Service/Social/TelegramProviderTest.php index 666158bb..3b0dded5 100644 --- a/tests/unit/Service/Social/TelegramProviderTest.php +++ b/tests/unit/Service/Social/TelegramProviderTest.php @@ -24,10 +24,10 @@ namespace OCA\Contacts\Service\Social; -use OCP\Http\Client\IClient; -use OCP\Http\Client\IResponse; -use OCP\Http\Client\IClientService; use ChristophWurst\Nextcloud\Testing\TestCase; +use OCP\Http\Client\IClient; +use OCP\Http\Client\IClientService; +use OCP\Http\Client\IResponse; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; diff --git a/tests/unit/Service/Social/XingProviderTest.php b/tests/unit/Service/Social/XingProviderTest.php index e5d94ee6..cf0badab 100644 --- a/tests/unit/Service/Social/XingProviderTest.php +++ b/tests/unit/Service/Social/XingProviderTest.php @@ -24,10 +24,10 @@ namespace OCA\Contacts\Service\Social; -use OCP\Http\Client\IClient; -use OCP\Http\Client\IResponse; -use OCP\Http\Client\IClientService; use ChristophWurst\Nextcloud\Testing\TestCase; +use OCP\Http\Client\IClient; +use OCP\Http\Client\IClientService; +use OCP\Http\Client\IResponse; use PHPUnit\Framework\MockObject\MockObject; class XingProviderTest extends TestCase { diff --git a/tests/unit/Service/SocialApiServiceTest.php b/tests/unit/Service/SocialApiServiceTest.php index 0bee78bd..1e1ed313 100644 --- a/tests/unit/Service/SocialApiServiceTest.php +++ b/tests/unit/Service/SocialApiServiceTest.php @@ -24,24 +24,24 @@ namespace OCA\Contacts\Service; -use OCA\Contacts\Service\Social\CompositeSocialProvider; -use OCA\Contacts\Service\Social\ISocialProvider; - -use OCP\AppFramework\Http; -use OCP\Http\Client\IClient; -use OCP\Http\Client\IResponse; -use OCP\Http\Client\IClientService; -use OCP\IConfig; -use OCP\Contacts\IManager; -use OCP\IAddressBook; -use OCA\DAV\CardDAV\CardDavBackend; -use OCP\IURLGenerator; -use OCP\IL10N; -use OCP\Util; -use OCP\AppFramework\Utility\ITimeFactory; - -use PHPUnit\Framework\MockObject\MockObject; use ChristophWurst\Nextcloud\Testing\TestCase; +use OCA\Contacts\Service\Social\CompositeSocialProvider; + +use OCA\Contacts\Service\Social\ISocialProvider; +use OCA\DAV\CardDAV\CardDavBackend; +use OCP\AppFramework\Http; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\Contacts\IManager; +use OCP\Http\Client\IClient; +use OCP\Http\Client\IClientService; +use OCP\Http\Client\IResponse; +use OCP\IAddressBook; +use OCP\IConfig; +use OCP\IL10N; +use OCP\IURLGenerator; + +use OCP\Util; +use PHPUnit\Framework\MockObject\MockObject; class SocialApiServiceTest extends TestCase { private SocialApiService $service;