diff --git a/spec/Gaufrette/Adapter/DoctrineDbalSpec.php b/spec/Gaufrette/Adapter/DoctrineDbalSpec.php index e78a3f7f..e55c73c3 100644 --- a/spec/Gaufrette/Adapter/DoctrineDbalSpec.php +++ b/spec/Gaufrette/Adapter/DoctrineDbalSpec.php @@ -154,7 +154,7 @@ function it_calculates_checksum(Connection $connection) ->$method('SELECT "checksum" FROM "someTableName" WHERE "key" = :key', ['key' => 'filename']) ->willReturn(1234); - $this->checksum('filename')->shouldReturn(1234); + $this->checksum('filename')->shouldReturn("1234"); } function it_gets_mtime(Connection $connection) diff --git a/spec/Gaufrette/Adapter/FlysystemSpec.php b/spec/Gaufrette/Adapter/FlysystemSpec.php index 26ce5270..bf0c0031 100644 --- a/spec/Gaufrette/Adapter/FlysystemSpec.php +++ b/spec/Gaufrette/Adapter/FlysystemSpec.php @@ -34,7 +34,7 @@ function it_writes_file(AdapterInterface $adapter, Config $config) { $adapter->write('filename', 'Hello.', $config)->willReturn([]); - $this->write('filename', 'Hello.')->shouldReturn([]); + $this->write('filename', 'Hello.')->shouldReturn(0); } function it_checks_if_file_exists(AdapterInterface $adapter) diff --git a/src/Gaufrette/Adapter/Flysystem.php b/src/Gaufrette/Adapter/Flysystem.php index cfabad98..fc8dc53d 100644 --- a/src/Gaufrette/Adapter/Flysystem.php +++ b/src/Gaufrette/Adapter/Flysystem.php @@ -37,7 +37,17 @@ public function read(string $key): string|bool */ public function write(string $key, mixed $content): int|bool { - return $this->adapter->write($key, $content, $this->config); + $metadata = $this->adapter->write($key, $content, $this->config); + + if (false === $metadata) { + return false; + } + + if (is_int($metadata['size'] ?? 0)) { + return $metadata['size'] ?? 0; + } + + return 0; } /**