diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-10-16 23:38:31 +0200 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-10-16 23:38:31 +0200 |
commit | ff4c8e9beea6c66b016f2fa59569d4e7cdeb921d (patch) | |
tree | e191eff2f4eaa0085a3c48bf39917e8eab10c491 /apps/files_external/lib | |
parent | c4bb69c143bbd5c493012ae5830e09481e8784a7 (diff) | |
download | nextcloud-server-ff4c8e9beea6c66b016f2fa59569d4e7cdeb921d.tar.gz nextcloud-server-ff4c8e9beea6c66b016f2fa59569d4e7cdeb921d.zip |
Force cast getCode to int
Otherwise psalm complains that the type can also be a non-falsy-string
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r-- | apps/files_external/lib/Controller/StoragesController.php | 4 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SMB.php | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/apps/files_external/lib/Controller/StoragesController.php b/apps/files_external/lib/Controller/StoragesController.php index b82d2a4a4c7..c8eda8658ef 100644 --- a/apps/files_external/lib/Controller/StoragesController.php +++ b/apps/files_external/lib/Controller/StoragesController.php @@ -294,12 +294,12 @@ abstract class StoragesController extends Controller { } catch (InsufficientDataForMeaningfulAnswerException $e) { $status = $e->getCode() ? $e->getCode() : StorageNotAvailableException::STATUS_INDETERMINATE; $storage->setStatus( - $status, + (int)$status, $this->l10n->t('Insufficient data: %s', [$e->getMessage()]) ); } catch (StorageNotAvailableException $e) { $storage->setStatus( - $e->getCode(), + (int)$e->getCode(), $this->l10n->t('%s', [$e->getMessage()]) ); } catch (\Exception $e) { diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 6c59263ddd5..c7055be3ed8 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -282,7 +282,7 @@ class SMB extends Common implements INotifyStorage { } } catch (ConnectException $e) { $this->logger->logException($e, ['message' => 'Error while getting folder content']); - throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); } } @@ -428,7 +428,7 @@ class SMB extends Common implements INotifyStorage { return false; } catch (ConnectException $e) { $this->logger->logException($e, ['message' => 'Error while deleting file']); - throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); } } @@ -515,7 +515,7 @@ class SMB extends Common implements INotifyStorage { throw new EntityTooLargeException("not enough available space to create file", 0, $e); } catch (ConnectException $e) { $this->logger->logException($e, ['message' => 'Error while opening file']); - throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); } } @@ -542,7 +542,7 @@ class SMB extends Common implements INotifyStorage { return false; } catch (ConnectException $e) { $this->logger->logException($e, ['message' => 'Error while removing folder']); - throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); } } @@ -558,7 +558,7 @@ class SMB extends Common implements INotifyStorage { throw new EntityTooLargeException("not enough available space to create file", 0, $e); } catch (ConnectException $e) { $this->logger->logException($e, ['message' => 'Error while creating file']); - throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); } } @@ -655,7 +655,7 @@ class SMB extends Common implements INotifyStorage { return true; } catch (ConnectException $e) { $this->logger->logException($e, ['message' => 'Error while creating folder']); - throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); } catch (Exception $e) { return false; } @@ -670,7 +670,7 @@ class SMB extends Common implements INotifyStorage { } catch (ForbiddenException $e) { return false; } catch (ConnectException $e) { - throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); } } |