File: UPGRADE-7.0.md

package info (click to toggle)
symfony 7.3.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 129,560 kB
  • sloc: php: 1,503,693; xml: 6,816; javascript: 1,043; sh: 586; makefile: 241; pascal: 70
file content (629 lines) | stat: -rw-r--r-- 25,078 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
UPGRADE FROM 6.4 to 7.0
=======================

Symfony 6.4 and Symfony 7.0 are released simultaneously at the end of November 2023. According to the Symfony
release process, both versions have the same features, but Symfony 7.0 doesn't include any deprecated features.
To upgrade, make sure to resolve all deprecation notices.
Read more about this in the [Symfony documentation](https://symfony.com/doc/7.0/setup/upgrade_major.html).

Symfony 7.0 introduced many native return and property types. Read [the announcement blogpost](https://symfony.com/blog/symfony-7-0-type-declarations)
on how to quickly make your code compatible.

Table of Contents
-----------------

Bundles
 * [FrameworkBundle](#FrameworkBundle)
 * [SecurityBundle](#SecurityBundle)
 * [TwigBundle](#TwigBundle)

Bridges
 * [DoctrineBridge](#DoctrineBridge)
 * [MonologBridge](#MonologBridge)
 * [ProxyManagerBridge](#ProxyManagerBridge)

Components
 * [Cache](#Cache)
 * [Config](#Config)
 * [Console](#Console)
 * [DependencyInjection](#DependencyInjection)
 * [DomCrawler](#DomCrawler)
 * [ExpressionLanguage](#ExpressionLanguage)
 * [Filesystem](#Filesystem)
 * [Form](#Form)
 * [HttpFoundation](#HttpFoundation)
 * [HttpClient](#HttpClient)
 * [HttpKernel](#HttpKernel)
 * [Lock](#Lock)
 * [Mailer](#Mailer)
 * [Messenger](#Messenger)
 * [Mime](#Mime)
 * [PropertyAccess](#PropertyAccess)
 * [Routing](#Routing)
 * [Security](#Security)
 * [Serializer](#Serializer)
 * [Templating](#Templating)
 * [Translation](#Translation)
 * [Validator](#Validator)
 * [VarDumper](#VarDumper)
 * [VarExporter](#VarExporter)
 * [Workflow](#Workflow)
 * [Yaml](#Yaml)

Cache
-----

 * Add parameter `\Closure $isSameDatabase` to `DoctrineDbalAdapter::configureSchema()`
 * Drop support for Postgres < 9.5 and SQL Server < 2008 in `DoctrineDbalAdapter`

Config
------

 * Require explicit argument when calling `NodeBuilder::setParent()`

Console
-------

 * Remove `Command::$defaultName` and `Command::$defaultDescription`, use the `AsCommand` attribute instead

   *Before*
   ```php
   use Symfony\Component\Console\Command\Command;

   class CreateUserCommand extends Command
   {
       protected static $defaultName = 'app:create-user';
       protected static $defaultDescription = 'Creates users';

       // ...
   }
   ```

   *After*
   ```php
   use Symfony\Component\Console\Attribute\AsCommand;
   use Symfony\Component\Console\Command\Command;

   #[AsCommand(name: 'app:create-user', description: 'Creates users')]
   class CreateUserCommand extends Command
   {
       // ...
   }
   ```

 * Require explicit argument when calling `*Command::setApplication()`, `*FormatterStyle::setForeground/setBackground()`, `Helper::setHelpSet()`, `Input*::setDefault()` and `Question::setAutocompleterCallback/setValidator()`
 * Remove `StringInput::REGEX_STRING`, use `StringInput::REGEX_UNQUOTED_STRING` or `StringInput::REGEX_QUOTED_STRING` instead
 * Add method `__toString()` to `InputInterface`

DependencyInjection
-------------------

 * Rename `#[MapDecorated]` to `#[AutowireDecorated]`
 * Remove `ProxyHelper`, use `Symfony\Component\VarExporter\ProxyHelper` instead
 * Remove `ReferenceSetArgumentTrait`
 * Remove support of `@required` annotation, use the `Symfony\Contracts\Service\Attribute\Required` attribute instead
 * Require explicit argument when calling `ContainerAwareTrait::setContainer()`
 * Remove `PhpDumper` options `inline_factories_parameter` and `inline_class_loader_parameter`, use options `inline_factories` and `inline_class_loader` with the direct boolean value instead
 * Parameter names of `ParameterBag` cannot be numerics
 * Remove `ContainerAwareInterface` and `ContainerAwareTrait`, use dependency injection instead

   *Before*
   ```php
   class MailingListService implements ContainerAwareInterface
   {
       use ContainerAwareTrait;

       public function sendMails()
       {
           $mailer = $this->container->get('mailer');

           // ...
       }
   }
   ```

   *After*
   ```php
   use Symfony\Component\Mailer\MailerInterface;

   class MailingListService
   {
       public function __construct(
           private MailerInterface $mailer,
       ) {
       }

       public function sendMails()
       {
           $mailer = $this->mailer;

           // ...
       }
   }
   ```

   To fetch services lazily, you can use a [service subscriber](https://symfony.com/doc/6.4/service_container/service_subscribers_locators.html#defining-a-service-subscriber).
 * Add parameter `string $id = null` and `bool &$asGhostObject = null` to `LazyProxy\PhpDumper\DumperInterface::isProxyCandidate()` and `getProxyCode()`
 * Add parameter `string $source = null` to `FileLoader::registerClasses()`

DoctrineBridge
--------------

 * Remove `DoctrineDbalCacheAdapterSchemaSubscriber`, use `DoctrineDbalCacheAdapterSchemaListener` instead
 * Remove `MessengerTransportDoctrineSchemaSubscriber`, use `MessengerTransportDoctrineSchemaListener` instead
 * Remove `RememberMeTokenProviderDoctrineSchemaSubscriber`, use `RememberMeTokenProviderDoctrineSchemaListener` instead
 * Remove `DbalLogger`, use a middleware instead
 * Remove `DoctrineDataCollector::addLogger()`, use a `DebugDataHolder` instead
 * Remove `ContainerAwareLoader`, use dependency injection in your fixtures instead
 * `ContainerAwareEventManager::getListeners()` must be called with an event name
 * DoctrineBridge now requires `doctrine/event-manager:^2`
 * Add parameter `\Closure $isSameDatabase` to `DoctrineTokenProvider::configureSchema()`
 * Remove support for Doctrine subscribers in `ContainerAwareEventManager`, use listeners instead

   *Before*
   ```php
   use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
   use Doctrine\ORM\Event\PostFlushEventArgs;
   use Doctrine\ORM\Events;

   class InvalidateCacheSubscriber implements EventSubscriberInterface
   {
        public function getSubscribedEvents(): array
        {
            return [Events::postFlush];
        }

        public function postFlush(PostFlushEventArgs $args): void
        {
            // ...
        }
   }
   ```

   *After*
   ```php
   use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener;
   use Doctrine\ORM\Event\PostFlushEventArgs;
   use Doctrine\ORM\Events;

   // Instead of PHP attributes, you can also tag this service with "doctrine.event_listener"
   #[AsDoctrineListener(event: Events::postFlush)]
   class InvalidateCacheSubscriber
   {
        public function postFlush(PostFlushEventArgs $args): void
        {
            // ...
        }
   }
   ```

DomCrawler
----------

 * Add parameter `bool $normalizeWhitespace = true` to `Crawler::innerText()`
 * Add parameter `string $default = null` to `Crawler::attr()`

ExpressionLanguage
------------------

 * The `in` and `not in` operators now use strict comparison

Filesystem
----------

 * Add parameter `bool $lock = false` to `Filesystem::appendToFile()`

Form
----

 * Throw when using `DateTime` or `DateTimeImmutable` model data with a different timezone than configured with the `model_timezone` option in `DateType`, `DateTimeType`, and `TimeType`
 * Make the "widget" option of date/time form types default to "single_text"
 * Require explicit argument when calling `Button/Form::setParent()`, `ButtonBuilder/FormConfigBuilder::setDataMapper()`, `TransformationFailedException::setInvalidMessage()`
 * `PostSetDataEvent::setData()` throws an exception, use `PreSetDataEvent::setData()` instead
 * `PostSubmitEvent::setData()` throws an exception, use `PreSubmitDataEvent::setData()` or `SubmitDataEvent::setData()` instead
 * Add `$duplicatePreferredChoices` parameter to `ChoiceListFactoryInterface::createView()`

FrameworkBundle
---------------

 * Renamed command `translation:update` to `translation:extract`
 * Remove the `Symfony\Component\Serializer\Normalizer\ObjectNormalizer` and
   `Symfony\Component\Serializer\Normalizer\PropertyNormalizer` autowiring aliases, type-hint against
   `Symfony\Component\Serializer\Normalizer\NormalizerInterface` or implement `NormalizerAwareInterface` instead
 * Remove the `Http\Client\HttpClient` service, use `Psr\Http\Client\ClientInterface` instead
 * Remove `AbstractController::renderForm()`, pass the `FormInterface` as parameter to `render()`

   *Before*
   ```php
   $this->renderForm(..., ['form' => $form]);
   ```

   *After*
   ```php
   $this->render(..., ['form' => $form]);
   ```

 * Remove the integration of the Doctrine annotations library, use native attributes instead
 * Remove `EnableLoggerDebugModePass`, use argument `$debug` of HttpKernel's `Logger` instead
 * Remove `AddDebugLogProcessorPass::configureLogger()`, use HttpKernel's `DebugLoggerConfigurator` instead
 * Add `array $tokenAttributes = []` optional parameter to `KernelBrowser::loginUser()`
 * Change default of some config options:

   | option                                       | default Symfony <7.0       | default in Symfony 7.0+                                                     |
   |----------------------------------------------|----------------------------|-----------------------------------------------------------------------------|
   | `framework.http_method_override`             | `true`                     | `false`                                                                     |
   | `framework.handle_all_throwables`            | `false`                    | `true`                                                                      |
   | `framework.php_errors.log`                   | `'%kernel.debug%'`         | `true`                                                                      |
   | `framework.session.cookie_secure`            | `false`                    | `auto`                                                                      |
   | `framework.session.cookie_samesite`          | `null`                     | `'lax'`                                                                     |
   | `framework.session.handler_id`               | `'session.handler.native'` | `null` if `save_path` is not set, `'session.handler.native_file'` otherwise |
   | `framework.uid.default_uuid_version`         | `6`                        | `7`                                                                         |
   | `framework.uid.time_based_uuid_version`      | `6`                        | `7`                                                                         |
   | `framework.validation.email_validation_mode` | `'loose'`                  | `'html5'`                                                                   |
 * Remove the `framework.validation.enable_annotations` config option, use `framework.validation.enable_attributes` instead
 * Remove the `framework.serializer.enable_annotations` config option, use `framework.serializer.enable_attributes` instead
 * Remove the `routing.loader.annotation` service, use the `routing.loader.attribute` service instead
 * Remove the `routing.loader.annotation.directory` service, use the `routing.loader.attribute.directory` service instead
 * Remove the `routing.loader.annotation.file` service, use the `routing.loader.attribute.file` service instead
 * Remove `AnnotatedRouteControllerLoader`, use `AttributeRouteControllerLoader` instead
 * Remove `AddExpressionLanguageProvidersPass`, use `Symfony\Component\Routing\DependencyInjection\AddExpressionLanguageProvidersPass` instead
 * Remove `DataCollectorTranslatorPass`, use `Symfony\Component\Translation\DependencyInjection\DataCollectorTranslatorPass` instead
 * Remove `LoggingTranslatorPass`, use `Symfony\Component\Translation\DependencyInjection\LoggingTranslatorPass` instead
 * Remove `WorkflowGuardListenerPass`, use `Symfony\Component\Workflow\DependencyInjection\WorkflowGuardListenerPass` instead

HttpFoundation
--------------

 * Calling `ParameterBag::filter()` on an invalid value throws an `UnexpectedValueException` instead of returning `false`.
   The exception is more specific for `InputBag` which throws a `BadRequestException` when invalid value is found.
   The flag `FILTER_NULL_ON_FAILURE` can be used to return `null` instead of throwing an exception.
 * The methods `ParameterBag::getInt()` and `ParameterBag::getBool()` no longer fallback to `0` or `false`
   when the value cannot be converted to the expected type. They throw a `UnexpectedValueException` instead.
 * Remove `RequestMatcher`, use `ChainRequestMatcher` instead
 * Remove `ExpressionRequestMatcher`, use `RequestMatcher\ExpressionRequestMatcher` instead
 * Rename `Request::getContentType()` to `Request::getContentTypeFormat()`
 * Throw an `InvalidArgumentException` when calling `Request::create()` with a malformed URI
 * Require explicit argument when calling `JsonResponse::setCallback()`, `Response::setExpires/setLastModified/setEtag()`, `MockArraySessionStorage/NativeSessionStorage::setMetadataBag()`, `NativeSessionStorage::setSaveHandler()`
 * Add parameter `int $statusCode = null` to `Response::sendHeaders()` and `StreamedResponse::sendHeaders()`

HttpClient
----------

 * Remove implementing `Http\Message\RequestFactory` from `HttplugClient`

HttpKernel
----------

 * Add parameter `\ReflectionFunctionAbstract $reflector = null` to `ArgumentResolverInterface::getArguments()` and `ArgumentMetadataFactoryInterface::createArgumentMetadata()`
 * Add argument `$buildDir` to `WarmableInterface`
 * Remove `ArgumentValueResolverInterface`, use `ValueResolverInterface` instead
 * Remove `StreamedResponseListener`
 * Remove `AbstractSurrogate::$phpEscapeMap`
 * Rename `HttpKernelInterface::MASTER_REQUEST` to `HttpKernelInterface::MAIN_REQUEST`
 * Remove `terminate_on_cache_hit` option from `HttpCache`, it will now always act as `false`
 * Require explicit argument when calling `ConfigDataCollector::setKernel()`, `RouterListener::setCurrentRequest()`
 * Remove `FileLinkFormatter`, use `FileLinkFormatter` from the ErrorHandler component instead
 * Remove `UriSigner`, use `UriSigner` from the HttpFoundation component instead
 * Remove `Kernel::stripComments()`
 * Add argument `$filter` to `Profiler::find()` and `FileProfilerStorage::find()`

Lock
----

 * Add parameter `\Closure $isSameDatabase` to `DoctrineDbalStore::configureSchema()`
 * Rename `gcProbablity` (notice the typo) option to `gcProbability` in the `MongoDbStore`

Mailer
------

 * Remove the OhMySmtp bridge in favor of the MailPace bridge

Messenger
---------

 * Add parameter `\Closure $isSameDatabase` to `DoctrineTransport::configureSchema()`
 * Remove `MessageHandlerInterface` and `MessageSubscriberInterface`, use `#[AsMessageHandler]` instead

   *Before*
   ```php
   use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
   use Symfony\Component\Messenger\Handler\MessageSubscriberInterface;

   class SmsNotificationHandler implements MessageHandlerInterface
   {
       public function __invoke(SmsNotification $message): void
       {
           // ...
       }
   }

   class UploadedImageHandler implements MessageSubscriberInterface
   {
       public static function getHandledMessages(): iterable
       {
           yield ThumbnailUploadedImage::class => ['method' => 'handleThumbnail'];
           yield ProfilePictureUploadedImage::class => ['method' => 'handleProfilePicture'];
       }

       // ...
   }
   ```

   *After*
   ```php
   use Symfony\Component\Messenger\Attribute\AsMessageHandler;

   #[AsMessageHandler]
   class SmsNotificationHandler
   {
       public function __invoke(SmsNotification $message): void
       {
           // ...
       }
   }

   class UploadedImageHandler
   {
       #[AsMessageHandler]
       public function handleThumbnail(ThumbnailUploadedImage $message): void
       {
           // ...
       }

       #[AsMessageHandler]
       public function handleThumbnail(ProfilePictureUploadedImage $message): void
       {
           // ...
       }
   }
   ```
 * Remove `StopWorkerOnSigtermSignalListener` in favor of using the `SignalableCommandInterface`
 * Remove `StopWorkerOnSignalsListener` in favor of using the `SignalableCommandInterface`
 * Rename `Symfony\Component\Messenger\Transport\InMemoryTransport` and `Symfony\Component\Messenger\Transport\InMemoryTransportFactory` to
   `Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport` and `Symfony\Component\Messenger\Transport\InMemory\InMemoryTransportFactory` respectively
 * Remove `HandlerFailedException::getNestedExceptions()`, `HandlerFailedException::getNestedExceptionsOfClass()`
   and `DelayedMessageHandlingException::getExceptions()` which are replaced by a new `getWrappedExceptions()` method

Mime
----

 * Remove `Email::attachPart()` method, use `Email::addPart()` instead
 * Require explicit argument when calling `Message::setBody()`

MonologBridge
-------------

 * Drop support for monolog < 3.0
 * Remove class `Logger`, use HttpKernel's `DebugLoggerConfigurator` instead

PropertyAccess
--------------

 * Add method `isNullSafe()` to `PropertyPathInterface`
 * Require explicit argument when calling `PropertyAccessorBuilder::setCacheItemPool()`

ProxyManagerBridge
------------------

 * Remove the bridge, use VarExporter's lazy objects instead

Routing
-------

 * Add parameter `array $routeParameters` to `UrlMatcher::handleRouteRequirements()`
 * Remove Doctrine annotations support in favor of native attributes. Use `Symfony\Component\Routing\Annotation\Route` as native attribute now
 * Remove `AnnotationClassLoader`, use `AttributeClassLoader` instead
 * Remove `AnnotationDirectoryLoader`, use `AttributeDirectoryLoader` instead
 * Remove `AnnotationFileLoader`, use `AttributeFileLoader` instead

Security
--------

 * Add parameter `string $badgeFqcn = null` to `Passport::addBadge()`
 * Add parameter `int $lifetime = null` to `LoginLinkHandlerInterface::createLoginLink()`
 * Require explicit argument when calling `TokenStorage::setToken()`
 * Change argument `$lastUsed` of `TokenProviderInterface::updateToken()` to accept `DateTimeInterface`
 * Throw when calling the constructor of `DefaultLoginRateLimiter` with an empty secret

SecurityBundle
--------------

 * Enabling SecurityBundle and not configuring it is not allowed, either remove the bundle or configure at least one firewall
 * Remove the `enable_authenticator_manager` config option
 * Remove the `security.firewalls.logout.csrf_token_generator` config option, use `security.firewalls.logout.csrf_token_manager` instead
 * Remove the `require_previous_session` config option from authenticators

Serializer
----------

 * Add method `getSupportedTypes()` to `DenormalizerInterface` and `NormalizerInterface`
 * Remove denormalization support for `AbstractUid` in `UidNormalizer`, use one of `AbstractUid` child class instead
 * Denormalizing to an abstract class in `UidNormalizer` now throws an `\Error`
 * Remove `ContextAwareDenormalizerInterface` and `ContextAwareNormalizerInterface`, use `DenormalizerInterface` and `NormalizerInterface` instead

   *Before*
   ```php
   use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;

   class TopicNormalizer implements ContextAwareNormalizerInterface
   {
       public function normalize($topic, string $format = null, array $context = [])
       {
       }
   }
   ```

   *After*
   ```php
   use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

   class TopicNormalizer implements NormalizerInterface
   {
       public function normalize($topic, string $format = null, array $context = [])
       {
       }
   }
   ```

 * Remove `CacheableSupportsMethodInterface`, use `NormalizerInterface` and `DenormalizerInterface` instead

   *Before*
   ```php
   use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
   use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;

   class TopicNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface
   {
       public function supportsNormalization($data, string $format = null, array $context = []): bool
       {
           return $data instanceof Topic;
       }

       public function hasCacheableSupportsMethod(): bool
       {
           return true;
       }

       // ...
   }
   ```

   *After*
   ```php
   use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

   class TopicNormalizer implements NormalizerInterface
   {
       public function supportsNormalization($data, string $format = null, array $context = []): bool
       {
           return $data instanceof Topic;
       }

       public function getSupportedTypes(?string $format): array
       {
           return [
               Topic::class => true,
           ];
       }

       // ...
   }
   ```

 * Require explicit argument when calling `AttributeMetadata::setSerializedName()` and `ClassMetadata::setClassDiscriminatorMapping()`
 * Add parameter `array $context = []` to `NormalizerInterface::supportsNormalization()` and `DenormalizerInterface::supportsDenormalization()`
 * Remove Doctrine annotations support in favor of native attributes
 * Remove the annotation reader parameter from the constructor of `AnnotationLoader`
 * The following Normalizer classes have become final, use decoration instead of inheritance:
   * `ConstraintViolationListNormalizer`
   * `CustomNormalizer`
   * `DataUriNormalizer`
   * `DateIntervalNormalizer`
   * `DateTimeNormalizer`
   * `DateTimeZoneNormalizer`
   * `GetSetMethodNormalizer`
   * `JsonSerializableNormalizer`
   * `ObjectNormalizer`
   * `PropertyNormalizer`

   *Before*
   ```php
   use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;

   class TopicNormalizer extends ObjectNormalizer
   {
       // ...

       public function normalize($topic, string $format = null, array $context = []): array
       {
           $data = parent::normalize($topic, $format, $context);

           // ...
       }
   }
   ```

   *After*
   ```php
   use Symfony\Component\DependencyInjection\Attribute\Autowire;
   use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
   use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

   class TopicNormalizer implements NormalizerInterface
   {
       public function __construct(
           #[Autowire(service: 'serializer.normalizer.object')] private NormalizerInterface&DenormalizerInterface $objectNormalizer,
       ) {
       }

       public function normalize($topic, string $format = null, array $context = []): array
       {
           $data = $this->objectNormalizer->normalize($topic, $format, $context);

           // ...
       }

       // ...
   }
   ```
 * Remove `AnnotationLoader`, use `AttributeLoader` instead

Templating
----------

 * Remove the component; use [Twig](https://twig.symfony.com) instead

Translation
-----------

 * Remove `PhpStringTokenParser`
 * Remove `PhpExtractor` in favor of `PhpAstExtractor`

TwigBundle
----------

 * Remove the `Twig_Environment` autowiring alias, use `Twig\Environment` instead
 * Remove option `twig.autoescape`; create a class that implements your escaping strategy
   (check `FileExtensionEscapingStrategy::guess()` for inspiration) and reference it using
   the `twig.autoescape_service` option instead
 * Drop support for Twig 2

Validator
---------

 * Add methods `getConstraint()`, `getCause()` and `__toString()` to `ConstraintViolationInterface`
 * Add method `__toString()` to `ConstraintViolationListInterface`
 * Add method `disableTranslation()` to `ConstraintViolationBuilderInterface`
 * Remove static property `$errorNames` from all constraints, use const `ERROR_NAMES` instead
 * Remove static property `$versions` from the `Ip` constraint, use the `VERSIONS` constant instead
 * Remove `VALIDATION_MODE_LOOSE` from `Email` constraint, use `VALIDATION_MODE_HTML5` instead
 * Remove constraint `ExpressionLanguageSyntax`, use `ExpressionSyntax` instead. The new constraint is ignored when the value
   is null or blank, consistently with the other constraints in this component
 * Remove Doctrine annotations support in favor of native attributes
 * Remove `ValidatorBuilder::setDoctrineAnnotationReader()`
 * Remove `ValidatorBuilder::addDefaultDoctrineAnnotationReader()`
 * Remove `ValidatorBuilder::enableAnnotationMapping()`, use `ValidatorBuilder::enableAttributeMapping()` instead
 * Remove `ValidatorBuilder::disableAnnotationMapping()`, use `ValidatorBuilder::disableAttributeMapping()` instead
 * Remove `AnnotationLoader`, use `AttributeLoader` instead

VarDumper
---------

 * Add parameter `string $label = null` to `VarDumper::dump()`
 * Require explicit argument when calling `VarDumper::setHandler()`

VarExporter
-----------

 * Remove support for per-property lazy-initializers

Workflow
--------

 * Require explicit argument when calling `Definition::setInitialPlaces()`
 * `GuardEvent::getContext()` method has been removed. Method was not supposed to be called within guard event listeners as it always returned an empty array anyway.

Yaml
----

 * Remove the `!php/const:` tag, use `!php/const` instead (without the colon)