Skip to content

DEV-3165 Add Symfony 7 support#341

Open
kiloumap wants to merge 5 commits into
masterfrom
DEV-3165-symfony-7-compat
Open

DEV-3165 Add Symfony 7 support#341
kiloumap wants to merge 5 commits into
masterfrom
DEV-3165-symfony-7-compat

Conversation

@kiloumap

Copy link
Copy Markdown
Collaborator

What

Makes the draw/* packages compatible with Symfony 7 (alongside 6.4) so downstream apps (pnp-api) can complete the Symfony 7.4 LTS upgrade. Implements DEV-3165 (unblocks pnp-api DEV-3995), story DEV-4044.

Changes

Dependency constraints

  • All 27 packages + root + monorepo-builder.php: symfony/* ^6.4.0^6.4 || ^7.0.
  • symfony/flex ^1.16^2.10 — SF 7.4 http-kernel declares a conflict with flex <2.10.
  • sonata-project/form-extensions ^1.13^2.0 — 1.x pins event-dispatcher ^4.4||^5.4||^6.2 (caps Symfony at 6.x); 2.x supports SF 6.4 and 7. This was the actual blocker preventing the whole tree from resolving on 7.x.
  • Resolves cleanly on Symfony 7.4.13 (sonata-admin auto-bumps to 4.43.0).

Code fixes (SF7 removals)

  • JWTLoginTrait::loginUser() — added the array $tokenAttributes = [] parameter to match SF7's KernelBrowser::loginUser() signature. Optional param ⇒ still compatible with 6.4.
  • OpenApi::validate()ValidatorBuilder::enableAnnotationMapping() (removed in SF7) → enableAttributeMapping() (available since 6.4).

Test fixtures / static analysis

  • Regenerated AppKernelTest event-dispatcher & message-handler snapshots — SF7 legitimately adds ResetMemoryUsageListener, IsCsrfTokenValidAttributeListener, messenger message signing (sign=1), and the Notifier DesktopMessage handler.
  • Regenerated GenerateDocumentationCommandTest fixture — SF7 Console adds the --silent global option.
  • ⚠️ phpstan-baseline.neon regenerated on SF7 (grew 47→268 lines / 66 baselined errors). The additions are predominantly phpstan-symfony Config-generics noise and non-empty-string getUserIdentifier() tightenings in test code — worth a skim, but no runtime impact.
  • .gitignore: flex-2 auto-generated config/reference.php.

Testing

  • Full suite green on Symfony 7.4.13: 1431 tests, 4038 assertions, 0 failures, 0 errors (PHP 8.5).
  • php-cs-fixer clean on changed files; phpstan green (with regenerated baseline).
  • 7 remaining deprecations are pre-existing PHP 8.5 notices (fgetcsv() $escape, ReflectionProperty::setValue() single-arg) unrelated to the Symfony bump — left out of scope.

Notes

Constraints keep ^6.4 for a transition window, but the lock now resolves to 7.4 (composer picks highest), so CI runs on 7.4.

Laurent Martinez added 3 commits June 17, 2026 16:28
- All 27 packages + root + monorepo-builder.php: symfony/* ^6.4.0 -> ^6.4 || ^7.0
- symfony/flex ^1.16 -> ^2.10 (SF7.4 http-kernel conflicts flex <2.10)
- sonata-project/form-extensions ^1.13 -> ^2.0 (1.x caps event-dispatcher at
  ^6.2, blocking SF7; 2.x supports SF6.4+7)
- Resolves cleanly on Symfony 7.4.13 (sonata-admin auto-bumps to 4.43.0)

Refs DEV-4044.
- JWTLoginTrait::loginUser(): add $tokenAttributes param to match SF7
  KernelBrowser::loginUser() signature (optional param, compatible with 6.4)
- OpenApi::validate(): enableAnnotationMapping() -> enableAttributeMapping()
  (removed in SF7; enableAttributeMapping exists since 6.4)

Refs DEV-4044.
- AppKernelTest event_dispatcher/message_handler snapshots: SF7 adds
  ResetMemoryUsageListener, IsCsrfTokenValidAttributeListener, messenger
  message signing (sign=1), Notifier DesktopMessage handler
- GenerateDocumentationCommandTest: SF7 Console adds --silent global option
- phpstan-baseline regenerated on SF7 (47->268 lines; mostly phpstan-symfony
  Config-generics noise + non-empty-string getUserIdentifier tightening)
- gitignore flex-2 auto-generated config/reference.php

Refs DEV-4044.
@kiloumap kiloumap marked this pull request as draft June 18, 2026 14:01
@kiloumap kiloumap marked this pull request as ready for review June 19, 2026 13:45
Laurent Martinez added 2 commits June 19, 2026 09:51
- Declare symfony/var-exporter in console/application/sonata-import-bundle/
  sonata-extra-bundle: Doctrine ORM 3 lazy proxies (LazyGhost) need it when
  the package is tested in isolation (After Split Testing); the monorepo had
  it transitively so the full suite passed.
- Apply php-cs-fixer no_whitespace_in_empty_array (newer php-cs-fixer pulled
  by the SF7 resolution) to 4 pre-existing test files.

Refs DEV-4044.
… from cs-fixer

- AbstainRoleHierarchyVoter, CanShowMessageVoter, DefaultCanVoter,
  PreventDeleteVoter: add ?Vote $vote = null to vote() to match SF7.3+
  VoterInterface::vote() (the new 4th arg); pass through to parent in
  AbstainRoleHierarchyVoter. Fatal 'must be compatible' surfaced in the
  isolated After-Split test for sonata-extra-bundle.
- php-cs-fixer: notPath the flex-generated config/reference.php.

Refs DEV-4044.
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