From 68f56671a4dbf607d01bce0972a7afcc00bf01c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sun, 5 Nov 2023 23:19:00 +0100 Subject: [PATCH] DX: fix data type with new rules for phpstan --- .../src/Service/Wopi/ChillDocumentLockManager.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php index d4338b208..e6889778c 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php @@ -52,7 +52,16 @@ class ChillDocumentLockManager implements DocumentLockManagerInterface public function hasLock(Document $document, RequestInterface $request): bool { - return $this->redis->exists($this->getCacheId($document)) > 0; + $r = $this->redis->exists($this->getCacheId($document)); + + if (is_bool($r)) { + return $r; + } + if (is_int($r)) { + return $r > 0; + } + + throw new \RuntimeException('data type not supported'); } public function setLock(Document $document, string $lockId, RequestInterface $request): bool