diff options
author | Andrey Borysenko <andrey18106x@gmail.com> | 2023-08-02 17:40:58 +0300 |
---|---|---|
committer | Andrey Borysenko <andrey18106x@gmail.com> | 2023-08-02 17:40:58 +0300 |
commit | d3583d3f309dc68c984d22ff4edd8e436776b475 (patch) | |
tree | ee9b217f2d058799d1b12dbc3b0e7cc9121abde6 | |
parent | ca76ab98bd49ee919a09a2751d5a20069d6207df (diff) | |
download | nextcloud-server-d3583d3f309dc68c984d22ff4edd8e436776b475.tar.gz nextcloud-server-d3583d3f309dc68c984d22ff4edd8e436776b475.zip |
Fix psalm ci (stub). Wrap server container with try-catch
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
-rw-r--r-- | build/stubs/app_ecosystem_v2.php | 15 | ||||
-rw-r--r-- | lib/base.php | 8 | ||||
-rw-r--r-- | psalm.xml | 1 |
3 files changed, 22 insertions, 2 deletions
diff --git a/build/stubs/app_ecosystem_v2.php b/build/stubs/app_ecosystem_v2.php new file mode 100644 index 00000000000..d2b07c9c616 --- /dev/null +++ b/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 {} +} diff --git a/lib/base.php b/lib/base.php index 4a4c7762595..e201ca29dcf 100644 --- a/lib/base.php +++ b/lib/base.php @@ -1187,8 +1187,12 @@ class OC { 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; + } } } diff --git a/psalm.xml b/psalm.xml index 87cecf3e2d2..cb7409489a8 100644 --- a/psalm.xml +++ b/psalm.xml @@ -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> <LessSpecificReturnStatement errorLevel="error"/> |