Skip to content

Commit 955285f

Browse files
[7.0] Remove remaining deprecated code paths
1 parent d6b5f54 commit 955285f

File tree

133 files changed

+414
-3124
lines changed

Some content is hidden

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

133 files changed

+414
-3124
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,28 +144,42 @@ 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
* Remove the `gcProbablity` (notice the typo) option, use `gcProbability` instead
123154

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

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

129172
Mime
130173
----
131174

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

135178
PropertyAccess
136179
--------------
137180

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

140184
ProxyManagerBridge
141185
------------------
@@ -152,6 +196,7 @@ Security
152196

153197
* Add argument `$badgeFqcn` to `Passport::addBadge()`
154198
* Add argument `$lifetime` to `LoginLinkHandlerInterface::createLoginLink()`
199+
* Require explicit argument when calling `TokenStorage::setToken()`
155200

156201
SecurityBundle
157202
--------------
@@ -189,6 +234,7 @@ Serializer
189234
}
190235
}
191236
```
237+
192238
* Remove `CacheableSupportsMethodInterface`, use `NormalizerInterface` and `DenormalizerInterface` instead
193239

194240
*Before*
@@ -233,9 +279,24 @@ Serializer
233279
// ...
234280
}
235281
```
236-
* First argument of `AttributeMetadata::setSerializedName()` is now required
282+
283+
* Require explicit argument when calling `AttributeMetadata::setSerializedName()` and `ClassMetadata::setClassDiscriminatorMapping()`
237284
* Add argument `$context` to `NormalizerInterface::supportsNormalization()` and `DenormalizerInterface::supportsDenormalization()`
238285

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

@@ -250,3 +311,14 @@ VarDumper
250311
---------
251312

252313
* Add argument `$label` to `VarDumper::dump()`
314+
* Require explicit argument when calling `VarDumper::setHandler()`
315+
316+
Workflow
317+
--------
318+
319+
* Require explicit argument when calling `Definition::setInitialPlaces()`
320+
321+
Yaml
322+
----
323+
324+
* 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', 'Registering "%s" as a Doctrine subscriber is deprecated. Register it as a listener instead, using e.g. the #[AsDoctrineListener] attribute.', $id);
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

0 commit comments

Comments
 (0)