Fix deprecations regarding core commands registered as services

This commit is contained in:
Robin Chalas 2017-08-12 12:12:58 +02:00
parent adc862ac21
commit 4659975944
20 changed files with 152 additions and 24 deletions

View File

@ -120,7 +120,52 @@ FrameworkBundle
class has been deprecated and will be removed in 4.0. Use the
`Symfony\Component\Translation\Reader\TranslationReader` class instead.
* The `translation.loader` service has been deprecated and will be removed in 4.0. Use the `translation.reader` service instead.
* The `translation.loader` service has been deprecated and will be removed in 4.0.
Use the `translation.reader` service instead..
* `AssetsInstallCommand::__construct()` now takes an instance of
`Symfony\Component\Filesystem\Filesystem` as first argument.
Not passing it is deprecated and will throw a `TypeError` in 4.0.
* `CacheClearCommand::__construct()` now takes an instance of
`Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `CachePoolClearCommand::__construct()` now takes an instance of
`Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `EventDispatcherDebugCommand::__construct()` now takes an instance of
`Symfony\Component\EventDispatcher\EventDispatcherInterface` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `RouterDebugCommand::__construct()` now takes an instance of
`Symfony\Component\Routing\RouterInteface` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `RouterMatchCommand::__construct()` now takes an instance of
`Symfony\Component\Routing\RouterInteface` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `TranslationDebugCommand::__construct()` now takes an instance of
`Symfony\Component\Translation\TranslatorInterface` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `TranslationUpdateCommand::__construct()` now takes an instance of
`Symfony\Component\Translation\TranslatorInterface` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `AssetsInstallCommand`, `CacheClearCommand`, `CachePoolClearCommand`,
`EventDispatcherDebugCommand`, `RouterDebugCommand`, `RouterMatchCommand`,
`TranslationDebugCommand`, `TranslationUpdateCommand`, `XliffLintCommand`
and `YamlLintCommand` classes have been marked as final
HttpKernel
----------
@ -168,6 +213,15 @@ SecurityBundle
* `FirewallContext::getListeners()` now returns `\Traversable|array`
* `InitAclCommand::__construct()` now takes an instance of
`Doctrine\DBAL\Connection` as first argument. Not passing it is
deprecated and will throw a `TypeError` in 4.0.
* `SetAclCommand::__construct()` now takes an instance of
`Symfony\Component\Security\Acl\Model\MutableAclProviderInterfaceConnection`
as first argument. Not passing it is deprecated and will throw a `TypeError`
in 4.0.
Translation
-----------

View File

@ -419,8 +419,40 @@ FrameworkBundle
class has been deprecated and will be removed in 4.0. Use the
`Symfony\Component\Translation\Reader\TranslationReader` class instead.
* The `translation.loader` service has been deprecated and will be removed in 4.0. Use the `translation.reader` service instead.
* The `translation.loader` service has been removed.
Use the `translation.reader` service instead.
* `AssetsInstallCommand::__construct()` now requires an instance of
`Symfony\Component\Filesystem\Filesystem` as first argument.
* `CacheClearCommand::__construct()` now requires an instance of
`Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface` as
first argument.
* `CachePoolClearCommand::__construct()` now requires an instance of
`Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer` as
first argument.
* `EventDispatcherDebugCommand::__construct()` now requires an instance of
`Symfony\Component\EventDispatcher\EventDispatcherInterface` as
first argument.
* `RouterDebugCommand::__construct()` now requires an instance of
`Symfony\Component\Routing\RouterInteface` as
first argument.
* `RouterMatchCommand::__construct()` now requires an instance of
`Symfony\Component\Routing\RouterInteface` as
first argument.
* `TranslationDebugCommand::__construct()` now requires an instance of
`Symfony\Component\Translation\TranslatorInterface` as
first argument.
* `TranslationUpdateCommand::__construct()` now requires an instance of
`Symfony\Component\Translation\TranslatorInterface` as
first argument.
HttpFoundation
--------------
@ -568,6 +600,13 @@ SecurityBundle
* `UserPasswordEncoderCommand` does not extend `ContainerAwareCommand` nor implement `ContainerAwareInterface` anymore.
* `InitAclCommand::__construct()` now requires an instance of
`Doctrine\DBAL\Connection` as first argument.
* `SetAclCommand::__construct()` now requires an instance of
`Symfony\Component\Security\Acl\Model\MutableAclProviderInterfaceConnection`
as first argument.
Serializer
----------
@ -642,11 +681,12 @@ TwigBridge
* The `TwigRendererEngine::setEnvironment()` method has been removed.
Pass the Twig Environment as second argument of the constructor instead.
* Removed `Symfony\Bridge\Twig\Command\DebugCommand::set/getTwigEnvironment` and the ability
to pass a command name as first argument.
* Removed `DebugCommand::set/getTwigEnvironment`. Pass an instance of
`Twig\Environment` as first argument of the constructor instead.
* Removed `LintCommand::set/getTwigEnvironment`. Pass an instance of
`Twig\Environment` as first argument of the constructor instead.
* Removed `Symfony\Bridge\Twig\Command\LintCommand::set/getTwigEnvironment` and the ability
to pass a command name as first argument.
Validator
---------

View File

@ -5,8 +5,10 @@ CHANGELOG
-----
* deprecated `Symfony\Bridge\Twig\Form\TwigRenderer`
* deprecated `Symfony\Bridge\Twig\Command\DebugCommand::set/getTwigEnvironment` and the ability to pass a command name as first argument
* deprecated `Symfony\Bridge\Twig\Command\LintCommand::set/getTwigEnvironment` and the ability to pass a command name as first argument
* deprecated `DebugCommand::set/getTwigEnvironment`. Pass an instance of
`Twig\Environment` as first argument of the constructor instead
* deprecated `LintCommand::set/getTwigEnvironment`. Pass an instance of
`Twig\Environment` as first argument of the constructor instead
3.3.0
-----

View File

@ -26,6 +26,33 @@ CHANGELOG
* Deprecated `Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader`, use
`Symfony\Component\Translation\Reader\TranslationReader` instead
* Deprecated `translation.loader` service, use `translation.reader` instead
* `AssetsInstallCommand::__construct()` now takes an instance of
`Symfony\Component\Filesystem\Filesystem` as first argument
* `CacheClearCommand::__construct()` now takes an instance of
`Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface` as
first argument
* `CachePoolClearCommand::__construct()` now takes an instance of
`Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer` as
first argument
* `EventDispatcherDebugCommand::__construct()` now takes an instance of
`Symfony\Component\EventDispatcher\EventDispatcherInterface` as
first argument
* `RouterDebugCommand::__construct()` now takes an instance of
`Symfony\Component\Routing\RouterInteface` as
first argument
* `RouterMatchCommand::__construct()` now takes an instance of
`Symfony\Component\Routing\RouterInteface` as
first argument
* `TranslationDebugCommand::__construct()` now takes an instance of
`Symfony\Component\Translation\TranslatorInterface` as
first argument
* `TranslationUpdateCommand::__construct()` now takes an instance of
`Symfony\Component\Translation\TranslatorInterface` as
first argument
* `AssetsInstallCommand`, `CacheClearCommand`, `CachePoolClearCommand`,
`EventDispatcherDebugCommand`, `RouterDebugCommand`, `RouterMatchCommand`,
`TranslationDebugCommand`, `TranslationUpdateCommand`, `XliffLintCommand`
and `YamlLintCommand` classes have been marked as final
3.3.0
-----

View File

@ -45,7 +45,7 @@ class AssetsInstallCommand extends ContainerAwareCommand
public function __construct($filesystem = null)
{
if (!$filesystem instanceof Filesystem) {
@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);
@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);
parent::__construct($filesystem);

View File

@ -45,7 +45,7 @@ class CacheClearCommand extends ContainerAwareCommand
public function __construct($cacheClearer = null, Filesystem $filesystem = null)
{
if (!$cacheClearer instanceof CacheClearerInterface) {
@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);
@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);
parent::__construct($cacheClearer);

View File

@ -35,7 +35,7 @@ final class CachePoolClearCommand extends ContainerAwareCommand
public function __construct($poolClearer = null)
{
if (!$poolClearer instanceof Psr6CacheClearer) {
@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);
@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);
parent::__construct($poolClearer);

View File

@ -37,7 +37,7 @@ class EventDispatcherDebugCommand extends ContainerAwareCommand
public function __construct($dispatcher = null)
{
if (!$dispatcher instanceof EventDispatcherInterface) {
@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);
@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);
parent::__construct($dispatcher);

View File

@ -41,7 +41,7 @@ class RouterDebugCommand extends ContainerAwareCommand
public function __construct($router = null)
{
if (!$router instanceof RouterInterface) {
@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);
@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);
parent::__construct($router);

View File

@ -39,7 +39,7 @@ class RouterMatchCommand extends ContainerAwareCommand
public function __construct($router = null)
{
if (!$router instanceof RouterInterface) {
@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);
@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);
parent::__construct($router);

View File

@ -54,7 +54,7 @@ class TranslationDebugCommand extends ContainerAwareCommand
public function __construct($translator = null, TranslationReaderInterface $reader = null, ExtractorInterface $extractor = null)
{
if (!$translator instanceof TranslatorInterface) {
@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);
@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);
parent::__construct($translator);

View File

@ -49,7 +49,7 @@ class TranslationUpdateCommand extends ContainerAwareCommand
public function __construct($writer = null, TranslationReaderInterface $reader = null, ExtractorInterface $extractor = null, $defaultLocale = null)
{
if (!$writer instanceof TranslationWriterInterface) {
@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);
@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);
parent::__construct($writer);

View File

@ -49,7 +49,7 @@ class RouterDebugCommandTest extends TestCase
/**
* @group legacy
* @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.
* @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.
*/
public function testLegacyDebugCommand()
{

View File

@ -43,8 +43,8 @@ class RouterMatchCommandTest extends TestCase
/**
* @group legacy
* @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.
* @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.
* @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.
* @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.
*/
public function testLegacyMatchCommand()
{

View File

@ -176,7 +176,7 @@ class TranslationDebugCommandTest extends TestCase
/**
* @group legacy
* @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.
* @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.
*/
public function testLegacyDebugCommand()
{

View File

@ -155,7 +155,7 @@ class TranslationUpdateCommandTest extends TestCase
/**
* @group legacy
* @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.
* @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.
*/
public function testLegacyUpdateCommand()
{

View File

@ -77,7 +77,7 @@ class CachePoolClearCommandTest extends WebTestCase
/**
* @group legacy
* @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.
* @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.
*/
public function testLegacyClearCommand()
{

View File

@ -8,6 +8,11 @@ CHANGELOG
`VoterInterface` on the class is now deprecated and will be removed in 4.0.
* [BC BREAK] `FirewallContext::getListeners()` now returns `\Traversable|array`
* added info about called security listeners in profiler
* `InitAclCommand::__construct()` now takes an instance of
`Doctrine\DBAL\Connection` as first argument
* `SetAclCommand::__construct()` now takes an instance of
`Symfony\Component\Security\Acl\Model\MutableAclProviderInterfaceConnection`
as first argument
3.3.0
-----

View File

@ -39,7 +39,7 @@ class InitAclCommand extends ContainerAwareCommand
public function __construct($connection = null, Schema $schema = null)
{
if (!$connection instanceof Connection) {
@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);
@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__, Connection::class), E_USER_DEPRECATED);
parent::__construct($connection);

View File

@ -42,7 +42,7 @@ class SetAclCommand extends ContainerAwareCommand
public function __construct($provider = null)
{
if (!$provider instanceof MutableAclProviderInterface) {
@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);
@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__, MutableAclProviderInterface::class), E_USER_DEPRECATED);
parent::__construct($provider);