Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ SPDX-PackageName = "contacts"
SPDX-PackageSupplier = "Nextcloud <info@nextcloud.com>"
SPDX-PackageDownloadLocation = "https://github.com/nextcloud/contacts"

[[annotations]]
path = ["vendor-bin/rector/composer.json", "vendor-bin/rector/composer.lock"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2026 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"

[[annotations]]
path = ["l10n/**.js", "l10n/**.json", "js/**.js.map", "js/**.js"]
precedence = "aggregate"
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:check:force": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --dry-run --diff",
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l",
"rector:apply": "rector && composer cs:fix",
"rector:check": "rector --dry-run",
"test:unit": "phpunit -c phpunit.xml --fail-on-warning",
"test:unit:coverage": "phpunit --coverage-clover coverage.xml -c phpunit.xml --fail-on-warning ",
"test:unit:dev": "phpunit -c phpunit.xml --fail-on-warning --stop-on-error --stop-on-failure",
Expand Down
2 changes: 1 addition & 1 deletion lib/Cron/SocialUpdateRegistration.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use OCP\IUserManager;

class SocialUpdateRegistration extends TimedJob {
private $appName;
private string $appName;

/**
* RegisterSocialUpdate constructor.
Expand Down
7 changes: 4 additions & 3 deletions lib/Dav/PatchPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use Sabre\CardDAV\Card;
use Sabre\DAV;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Server;
use Sabre\DAV\ServerPlugin;
use Sabre\HTTP\RequestInterface;
Expand Down Expand Up @@ -91,7 +92,7 @@ public function httpPatch(RequestInterface $request, ResponseInterface $response
// Init property name & value
$propertyName = $request->getHeader('X-Property');
if (is_null($propertyName)) {
throw new DAV\Exception\BadRequest('No valid "X-Property" found in the headers');
throw new BadRequest('No valid "X-Property" found in the headers');
}

$propertyData = $request->getHeader('X-Property-Replace');
Expand All @@ -100,7 +101,7 @@ public function httpPatch(RequestInterface $request, ResponseInterface $response
$propertyData = $request->getHeader('X-Property-Append');
$method = self::METHOD_APPEND;
if (is_null($propertyData)) {
throw new DAV\Exception\BadRequest('No valid "X-Property-Append" or "X-Property-Replace" found in the headers');
throw new BadRequest('No valid "X-Property-Append" or "X-Property-Replace" found in the headers');
}
}

Expand All @@ -112,7 +113,7 @@ public function httpPatch(RequestInterface $request, ResponseInterface $response

// We cannot know which one to update in that case
if (count($properties) > 1) {
throw new DAV\Exception\BadRequest('The specified property appear more than once');
throw new BadRequest('The specified property appear more than once');
}

// Init if not in the vcard
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/Social/CompositeSocialProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class CompositeSocialProvider {
/** @var ISocialProvider[] */
private $providers;
private array $providers;

public function __construct(InstagramProvider $instagramProvider,
MastodonProvider $mastodonProvider,
Expand Down
6 changes: 2 additions & 4 deletions lib/Service/Social/DiasporaProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@
use OCP\Http\Client\IClientService;

class DiasporaProvider implements ISocialProvider {
/** @var IClient */
private $httpClient;
private IClient $httpClient;

/** @var bool */
private $looping;
private bool $looping;

/** @var string */
public $name = 'diaspora';
Expand Down
3 changes: 1 addition & 2 deletions lib/Service/Social/FacebookProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
use OCP\Http\Client\IClientService;

class FacebookProvider implements ISocialProvider {
/** @var IClient */
private $httpClient;
private IClient $httpClient;

/** @var string */
public $name = 'facebook';
Expand Down
13 changes: 5 additions & 8 deletions lib/Service/Social/InstagramProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@
use Psr\Log\LoggerInterface;

class InstagramProvider implements ISocialProvider {
/** @var IClient */
private $httpClient;

/** @var LoggerInterface */
private $logger;
private IClient $httpClient;

/** @var string */
public $name = 'instagram';

public function __construct(IClientService $httpClient,
LoggerInterface $logger) {
public function __construct(
IClientService $httpClient,
private LoggerInterface $logger,
) {
$this->httpClient = $httpClient->newClient();
$this->logger = $logger;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions lib/Service/Social/MastodonProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
use OCP\Http\Client\IClientService;

class MastodonProvider implements ISocialProvider {
/** @var IClient */
private $httpClient;
private IClient $httpClient;

/** @var string */
public $name = 'mastodon';
Expand Down
13 changes: 5 additions & 8 deletions lib/Service/Social/TelegramProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@
use Psr\Log\LoggerInterface;

class TelegramProvider implements ISocialProvider {
/** @var IClient */
private $httpClient;

/** @var LoggerInterface */
private $logger;
private IClient $httpClient;

/** @var string */
public $name = 'telegram';

public function __construct(IClientService $httpClient,
LoggerInterface $logger) {
public function __construct(
IClientService $httpClient,
private LoggerInterface $logger,
) {
$this->httpClient = $httpClient->newClient();
$this->logger = $logger;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions lib/Service/Social/XingProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
use OCP\Http\Client\IClientService;

class XingProvider implements ISocialProvider {
/** @var IClient */
private $httpClient;
private IClient $httpClient;

/** @var string */
public $name = 'xing';
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/SocialApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SocialApiService {
'image/jpeg',
'image/gif'
];
private $appName;
private string $appName;

public function __construct(
private CompositeSocialProvider $socialProvider,
Expand Down
32 changes: 32 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

use Rector\Config\RectorConfig;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
use Rector\ValueObject\PhpVersion;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/appinfo/routes.php',
__DIR__ . '/lib',
__DIR__ . '/tests/unit',
])
->withAutoloadPaths([
__DIR__ . '/vendor-bin/rector/vendor/nextcloud/ocp/OCP',
])
->withImportNames(importShortClasses: false)
->withPhpVersion(PhpVersion::PHP_82)
->withRules([
TypedPropertyFromStrictConstructorRector::class,
])
->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [
'inline_public' => true,
'rename_property' => true,
]);
11 changes: 11 additions & 0 deletions vendor-bin/rector/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"config": {
"platform": {
"php": "8.1"
},
"sort-packages": true
},
"require-dev": {
"nextcloud/rector": "^0.5.2"
}
}
Loading
Loading