Skip to content

Comments

[TASK] Upgrade league/flysystem from v1 to v3#9

Open
CybotTM wants to merge 2 commits intomainfrom
feature/flysystem-3
Open

[TASK] Upgrade league/flysystem from v1 to v3#9
CybotTM wants to merge 2 commits intomainfrom
feature/flysystem-3

Conversation

@CybotTM
Copy link
Member

@CybotTM CybotTM commented Feb 22, 2026

Summary

  • Upgrade league/flysystem from abandoned v1 (since 2022) to v3
  • Migrate code to v3 API (LocalFilesystemAdapter, FilesystemException)
  • Upstream phpdocumentor/guides 1.9.5 already supports flysystem v3
  • phpdocumentor provides FilesystemInterface compatibility shim

Files changed

  • composer.json / composer.lock - constraint update + transitive upgrades
  • packages/typo3-docs-theme/src/EventListeners/CopyResources.php - v3 API migration
  • packages/typo3-docs-theme/src/Twig/TwigExtension.php - exception class update
  • packages/typo3-docs-theme/src/Directives/IncludeDirective.php - docblock update
  • packages/typo3-docs-theme/src/Directives/SiteSetSettingsDirective.php - docblock update
  • Integration test expected output updated for v3 error message format

Test plan

  • PHPStan passes (level max)
  • Unit tests pass (83/83)
  • Integration tests pass (112/112)

league/flysystem v1 has been abandoned since 2022. Migrate to v3 API:

- Replace Adapter\Local with Local\LocalFilesystemAdapter
- Replace League\Flysystem\Exception with FilesystemException
- Remove readStream false-check (v3 throws instead of returning false)
- Remove outdated @throws FileNotFoundException docblocks
- Update integration test expectations for v3 path traversal message
- Upstream phpdocumentor/guides 1.9.5 already supports flysystem v3
@gemini-code-assist
Copy link

Summary of Changes

Hello @CybotTM, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a critical dependency upgrade, moving the project from the abandoned league/flysystem v1 to the actively maintained v3. This involved updating the core library and its associated local adapter, migrating existing code to the new API, and ensuring all transitive dependencies are compatible. The changes enhance the project's stability and maintainability by using modern, supported libraries.

Highlights

  • Flysystem Upgrade: The league/flysystem library has been upgraded from version 1 to version 3, addressing the abandonment of the v1 branch and adopting the new API.
  • API Migration: Code references to League\Flysystem\Adapter\Local were migrated to League\Flysystem\Local\LocalFilesystemAdapter, and League\Flysystem\Exception was updated to League\Flysystem\FilesystemException to align with the v3 API.
  • Dependency Updates: The composer.lock file was updated, reflecting transitive upgrades across various packages including doctrine/deprecations, phpdocumentor/flyfinder, phpdocumentor/guides, and several Symfony components, ensuring compatibility with the new Flysystem version.
  • Docblock Refinement: Redundant @throws \League\Flysystem\FileNotFoundException annotations were removed from docblocks in directives, as the exception handling model changed in Flysystem v3.
  • Integration Test Alignment: Expected error messages in integration tests were updated to match the new format produced by Flysystem v3, specifically for path traversal detection.
Changelog
  • composer.json
    • Updated league/flysystem dependency constraint from ^1.1.10 to ^3.29.
  • composer.lock
    • Updated content hash to reflect new dependency versions.
    • Upgraded doctrine/deprecations from 1.1.4 to 1.1.6.
    • Upgraded league/flysystem from 1.1.10 to 3.31.0 and introduced league/flysystem-local at 3.31.0.
    • Upgraded league/tactician from v1.1.0 to v1.2.0.
    • Upgraded league/uri from 7.5.1 to 7.8.0.
    • Upgraded league/uri-interfaces from 7.5.0 to 7.8.0.
    • Upgraded masterminds/html5 from 2.9.0 to 2.10.0.
    • Upgraded phpdocumentor/flyfinder from 1.1.0 to 2.0.0.
    • Upgraded phpdocumentor/guides from 1.9.2 to 1.9.5.
    • Upgraded symfony/clock from v6.4.13 to v6.4.30.
    • Upgraded symfony/html-sanitizer from v6.4.18 to v6.4.28.
    • Upgraded symfony/http-client from v6.4.19 to v6.4.33.
    • Upgraded symfony/http-client-contracts from v3.5.2 to v3.6.0.
    • Upgraded symfony/polyfill-php83 from v1.32.0 to v1.33.0.
    • Upgraded symfony/translation-contracts from v3.5.1 to v3.6.1.
    • Upgraded twig/twig from v3.20.0 to v3.23.0.
    • Upgraded webmozart/assert from 1.11.0 to 1.12.1.
    • Updated plugin-api-version from 2.6.0 to 2.9.0.
  • packages/typo3-docs-theme/src/Directives/IncludeDirective.php
    • Removed @throws \League\Flysystem\FileNotFoundException from resolveGlobInclude, resolveBasicInclude, and getCollectionFromPath methods.
  • packages/typo3-docs-theme/src/Directives/SiteSetSettingsDirective.php
    • Removed @throws \League\Flysystem\FileNotFoundException from loadFileFromDocumentation method.
  • packages/typo3-docs-theme/src/EventListeners/CopyResources.php
    • Replaced League\Flysystem\Adapter\Local with League\Flysystem\Local\LocalFilesystemAdapter.
    • Removed explicit false check for readStream return value, aligning with Flysystem v3 behavior.
  • packages/typo3-docs-theme/src/Twig/TwigExtension.php
    • Replaced League\Flysystem\Exception with League\Flysystem\FilesystemException in use statements and catch blocks.
  • tests/Integration/tests/site-set-failure/expected/logs/error.log
    • Updated the expected error message for path traversal to reflect Flysystem v3's output.
  • tests/Integration/tests/site-set-failure/expected/logs/warning.log
    • Updated the expected warning message for path traversal to reflect Flysystem v3's output.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/main.yaml
Activity
  • The pull request author, CybotTM, initiated the upgrade of league/flysystem from v1 to v3.
  • The author migrated existing code to the new Flysystem v3 API, including updating adapter and exception classes.
  • The author confirmed that phpdocumentor/guides version 1.9.5 already supports Flysystem v3 and that phpdocumentor provides a compatibility shim.
  • The author updated composer.json and composer.lock to reflect the new dependency versions and transitive upgrades.
  • The author updated docblocks in IncludeDirective.php and SiteSetSettingsDirective.php by removing outdated exception annotations.
  • The author adjusted the CopyResources.php event listener to use the new local filesystem adapter and updated stream handling.
  • The author modified TwigExtension.php to catch the new FilesystemException type.
  • The author updated integration test expected output logs to match the new error message format from Flysystem v3.
  • The author provided a test plan confirming PHPStan, unit, and integration tests pass with the changes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request successfully upgrades league/flysystem from v1 to v3, along with other dependency updates in composer.json and composer.lock. The code changes reflect the API migration, specifically in CopyResources.php for LocalFilesystemAdapter and TwigExtension.php for FilesystemException. Docblock updates were also made in IncludeDirective.php and SiteSetSettingsDirective.php to remove references to FileNotFoundException which is no longer thrown by Flysystem v3. The integration test logs were updated to reflect the new error message format. The changes are well-aligned with the goal of upgrading the library and migrating to its new API.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the league/flysystem dependency from the abandoned v1 (end-of-life since 2022) to the current v3 version. The migration involves updating the code to use Flysystem v3's API changes, including the new LocalFilesystemAdapter class and FilesystemException for error handling. The phpdocumentor/guides upstream dependency (v1.9.5) already supports Flysystem v3, enabling this upgrade.

Changes:

  • Updated league/flysystem constraint from ^1.1.10 to ^3.29 with corresponding composer.lock updates
  • Migrated from deprecated League\Flysystem\Adapter\Local to League\Flysystem\Local\LocalFilesystemAdapter
  • Updated exception handling from League\Flysystem\Exception to League\Flysystem\FilesystemException
  • Removed obsolete @throws \League\Flysystem\FileNotFoundException docblock annotations
  • Updated integration test expectations to match Flysystem v3 error message format
  • Added PHP 8.5 to CI test matrix

Reviewed changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
composer.json Updated flysystem constraint to ^3.29
composer.lock Flysystem v3.31.0 and transitive dependency updates (doctrine/deprecations, league/tactician, league/uri, masterminds/html5, phpdocumentor/flyfinder 2.0.0, phpdocumentor/guides 1.9.5, symfony packages, twig 3.23.0, webmozart/assert)
packages/typo3-docs-theme/src/EventListeners/CopyResources.php Migrated to LocalFilesystemAdapter, removed false-check error handling (v3 throws exceptions)
packages/typo3-docs-theme/src/Twig/TwigExtension.php Updated exception import to FilesystemException
packages/typo3-docs-theme/src/Directives/IncludeDirective.php Removed obsolete FileNotFoundException docblock annotations
packages/typo3-docs-theme/src/Directives/SiteSetSettingsDirective.php Removed obsolete FileNotFoundException docblock annotation
tests/Integration/tests/site-set-failure/expected/logs/*.log Updated expected error message from "Path is outside of the defined root" to "Path traversal detected" with new log format
.github/workflows/main.yaml Added PHP 8.5 to CI matrix
Comments suppressed due to low confidence (1)

packages/typo3-docs-theme/src/EventListeners/CopyResources.php:56

  • In Flysystem v3, the readStream() and putStream() methods throw FilesystemException instead of returning false on errors. The removed error handling for false returns should be replaced with try-catch block to handle potential exceptions. Without this, exceptions from file operations will propagate uncaught, potentially causing the entire resource copying process to fail on a single problematic file.

Consider wrapping the file operations in a try-catch block similar to the pattern used in TwigExtension.php (line 620), logging errors and continuing with the next file rather than halting the entire process.

        foreach ($finder as $file) {
            $stream = $source->readStream($file->getRelativePathname());

            $destinationPath = sprintf(
                '%s/%s%s',
                self::DESTINATION_PATH,
                $file->getRelativePath() !== '' ? $file->getRelativePath() . '/' : '',
                $file->getFilename()
            );
            $destination->putStream($destinationPath, $stream);
            is_resource($stream) && fclose($stream);
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CybotTM CybotTM closed this Feb 22, 2026
@CybotTM CybotTM reopened this Feb 22, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 8 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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