Skip to content

Commit 8b687f6

Browse files
[7.0] Remove remaining deprecated code paths
1 parent 465bc72 commit 8b687f6

File tree

135 files changed

+432
-3150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+432
-3150
lines changed

.github/expected-missing-return-types.diff

Lines changed: 87 additions & 133 deletions
Large diffs are not rendered by default.

UPGRADE-7.0.md

Lines changed: 76 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ Cache
1111

1212
* Add parameter `$isSameDatabase` to `DoctrineDbalAdapter::configureSchema()`
1313

14+
Config
15+
------
16+
17+
* Require explicit argument when calling `NodeBuilder::setParent()`
18+
1419
Console
1520
-------
1621

@@ -41,7 +46,7 @@ Console
4146
}
4247
```
4348

44-
* Passing null to `*Command::setApplication()`, `*FormatterStyle::setForeground/setBackground()`, `Helper::setHelpSet()`, `Input*::setDefault()` and `Question::setAutocompleterCallback/setValidator()` must be done explicitly
49+
* Require explicit argument when calling `*Command::setApplication()`, `*FormatterStyle::setForeground/setBackground()`, `Helper::setHelpSet()`, `Input*::setDefault()` and `Question::setAutocompleterCallback/setValidator()`
4550
* Remove `StringInput::REGEX_STRING`
4651
* Add method `__toString()` to `InputInterface`
4752

@@ -52,7 +57,7 @@ DependencyInjection
5257
* Remove `ProxyHelper`, use `Symfony\Component\VarExporter\ProxyHelper` instead
5358
* Remove `ReferenceSetArgumentTrait`
5459
* Remove support of `@required` annotation, use the `Symfony\Contracts\Service\Attribute\Required` attribute instead
55-
* Passing `null` to `ContainerAwareTrait::setContainer()` must be done explicitly
60+
* Require explicit argument when calling `ContainerAwareTrait::setContainer()`
5661
* Remove `PhpDumper` options `inline_factories_parameter` and `inline_class_loader_parameter`, use options `inline_factories` and `inline_class_loader` instead
5762
* Parameter names of `ParameterBag` cannot be numerics
5863
* Remove `ContainerAwareInterface` and `ContainerAwareTrait`, use dependency injection instead
@@ -82,10 +87,34 @@ Filesystem
8287

8388
* Add argument `$lock` to `Filesystem::appendToFile()`
8489

90+
Form
91+
----
92+
93+
* Throw when using `DateTime` or `DateTimeImmutable` model data with a different timezone than configured with the
94+
`model_timezone` option in `DateType`, `DateTimeType`, and `TimeType`
95+
* Make the "widget" option of date/time form types default to "single_text"
96+
* Require explicit argument when calling `Button/Form::setParent()`, `ButtonBuilder/FormConfigBuilder::setDataMapper()`, `TransformationFailedException::setInvalidMessage()`
97+
8598
FrameworkBundle
8699
---------------
87100

88101
* Remove command `translation:update`, use `translation:extract` instead
102+
* Make the `http_method_override` config option default to `false`
103+
* Remove the `Symfony\Component\Serializer\Normalizer\ObjectNormalizer` and
104+
`Symfony\Component\Serializer\Normalizer\PropertyNormalizer` autowiring aliases, type-hint against
105+
`Symfony\Component\Serializer\Normalizer\NormalizerInterface` or implement `NormalizerAwareInterface` instead
106+
* Remove the `Http\Client\HttpClient` service, use `Psr\Http\Client\ClientInterface` instead
107+
* Remove `AbstractController::renderForm()`, use `render()` instead
108+
109+
*Before*
110+
```php
111+
$this->renderForm(..., ['form' => $form]);
112+
```
113+
114+
*After*
115+
```php
116+
$this->render(..., ['form' => $form]);
117+
```
89118

90119
HttpFoundation
91120
--------------
@@ -99,6 +128,7 @@ HttpFoundation
99128
* Replace `ExpressionRequestMatcher` with `RequestMatcher\ExpressionRequestMatcher`
100129
* Remove `Request::getContentType()`, use `Request::getContentTypeFormat()` instead
101130
* Throw an `InvalidArgumentException` when calling `Request::create()` with a malformed URI
131+
* Require explicit argument when calling `JsonResponse::setCallback()`, `Response::setExpires/setLastModified/setEtag()`, `MockArraySessionStorage/NativeSessionStorage::setMetadataBag()`, `NativeSessionStorage::setSaveHandler()`
102132

103133
HttpClient
104134
----------
@@ -114,27 +144,41 @@ HttpKernel
114144
* Remove `AbstractSurrogate::$phpEscapeMap`
115145
* Remove `HttpKernelInterface::MASTER_REQUEST`
116146
* Remove `terminate_on_cache_hit` option from `HttpCache`
147+
* Require explicit argument when calling `ConfigDataCollector::setKernel()`, `RouterListener::setCurrentRequest()`
117148

118149
Lock
119150
----
120151

121152
* Add parameter `$isSameDatabase` to `DoctrineDbalStore::configureSchema()`
122153

154+
Mailer
155+
------
156+
157+
* Remove the OhMySmtp bridge in favor of the MailPace bridge
158+
123159
Messenger
124160
---------
125161

126162
* Add parameter `$isSameDatabase` to `DoctrineTransport::configureSchema()`
163+
* Remove `MessageHandlerInterface` and `MessageSubscriberInterface`, use `#[AsMessageHandler]` instead
164+
* Remove `StopWorkerOnSigtermSignalListener` in favor of
165+
`StopWorkerOnSignalsListener` and make it configurable with SIGINT and
166+
* Remove `Symfony\Component\Messenger\Transport\InMemoryTransport` and
167+
`Symfony\Component\Messenger\Transport\InMemoryTransportFactory` in favor of
168+
`Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport` and
169+
`Symfony\Component\Messenger\Transport\InMemory\InMemoryTransportFactory`
127170

128171
Mime
129172
----
130173

131174
* Remove `Email::attachPart()` method, use `Email::addPart()` instead
132-
* Parameter `$body` is now required (at least null) in `Message::setBody()`
175+
* Require explicit argument when calling `Message::setBody()`
133176

134177
PropertyAccess
135178
--------------
136179

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

139183
ProxyManagerBridge
140184
------------------
@@ -151,6 +195,7 @@ Security
151195

152196
* Add argument `$badgeFqcn` to `Passport::addBadge()`
153197
* Add argument `$lifetime` to `LoginLinkHandlerInterface::createLoginLink()`
198+
* Require explicit argument when calling `TokenStorage::setToken()`
154199

155200
SecurityBundle
156201
--------------
@@ -188,6 +233,7 @@ Serializer
188233
}
189234
}
190235
```
236+
191237
* Remove `CacheableSupportsMethodInterface`, use `NormalizerInterface` and `DenormalizerInterface` instead
192238

193239
*Before*
@@ -232,9 +278,24 @@ Serializer
232278
// ...
233279
}
234280
```
235-
* First argument of `AttributeMetadata::setSerializedName()` is now required
281+
282+
* Require explicit argument when calling `AttributeMetadata::setSerializedName()` and `ClassMetadata::setClassDiscriminatorMapping()`
236283
* Add argument `$context` to `NormalizerInterface::supportsNormalization()` and `DenormalizerInterface::supportsDenormalization()`
237284

285+
Translation
286+
-----------
287+
288+
* Remove `PhpStringTokenParser`
289+
* Remove `PhpExtractor` in favor of `PhpAstExtractor`
290+
291+
TwigBundle
292+
----------
293+
294+
* Remove the `Twig_Environment` autowiring alias, use `Twig\Environment` instead
295+
* Remove option `twig.autoescape`; create a class that implements your escaping strategy
296+
(check `FileExtensionEscapingStrategy::guess()` for inspiration) and reference it using
297+
the `twig.autoescape_service` option instead
298+
238299
Validator
239300
---------
240301

@@ -249,3 +310,14 @@ VarDumper
249310
---------
250311

251312
* Add argument `$label` to `VarDumper::dump()`
313+
* Require explicit argument when calling `VarDumper::setHandler()`
314+
315+
Workflow
316+
--------
317+
318+
* Require explicit argument when calling `Definition::setInitialPlaces()`
319+
320+
Yaml
321+
----
322+
323+
* Remove the `!php/const:` tag, use `!php/const` instead (without the colon)

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@
141141
"pda/pheanstalk": "^4.0",
142142
"php-http/discovery": "^1.15",
143143
"php-http/httplug": "^1.0|^2.0",
144-
"php-http/message-factory": "^1.0",
145144
"phpdocumentor/reflection-docblock": "^5.2",
146145
"phpstan/phpdoc-parser": "^1.0",
147146
"predis/predis": "^1.1|^2.0",

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use Symfony\Component\DependencyInjection\Reference;
2323

2424
/**
25-
* Registers event listeners and subscribers to the available doctrine connections.
25+
* Registers event listeners to the available doctrine connections.
2626
*
2727
* @author Jeremy Mikola <jmikola@gmail.com>
2828
* @author Alexander <iam.asm89@gmail.com>
@@ -44,7 +44,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
4444
/**
4545
* @param string $managerTemplate sprintf() template for generating the event
4646
* manager's service ID for a connection name
47-
* @param string $tagPrefix Tag prefix for listeners and subscribers
47+
* @param string $tagPrefix Tag prefix for listeners
4848
*/
4949
public function __construct(string $connectionsParameter, string $managerTemplate, string $tagPrefix)
5050
{
@@ -72,18 +72,13 @@ public function process(ContainerBuilder $container): void
7272

7373
private function addTaggedServices(ContainerBuilder $container): array
7474
{
75-
$listenerTag = $this->tagPrefix.'.event_listener';
76-
$subscriberTag = $this->tagPrefix.'.event_subscriber';
7775
$listenerRefs = [];
78-
$taggedServices = $this->findAndSortTags($subscriberTag, $listenerTag, $container);
79-
8076
$managerDefs = [];
81-
foreach ($taggedServices as $taggedSubscriber) {
82-
[$tagName, $id, $tag] = $taggedSubscriber;
77+
foreach ($this->findAndSortTags($container) as [$id, $tag]) {
8378
$connections = isset($tag['connection'])
8479
? [$container->getParameterBag()->resolveValue($tag['connection'])]
8580
: array_keys($this->connections);
86-
if ($listenerTag === $tagName && !isset($tag['event'])) {
81+
if (!isset($tag['event'])) {
8782
throw new InvalidArgumentException(sprintf('Doctrine event listener "%s" must specify the "event" attribute.', $id));
8883
}
8984
foreach ($connections as $con) {
@@ -105,19 +100,10 @@ private function addTaggedServices(ContainerBuilder $container): array
105100
if (ContainerAwareEventManager::class === $managerClass) {
106101
$refs = $managerDef->getArguments()[1] ?? [];
107102
$listenerRefs[$con][$id] = new Reference($id);
108-
if ($subscriberTag === $tagName) {
109-
trigger_deprecation('symfony/doctrine-bridge', '6.3', 'Using Doctrine subscribers as services is deprecated, declare listeners instead');
110-
$refs[] = $id;
111-
} else {
112-
$refs[] = [[$tag['event']], $id];
113-
}
103+
$refs[] = [[$tag['event']], $id];
114104
$managerDef->setArgument(1, $refs);
115105
} else {
116-
if ($subscriberTag === $tagName) {
117-
$managerDef->addMethodCall('addEventSubscriber', [new Reference($id)]);
118-
} else {
119-
$managerDef->addMethodCall('addEventListener', [[$tag['event']], new Reference($id)]);
120-
}
106+
$managerDef->addMethodCall('addEventListener', [[$tag['event']], new Reference($id)]);
121107
}
122108
}
123109
}
@@ -144,21 +130,14 @@ private function getEventManagerDef(ContainerBuilder $container, string $name):
144130
* @see https://bugs.php.net/53710
145131
* @see https://bugs.php.net/60926
146132
*/
147-
private function findAndSortTags(string $subscriberTag, string $listenerTag, ContainerBuilder $container): array
133+
private function findAndSortTags(ContainerBuilder $container): array
148134
{
149135
$sortedTags = [];
150-
$taggedIds = [
151-
$subscriberTag => $container->findTaggedServiceIds($subscriberTag, true),
152-
$listenerTag => $container->findTaggedServiceIds($listenerTag, true),
153-
];
154-
$taggedIds[$subscriberTag] = array_diff_key($taggedIds[$subscriberTag], $taggedIds[$listenerTag]);
155-
156-
foreach ($taggedIds as $tagName => $serviceIds) {
157-
foreach ($serviceIds as $serviceId => $tags) {
158-
foreach ($tags as $attributes) {
159-
$priority = $attributes['priority'] ?? 0;
160-
$sortedTags[$priority][] = [$tagName, $serviceId, $attributes];
161-
}
136+
137+
foreach ($container->findTaggedServiceIds($this->tagPrefix.'.event_listener', true) as $serviceId => $tags) {
138+
foreach ($tags as $attributes) {
139+
$priority = $attributes['priority'] ?? 0;
140+
$sortedTags[$priority][] = [$serviceId, $attributes];
162141
}
163142
}
164143

src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ protected function loadChoices(): iterable
5757
: $this->manager->getRepository($this->class)->findAll();
5858
}
5959

60-
/**
61-
* @internal to be remove in Symfony 6
62-
*/
6360
protected function doLoadValuesForChoices(array $choices): array
6461
{
6562
// Optimize performance for single-field identifiers. We already

0 commit comments

Comments
 (0)