8000 Fix deprecations regarding core commands registered as services by chalasr · Pull Request #24074 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Fix deprecations regarding core commands registered as services #24074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion UPGRADE-3.4.md
8000
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down Expand Up @@ -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
-----------

Expand Down
50 changes: 45 additions & 5 deletions UPGRADE-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------

Expand Down Expand Up @@ -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
----------

Expand Down Expand Up @@ -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
---------
Expand Down
6 changes: 4 additions & 2 deletions src/Symfony/Bridge/Twig/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
27 changes: 27 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Member Author
@chalasr chalasr Sep 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The If the command was registered by convention, make it a service instead hint is not useful here as we deprecated convention based registration meanwhile, which gives the very same hint if you use it.

@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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testDebugInvalidRoute()

/**
* @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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public function testWithNotMatchPath()

/**
* @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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private function createCommandTester($extractedMessages = array(), $loadedMessag

/**
* @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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private function createCommandTester($extractedMessages = array(), $loadedMessag

/**
* @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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function testClearUnexistingPool()

/**
* @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()
{
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Bundle/SecurityBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading
0