Skip to content

Commit

Permalink
Fix psalm ci (stub). Wrap server container with try-catch
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
  • Loading branch information
andrey18106 committed Aug 10, 2023
1 parent 10d24cd commit c0f43da
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
15 changes: 15 additions & 0 deletions build/stubs/app_ecosystem_v2.php
@@ -0,0 +1,15 @@
<?php

namespace OCA\AppEcosystemV2\Service;

use OCP\IRequest;

class AppEcosystemV2Service {
/**
* @param IRequest $request
* @param bool $isDav
*
* @return bool
*/
public function validateExAppRequestToNC(IRequest $request, bool $isDav = false): bool {}
}
8 changes: 6 additions & 2 deletions lib/base.php
Expand Up @@ -1187,8 +1187,12 @@ protected static function tryAppEcosystemV2Login(OCP\IRequest $request): bool {
if (!$appManager->isInstalled('app_ecosystem_v2')) {
return false;
}
$appEcosystemV2Service = Server::get(OCA\AppEcosystemV2\Service\AppEcosystemV2Service::class);
return $appEcosystemV2Service->validateExAppRequestToNC($request);
try {
$appEcosystemV2Service = Server::get(OCA\AppEcosystemV2\Service\AppEcosystemV2Service::class);
return $appEcosystemV2Service->validateExAppRequestToNC($request);
} catch (\Psr\Container\NotFoundExceptionInterface|\Psr\Container\ContainerExceptionInterface $e) {
return false;
}
}
}

Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Expand Up @@ -81,6 +81,7 @@
<file name="build/stubs/zip.php"/>
<file name="build/stubs/psr_container.php"/>
<file name="3rdparty/sabre/uri/lib/functions.php" />
<file name="build/stubs/app_ecosystem_v2.php" />
</stubs>
<issueHandlers>
<UndefinedClass>
Expand Down

0 comments on commit c0f43da

Please sign in to comment.