8000 [FrameworkBundle] Deprecate ContainerAwareCommand · symfony/symfony@d962935 · GitHub
[go: up one dir, main page]

Skip to content

Commit d962935

Browse files
author
Robin Chalas
committed
[FrameworkBundle] Deprecate ContainerAwareCommand
1 parent 344b8ce commit d962935

File tree

5 files changed

+13
-0
lines changed

5 files changed

+13
-0
lines changed

UPGRADE-4.2.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ FrameworkBundle
8585
and will allow dumping optimized routers and using Unicode classes in requirements.
8686
* Added support for the SameSite attribute for session cookies. It is highly recommended to set this setting (`framework.session.cookie_samesite`) to `lax` for increased security against CSRF attacks.
8787
* The `Controller` class has been deprecated, use `AbstractController` instead.
88+
* The `ContainerAwareCommand` class has been deprecated, use `Symfony\Component\Console\Command\Command`
89+
with dependency injection instead.
8890

8991
Messenger
9092
---------

UPGRADE-5.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ FrameworkBundle
9393
* The `RequestDataCollector` class has been removed. Use the `Symfony\Component\HttpKernel\DataCollector\RequestDataCollector` class instead.
9494
* Removed `Symfony\Bundle\FrameworkBundle\Controller\Controller`. Use `Symfony\Bundle\FrameworkBundle\Controller\AbstractController` instead.
9595
* Added support for the SameSite attribute for session cookies. It is highly recommended to set this setting (`framework.session.cookie_samesite`) to `lax` for increased security against CSRF attacks.
96+
* The `ContainerAwareCommand` class has been removed, use `Symfony\Component\Console\Command\Command`
97+
with dependency injection instead.
9698

9799
HttpFoundation
98100
--------------

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ CHANGELOG
1111
* Deprecated the `Symfony\Bundle\FrameworkBundle\Controller\Controller` class in favor of `Symfony\Bundle\FrameworkBundle\Controller\AbstractController`.
1212
* Enabled autoconfiguration for `Psr\Log\LoggerAwareInterface`
1313
* Added new "auto" mode for `framework.session.cookie_secure` to turn it on when HTTPS is used
14+
* Deprecated the `ContainerAwareCommand` class in favor of `Symfony\Component\Console\Command\Command`
1415

1516
4.1.0
1617
-----

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@
1515
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
1616
use Symfony\Component\DependencyInjection\ContainerInterface;
1717

18+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use "%s" with dependency injection instead.', ContainerAwareCommand::class, Command::class), E_USER_DEPRECATED);
19+
1820
/**
1921
* Command.
2022
*
2123
* @author Fabien Potencier <fabien@symfony.com>
24+
*
25+
* @deprecated since Symfony 4.2, use {@see Command} instead.
2226
*/
2327
abstract class ContainerAwareCommand extends Command implements ContainerAwareInterface
2428
{

src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ public function testBundleCommandCanBeFoundByAlias()
101101
$this->assertSame($command, $application->find('alias'));
102102
}
103103

104+
/**
105+
* @group legacy
106+
* @expectedDeprecation The "Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand" class is deprecated since Symfony 4.2, use "Symfony\Component\Console\Command\Command" with dependency injection instead.
107+
*/
104108
public function testBundleCommandsHaveRightContainer()
105109
{
106110
$command = $this->getMockForAbstractClass('Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand', array('foo'), '', true, true, true, array('setContainer'));

0 commit comments

Comments
 (0)
0