Skip to content

Commit

Permalink
fix(files): fix issue with method get for files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Awilum committed Sep 14, 2022
1 parent 79c571b commit 49eb627
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public function put(string $data, bool $lock = false): int|bool
*/
public function get($lock = false): string|bool
{
$contents = false;

if ($this->isFile($this->path)) {
$contents = $lock ? $this->sharedGet() : file_get_contents($this->path);
}
Expand Down
1 change: 1 addition & 0 deletions tests/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
$filesystem->file($this->tempDir . '/1.txt')->put('test');
$this->assertEquals('test', $filesystem->file($this->tempDir . '/1.txt')->get());
$this->assertEquals('test', $filesystem->file($this->tempDir . '/1.txt')->get(true));
$this->assertEquals(false, $filesystem->file($this->tempDir . '/2.txt')->get());
});

test('file sharedGet method', function (): void {
Expand Down

0 comments on commit 49eb627

Please sign in to comment.