8000 Fix deprecations regarding core commands registered as services · symfony/symfony@33154bf · GitHub
[go: up one dir, main page]

Skip to content

Commit 33154bf

Browse files
author
Robin Chalas
committed
Fix deprecations regarding core commands registered as services
1 parent adc862a commit 33154bf

20 files changed

+152
-24
lines changed

UPGRADE-3.4.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,52 @@ FrameworkBundle
120120
class has been deprecated and will be removed in 4.0. Use the
121121
`Symfony\Component\Translation\Reader\TranslationReader` class instead.
122122

123-
* The `translation.loader` service has been deprecated and will be removed in 4.0. Use the `translation.reader` service instead.
123+
* The `translation.loader` service has been deprecated and will be removed in 4.0.
124+
Use the `translation.reader` service instead..
125+
126+
* `AssetsInstallCommand::__construct()` now takes an instance of
127+
`Symfony\Component\Filesystem\Filesystem` as first argument.
128+
Not passing it is deprecated and will throw a `TypeError` in 4.0.
129+
130+
* `CacheClearCommand::__construct()` now takes an instance of
131+
`Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface` as
132+
first argument. Not passing it is deprecated and will throw
133+
a `TypeError` in 4.0.
134+
135+
* `CachePoolClearCommand::__construct()` now takes an instance of
136+
`Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer` as
137+
first argument. Not passing it is deprecated and will throw
138+
a `TypeError` in 4.0.
139+
140+
* `EventDispatcherDebugCommand::__construct()` now takes an instance of
141+
`Symfony\Component\EventDispatcher\EventDispatcherInterface` as
142+
first argument. Not passing it is deprecated and will throw
143+
a `TypeError` in 4.0.
144+
145+
* `RouterDebugCommand::__construct()` now takes an instance of
146+
`Symfony\Component\Routing\RouterInteface` as
147+
first argument. Not passing it is deprecated and will throw
148+
a `TypeError` in 4.0.
149+
150+
* `RouterMatchCommand::__construct()` now takes an instance of
151+
`Symfony\Component\Routing\RouterInteface` as
152+
first argument. Not passing it is deprecated and will throw
153+
a `TypeError` in 4.0.
154+
155+
* `TranslationDebugCommand::__construct()` now takes an instance of
156+
`Symfony\Component\Translation\TranslatorInterface` as
157+
first argument. Not passing it is deprecated and will throw
158+
a `TypeError` in 4.0.
159+
160+
* `TranslationUpdateCommand::__construct()` now takes an instance of
161+
`Symfony\Component\Translation\TranslatorInterface` as
162+
first argument. Not passing it is deprecated and will throw
163+
a `TypeError` in 4.0.
164+
165+
* `AssetsInstallCommand`, `CacheClearCommand`, `CachePoolClearCommand`,
166+
`EventDispatcherDebugCommand`, `RouterDebugCommand`, `RouterMatchCommand`,
167+
`TranslationDebugCommand`, `TranslationUpdateCommand`, `XliffLintCommand`
168+
and `YamlLintCommand` classes have been marked as final
124169

125170
HttpKernel
126171
----------
@@ -168,6 +213,15 @@ SecurityBundle
168213

169214
* `FirewallContext::getListeners()` now returns `\Traversable|array`
170215

216+
* `InitAclCommand::__construct()` now takes an instance of
217+
`Doctrine\DBAL\Connection` as first argument. Not passing it is
218+
deprecated and will throw a `TypeError` in 4.0.
219+
220+
* `SetAclCommand::__construct()` now takes an instance of
221+
`Symfony\Component\Security\Acl\Model\MutableAclProviderInterfaceConnection`
222+
as first argument. Not passing it is deprecated and will throw a `TypeError`
223+
in 4.0.
224+
171225
Translation
172226
-----------
173227

UPGRADE-4.0.md

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,40 @@ FrameworkBundle
419419
class has been deprecated and will be removed in 4.0. Use the
420420
`Symfony\Component\Translation\Reader\TranslationReader` class instead.
421421

422-
* The `translation.loader` service has been deprecated and will be removed in 4.0. Use the `translation.reader` service instead.
422+
* The `translation.loader` service has been removed.
423+
Use the `translation.reader` service instead.
423424

425+
* `AssetsInstallCommand::__construct()` now requires an instance of
426+
`Symfony\Component\Filesystem\Filesystem` as first argument.
427+
428+
* `CacheClearCommand::__construct()` now requires an instance of
429+
`Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface` as
430+
first argument.
431+
432+
* `CachePoolClearCommand::__construct()` now requires an instance of
433+
`Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer` as
434+
first argument.
435+
436+
* `EventDispatcherDebugCommand::__construct()` now requires an instance of
437+
`Symfony\Component\EventDispatcher\EventDispatcherInterface` as
438+
first argument.
439+
440+
* `RouterDebugCommand::__construct()` now requires an instance of
441+
`Symfony\Component\Routing\RouterInteface` as
442+
first argument.
443+
444+
* `RouterMatchCommand::__construct()` now requires an instance of
445+
`Symfony\Component\Routing\RouterInteface` as
446+
first argument.
447+
448+
* `TranslationDebugCommand::__construct()` now requires an instance of
449+
`Symfony\Component\Translation\TranslatorInterface` as
450+
first argument.
451+
452+
* `TranslationUpdateCommand::__construct()` now requires an instance of
453+
`Symfony\Component\Translation\TranslatorInterface` as
454+
first argument.
455+
424456
HttpFoundation
425457
--------------
426458

@@ -568,6 +600,13 @@ SecurityBundle
568600

569601
* `UserPasswordEncoderCommand` does not extend `ContainerAwareCommand` nor implement `ContainerAwareInterface` anymore.
570602

603+
* `InitAclCommand::__construct()` now requires an instance of
604+
`Doctrine\DBAL\Connection` as first argument.
605+
606+
* `SetAclCommand::__construct()` now requires an instance of
607+
`Symfony\Component\Security\Acl\Model\MutableAclProviderInterfaceConnection`
608+
as first argument.
609+
571610
Serializer
572611
----------
573612

@@ -642,11 +681,12 @@ TwigBridge
642681
* The `TwigRendererEngine::setEnvironment()` method has been removed.
643682
Pass the Twig Environment as second argument of the constructor instead.
644683

645-
* Removed `Symfony\Bridge\Twig\Command\DebugCommand::set/getTwigEnvironment` and the ability
646-
to pass a command name as first argument.
684+
* Removed `DebugCommand::set/getTwigEnvironment`. Pass an instance of
685+
`Twig\Environment` as first argument `DebugCommand::__construct()` instead
686+
687+
* Removed `LintCommand::set/getTwigEnvironment`. Pass an instance of
688+
`Twig\Environment` as first argument `LintCommand::__construct()` instead
647689

648-
* Removed `Symfony\Bridge\Twig\Command\LintCommand::set/getTwigEnvironment` and the ability
649-
to pass a command name as first argument.
650690

651691
Validator
652692
---------

src/Symfony/Bridge/Twig/CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ CHANGELOG
55
-----
66

77
* deprecated `Symfony\Bridge\Twig\Form\TwigRenderer`
8-
* deprecated `Symfony\Bridge\Twig\Command\DebugCommand::set/getTwigEnvironment` and the ability to pass a command name as first argument
9-
* deprecated `Symfony\Bridge\Twig\Command\LintCommand::set/getTwigEnvironment` and the ability to pass a command name as first argument
8+
* deprecated `DebugCommand::set/getTwigEnvironment`. Pass an instance of
9+
`Twig\Environment` as first argument `DebugCommand::__construct()` instead
10+
* deprecated `LintCommand::set/getTwigEnvironment`. Pass an instance of
11+
`Twig\Environment` as first argument `LintCommand::__construct()` instead
1012

1113
3.3.0
1214
-----

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,33 @@ CHANGELOG
2626
* Deprecated `Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader`, use
2727
`Symfony\Component\Translation\Reader\TranslationReader` instead
2828
* Deprecated `translation.loader` service, use `translation.reader` instead
29+
* `AssetsInstallCommand::__construct()` now takes an instance of
30+
`Symfony\Component\Filesystem\Filesystem` as first argument
31+
* `CacheClearCommand::__construct()` now takes an instance of
32+
`Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface` as
33+
first argument
34+
* `CachePoolClearCommand::__construct()` now takes an instance of
35+
`Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer` as
36+
first argument
37+
* `EventDispatcherDebugCommand::__construct()` now takes an instance of
38+
`Symfony\Component\EventDispatcher\EventDispatcherInterface` as
39+
first argument
40+
* `RouterDebugCommand::__construct()` now takes an instance of
41+
`Symfony\Component\Routing\RouterInteface` as
42+
first argument
43+
* `RouterMatchCommand::__construct()` now takes an instance of
44+
`Symfony\Component\Routing\RouterInteface` as
45+
first argument
46+
* `TranslationDebugCommand::__construct()` now takes an instance of
47+
`Symfony\Component\Translation\TranslatorInterface` as
48+
first argument
49+
* `TranslationUpdateCommand::__construct()` now takes an instance of
50+
`Symfony\Component\Translation\TranslatorInterface` as
51+
first argument
52+
* `AssetsInstallCommand`, `CacheClearCommand`, `CachePoolClearCommand`,
53+
`EventDispatcherDebugCommand`, `RouterDebugCommand`, `RouterMatchCommand`,
54+
`TranslationDebugCommand`, `TranslationUpdateCommand`, `XliffLintCommand`
55+
and `YamlLintCommand` classes have been marked as final
2956

3057
3.3.0
3158
-----

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class AssetsInstallCommand extends ContainerAwareCommand
4545
public function __construct($filesystem = null)
4646
{
4747
if (!$filesystem instanceof Filesystem) {
48-
@trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
48+
@trigger_error(sprintf('%s() expects an instance of "%s" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, Filesystem::class), E_USER_DEPRECATED);
4949

5050
parent::__construct($filesystem);
5151

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class CacheClearCommand extends ContainerAwareCommand
4545
public function __construct($cacheClearer = null, Filesystem $filesystem = null)
4646
{
4747
if (!$cacheClearer instanceof CacheClearerInterface) {
48-
@trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
48+
@trigger_error(sprintf('%s() expects an instance of "%s" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, CacheClearerInterface::class), E_USER_DEPRECATED);
4949

5050
parent::__construct($cacheClearer);
5151

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ final class CachePoolClearCommand extends ContainerAwareCommand
3535
public function __construct($poolClearer = null)
3636
{
3737
if (!$poolClearer instanceof Psr6CacheClearer) {
38-
@trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
38+
@trigger_error(sprintf('%s() expects an instance of "%s" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, Psr6CacheClearer::class), E_USER_DEPRECATED);
3939

4040
parent::__construct($poolClearer);
4141

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class EventDispatcherDebugCommand extends ContainerAwareCommand
3737
public function __construct($dispatcher = null)
3838
{
3939
if (!$dispatcher instanceof EventDispatcherInterface) {
40-
@trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
40+
@trigger_error(sprintf('%s() expects an instance of "%s" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, EventDispatcherInterface::class), E_USER_DEPRECATED);
4141

4242
parent::__construct($dispatcher);
4343

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class RouterDebugCommand extends ContainerAwareCommand
4141
public function __construct($router = null)
4242
{
4343
if (!$router instanceof RouterInterface) {
44-
@trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
44+
@trigger_error(sprintf('%s() expects an instance of "%s" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, RouterInterface::class), E_USER_DEPRECATED);
4545

4646
parent::__construct($router);
4747

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class RouterMatchCommand extends ContainerAwareCommand
3939
public function __construct($router = null)
4040
{
4141
if (!$router instanceof RouterInterface) {
42-
@trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
42+
@trigger_error(sprintf('%s() expects an instance of "%s" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, RouterInterface::class), E_USER_DEPRECATED);
4343

4444
parent::__construct($router);
4545

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class TranslationDebugCommand extends ContainerAwareCommand
5454
public function __construct($translator = null, TranslationReaderInterface $reader = null, ExtractorInterface $extractor = null)
5555
{
5656
if (!$translator instanceof TranslatorInterface) {
57-
@trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
57+
@trigger_error(sprintf('%s() expects an instance of "%s" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, TranslatorInterface::class), E_USER_DEPRECATED);
5858

5959
parent::__construct($translator);
6060

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class TranslationUpdateCommand extends ContainerAwareCommand
4949
public function __construct($writer = null, TranslationReaderInterface $reader = null, ExtractorInterface $extractor = null, $defaultLocale = null)
5050
{
5151
if (!$writer instanceof TranslationWriterInterface) {
52-
@trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
52+
@trigger_error(sprintf('%s() expects an instance of "%s" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, TranslationWriterInterface::class), E_USER_DEPRECATED);
5353

5454
parent::__construct($writer);
5555

src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testDebugInvalidRoute()
4949

5050
/**
5151
* @group legacy
52-
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand::__construct" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.
52+
* @expectedDeprecation Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand::__construct() expects an instance of "Symfony\Component\Routing\RouterInterface" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.
5353
*/
5454
public function testLegacyDebugCommand()
5555
{

src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public function testWithNotMatchPath()
4343

4444
/**
4545
* @group legacy
46-
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand::__construct" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.
47-
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand::__construct" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.
46+
* @expectedDeprecation Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand::__construct() expects an instance of "Symfony\Component\Routing\RouterInterface" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.
47+
* @expectedDeprecation Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand::__construct() expects an instance of "Symfony\Component\Routing\RouterInterface" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.
4848
*/
4949
public function testLegacyMatchCommand()
5050
{

src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private function createCommandTester($extractedMessages = array(), $loadedMessag
176176

177177
/**
178178
* @group legacy
179-
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand::__construct" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.
179+
* @expectedDeprecation Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand::__construct() expects an instance of "Symfony\Component\Translation\TranslatorInterface" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.
180180
*/
181181
public function testLegacyDebugCommand()
182182
{

src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ private function createCommandTester($extractedMessages = array(), $loadedMessag
155155

156156
/**
157157
* @group legacy
158-
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand::__construct" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.
158+
* @expectedDeprecation Symfony\Bundle\Framew 10000 orkBundle\Command\TranslationUpdateCommand::__construct() expects an instance of "Symfony\Component\Translation\Writer\TranslationWriterInterface" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.
159159
*/
160160
public function testLegacyUpdateCommand()
161161
{

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function testClearUnexistingPool()
7777

7878
/**
7979
* @group legacy
80-
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bundle\FrameworkBundle\Command\CachePoolClearCommand::__construct" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.
80+
* @expectedDeprecation Symfony\Bundle\FrameworkBundle\Command\CachePoolClearCommand::__construct() expects an instance of "Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.
8181
*/
8282
public function testLegacyClearCommand()
8383
{

src/Symfony/Bundle/SecurityBundle/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ CHANGELOG
88
`VoterInterface` on the class is now deprecated and will be removed in 4.0.
99
* [BC BREAK] `FirewallContext::getListeners()` now returns `\Traversable|array`
1010
* added info about called security listeners in profiler
11+
* `InitAclCommand::__construct()` now takes an instance of
12+
`Doctrine\DBAL\Connection` as first argument
13+
* `SetAclCommand::__construct()` now takes an instance of
14+
`Symfony\Component\Security\Acl\Model\MutableAclProviderInterfaceConnection`
15+
as first argument
1116

1217
3.3.0
1318
-----

src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class InitAclCommand extends ContainerAwareCommand
3939
public function __construct($connection = null, Schema $schema = null)
4040
{
4141
if (!$connection instanceof Connection) {
42-
@trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
42+
@trigger_error(sprintf('%s() expects an instance of "%s" as 1st argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, Connection::class), E_USER_DEPRECATED);
4343

4444
parent::__construct($connection);
4545

0 commit comments

Comments
 (0)
0