From 61337742e9e390ab3c68f064a2aba0f0b2cf1794 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Tue, 10 Sep 2024 20:37:12 +0200 Subject: [PATCH] refactor: Eliminate \OC::$server->get calls Signed-off-by: Christoph Wurst --- rector.php | 8 +++++++- .../Phishing/PhishingDetectionServiceIntegrationTest.php | 2 +- vendor-bin/rector/composer.json | 8 ++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/rector.php b/rector.php index 433aac517a..bc26c763f2 100644 --- a/rector.php +++ b/rector.php @@ -20,4 +20,10 @@ ->withPreparedSets( phpunitCodeQuality: true, phpunit: true, - ); + ) + ->withBootstrapFiles([ + __DIR__ . '/../../lib/composer/autoload.php', + ]) + ->withRules([ + \ChristophWurst\Nextcloud\Rector\Rector\OcServerToOcpServerRector::class, + ]); diff --git a/tests/Integration/Service/Phishing/PhishingDetectionServiceIntegrationTest.php b/tests/Integration/Service/Phishing/PhishingDetectionServiceIntegrationTest.php index fb2e10dbc6..3d2612d1e6 100644 --- a/tests/Integration/Service/Phishing/PhishingDetectionServiceIntegrationTest.php +++ b/tests/Integration/Service/Phishing/PhishingDetectionServiceIntegrationTest.php @@ -40,7 +40,7 @@ protected function setUp(): void { $this->l10n = $this->createMock(IL10N::class); $this->contactCheck = new ContactCheck($this->contactsIntegration, $this->l10n); $this->customEmailCheck = new CustomEmailCheck($this->l10n); - $this->dateCheck = new DateCheck($this->l10n, \OC::$server->get(ITimeFactory::class)); + $this->dateCheck = new DateCheck($this->l10n, \OCP\Server::get(ITimeFactory::class)); $this->replyToCheck = new ReplyToCheck($this->l10n); $this->linkCheck = new LinkCheck($this->l10n); $this->service = new PhishingDetectionService($this->contactCheck, $this->customEmailCheck, $this->dateCheck, $this->replyToCheck, $this->linkCheck); diff --git a/vendor-bin/rector/composer.json b/vendor-bin/rector/composer.json index aba091e522..2e102f92a6 100644 --- a/vendor-bin/rector/composer.json +++ b/vendor-bin/rector/composer.json @@ -1,5 +1,9 @@ { + "config": { + "sort-packages": true + }, "require-dev": { - "rector/rector": "^1.2.4" - } + "christophwurst/nextcloud-rector": "^0.0.4", + "rector/rector": "^1.2.4" + } }