Skip to content

Commit 4a863f8

Browse files
[DependencyInjection] Remove deprecations across the component
1 parent 2a2c825 commit 4a863f8

40 files changed

+118
-1205
lines changed

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

Lines changed: 16 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,6 @@ index c61c28a147..640539c1d0 100644
3232
+ public function getQueryCount(): int
3333
{
3434
return array_sum(array_map('count', $this->data['queries']));
35-
diff --git a/src/Symfony/Bridge/Doctrine/DataFixtures/ContainerAwareLoader.php b/src/Symfony/Bridge/Doctrine/DataFixtures/ContainerAwareLoader.php
36-
index 448da935d9..06c97eb70c 100644
37-
--- a/src/Symfony/Bridge/Doctrine/DataFixtures/ContainerAwareLoader.php
38-
+++ b/src/Symfony/Bridge/Doctrine/DataFixtures/ContainerAwareLoader.php
39-
@@ -40,5 +40,5 @@ class ContainerAwareLoader extends Loader
40-
* @return void
41-
*/
42-
- public function addFixture(FixtureInterface $fixture)
43-
+ public function addFixture(FixtureInterface $fixture): void
44-
{
45-
if ($fixture instanceof ContainerAwareInterface) {
4635
diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php
4736
index 1ce0ffd40c..585265fb38 100644
4837
--- a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php
@@ -484,17 +473,17 @@ index eadeafba55..4f1ca3bfef 100644
484473
{
485474
$configuration = new Configuration();
486475
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php
487-
index 02709ba649..5a3e972793 100644
476+
index 0451b31fe1..14806da8ee 100644
488477
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php
489478
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php
490-
@@ -56,5 +56,5 @@ class Application extends BaseApplication
479+
@@ -55,5 +55,5 @@ class Application extends BaseApplication
491480
* @return void
492481
*/
493482
- public function reset()
494483
+ public function reset(): void
495484
{
496485
if ($this->kernel->getContainer()->has('services_resetter')) {
497-
@@ -145,5 +145,5 @@ class Application extends BaseApplication
486+
@@ -137,5 +137,5 @@ class Application extends BaseApplication
498487
* @return void
499488
*/
500489
- protected function registerCommands()
@@ -4108,27 +4097,6 @@ index 3ea2228b94..f1d7078383 100644
41084097
+ protected function load(string $file): mixed
41094098
{
41104099
return require $file;
4111-
diff --git a/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php b/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php
4112-
index 9b3709c965..97b54712c9 100644
4113-
--- a/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php
4114-
+++ b/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php
4115-
@@ -26,4 +26,4 @@ interface ContainerAwareInterface
4116-
* @return void
4117-
*/
4118-
- public function setContainer(?ContainerInterface $container);
4119-
+ public function setContainer(?ContainerInterface $container): void;
4120-
}
4121-
diff --git a/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php b/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php
4122-
index 4174fec8d0..f6a7b2da12 100644
4123-
--- a/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php
4124-
+++ b/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php
4125-
@@ -31,5 +31,5 @@ trait ContainerAwareTrait
4126-
* @return void
4127-
*/
4128-
- public function setContainer(ContainerInterface $container = null)
4129-
+ public function setContainer(ContainerInterface $container = null): void
4130-
{
4131-
if (1 > \func_num_args()) {
41324100
diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
41334101
index a7a9c145aa..bd16e937ca 100644
41344102
--- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
@@ -4560,52 +4528,52 @@ index 1ede090384..7b6b63c599 100644
45604528
{
45614529
throw new LogicException('Impossible to call remove() on a frozen ParameterBag.');
45624530
diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php
4563-
index 6ba8a4cf7c..5e5e22bc09 100644
4531+
index 8cd6111fe2..61a1e894a7 100644
45644532
--- a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php
45654533
+++ b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php
4566-
@@ -35,5 +35,5 @@ class ParameterBag implements ParameterBagInterface
4534+
@@ -36,5 +36,5 @@ class ParameterBag implements ParameterBagInterface
45674535
* @return void
45684536
*/
45694537
- public function clear()
45704538
+ public function clear(): void
45714539
{
45724540
$this->parameters = [];
4573-
@@ -43,5 +43,5 @@ class ParameterBag implements ParameterBagInterface
4541+
@@ -44,5 +44,5 @@ class ParameterBag implements ParameterBagInterface
45744542
* @return void
45754543
*/
45764544
- public function add(array $parameters)
45774545
+ public function add(array $parameters): void
45784546
{
45794547
foreach ($parameters as $key => $value) {
4580-
@@ -104,5 +104,5 @@ class ParameterBag implements ParameterBagInterface
4548+
@@ -105,5 +105,5 @@ class ParameterBag implements ParameterBagInterface
45814549
* @return void
45824550
*/
45834551
- public function set(string $name, array|bool|string|int|float|\UnitEnum|null $value)
45844552
+ public function set(string $name, array|bool|string|int|float|\UnitEnum|null $value): void
45854553
{
45864554
if (is_numeric($name)) {
4587-
@@ -122,5 +122,5 @@ class ParameterBag implements ParameterBagInterface
4555+
@@ -121,5 +121,5 @@ class ParameterBag implements ParameterBagInterface
45884556
* @throws ParameterNotFoundException if the parameter is not defined
45894557
*/
45904558
- public function deprecate(string $name, string $package, string $version, string $message = 'The parameter "%s" is deprecated.')
45914559
+ public function deprecate(string $name, string $package, string $version, string $message = 'The parameter "%s" is deprecated.'): void
45924560
{
45934561
if (!\array_key_exists($name, $this->parameters)) {
4594-
@@ -139,5 +139,5 @@ class ParameterBag implements ParameterBagInterface
4562+
@@ -138,5 +138,5 @@ class ParameterBag implements ParameterBagInterface
45954563
* @return void
45964564
*/
45974565
- public function remove(string $name)
45984566
+ public function remove(string $name): void
45994567
{
46004568
unset($this->parameters[$name], $this->deprecatedParameters[$name]);
4601-
@@ -147,5 +147,5 @@ class ParameterBag implements ParameterBagInterface
4569+
@@ -146,5 +146,5 @@ class ParameterBag implements ParameterBagInterface
46024570
* @return void
46034571
*/
46044572
- public function resolve()
46054573
+ public function resolve(): void
46064574
{
46074575
if ($this->resolved) {
4608-
@@ -259,5 +259,5 @@ class ParameterBag implements ParameterBagInterface
4576+
@@ -258,5 +258,5 @@ class ParameterBag implements ParameterBagInterface
46094577
* @return bool
46104578
*/
46114579
- public function isResolved()
@@ -8250,31 +8218,31 @@ index af21469b1c..7b024368c5 100644
82508218
{
82518219
}
82528220
diff --git a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php
8253-
index fe200629f4..692c41ec53 100644
8221+
index 400a9e0c92..870cbe80e5 100644
82548222
--- a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php
82558223
+++ b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php
8256-
@@ -29,5 +29,5 @@ interface BundleInterface extends ContainerAwareInterface
8224+
@@ -28,5 +28,5 @@ interface BundleInterface
82578225
* @return void
82588226
*/
82598227
- public function boot();
82608228
+ public function boot(): void;
82618229

82628230
/**
8263-
@@ -36,5 +36,5 @@ interface BundleInterface extends ContainerAwareInterface
8231+
@@ -35,5 +35,5 @@ interface BundleInterface
82648232
* @return void
82658233
*/
82668234
- public function shutdown();
82678235
+ public function shutdown(): void;
82688236

82698237
/**
8270-
@@ -45,5 +45,5 @@ interface BundleInterface extends ContainerAwareInterface
8238+
@@ -44,5 +44,5 @@ interface BundleInterface
82718239
* @return void
82728240
*/
82738241
- public function build(ContainerBuilder $container);
82748242
+ public function build(ContainerBuilder $container): void;
82758243

82768244
/**
8277-
@@ -72,4 +72,4 @@ interface BundleInterface extends ContainerAwareInterface
8245+
@@ -71,4 +71,4 @@ interface BundleInterface
82788246
* @return void
82798247
*/
82808248
- public function setContainer(?ContainerInterface $container);

UPGRADE-7.0.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ Symfony 6.4 and Symfony 7.0 will be released simultaneously at the end of Novemb
55
release process, both versions will have the same features, but Symfony 7.0 won't include any deprecated features.
66
To upgrade, make sure to resolve all deprecation notices.
77

8+
DependencyInjection
9+
-------------------
10+
11+
* Remove `#[MapDecorated]`, use `#[AutowireDecorated]` instead
12+
* Remove `ProxyHelper`, use `Symfony\Component\VarExporter\ProxyHelper` instead
13+
* Remove `ReferenceSetArgumentTrait`
14+
* Remove support of `@required` annotation, use the `Symfony\Contracts\Service\Attribute\Required` attribute instead
15+
* Passing `null` to `ContainerAwareTrait::setContainer()` must be done explicitly
16+
* Remove `PhpDumper` options `inline_factories_parameter` and `inline_class_loader_parameter`, use options `inline_factories` and `inline_class_loader` instead
17+
* Parameter names of `ParameterBag` cannot be numerics
18+
* Remove `ContainerAwareInterface` and `ContainerAwareTrait`, use dependency injection instead
19+
820
DoctrineBridge
921
--------------
1022

@@ -15,6 +27,7 @@ DoctrineBridge
1527
* Remove `DoctrineDataCollector::addLogger()`, use a `DebugDataHolder` instead
1628
* `ContainerAwareEventManager::getListeners()` must be called with an event name
1729
* DoctrineBridge now requires `doctrine/event-manager:^2`
30+
* Remove `ContainerAwareLoader`, use dependency injection in your fixtures instead
1831

1932
ProxyManagerBridge
2033
------------------

src/Symfony/Bridge/Doctrine/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ CHANGELOG
1111
* Remove `DoctrineDataCollector::addLogger()`, use a `DebugDataHolder` instead
1212
* `ContainerAwareEventManager::getListeners()` must be called with an event name
1313
* DoctrineBridge now requires `doctrine/event-manager:^2`
14+
* Remove `ContainerAwareLoader`, use dependency injection in your fixtures instead
1415

1516
6.4
1617
---

src/Symfony/Bridge/Doctrine/DataFixtures/ContainerAwareLoader.php

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/Symfony/Bridge/Doctrine/Tests/DataFixtures/ContainerAwareLoaderTest.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/Symfony/Bridge/Doctrine/Tests/Fixtures/ContainerAwareFixture.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/Symfony/Bundle/FrameworkBundle/Console/Application.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Symfony\Component\Console\Output\ConsoleOutputInterface;
2020
use Symfony\Component\Console\Output\OutputInterface;
2121
use Symfony\Component\Console\Style\SymfonyStyle;
22-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
2322
use Symfony\Component\HttpKernel\Bundle\Bundle;
2423
use Symfony\Component\HttpKernel\Kernel;
2524
use Symfony\Component\HttpKernel\KernelInterface;
@@ -112,14 +111,7 @@ public function get(string $name): Command
112111
{
113112
$this->registerCommands();
114113

115-
$command = parent::get($name);
116-
117-
if ($command instanceof ContainerAwareInterface) {
118-
trigger_deprecation('symfony/dependency-injection', '6.4', 'Relying on "%s" to get the container in "%s" is deprecated, register the command as a service and use dependency injection instead.', ContainerAwareInterface::class, get_debug_type($command));
119-
$command->setContainer($this->kernel->getContainer());
120-
}
121-
122-
return $command;
114+
return parent::get($name);
123115
}
124116

125117
public function all(string $namespace = null): array

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Controller;
1313

14-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
1514
use Symfony\Component\HttpKernel\Controller\ContainerControllerResolver;
1615

1716
/**
@@ -25,10 +24,6 @@ protected function instantiateController(string $class): object
2524
{
2625
$controller = parent::instantiateController($class);
2726

28-
if ($controller instanceof ContainerAwareInterface) {
29-
trigger_deprecation('symfony/dependency-injection', '6.4', 'Relying on "%s" to get the container in "%s" is deprecated, register the controller as a service and use dependency injection instead.', ContainerAwareInterface::class, get_debug_type($controller));
30-
$controller->setContainer($this->container);
31-
}
3227
if ($controller instanceof AbstractController) {
3328
if (null === $previousContainer = $controller->setContainer($this->container)) {
3429
throw new \LogicException(sprintf('"%s" has no container set, did you forget to define it as a service subscriber?', $class));

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