Skip to content

Commit dd0d2e9

Browse files
authored
Merge pull request #572 from teohhanhui/fix/flysystem-adapter-exists
Ensure correct return type from Flysystem adapter "exists" method
2 parents 827dc53 + 5be9eae commit dd0d2e9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

spec/Gaufrette/Adapter/FlysystemSpec.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ function it_checks_if_file_exists(AdapterInterface $adapter)
4545
$this->exists('filename')->shouldReturn(true);
4646
}
4747

48+
function it_checks_if_file_exists_when_flysystem_returns_array(AdapterInterface $adapter)
49+
{
50+
$adapter->has('filename')->willReturn(['type' => 'file']);
51+
52+
$this->exists('filename')->shouldReturn(true);
53+
}
54+
4855
function it_fetches_keys(AdapterInterface $adapter)
4956
{
5057
$adapter->listContents()->willReturn([[

src/Gaufrette/Adapter/Flysystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function write($key, $content)
5050
*/
5151
public function exists($key)
5252
{
53-
return $this->adapter->has($key);
53+
return (bool) $this->adapter->has($key);
5454
}
5555

5656
/**

0 commit comments

Comments
 (0)