Skip to content

Conversation

@Sven-Ve
Copy link
Contributor

@Sven-Ve Sven-Ve commented Dec 6, 2025

This commit updates the bundle to support modern Symfony versions while maintaining backward compatibility with Symfony 6.4+.

Changes:

  • Updated composer.json to require Symfony ^6.4|^7.0|^8.0
  • Removed deprecated TreeBuilder BC layer for old Symfony versions
  • Fixed strict type comparisons (== to ===, != to !==)
  • Added return type declarations for Symfony 8 compatibility
  • Updated Recaptcha3 constraint to handle both array-based and named-parameter instantiation (Symfony 6.4+ requirement)
  • Added PHPStan as dev dependency with strict rules
  • Updated PHPUnit to support versions 9-11
  • Added UPGRADE.md with migration guide
  • Updated README.md with version compatibility table

Breaking Changes:

  • Minimum Symfony version is now 6.4
  • Symfony 3.x, 4.x, and 5.x are no longer supported
  • Users on older Symfony versions should use bundle version 0.2.x

Testing:

  • All tests pass with Symfony 6.4, 7.x, and 8.0
  • PHPStan analysis passes without errors (level 5 with strict rules)

Sven-Ve and others added 3 commits December 6, 2025 14:16
This commit updates the bundle to support modern Symfony versions while
maintaining backward compatibility with Symfony 6.4+.

Changes:
- Updated composer.json to require Symfony ^6.4|^7.0|^8.0
- Removed deprecated TreeBuilder BC layer for old Symfony versions
- Fixed strict type comparisons (== to ===, != to !==)
- Added return type declarations for Symfony 8 compatibility
- Updated Recaptcha3 constraint to handle both array-based and
  named-parameter instantiation (Symfony 6.4+ requirement)
- Added PHPStan as dev dependency with strict rules
- Updated PHPUnit to support versions 9-11
- Added UPGRADE.md with migration guide
- Updated README.md with version compatibility table

Breaking Changes:
- Minimum Symfony version is now 6.4
- Symfony 3.x, 4.x, and 5.x are no longer supported
- Users on older Symfony versions should use bundle version 0.2.x

Testing:
- All tests pass with Symfony 6.4, 7.x, and 8.0
- PHPStan analysis passes without errors (level 5 with strict rules)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The 8 PHPUnit deprecation warnings are related to DocBlock annotations
that should be replaced with PHP 8 Attributes. Since we still support
PHP 7.4, we cannot use Attributes yet. These warnings are not critical
and will only become errors in PHPUnit 12.

Updated UPGRADE.md to explain the situation and provide workarounds.
In Symfony 7.4+, constraint properties should be initialized directly
in the constructor and parent::__construct() must be called with null
as the first argument to avoid the legacy option processing system.

Changes:
- Extract all parameters (message, messageMissingValue, groups, payload)
  from the options array for backward compatibility
- Set custom properties directly before calling parent
- Pass null as first argument to parent::__construct() instead of
  the options array or empty array
- This prevents the deprecation warning in Symfony 7.4+

The solution maintains full backward compatibility with Symfony 6.4+
by still supporting the old array-based initialization while using
the new initialization pattern internally.

References:
- https://symfony.com/blog/preparing-for-symfony-7-4-and-symfony-8-0
- https://github.com/symfony/symfony/blob/7.4/src/Symfony/Component/Validator/Constraint.php
@karser karser force-pushed the symfony-8-support branch 4 times, most recently from 2ec09bf to e718097 Compare December 8, 2025 10:57
@karser karser force-pushed the symfony-8-support branch from e718097 to d519333 Compare December 8, 2025 11:14
@karser karser changed the title Add Symfony 6.4, 7.x, and 8.0 support Add Symfony 8.0 support Dec 8, 2025
@karser karser force-pushed the symfony-8-support branch from f929611 to d0b9a98 Compare December 8, 2025 11:22
@karser
Copy link
Owner

karser commented Dec 8, 2025

thanks for the PR @Sven-Ve

@karser karser merged commit 3d194da into karser:master Dec 8, 2025
10 checks passed
@Sven-Ve Sven-Ve deleted the symfony-8-support branch December 8, 2025 15:26
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.

2 participants