Skip to content

Commit 72fb7fd

Browse files
committed
Add a stubs file for Coordinator
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent ebe7931 commit 72fb7fd

File tree

3 files changed

+33
-15
lines changed

3 files changed

+33
-15
lines changed

lib/Service/UserMigrationService.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ class UserMigrationService {
6060
protected ContainerInterface $container;
6161

6262
// Allow use of the private Coordinator class here to get and run registered migrators
63-
/**
64-
* @psalm-suppress UndefinedClass
65-
*/
6663
protected Coordinator $coordinator;
6764

6865
public function __construct(
@@ -72,9 +69,6 @@ public function __construct(
7269
ITempManager $tempManager,
7370
IUserManager $userManager,
7471
ContainerInterface $container,
75-
/**
76-
* @psalm-suppress UndefinedClass
77-
*/
7872
Coordinator $coordinator
7973
) {
8074
$this->root = $rootFolder;
@@ -83,9 +77,6 @@ public function __construct(
8377
$this->tempManager = $tempManager;
8478
$this->userManager = $userManager;
8579
$this->container = $container;
86-
/**
87-
* @psalm-suppress UndefinedClass
88-
*/
8980
$this->coordinator = $coordinator;
9081
}
9182

@@ -136,9 +127,6 @@ public function export(IUser $user, ?OutputInterface $output = null): string {
136127
);
137128

138129
// Run exports of registered migrators
139-
/**
140-
* @psalm-suppress UndefinedClass
141-
*/
142130
$context = $this->coordinator->getRegistrationContext();
143131

144132
if ($context !== null) {
@@ -169,9 +157,6 @@ public function import(string $path, ?OutputInterface $output = null): void {
169157
$this->importFiles($user, $importSource, $output);
170158

171159
// Run imports of registered migrators
172-
/**
173-
* @psalm-suppress UndefinedClass
174-
*/
175160
$context = $this->coordinator->getRegistrationContext();
176161

177162
if ($context !== null) {

psalm.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<extraFiles>
1818
<directory name="vendor" />
1919
</extraFiles>
20+
<stubs>
21+
<file name="tests/stubs/stub.phpstub" preloadClasses="true"/>
22+
</stubs>
2023
<issueHandlers>
2124
<UndefinedClass>
2225
<errorLevel type="suppress">

tests/stubs/stub.phpstub

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* @copyright Copyright (c) 2022 Côme Chilliet <come.chilliet@nextcloud.com>
6+
*
7+
* @license GNU AGPL version 3 or any later version
8+
*
9+
* This program is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU Affero General Public License as
11+
* published by the Free Software Foundation, either version 3 of the
12+
* License, or (at your option) any later version.
13+
*
14+
* This program is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Affero General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Affero General Public License
20+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21+
*
22+
*/
23+
24+
namespace OC\AppFramework\Bootstrap {
25+
class Coordinator {
26+
public function getRegistrationContext(): ?RegistrationContext {
27+
return null;
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)