Skip to content

feat: Add Flysystem v2 and v3 compatibility #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kevinrob
Copy link
Owner

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant