Skip to content

Commit f07fb6f

Browse files
[7.0] Remove remaining deprecated code paths
1 parent 0e01e2d commit f07fb6f

File tree

126 files changed

+355
-2786
lines changed

Some content is hidden

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

126 files changed

+355
-2786
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: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,23 @@ Filesystem
5555

5656
* Add argument `$lock` to `Filesystem::appendToFile()`
5757

58+
Form
59+
----
60+
61+
* Throw when using `DateTime` or `DateTimeImmutable` model data with a different timezone than configured with the
62+
`model_timezone` option in `DateType`, `DateTimeType`, and `TimeType`
63+
* Make the "widget" option of date/time form types default to "single_text"
64+
5865
FrameworkBundle
5966
---------------
6067

6168
* Remove command `translation:update`, use `translation:extract` instead
69+
* Make the `http_method_override` config option default to `false`
70+
* Remove `AbstractController::renderForm()`, use `render()` instead
71+
* Remove the `Symfony\Component\Serializer\Normalizer\ObjectNormalizer` and
72+
`Symfony\Component\Serializer\Normalizer\PropertyNormalizer` autowiring aliases, type-hint against
73+
`Symfony\Component\Serializer\Normalizer\NormalizerInterface` or implement `NormalizerAwareInterface` instead
74+
* Remove the `Http\Client\HttpClient` service, use `Psr\Http\Client\ClientInterface` instead
6275

6376
HttpFoundation
6477
--------------
@@ -93,10 +106,22 @@ Lock
93106

94107
* Add parameter `$isSameDatabase` to `DoctrineDbalStore::configureSchema()`
95108

109+
Mailer
110+
------
111+
112+
* Remove the OhMySmtp bridge in favor of the MailPace bridge
113+
96114
Messenger
97115
---------
98116

99117
* Add parameter `$isSameDatabase` to `DoctrineTransport::configureSchema()`
118+
* Remove `MessageHandlerInterface` and `MessageSubscriberInterface`, use `#[AsMessageHandler]` instead
119+
* Remove `StopWorkerOnSigtermSignalListener` in favor of
120+
`StopWorkerOnSignalsListener` and make it configurable with SIGINT and
121+
* Remove `Symfony\Component\Messenger\Transport\InMemoryTransport` and
122+
`Symfony\Component\Messenger\Transport\InMemoryTransportFactory` in favor of
123+
`Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport` and
124+
`Symfony\Component\Messenger\Transport\InMemory\InMemoryTransportFactory`
100125

101126
PropertyAccess
102127
--------------
@@ -136,6 +161,18 @@ Serializer
136161
* First argument of `AttributeMetadata::setSerializedName()` is now required
137162
* Add argument `$context` to `NormalizerInterface::supportsNormalization()` and `DenormalizerInterface::supportsDenormalization()`
138163

164+
Translation
165+
-----------
166+
167+
* Remove `PhpStringTokenParser`
168+
* Remove `PhpExtractor` in favor of `PhpAstExtractor`
169+
170+
TwigBundle
171+
----------
172+
173+
* Remove option `twig.autoescape`, use `twig.autoescape_service[_method]` instead
174+
* Remove the `Twig_Environment` autowiring alias, use `Twig\Environment` instead
175+
139176
Validator
140177
---------
141178

@@ -150,3 +187,8 @@ VarDumper
150187
---------
151188

152189
* Add argument `$label` to `VarDumper::dump()`
190+
191+
Yaml
192+
----
193+
194+
* 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/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

src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function getDefaultFormatter()
4848
/**
4949
* @author Grégoire Pineau <lyrixx@lyrixx.info>
5050
*
51-
* @internal since Symfony 6.1
51+
* @internal
5252
*/
5353
trait ServerLogHandlerTrait
5454
{

src/Symfony/Bridge/Monolog/Processor/AbstractTokenProcessor.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,15 @@
2121
* @author Dany Maillard <danymaillard93b@gmail.com>
2222
* @author Igor Timoshenko <igor.timoshenko@i.ua>
2323
*
24-
* @internal since Symfony 6.1
24+
* @internal
2525
*/
2626
abstract class AbstractTokenProcessor
2727
{
2828
use CompatibilityProcessor;
2929

30-
/**
31-
* @var TokenStorageInterface
32-
*/
33-
protected $tokenStorage;
34-
35-
public function __construct(TokenStorageInterface $tokenStorage)
36-
{
37-
$this->tokenStorage = $tokenStorage;
30+
public function __construct(
31+
protected TokenStorageInterface $tokenStorage,
32+
) {
3833
}
3934

4035
abstract protected function getKey(): string;

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ CHANGELOG
55
---
66

77
* Remove command `translation:update`, use `translation:extract` instead
8+
* Make the `http_method_override` config option default to `false`
9+
* Remove `AbstractController::renderForm()`, use `render()` instead
10+
* Remove the `Symfony\Component\Serializer\Normalizer\ObjectNormalizer` and
11+
`Symfony\Component\Serializer\Normalizer\PropertyNormalizer` autowiring aliases, type-hint against
12+
`Symfony\Component\Serializer\Normalizer\NormalizerInterface` or implement `NormalizerAwareInterface` instead
13+
* Remove the `Http\Client\HttpClient` service, use `Psr\Http\Client\ClientInterface` instead
814

915
6.3
1016
---

src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use Symfony\Component\Console\Input\InputOption;
2222
use Symfony\Component\Console\Output\OutputInterface;
2323
use Symfony\Component\DependencyInjection\ServiceLocator;
24-
use Symfony\Component\Workflow\Definition;
2524
use Symfony\Component\Workflow\Dumper\GraphvizDumper;
2625
use Symfony\Component\Workflow\Dumper\MermaidDumper;
2726
use Symfony\Component\Workflow\Dumper\PlantUmlDumper;
@@ -37,33 +36,16 @@
3736
#[AsCommand(name: 'workflow:dump', description: 'Dump a workflow')]
3837
class WorkflowDumpCommand extends Command
3938
{
40-
/**
41-
* string is the service id.
42-
*
43-
* @var array<string, Definition>
44-
*/
45-
private array $definitions = [];
46-
47-
private ServiceLocator $workflows;
48-
4939
private const DUMP_FORMAT_OPTIONS = [
5040
'puml',
5141
'mermaid',
5242
'dot',
5343
];
5444

55-
public function __construct($workflows)
56-
{
45+
public function __construct(
46+
private ServiceLocator $workflows,
47+
) {
5748
parent::__construct();
58-
59-
if ($workflows instanceof ServiceLocator) {
60-
$this->workflows = $workflows;
61-
} elseif (\is_array($workflows)) {
62-
$this->definitions = $workflows;
63-
trigger_deprecation('symfony/framework-bundle', '6.2', 'Passing an array of definitions in "%s()" is deprecated. Inject a ServiceLocator filled with all workflows instead.', __METHOD__);
64-
} else {
65-
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an array or a ServiceLocator, "%s" given.', __METHOD__, \gettype($workflows)));
66-
}
6749
}
6850

6951
protected function configure(): void
@@ -92,20 +74,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9274
{
9375
$workflowName = $input->getArgument('name');
9476

95-
if (isset($this->workflows)) {
96-
if (!$this->workflows->has($workflowName)) {
97-
throw new InvalidArgumentException(sprintf('The workflow named "%s" cannot be found.', $workflowName));
98-
}
99-
$workflow = $this->workflows->get($workflowName);
100-
$type = $workflow instanceof StateMachine ? 'state_machine' : 'workflow';
101-
$definition = $workflow->getDefinition();
102-
} elseif (isset($this->definitions['workflow.'.$workflowName])) {
103-
$definition = $this->definitions['workflow.'.$workflowName];
104-
$type = 'workflow';
105-
} elseif (isset($this->definitions['state_machine.'.$workflowName])) {
106-
$definition = $this->definitions['state_machine.'.$workflowName];
107-
$type = 'state_machine';
77+
if (!$this->workflows->has($workflowName)) {
78+
throw new InvalidArgumentException(sprintf('The workflow named "%s" cannot be found.', $workflowName));
10879
}
80+
$workflow = $this->workflows->get($workflowName);
81+
$type = $workflow instanceof StateMachine ? 'state_machine' : 'workflow';
82+
$definition = $workflow->getDefinition();
10983

11084
if (null === $definition) {
11185
throw new InvalidArgumentException(sprintf('No service found for "workflow.%1$s" nor "state_machine.%1$s".', $workflowName));
@@ -147,11 +121,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
147121
public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
148122
{
149123
if ($input->mustSuggestArgumentValuesFor('name')) {
150-
if (isset($this->workflows)) {
151-
$suggestions->suggestValues(array_keys($this->workflows->getProvidedServices()));
152-
} else {
153-
$suggestions->suggestValues(array_keys($this->definitions));
154-
}
124+
$suggestions->suggestValues(array_keys($this->workflows->getProvidedServices()));
155125
}
156126

157127
if ($input->mustSuggestOptionValuesFor('dump-format')) {

src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ protected function addFlash(string $type, mixed $message): void
186186
}
187187

188188
if (!$session instanceof FlashBagAwareSessionInterface) {
189-
trigger_deprecation('symfony/framework-bundle', '6.2', 'Calling "addFlash()" method when the session does not implement %s is deprecated.', FlashBagAwareSessionInterface::class);
189+
throw new \LogicException(sprintf('You cannot use the addFlash method because class "%s" doesn\'t implement "%s".', get_debug_type($session), FlashBagAwareSessionInterface::class), 0, $e);
190190
}
191191

192192
$session->getFlashBag()->add($type, $message);
@@ -268,20 +268,6 @@ protected function render(string $view, array $parameters = [], Response $respon
268268
return $response;
269269
}
270270

271-
/**
272-
* Renders a view and sets the appropriate status code when a form is listed in parameters.
273-
*
274-
* If an invalid form is found in the list of parameters, a 422 status code is returned.
275-
*
276-
* @deprecated since Symfony 6.2, use render() instead
277-
*/
278-
protected function renderForm(string $view, array $parameters = [], Response $response = null): Response
279-
{
280-
trigger_deprecation('symfony/framework-bundle', '6.2', 'The "%s::renderForm()" method is deprecated, use "render()" instead.', get_debug_type($this));
281-
282-
return $this->render($view, $parameters, $response);
283-
}
284-
285271
/**
286272
* Streams a view.
287273
*/

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,12 @@ public function getConfigTreeBuilder(): TreeBuilder
8181
return $v;
8282
})
8383
->end()
84-
->validate()
85-
->always(function ($v) {
86-
if (!isset($v['http_method_override'])) {
87-
trigger_deprecation('symfony/framework-bundle', '6.1', 'Not setting the "framework.http_method_override" config option is deprecated. It will default to "false" in 7.0.');
88-
89-
$v['http_method_override'] = true;
90-
}
91-
92-
return $v;
93-
})
94-
->end()
9584
->fixXmlConfig('enabled_locale')
9685
->children()
9786
->scalarNode('secret')->end()
9887
->booleanNode('http_method_override')
9988
->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. Note: When using the HttpCache, you need to call the method in your front controller instead")
100-
->treatNullLike(false)
89+
->defaultFalse()
10190
->end()
10291
->scalarNode('trust_x_sendfile_type_header')
10392
->info('Set true to enable support for xsendfile in binary file responses.')
@@ -244,9 +233,6 @@ private function addFormSection(ArrayNodeDefinition $rootNode, callable $enableI
244233
->scalarNode('field_name')->defaultValue('_token')->end()
245234
->end()
246235
->end()
247-
->booleanNode('legacy_error_messages')
248-
->setDeprecated('symfony/framework-bundle', '6.2')
249-
->end()
250236
->end()
251237
->end()
252238
->end()
@@ -1303,27 +1289,6 @@ private function addExceptionsSection(ArrayNodeDefinition $rootNode): void
13031289
->arrayNode('exceptions')
13041290
->info('Exception handling configuration')
13051291
->useAttributeAsKey('class')
1306-
->beforeNormalization()
1307-
// Handle legacy XML configuration
1308-
->ifArray()
1309-
->then(function (array $v): array {
1310-
if (!\array_key_exists('exception', $v)) {
1311-
return $v;
1312-
}
1313-
1314-
trigger_deprecation('symfony/framework-bundle', '6.3', '"framework:exceptions" tag is deprecated. Unwrap it and replace your "framework:exception" tags\' "name" attribute by "class".');
1315-
1316-
$v = $v['exception'];
1317-
unset($v['exception']);
1318-
1319-
foreach ($v as &$exception) {
1320-
$exception['class'] = $exception['name'];
1321-
unset($exception['name']);
1322-
}
1323-
1324-
return $v;
1325-
})
1326-
->end()
13271292
->prototype('array')
13281293
->children()
13291294
->scalarNode('log_level')
@@ -1620,15 +1585,6 @@ function ($a) {
16201585
->defaultNull()
16211586
->info('Transport name to send failed messages to (after all retries have failed).')
16221587
->end()
1623-
->booleanNode('reset_on_message')
1624-
->defaultTrue()
1625-
->info('Reset container services after each message.')
1626-
->setDeprecated('symfony/framework-bundle', '6.1', 'Option "%node%" at "%path%" is deprecated. It does nothing and will be removed in version 7.0.')
1627-
->validate()
1628-
->ifTrue(static fn ($v) => true !== $v)
1629-
->thenInvalid('The "framework.messenger.reset_on_message" configuration option can be set to "true" only. To prevent services resetting after each message you can set the "--no-reset" option in "messenger:consume" command.')
1630-
->end()
1631-
->end()
16321588
->arrayNode('stop_worker_on_signals')
16331589
->defaultValue([])
16341590
->info('A list of signals that should stop the worker; defaults to SIGTERM and SIGINT.')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy