Add Symfony 8.0 support#88
Merged
karser merged 6 commits intokarser:masterfrom Dec 8, 2025
Sven-Ve:symfony-8-support
Merged
Conversation
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
Owner
|
thanks for the PR @Sven-Ve |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit updates the bundle to support modern Symfony versions while maintaining backward compatibility with Symfony 6.4+.
Changes:
Breaking Changes:
Testing: