Skip to content

Commit 9a22db7

Browse files
committed
refactor(rector): Run rector on new code
Signed-off-by: Carl Schwan <carlschwan@kde.org>
1 parent 1dbaf17 commit 9a22db7

File tree

55 files changed

+268
-353
lines changed

Some content is hidden

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

55 files changed

+268
-353
lines changed

apps/dav/appinfo/v1/carddav.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
/** @var string $baseuri defined in remote.php */
9090
$server->setBaseUri($baseuri);
9191
// Add plugins
92-
$server->addPlugin(new MaintenancePlugin(Server::get(IConfig::class), \OCP\Server::get(IL10nFactory::class)->get('dav')));
92+
$server->addPlugin(new MaintenancePlugin(Server::get(IConfig::class), Server::get(IL10nFactory::class)->get('dav')));
9393
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
9494
$server->addPlugin(new Plugin());
9595

apps/dav/lib/Connector/Sabre/Directory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ public function getNodeForPath($path): INode {
532532
}
533533

534534
if ($info->getMimeType() === FileInfo::MIMETYPE_FOLDER) {
535-
$node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info, $this->tree, $this->shareManager);
535+
$node = new Directory($this->fileView, $info, $this->tree, $this->shareManager);
536536
} else {
537537
// In case reading a directory was allowed but it turns out the node was a not a directory, reject it now.
538538
if (!$this->info->isReadable()) {

apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use OCP\IAppConfig;
1818
use OCP\IDBConnection;
1919
use OCP\IL10N;
20+
use OCP\IUser;
2021
use OCP\IUserManager;
2122
use OCP\L10N\IFactory;
2223
use OCP\Security\ISecureRandom;
@@ -163,7 +164,7 @@ public function testGetFrom(): void {
163164

164165
public function testIsSystemUserWhenUserExists(): void {
165166
$email = 'user@example.com';
166-
$user = $this->createMock(\OCP\IUser::class);
167+
$user = $this->createMock(IUser::class);
167168

168169
$this->userManager->expects(self::once())
169170
->method('getByEmail')

apps/dav/tests/unit/Connector/Sabre/NodeTest.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static function davPermissionsProvider(): array {
5555
public function testDavPermissions(int $permissions, string $type, bool $shared, int $shareRootPermissions, bool $mounted, string $internalPath, string $expected): void {
5656
$info = $this->getMockBuilder(FileInfo::class)
5757
->disableOriginalConstructor()
58-
->onlyMethods(['getPermissions', 'isShared', 'isMounted', 'getType', 'getInternalPath', 'getStorage', 'getMountPoint'])
58+
->onlyMethods(['getPermissions', 'isShared', 'isMounted', 'getType', 'getInternalPath', 'getStorage', 'getMountPoint', 'getPath'])
5959
->getMock();
6060
$info->method('getPermissions')
6161
->willReturn($permissions);
@@ -65,6 +65,8 @@ public function testDavPermissions(int $permissions, string $type, bool $shared,
6565
->willReturn($mounted);
6666
$info->method('getType')
6767
->willReturn($type);
68+
$info->method('getPath')
69+
->willReturn('');
6870
$info->method('getInternalPath')
6971
->willReturn($internalPath);
7072
$info->method('getMountPoint')
@@ -160,18 +162,18 @@ public function testSharePermissions(string $type, ?string $user, int $permissio
160162

161163
$info = $this->getMockBuilder(FileInfo::class)
162164
->disableOriginalConstructor()
163-
->onlyMethods(['getStorage', 'getType', 'getMountPoint', 'getPermissions'])
165+
->onlyMethods(['getStorage', 'getType', 'getMountPoint', 'getPermissions', 'getPath'])
164166
->getMock();
165167

166168
$info->method('getStorage')->willReturn($storage);
169+
$info->method('getPath')->willReturn('notMyPath');
167170
$info->method('getType')->willReturn($type);
168171
$info->method('getMountPoint')->willReturn($mountpoint);
169172
$info->method('getPermissions')->willReturn($permissions);
170173

171174
$view = $this->createMock(View::class);
172175

173-
$node = new File($view, $info);
174-
$this->invokePrivate($node, 'shareManager', [$shareManager]);
176+
$node = new File($view, $info, $shareManager);
175177
$this->assertEquals($expected, $node->getSharePermissions($user));
176178
}
177179

@@ -196,9 +198,10 @@ public function testShareAttributes(): void {
196198
/** @var Folder&MockObject $info */
197199
$info = $this->getMockBuilder(Folder::class)
198200
->disableOriginalConstructor()
199-
->onlyMethods(['getStorage', 'getType'])
201+
->onlyMethods(['getStorage', 'getType', 'getPath'])
200202
->getMock();
201203

204+
$info->method('getPath')->willReturn('myPath');
202205
$info->method('getStorage')->willReturn($storage);
203206
$info->method('getType')->willReturn(FileInfo::TYPE_FOLDER);
204207

@@ -217,9 +220,10 @@ public function testShareAttributesNonShare(): void {
217220
/** @var Folder&MockObject */
218221
$info = $this->getMockBuilder(Folder::class)
219222
->disableOriginalConstructor()
220-
->onlyMethods(['getStorage', 'getType'])
223+
->onlyMethods(['getStorage', 'getType', 'getPath'])
221224
->getMock();
222225

226+
$info->method('getPath')->willReturn('myPath');
223227
$info->method('getStorage')->willReturn($storage);
224228
$info->method('getType')->willReturn(FileInfo::TYPE_FOLDER);
225229

apps/federatedfilesharing/lib/AppInfo/Application.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use OCP\AppFramework\Bootstrap\IBootstrap;
1818
use OCP\AppFramework\Bootstrap\IRegistrationContext;
1919
use OCP\Federation\ICloudFederationProviderManager;
20+
use OCP\Server;
2021

2122
class Application extends App implements IBootstrap {
2223

@@ -41,7 +42,7 @@ private function registerCloudFederationProvider(ICloudFederationProviderManager
4142
$manager->addCloudFederationProvider($type,
4243
'Federated Files Sharing',
4344
function (): CloudFederationProviderFiles {
44-
return \OCP\Server::get(CloudFederationProviderFiles::class);
45+
return Server::get(CloudFederationProviderFiles::class);
4546
});
4647
}
4748
}

apps/federatedfilesharing/lib/Settings/Admin.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use OCP\IL10N;
1515
use OCP\IURLGenerator;
1616
use OCP\Settings\IDelegatedSettings;
17+
use OCP\Util;
1718

1819
class Admin implements IDelegatedSettings {
1920
/**
@@ -44,8 +45,8 @@ public function getForm() {
4445
$this->initialState->provideInitialState('lookupServerUploadEnabled', $this->fedShareProvider->isLookupServerUploadEnabled());
4546
$this->initialState->provideInitialState('federatedTrustedShareAutoAccept', $this->fedShareProvider->isFederatedTrustedShareAutoAccept());
4647

47-
\OCP\Util::addStyle(Application::APP_ID, 'settings-admin');
48-
\OCP\Util::addScript(Application::APP_ID, 'settings-admin');
48+
Util::addStyle(Application::APP_ID, 'settings-admin');
49+
Util::addScript(Application::APP_ID, 'settings-admin');
4950
return new TemplateResponse(Application::APP_ID, 'settings-admin', renderAs: '');
5051
}
5152

apps/federatedfilesharing/lib/Settings/Personal.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use OCP\IURLGenerator;
1717
use OCP\IUserSession;
1818
use OCP\Settings\ISettings;
19+
use OCP\Util;
1920

2021
class Personal implements ISettings {
2122
public function __construct(
@@ -42,8 +43,8 @@ public function getForm(): TemplateResponse {
4243
$this->initialState->provideInitialState('cloudId', $cloudID);
4344
$this->initialState->provideInitialState('docUrlFederated', $this->urlGenerator->linkToDocs('user-sharing-federated'));
4445

45-
\OCP\Util::addStyle(Application::APP_ID, 'settings-personal');
46-
\OCP\Util::addScript(Application::APP_ID, 'settings-personal');
46+
Util::addStyle(Application::APP_ID, 'settings-personal');
47+
Util::addScript(Application::APP_ID, 'settings-personal');
4748
return new TemplateResponse(Application::APP_ID, 'settings-personal', renderAs: TemplateResponse::RENDER_AS_BLANK);
4849
}
4950

apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ public function __construct(
3939
]);
4040
}
4141

42-
/**
43-
* @return void
44-
*/
45-
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
42+
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null): void {
4643
try {
4744
$credentials = $this->credentialsStore->getLoginCredentials();
4845
} catch (CredentialsUnavailableException $e) {

apps/files_external/lib/Lib/SessionStorageWrapper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99

1010
use OC\Files\Storage\Wrapper\PermissionsMask;
1111
use OCP\Constants;
12+
use OCP\Files\Storage;
13+
use OCP\Files\Storage\IStorage;
1214

1315
/**
1416
* Wrap Storage in PermissionsMask for session ephemeral use
1517
*/
1618
class SessionStorageWrapper extends PermissionsMask {
1719
/**
18-
* @param array $parameters ['storage' => $storage]
20+
* @param array{storage: IStorage} $parameters
1921
*/
2022
public function __construct(array $parameters) {
2123
// disable sharing permission

apps/files_external/tests/Settings/AdminTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function testGetForm(): void {
8585
$this->initialState
8686
->expects($this->atLeastOnce())
8787
->method('provideInitialState')
88-
->willReturnCallback(function () use (&$initialState) {
88+
->willReturnCallback(function () use (&$initialState): void {
8989
$args = func_get_args();
9090
$initialState[$args[0]] = $args[1];
9191
});

0 commit comments

Comments
 (0)