Skip to content

Commit b55ab43

Browse files
author
Robin Chalas
committed
Fix deprecations regarding core commands registered as services
1 parent 2cc10cc commit b55ab43

14 files changed

+41
-14
lines changed

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
-----

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

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

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

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

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

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

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 first 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

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 first 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

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 first argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.
5353
*/
5454
public function testLegacyDebugCommand()
5555
{

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 first 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 first argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.
4848
*/
4949
public function testLegacyMatchCommand()
5050
{

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 first argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.
180180
*/
181181
public function testLegacyDebugCommand()
182182
{

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\FrameworkBundle\Command\TranslationUpdateCommand::__construct() expects an instance of "Symfony\Component\Translation\Writer\TranslationWriterInterface" as first argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.
159159
*/
160160
public function testLegacyUpdateCommand()
161161
{

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 first argument since version 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.
8181
*/
8282
public function testLegacyClearCommand()
8383
{

0 commit comments

Comments
 (0)