Skip to content

Commit 8ecadfa

Browse files
Merge pull request #52820 from nextcloud/refactor/rector-core
2 parents 300964e + 82fb8f8 commit 8ecadfa

File tree

67 files changed

+382
-263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+382
-263
lines changed

apps/files/lib/Command/Copy.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
use Symfony\Component\Console\Question\ConfirmationQuestion;
2020

2121
class Copy extends Command {
22-
private FileUtils $fileUtils;
23-
24-
public function __construct(FileUtils $fileUtils) {
25-
$this->fileUtils = $fileUtils;
22+
public function __construct(
23+
private FileUtils $fileUtils,
24+
) {
2625
parent::__construct();
2726
}
2827

apps/files/lib/Command/Move.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020
use Symfony\Component\Console\Question\ConfirmationQuestion;
2121

2222
class Move extends Command {
23-
private FileUtils $fileUtils;
24-
25-
public function __construct(FileUtils $fileUtils) {
26-
$this->fileUtils = $fileUtils;
23+
public function __construct(
24+
private FileUtils $fileUtils,
25+
) {
2726
parent::__construct();
2827
}
2928

apps/files_trashbin/tests/TrashbinTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected function setUp(): void {
118118
$config = Server::get(IConfig::class);
119119
$mockConfig = $this->getMockBuilder(AllConfig::class)
120120
->onlyMethods(['getSystemValue'])
121-
->setConstructorArgs([Server::get(\OC\SystemConfig::class)])
121+
->setConstructorArgs([Server::get(SystemConfig::class)])
122122
->getMock();
123123
$mockConfig->expects($this->any())
124124
->method('getSystemValue')

apps/files_versions/tests/VersioningTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected function setUp(): void {
8585
$config = Server::get(IConfig::class);
8686
$mockConfig = $this->getMockBuilder(AllConfig::class)
8787
->onlyMethods(['getSystemValue'])
88-
->setConstructorArgs([Server::get(\OC\SystemConfig::class)])
88+
->setConstructorArgs([Server::get(SystemConfig::class)])
8989
->getMock();
9090
$mockConfig->expects($this->any())
9191
->method('getSystemValue')

apps/settings/lib/UserMigration/AccountMigrator.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator {
3535

3636
private ProfileManager $profileManager;
3737

38-
private ProfileConfigMapper $configMapper;
39-
4038
private const PATH_ROOT = Application::APP_ID . '/';
4139

4240
private const PATH_ACCOUNT_FILE = AccountMigrator::PATH_ROOT . 'account.json';
@@ -49,11 +47,10 @@ public function __construct(
4947
private IAccountManager $accountManager,
5048
private IAvatarManager $avatarManager,
5149
ProfileManager $profileManager,
52-
ProfileConfigMapper $configMapper,
50+
private ProfileConfigMapper $configMapper,
5351
private IL10N $l10n,
5452
) {
5553
$this->profileManager = $profileManager;
56-
$this->configMapper = $configMapper;
5754
}
5855

5956
/**

build/rector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public function shouldSkip(File $file, FullyQualifiedObjectType $fullyQualifiedO
5252
$config = RectorConfig::configure()
5353
->withPaths([
5454
$nextcloudDir . '/apps',
55+
$nextcloudDir . '/core',
5556
$nextcloudDir . '/status.php',
5657
// $nextcloudDir . '/config',
57-
// $nextcloudDir . '/core',
5858
// $nextcloudDir . '/lib',
5959
// $nextcloudDir . '/ocs',
6060
// $nextcloudDir . '/ocs-provider',

core/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct() {
5454
$notificationManager->registerNotifierService(CoreNotifier::class);
5555
$notificationManager->registerNotifierService(AuthenticationNotifier::class);
5656

57-
$eventDispatcher->addListener(AddMissingIndicesEvent::class, function (AddMissingIndicesEvent $event) {
57+
$eventDispatcher->addListener(AddMissingIndicesEvent::class, function (AddMissingIndicesEvent $event): void {
5858
$event->addMissingIndex(
5959
'share',
6060
'share_with_index',
@@ -244,7 +244,7 @@ public function __construct() {
244244
);
245245
});
246246

247-
$eventDispatcher->addListener(AddMissingPrimaryKeyEvent::class, function (AddMissingPrimaryKeyEvent $event) {
247+
$eventDispatcher->addListener(AddMissingPrimaryKeyEvent::class, function (AddMissingPrimaryKeyEvent $event): void {
248248
$event->addMissingPrimaryKey(
249249
'federated_reshares',
250250
'federated_res_pk',

core/BackgroundJobs/CheckForUserCertificates.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(
3232
*/
3333
public function run($arguments): void {
3434
$uploadList = [];
35-
$this->userManager->callForSeenUsers(function (IUser $user) use (&$uploadList) {
35+
$this->userManager->callForSeenUsers(function (IUser $user) use (&$uploadList): void {
3636
$userId = $user->getUID();
3737
try {
3838
\OC_Util::setupFS($userId);

core/BackgroundJobs/GenerateMetadataJob.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace OC\Core\BackgroundJobs;
1010

11+
use OC\Files\Mount\MoveableMount;
1112
use OCP\AppFramework\Utility\ITimeFactory;
1213
use OCP\BackgroundJob\IJobList;
1314
use OCP\BackgroundJob\TimedJob;
@@ -83,7 +84,7 @@ private function scanFilesForUser(string $userId): void {
8384

8485
private function scanFolder(Folder $folder): void {
8586
// Do not scan share and other moveable mounts.
86-
if ($folder->getMountPoint() instanceof \OC\Files\Mount\MoveableMount) {
87+
if ($folder->getMountPoint() instanceof MoveableMount) {
8788
return;
8889
}
8990

core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(
2727
* @param array $argument
2828
*/
2929
public function run($argument): void {
30-
$this->userManager->callForSeenUsers(function (IUser $user) {
30+
$this->userManager->callForSeenUsers(function (IUser $user): void {
3131
// If the user data was not updated yet (check if LUS is enabled and if then update on LUS or delete on LUS)
3232
// then we need to flag the user data to be checked
3333
if ($this->config->getUserValue($user->getUID(), 'lookup_server_connector', 'dataSend', '') === '') {

0 commit comments

Comments
 (0)