Skip to content

Commit b80d8c8

Browse files
committed
minor symfony#24074 Fix deprecations regarding core commands registered as services (chalasr)
This PR was merged into the 3.4 branch. Discussion ---------- Fix deprecations regarding core commands registered as services | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#23624 (comment) | License | MIT | Doc PR | n/a Current deprecation messages can be confusing (see fixed ticket), this improves them and adds a bunch of missing CHANGELOG/UPGRADE entries on the same topic Commits ------- 4659975 Fix deprecations regarding core commands registered as services
2 parents b2e1415 + 4659975 commit b80d8c8

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
----------
@@ -170,6 +215,15 @@ SecurityBundle
170215

171216
* `FirewallContext::getListeners()` now returns `\Traversable|array`
172217

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

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

@@ -570,6 +602,13 @@ SecurityBundle
570602

571603
* `UserPasswordEncoderCommand` does not extend `ContainerAwareCommand` nor implement `ContainerAwareInterface` anymore.
572604

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

@@ -644,11 +683,12 @@ TwigBridge
644683
* The `TwigRendererEngine::setEnvironment()` method has been removed.
645684
Pass the Twig Environment as second argument of the constructor instead.
646685

647-
* Removed `Symfony\Bridge\Twig\Command\DebugCommand::set/getTwigEnvironment` and the ability
648-
to pass a command name as first argument.
686+
* Removed `DebugCommand::set/getTwigEnvironment`. Pass an instance of
687+
`Twig\Environment` as first argument of the constructor instead.
688+
689+
* Removed `LintCommand::set/getTwigEnvironment`. Pass an instance of
690+
`Twig\Environment` as first argument of the constructor instead.
649691

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

653693
Validator
654694
---------

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 of the constructor instead
10+
* deprecated `LintCommand::set/getTwigEnvironment`. Pass an instance of
11+
`Twig\Environment` as first argument of the constructor 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 first 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 first 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 first 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 first 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 first 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 first 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

0 commit comments

Comments
 (0)