|
34 | 34 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
35 | 35 | use Symfony\Component\DependencyInjection\ContainerBuilder;
|
36 | 36 | use Symfony\Component\ErrorHandler\ErrorRenderer\ErrorRendererInterface;
|
| 37 | +use Symfony\Component\HttpClient\Messenger\PingWebhookMessageHandler; |
37 | 38 | use Symfony\Component\HttpFoundation\Session\SessionFactory;
|
38 | 39 | use Symfony\Component\HttpKernel\Kernel;
|
39 | 40 | use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher;
|
@@ -112,21 +113,45 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
|
112 | 113 | ],
|
113 | 114 | ];
|
114 | 115 |
|
115 |
| - $c->prependExtensionConfig('framework', [ |
116 |
| - 'secret' => 'dunglas.fr', |
117 |
| - 'validation' => ['enable_annotations' => true], |
118 |
| - 'serializer' => ['enable_annotations' => true], |
119 |
| - 'test' => null, |
120 |
| - 'session' => class_exists(SessionFactory::class) ? ['storage_factory_id' => 'session.storage.factory.mock_file'] : ['storage_id' => 'session.storage.mock_file'], |
121 |
| - 'profiler' => [ |
122 |
| - 'enabled' => true, |
123 |
| - 'collect' => false, |
124 |
| - ], |
125 |
| - 'messenger' => $messengerConfig, |
126 |
| - 'router' => ['utf8' => true], |
127 |
| - 'http_method_override' => false, |
128 |
| - 'annotations' => false, |
129 |
| - ]); |
| 116 | + // This class is introduced in Symfony 6.4 just using it to use the new configuration and to avoid unnecessary deprecations |
| 117 | + if (class_exists(PingWebhookMessageHandler::class)) { |
| 118 | + $config = [ |
| 119 | + 'secret' => 'dunglas.fr', |
| 120 | + 'validation' => ['enable_attributes' => true, 'email_validation_mode' => 'html5'], |
| 121 | + 'serializer' => ['enable_attributes' => true], |
| 122 | + 'test' => null, |
| 123 | + 'session' => ['cookie_secure' => true, 'cookie_samesite' => 'lax', 'handler_id' => 'session.handler.native_file'], |
| 124 | + 'profiler' => [ |
| 125 | + 'enabled' => true, |
| 126 | + 'collect' => false, |
| 127 | + ], |
| 128 | + 'php_errors' => ['log' => true], |
| 129 | + 'messenger' => $messengerConfig, |
| 130 | + 'router' => ['utf8' => true], |
| 131 | + 'http_method_override' => false, |
| 132 | + 'annotations' => false, |
| 133 | + 'handle_all_throwables' => true, |
| 134 | + 'uid' => ['default_uuid_version' => 7, 'time_based_uuid_version' => 7], |
| 135 | + ]; |
| 136 | + } else { |
| 137 | + $config = [ |
| 138 | + 'secret' => 'dunglas.fr', |
| 139 | + 'validation' => ['enable_annotations' => true], |
| 140 | + 'serializer' => ['enable_annotations' => true], |
| 141 | + 'test' => null, |
| 142 | + 'session' => class_exists(SessionFactory::class) ? ['storage_factory_id' => 'session.storage.factory.mock_file'] : ['storage_id' => 'session.storage.mock_file'], |
| 143 | + 'profiler' => [ |
| 144 | + 'enabled' => true, |
| 145 | + 'collect' => false, |
| 146 | + ], |
| 147 | + 'messenger' => $messengerConfig, |
| 148 | + 'router' => ['utf8' => true], |
| 149 | + 'http_method_override' => false, |
| 150 | + 'annotations' => false, |
| 151 | + ]; |
| 152 | + } |
| 153 | + |
| 154 | + $c->prependExtensionConfig('framework', $config); |
130 | 155 |
|
131 | 156 | $alg = class_exists(NativePasswordHasher::class, false) || class_exists('Symfony\Component\Security\Core\Encoder\NativePasswordEncoder') ? 'auto' : 'bcrypt';
|
132 | 157 | $securityConfig = [
|
|
0 commit comments