Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/private/Snowflake/FileSequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
/** Delete sequences after SEQUENCE_TTL seconds **/
private const SEQUENCE_TTL = 30;

private string $workDir;
private ?string $workDir = null;

public function __construct(
ITempManager $tempManager,
private ITempManager $tempManager,
) {
$this->workDir = $tempManager->getTemporaryFolder('.snowflakes');
}

#[Override]
Expand Down Expand Up @@ -84,6 +83,13 @@
}

private function getFilePath(int $fileId): string {
return $this->workDir . sprintf(self::LOCK_FILE_FORMAT, $fileId);
return $this->getWorkDir() . sprintf(self::LOCK_FILE_FORMAT, $fileId);
}

private function getWorkDir(): string {
if ($this->workDir === null || !is_dir($this->workDir)) {
$this->workDir = $this->tempManager->getTemporaryFolder('.snowflakes');
}
return $this->workDir;

Check failure on line 93 in lib/private/Snowflake/FileSequence.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

FalsableReturnStatement

lib/private/Snowflake/FileSequence.php:93:10: FalsableReturnStatement: The declared return type 'string' for OC\Snowflake\FileSequence::getWorkDir does not allow false, but the function returns 'false|string' (see https://psalm.dev/137)
}
}
Loading