Skip to content

Commit 49eb627

Browse files
committed
fix(files): fix issue with method get for files.
1 parent 79c571b commit 49eb627

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/File.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public function put(string $data, bool $lock = false): int|bool
7676
*/
7777
public function get($lock = false): string|bool
7878
{
79+
$contents = false;
80+
7981
if ($this->isFile($this->path)) {
8082
$contents = $lock ? $this->sharedGet() : file_get_contents($this->path);
8183
}

tests/FilesystemTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
$filesystem->file($this->tempDir . '/1.txt')->put('test');
156156
$this->assertEquals('test', $filesystem->file($this->tempDir . '/1.txt')->get());
157157
$this->assertEquals('test', $filesystem->file($this->tempDir . '/1.txt')->get(true));
158+
$this->assertEquals(false, $filesystem->file($this->tempDir . '/2.txt')->get());
158159
});
159160

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

0 commit comments

Comments
 (0)