guzzle-cache-middleware icon indicating copy to clipboard operation
guzzle-cache-middleware copied to clipboard

feat: Add Flysystem v2 and v3 compatibility

Open Kevinrob opened this issue 6 months ago • 0 comments

This change updates the library to be compatible with both Flysystem v2 and v3.

Key changes include:

  • Updated composer.json to allow league/flysystem versions ^2.5 || ^3.0.
  • Modified src/Storage/FlysystemStorage.php to correctly handle exceptions and return values from Flysystem v2/v3 methods:
    • fetch() now catches FilesystemException during read and returns null.
    • save() ensures true is returned on success and false on FilesystemException.
    • delete() now correctly returns false if a FilesystemException occurs (previously returned true).
  • Added tests/Storage/FlysystemStorageTest.php with new unit tests covering success and failure scenarios for fetch, save, and delete operations, including mocking Flysystem exceptions. This ensures the storage layer behaves as expected when underlying file operations fail.
  • Added phpspec/prophecy-phpunit to dev dependencies for mocking in tests.

Kevinrob avatar May 23 '25 12:05 Kevinrob