Skip to content

Commit 8763eb9

Browse files
committed
chore(cleanup): remove unused $newVersion.
Signed-off-by: Max <[email protected]>
1 parent 376b814 commit 8763eb9

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/Service/DocumentService.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ public function addStep(Document $document, Session $session, array $steps, int
211211
$stepsToInsert = [];
212212
$stepsIncludeQuery = false;
213213
$documentState = null;
214-
$newVersion = $version;
215214
foreach ($steps as $step) {
216215
$message = YjsMessage::fromBase64($step);
217216
if ($readOnly && $message->isUpdate()) {
@@ -228,7 +227,7 @@ public function addStep(Document $document, Session $session, array $steps, int
228227
if ($readOnly) {
229228
throw new NotPermittedException('Read-only client tries to push steps with changes');
230229
}
231-
$newVersion = $this->insertSteps($document, $session, $stepsToInsert);
230+
$this->insertSteps($document, $session, $stepsToInsert);
232231
}
233232

234233
// By default, send all steps the user has not received yet.
@@ -275,14 +274,12 @@ public function addStep(Document $document, Session $session, array $steps, int
275274
* @param Session $session
276275
* @param Step[] $steps
277276
*
278-
* @return int
279-
*
280277
* @throws DoesNotExistException
281278
* @throws InvalidArgumentException
282279
*
283280
* @psalm-param non-empty-list<mixed> $steps
284281
*/
285-
private function insertSteps(Document $document, Session $session, array $steps): int {
282+
private function insertSteps(Document $document, Session $session, array $steps): void {
286283
$stepsVersion = null;
287284
try {
288285
$stepsJson = json_encode($steps, JSON_THROW_ON_ERROR);
@@ -298,7 +295,6 @@ private function insertSteps(Document $document, Session $session, array $steps)
298295
$this->logger->debug('Adding steps to ' . $document->getId() . ": bumping version from $stepsVersion to $newVersion");
299296
$this->cache->set('document-version-' . $document->getId(), $newVersion);
300297
// TODO write steps to cache for quicker reading
301-
return $newVersion;
302298
} catch (\Throwable $e) {
303299
if ($stepsVersion !== null) {
304300
$this->logger->error('This should never happen. An error occurred when storing the version, trying to recover the last stable one', ['exception' => $e]);

0 commit comments

Comments
 (0)