Skip to content

Commit 091b92d

Browse files
committed
chore: psalm fixes
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 4cb718e commit 091b92d

4 files changed

Lines changed: 20 additions & 9 deletions

File tree

apps/sharing/tests/Command/CommandTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,6 @@ protected function deleteShare(ShareAccessContext $accessContext, string $id): v
362362
);
363363
}
364364

365-
/**
366-
* @return array<string, mixed>
367-
*/
368365
#[Override]
369366
protected function getShare(ShareAccessContext $accessContext, string $id): array {
370367
$stdout = $this->runCommand(
@@ -379,9 +376,6 @@ protected function getShare(ShareAccessContext $accessContext, string $id): arra
379376
return json_decode($stdout, true, 512, JSON_THROW_ON_ERROR);
380377
}
381378

382-
/**
383-
* @return array<string, mixed>
384-
*/
385379
#[Override]
386380
protected function getShares(ShareAccessContext $accessContext, ?string $filterSourceTypeClass, ?string $filterSourceTypeValue, ?string $lastShareID, ?int $limit): array {
387381
$stdout = $this->runCommand(

apps/sharing/tests/Controller/ApiV1ControllerTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,18 @@
2222
use OCP\Sharing\Permission\SharePermission;
2323
use OCP\Sharing\Property\ShareProperty;
2424
use OCP\Sharing\Recipient\ShareRecipient;
25+
use OCP\Sharing\Share;
2526
use OCP\Sharing\ShareAccessContext;
2627
use OCP\Sharing\ShareState;
2728
use OCP\Sharing\Source\ShareSource;
2829
use PHPUnit\Framework\Attributes\Group;
2930
use Test\Sharing\AbstractSharingManagerTests;
3031

3132
// TODO: Use Dispatcher
33+
34+
/**
35+
* @psalm-import-type SharingShare from Share
36+
*/
3237
#[Group(name: 'DB')]
3338
final class ApiV1ControllerTest extends AbstractSharingManagerTests {
3439
public function testDefaultShareAccessContext(): void {
@@ -146,11 +151,17 @@ protected function deleteShare(ShareAccessContext $accessContext, string $id): v
146151
$this->executeRequest($accessContext, fn (ApiV1Controller $controller): DataResponse => $controller->deleteShare($id));
147152
}
148153

154+
/**
155+
* @psalm-suppress MixedReturnTypeCoercion
156+
*/
149157
#[Override]
150158
protected function getShare(ShareAccessContext $accessContext, string $id): array {
151159
return $this->executeRequest(new ShareAccessContext($accessContext->currentUser, null, [], $accessContext->overrideChecks), fn (ApiV1Controller $controller): DataResponse => $controller->getShare($id, $accessContext->secret, $accessContext->arguments));
152160
}
153161

162+
/**
163+
* @psalm-suppress MixedReturnTypeCoercion
164+
*/
154165
#[Override]
155166
protected function getShares(ShareAccessContext $accessContext, ?string $filterSourceTypeClass, ?string $filterSourceTypeValue, ?string $lastShareID, ?int $limit): array {
156167
return $this->executeRequest($accessContext, function (ApiV1Controller $controller) use ($filterSourceTypeClass, $filterSourceTypeValue, $lastShareID, $limit): DataResponse {

tests/lib/Sharing/AbstractSharingManagerTests.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
/**
3636
* @psalm-import-type SharingShare from Share
3737
* @psalm-import-type SharingRecipient from Share
38+
*
39+
* @psalm-suppress RedundantConditionGivenDocblockType
40+
* @psalm-suppress PossiblyUndefinedArrayOffset
3841
*/
3942
abstract class AbstractSharingManagerTests extends TestCase {
4043
abstract protected function searchRecipients(ShareAccessContext $accessContext, ?array $filterRecipientTypeClasses, string $query, int $limit, int $offset, ?string $id = null): array;
@@ -61,8 +64,14 @@ abstract protected function selectSharePermissionPreset(ShareAccessContext $acce
6164

6265
abstract protected function deleteShare(ShareAccessContext $accessContext, string $id): void;
6366

67+
/**
68+
* @return SharingShare
69+
*/
6470
abstract protected function getShare(ShareAccessContext $accessContext, string $id): array;
6571

72+
/**
73+
* @return SharingShare[]
74+
*/
6675
abstract protected function getShares(ShareAccessContext $accessContext, ?string $filterSourceTypeClass, ?string $filterSourceTypeValue, ?string $lastShareID, ?int $limit): array;
6776

6877
protected IDBConnection $dbConnection;

tests/lib/Sharing/SharingManagerTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,6 @@ protected function getShare(ShareAccessContext $accessContext, string $id): arra
207207
}
208208
}
209209

210-
/**
211-
* @return mixed[][]
212-
*/
213210
#[\Override]
214211
protected function getShares(ShareAccessContext $accessContext, ?string $filterSourceTypeClass, ?string $filterSourceTypeValue, ?string $lastShareID, ?int $limit): array {
215212
try {

0 commit comments

Comments
 (0)