Skip to content

Add support of Doctrine DBAL 4 and Symfony 8 - #7

Merged
alxvgt merged 1 commit into
Youtrust:mainfrom
alxvgt:support-dbal-4-and-symfony-8
Aug 11, 2026
Merged

alxvgt merged 1 commit into
Youtrust:mainfrom
alxvgt:support-dbal-4-and-symfony-8

Conversation

@alxvgt

@alxvgt alxvgt commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Why

The package cannot currently be installed next to doctrine/doctrine-bundle 3.x, which requires DBAL 4, nor on a Symfony 8 application:

Required Blocked by
doctrine/dbal ^3.7 doctrine-bundle 3.x pulls DBAL 4
symfony/string ^6.4 || ^7.0 Symfony 8

We hit this on a new internal service that starts on PHP 8.5 / Symfony 8.1, where safe-migrations is the migration base class we want from day one.

What changed

No source change was needed for DBAL 4. AbstractDriverMiddleware, AbstractConnectionMiddleware, Driver::connect(), Connection::query(), getNativeConnection() and DriverException::getSQLState() all kept their signatures. Only the constraints were in the way.

  • doctrine/dbal → ^3.7 || ^4.0
  • symfony/string → ^6.4 || ^7.0 || ^8.0
  • doctrine/migrations → ^3.6, the first release that accepts DBAL 4, still allowing DBAL 3
  • PHPStan → ^2.1. It drops the checkMissingIterableValueType option, so the two array parameters that option was hiding are documented instead — same @param mixed[] as AbstractMigration::addSql() upstream.
  • PHPUnit → ^10.4.2 || ^11.0, so the suite runs on recent PHP. Capped at 11 on purpose: PHPUnit 12 removes the @before / @after annotations used in MigrationTest, and converting those belongs in its own pull request.
  • One trailing comma in RetryLockTimeoutDriver, which a current php-cs-fixer wants. Included only so make php-cs-fixer-check stays green on this branch.

CI

The matrix gains PHP 8.3, 8.4 and 8.5. Symfony 8 requires PHP 8.4, so without those rows the new support would never actually be exercised. The existing --prefer-lowest row keeps DBAL 3 covered, and every other row now resolves to DBAL 4 — so both majors are tested.

Static analysis moves from PHP 8.2 to 8.4 for the same reason.

Verified locally

On PHP 8.5.9 with DBAL 4.4.4, doctrine/migrations 3.9.7 and symfony/string 8.1.2, the four steps of make tests:

  • composer validate --strict — valid
  • vendor/bin/phpstan analyse (level 9) — no errors
  • vendor/bin/php-cs-fixer fix --dry-run — no changes
  • vendor/bin/phpunit — 26 tests, 30 assertions, all passing

🤖 Generated with Claude Code

The package could not be installed alongside doctrine/doctrine-bundle 3.x,
which requires DBAL 4, nor on a Symfony 8 application.

No source change was needed for DBAL 4: AbstractDriverMiddleware,
AbstractConnectionMiddleware, Driver::connect(), Connection::query(),
getNativeConnection() and DriverException::getSQLState() all kept their
signatures. Only the constraints were in the way.

doctrine/migrations moves to ^3.6, the first release that accepts DBAL 4,
while still allowing DBAL 3.

PHPStan goes to 2.x, which drops the checkMissingIterableValueType option;
the two array parameters it was hiding are now documented instead.

The CI matrix gains PHP 8.3, 8.4 and 8.5. Symfony 8 needs PHP 8.4, so
without those rows the new support would never be exercised. The existing
--prefer-lowest row keeps DBAL 3 covered.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@alxvgt
alxvgt requested review from B-Galati and ndousson August 11, 2026 07:56
@ndousson

Copy link
Copy Markdown
Collaborator

Thanks @alxvgt for your contribution 🫶

Everything LGTM 👌🏻

I let @B-Galati review it too but for me it's mergeable and releaseable.

@benconda

benconda commented Aug 11, 2026 •

Copy link
Copy Markdown

LGTM too, let's wait @B-Galati review.

Note: Could be great to drop support for old Symfony and PHP version (not in this PR, but as a potential clean up task), don't know what you think about BG :)

@B-Galati

Copy link
Copy Markdown
Collaborator

Hi guys! thanks for the ping.

Fully agree with you:

  • We should drop support for old Symfony version. starting with 7.4+
  • We should drop support for old PHP version starting with 8.4+

Let's do it later 👍

@B-Galati B-Galati left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looking good 👍 Tests are passing and they use the DBAL connection directly so I don't see any reason it would not work with a real project.

thanks @alxvgt!

@alxvgt
alxvgt merged commit 8311f9d into Youtrust:main Aug 11, 2026
7 checks passed
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.

4 participants