Skip to content

[TwigBundle] bump the required Twig bridge version #60304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 7.3
Choose a base branch
from

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Apr 30, 2025

Q A
Branch? 7.3
Bug fix? yes
New feature? no
Deprecations? no
Issues
License MIT

@@ -70,7 +70,7 @@ public function load(array $configs, ContainerBuilder $container): void
$container->removeDefinition('twig.translation.extractor');
}

if ($container::willBeAvailable('symfony/validator', Constraint::class, ['symfony/twig-bundle'])) {
if ($container::willBeAvailable('symfony/twig-bridge', TwigValidator::class, ['symfony/twig-bundle'])) {
Copy link
Member

@GromNaN GromNaN Apr 30, 2025

Choose a reason for hiding this comment

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

willBeAvailable indicates whether a package is installed or not. Here the twig-bridge package is always installed, but TwigValidator is only available in version 7.3.

Maybe add both conditions:

Suggested change
if ($container::willBeAvailable('symfony/twig-bridge', TwigValidator::class, ['symfony/twig-bundle'])) {
if (class_exists(TwigValidator::class) && $container::willBeAvailable('symfony/validator', Constraint::class, ['symfony/twig-bundle'])) {

Copy link
Member

Choose a reason for hiding this comment

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

But it's more direct to require symfony/twig-bridge: ^7.3 in symfony/twig-bundle

Copy link
Member Author

Choose a reason for hiding this comment

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

But it's more direct to require symfony/twig-bridge: ^7.3 in symfony/twig-bundle

good point, let's do that instead

@xabbuh xabbuh changed the title [TwigBundle] don't register the Twig validator with symfony/twig-bridge < 7.3 [TwigBundle] bump the required Twig bridge version Apr 30, 2025
@xabbuh xabbuh requested a review from yceruto April 30, 2025 11:53
@GromNaN GromNaN added the ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" label Apr 30, 2025
@@ -43,6 +43,7 @@ public function registerBundles(): iterable
public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load(static function (ContainerBuilder $container) {
$container->setParameter('kernel.secret', 'secret');
Copy link
Member Author

Choose a reason for hiding this comment

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

The lowest installed Twig version that is now installed is 3.21. This means that this test is not skipped anymore, but since FrameworkBundle 6.4 is installed we also need the kernel.secret parameter to be set as the uri_signer is not lazy (this was changed with #59086 in Symfony 7.2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" Status: Reviewed TwigBundle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants