diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
index 3b9130a8e4..e4852da379 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Helper\TableSeparator;
use Symfony\Component\Console\Input\InputInterface;
@@ -26,7 +27,7 @@ use Symfony\Component\HttpKernel\KernelInterface;
*
* @final since version 3.4
*/
-class AboutCommand extends ContainerAwareCommand
+class AboutCommand extends Command
{
/**
* {@inheritdoc}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php
index 4a31f80901..d314748670 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -29,7 +30,7 @@ use Symfony\Component\HttpKernel\Bundle\BundleInterface;
*
* @final since version 3.4
*/
-class AssetsInstallCommand extends ContainerAwareCommand
+class AssetsInstallCommand extends Command
{
const METHOD_COPY = 'copy';
const METHOD_ABSOLUTE_SYMLINK = 'absolute symlink';
@@ -37,19 +38,8 @@ class AssetsInstallCommand extends ContainerAwareCommand
private $filesystem;
- /**
- * @param Filesystem $filesystem
- */
- public function __construct($filesystem = null)
+ public function __construct(Filesystem $filesystem)
{
- 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);
-
- parent::__construct($filesystem);
-
- return;
- }
-
parent::__construct();
$this->filesystem = $filesystem;
@@ -96,17 +86,11 @@ EOT
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- // BC to be removed in 4.0
- if (null === $this->filesystem) {
- $this->filesystem = $this->getContainer()->get('filesystem');
- $baseDir = $this->getContainer()->getParameter('kernel.project_dir');
- }
-
$kernel = $this->getApplication()->getKernel();
$targetArg = rtrim($input->getArgument('target'), '/');
if (!is_dir($targetArg)) {
- $targetArg = (isset($baseDir) ? $baseDir : $kernel->getContainer()->getParameter('kernel.project_dir')).'/'.$targetArg;
+ $targetArg = $kernel->getContainer()->getParameter('kernel.project_dir').'/'.$targetArg;
if (!is_dir($targetArg)) {
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
index f60ce74e73..3a436aefbe 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@@ -27,7 +28,7 @@ use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
*
* @final since version 3.4
*/
-class CacheClearCommand extends ContainerAwareCommand
+class CacheClearCommand extends Command
{
private $cacheClearer;
private $filesystem;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php
index fec933f67b..2bd42e69ec 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
use Psr\Cache\CacheItemPoolInterface;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
@@ -23,23 +24,12 @@ use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer;
*
* @author Nicolas Grekas
*/
-final class CachePoolClearCommand extends ContainerAwareCommand
+final class CachePoolClearCommand extends Command
{
private $poolClearer;
- /**
- * @param Psr6CacheClearer $poolClearer
- */
- public function __construct($poolClearer = null)
+ public function __construct(Psr6CacheClearer $poolClearer)
{
- 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);
-
- parent::__construct($poolClearer);
-
- return;
- }
-
parent::__construct();
$this->poolClearer = $poolClearer;
@@ -70,12 +60,6 @@ EOF
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- // BC to be removed in 4.0
- if (null === $this->poolClearer) {
- $this->poolClearer = $this->getContainer()->get('cache.global_clearer');
- $cacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
- }
-
$io = new SymfonyStyle($input, $output);
$kernel = $this->getApplication()->getKernel();
$pools = array();
@@ -99,7 +83,7 @@ EOF
foreach ($clearers as $id => $clearer) {
$io->comment(sprintf('Calling cache clearer: %s', $id));
- $clearer->clear(isset($cacheDir) ? $cacheDir : $kernel->getContainer()->getParameter('kernel.cache_dir'));
+ $clearer->clear($kernel->getContainer()->getParameter('kernel.cache_dir'));
}
foreach ($pools as $id => $pool) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php
index 57972782dc..b890ce8c3f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@@ -24,23 +25,12 @@ use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate;
*
* @final since version 3.4
*/
-class CacheWarmupCommand extends ContainerAwareCommand
+class CacheWarmupCommand extends Command
{
private $cacheWarmer;
- /**
- * @param CacheWarmerAggregate $cacheWarmer
- */
- public function __construct($cacheWarmer = null)
+ public function __construct(CacheWarmerAggregate $cacheWarmer)
{
- if (!$cacheWarmer instanceof CacheWarmerAggregate) {
- @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);
-
- parent::__construct($cacheWarmer);
-
- return;
- }
-
parent::__construct();
$this->cacheWarmer = $cacheWarmer;
@@ -77,12 +67,6 @@ EOF
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- // BC to be removed in 4.0
- if (null === $this->cacheWarmer) {
- $this->cacheWarmer = $this->getContainer()->get('cache_warmer');
- $cacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
- }
-
$io = new SymfonyStyle($input, $output);
$kernel = $this->getApplication()->getKernel();
@@ -92,7 +76,7 @@ EOF
$this->cacheWarmer->enableOptionalWarmers();
}
- $this->cacheWarmer->warmUp(isset($cacheDir) ? $cacheDir : $kernel->getContainer()->getParameter('kernel.cache_dir'));
+ $this->cacheWarmer->warmUp($kernel->getContainer()->getParameter('kernel.cache_dir'));
$io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully warmed.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
index 51c0496987..6ec4f4b8c4 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
@@ -13,6 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Command;
use Symfony\Bundle\FrameworkBundle\Console\Helper\DescriptorHelper;
use Symfony\Component\Config\ConfigCache;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
@@ -30,7 +31,7 @@ use Symfony\Component\Config\FileLocator;
*
* @internal since version 3.4
*/
-class ContainerDebugCommand extends ContainerAwareCommand
+class ContainerDebugCommand extends Command
{
/**
* @var ContainerBuilder|null
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php
index 18aa08575c..69144d300e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
use Symfony\Bundle\FrameworkBundle\Console\Helper\DescriptorHelper;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
@@ -26,23 +27,12 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
*
* @final since version 3.4
*/
-class EventDispatcherDebugCommand extends ContainerAwareCommand
+class EventDispatcherDebugCommand extends Command
{
private $dispatcher;
- /**
- * @param EventDispatcherInterface $dispatcher
- */
- public function __construct($dispatcher = null)
+ public function __construct(EventDispatcherInterface $dispatcher)
{
- 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);
-
- parent::__construct($dispatcher);
-
- return;
- }
-
parent::__construct();
$this->dispatcher = $dispatcher;
@@ -81,11 +71,6 @@ EOF
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- // BC to be removed in 4.0
- if (null === $this->dispatcher) {
- $this->dispatcher = $this->getEventDispatcher();
- }
-
$io = new SymfonyStyle($input, $output);
$options = array();
@@ -105,16 +90,4 @@ EOF
$options['output'] = $io;
$helper->describe($io, $this->dispatcher, $options);
}
-
- /**
- * Loads the Event Dispatcher from the container.
- *
- * BC to removed in 4.0
- *
- * @return EventDispatcherInterface
- */
- protected function getEventDispatcher()
- {
- return $this->getContainer()->get('event_dispatcher');
- }
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
index 2a00509032..61345c0c49 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
@@ -13,6 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Command;
use Symfony\Bundle\FrameworkBundle\Console\Helper\DescriptorHelper;
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -30,49 +31,17 @@ use Symfony\Component\Routing\Route;
*
* @final since version 3.4
*/
-class RouterDebugCommand extends ContainerAwareCommand
+class RouterDebugCommand extends Command
{
private $router;
- /**
- * @param RouterInterface $router
- */
- public function __construct($router = null)
+ public function __construct(RouterInterface $router)
{
- 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);
-
- parent::__construct($router);
-
- return;
- }
-
parent::__construct();
$this->router = $router;
}
- /**
- * {@inheritdoc}
- *
- * BC to be removed in 4.0
- */
- public function isEnabled()
- {
- if (null !== $this->router) {
- return parent::isEnabled();
- }
- if (!$this->getContainer()->has('router')) {
- return false;
- }
- $router = $this->getContainer()->get('router');
- if (!$router instanceof RouterInterface) {
- return false;
- }
-
- return parent::isEnabled();
- }
-
/**
* {@inheritdoc}
*/
@@ -104,11 +73,6 @@ EOF
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- // BC to be removed in 4.0
- if (null === $this->router) {
- $this->router = $this->getContainer()->get('router');
- }
-
$io = new SymfonyStyle($input, $output);
$name = $input->getArgument('name');
$helper = new DescriptorHelper();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php
index f88d2a2dfe..4c99b9dbe5 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -27,49 +28,17 @@ use Symfony\Component\Routing\Matcher\TraceableUrlMatcher;
*
* @final since version 3.4
*/
-class RouterMatchCommand extends ContainerAwareCommand
+class RouterMatchCommand extends Command
{
private $router;
- /**
- * @param RouterInterface $router
- */
- public function __construct($router = null)
+ public function __construct(RouterInterface $router)
{
- 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);
-
- parent::__construct($router);
-
- return;
- }
-
parent::__construct();
$this->router = $router;
}
- /**
- * {@inheritdoc}
- *
- * BC to be removed in 4.0
- */
- public function isEnabled()
- {
- if (null !== $this->router) {
- return parent::isEnabled();
- }
- if (!$this->getContainer()->has('router')) {
- return false;
- }
- $router = $this->getContainer()->get('router');
- if (!$router instanceof RouterInterface) {
- return false;
- }
-
- return parent::isEnabled();
- }
-
/**
* {@inheritdoc}
*/
@@ -103,11 +72,6 @@ EOF
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- // BC to be removed in 4.0
- if (null === $this->router) {
- $this->router = $this->getContainer()->get('router');
- }
-
$io = new SymfonyStyle($input, $output);
$context = $this->router->getContext();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
index f8e69a3c4a..933a60a2d0 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
@@ -34,7 +35,7 @@ use Symfony\Component\Translation\TranslatorInterface;
*
* @final since version 3.4
*/
-class TranslationDebugCommand extends ContainerAwareCommand
+class TranslationDebugCommand extends Command
{
const MESSAGE_MISSING = 0;
const MESSAGE_UNUSED = 1;
@@ -44,21 +45,8 @@ class TranslationDebugCommand extends ContainerAwareCommand
private $loader;
private $extractor;
- /**
- * @param TranslatorInterface $translator
- * @param TranslationLoader $loader
- * @param ExtractorInterface $extractor
- */
- public function __construct($translator = null, TranslationLoader $loader = null, ExtractorInterface $extractor = null)
+ public function __construct(TranslatorInterface $translator, TranslationLoader $loader, ExtractorInterface $extractor)
{
- 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);
-
- parent::__construct($translator);
-
- return;
- }
-
parent::__construct();
$this->translator = $translator;
@@ -116,35 +104,11 @@ EOF
;
}
- /**
- * {@inheritdoc}
- *
- * BC to be removed in 4.0
- */
- public function isEnabled()
- {
- if (null !== $this->translator) {
- return parent::isEnabled();
- }
- if (!class_exists('Symfony\Component\Translation\Translator')) {
- return false;
- }
-
- return parent::isEnabled();
- }
-
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- // BC to be removed in 4.0
- if (null === $this->translator) {
- $this->translator = $this->getContainer()->get('translator');
- $this->loader = $this->getContainer()->get('translation.loader');
- $this->extractor = $this->getContainer()->get('translation.extractor');
- }
-
$io = new SymfonyStyle($input, $output);
$locale = $input->getArgument('locale');
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
index 33adca99f1..0f0fc026af 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Translation\Catalogue\TargetOperation;
use Symfony\Component\Translation\Catalogue\MergeOperation;
@@ -31,7 +32,7 @@ use Symfony\Component\Translation\Writer\TranslationWriter;
*
* @final since version 3.4
*/
-class TranslationUpdateCommand extends ContainerAwareCommand
+class TranslationUpdateCommand extends Command
{
private $writer;
private $loader;
@@ -44,16 +45,8 @@ class TranslationUpdateCommand extends ContainerAwareCommand
* @param ExtractorInterface $extractor
* @param string $defaultLocale
*/
- public function __construct($writer = null, TranslationLoader $loader = null, ExtractorInterface $extractor = null, $defaultLocale = null)
+ public function __construct(TranslationWriter $writer, TranslationLoader $loader, ExtractorInterface $extractor, $defaultLocale)
{
- if (!$writer instanceof TranslationWriter) {
- @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);
-
- parent::__construct($writer);
-
- return;
- }
-
parent::__construct();
$this->writer = $writer;
@@ -100,36 +93,11 @@ EOF
;
}
- /**
- * {@inheritdoc}
- *
- * BC to be removed in 4.0
- */
- public function isEnabled()
- {
- if (null !== $this->writer) {
- return parent::isEnabled();
- }
- if (!class_exists('Symfony\Component\Translation\Translator')) {
- return false;
- }
-
- return parent::isEnabled();
- }
-
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- // BC to be removed in 4.0
- if (null === $this->writer) {
- $this->writer = $this->getContainer()->get('translation.writer');
- $this->loader = $this->getContainer()->get('translation.loader');
- $this->extractor = $this->getContainer()->get('translation.extractor');
- $this->defaultLocale = $this->getContainer()->getParameter('kernel.default_locale');
- }
-
$io = new SymfonyStyle($input, $output);
$errorIo = $io->getErrorStyle();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php
index 27e0f645d8..e06547103d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -23,18 +24,8 @@ use Symfony\Component\Workflow\Marking;
*
* @final since version 3.4
*/
-class WorkflowDumpCommand extends ContainerAwareCommand
+class WorkflowDumpCommand extends Command
{
- /**
- * {@inheritdoc}
- *
- * BC to be removed in 4.0
- */
- public function isEnabled()
- {
- return $this->getContainer()->has('workflow.registry');
- }
-
/**
* {@inheritdoc}
*/
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php
index 36876dee24..354d714694 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php
@@ -24,29 +24,21 @@ use Symfony\Component\Translation\Command\XliffLintCommand as BaseLintCommand;
*/
class XliffLintCommand extends BaseLintCommand
{
- public function __construct($name = null, $directoryIteratorProvider = null, $isReadableProvider = null)
+ public function __construct()
{
- if (func_num_args()) {
- @trigger_error(sprintf('Passing a constructor argument in "%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);
- }
+ $directoryIteratorProvider = function ($directory, $default) {
+ if (!is_dir($directory)) {
+ $directory = $this->getApplication()->getKernel()->locateResource($directory);
+ }
- if (null === $directoryIteratorProvider) {
- $directoryIteratorProvider = function ($directory, $default) {
- if (!is_dir($directory)) {
- $directory = $this->getApplication()->getKernel()->locateResource($directory);
- }
+ return $default($directory);
+ };
- return $default($directory);
- };
- }
+ $isReadableProvider = function ($fileOrDirectory, $default) {
+ return 0 === strpos($fileOrDirectory, '@') || $default($fileOrDirectory);
+ };
- if (null === $isReadableProvider) {
- $isReadableProvider = function ($fileOrDirectory, $default) {
- return 0 === strpos($fileOrDirectory, '@') || $default($fileOrDirectory);
- };
- }
-
- parent::__construct($name, $directoryIteratorProvider, $isReadableProvider);
+ parent::__construct(null, $directoryIteratorProvider, $isReadableProvider);
}
/**
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php
index f6c1a7f85b..267a57027e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php
@@ -23,29 +23,21 @@ use Symfony\Component\Yaml\Command\LintCommand as BaseLintCommand;
*/
class YamlLintCommand extends BaseLintCommand
{
- public function __construct($name = null, $directoryIteratorProvider = null, $isReadableProvider = null)
+ public function __construct()
{
- if (func_num_args()) {
- @trigger_error(sprintf('Passing a constructor argument in "%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);
- }
+ $directoryIteratorProvider = function ($directory, $default) {
+ if (!is_dir($directory)) {
+ $directory = $this->getApplication()->getKernel()->locateResource($directory);
+ }
- if (null === $directoryIteratorProvider) {
- $directoryIteratorProvider = function ($directory, $default) {
- if (!is_dir($directory)) {
- $directory = $this->getApplication()->getKernel()->locateResource($directory);
- }
+ return $default($directory);
+ };
- return $default($directory);
- };
- }
+ $isReadableProvider = function ($fileOrDirectory, $default) {
+ return 0 === strpos($fileOrDirectory, '@') || $default($fileOrDirectory);
+ };
- if (null === $isReadableProvider) {
- $isReadableProvider = function ($fileOrDirectory, $default) {
- return 0 === strpos($fileOrDirectory, '@') || $default($fileOrDirectory);
- };
- }
-
- parent::__construct($name, $directoryIteratorProvider, $isReadableProvider);
+ parent::__construct(null, $directoryIteratorProvider, $isReadableProvider);
}
/**
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php
index c201fe9db7..54fb8db8c6 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php
@@ -47,22 +47,6 @@ class RouterDebugCommandTest extends TestCase
$this->createCommandTester()->execute(array('name' => 'test'));
}
- /**
- * @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.
- */
- public function testLegacyDebugCommand()
- {
- $application = new Application($this->getKernel());
- $application->add(new RouterDebugCommand());
-
- $tester = new CommandTester($application->find('debug:router'));
-
- $tester->execute(array());
-
- $this->assertRegExp('/foo\s+ANY\s+ANY\s+ANY\s+\\/foo/', $tester->getDisplay());
- }
-
/**
* @return CommandTester
*/
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php
index 2570d41d78..7baa874355 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php
@@ -41,24 +41,6 @@ class RouterMatchCommandTest extends TestCase
$this->assertContains('None of the routes match the path "/test"', $tester->getDisplay());
}
- /**
- * @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.
- */
- public function testLegacyMatchCommand()
- {
- $application = new Application($this->getKernel());
- $application->add(new RouterMatchCommand());
- $application->add(new RouterDebugCommand());
-
- $tester = new CommandTester($application->find('router:match'));
-
- $tester->execute(array('path_info' => '/'));
-
- $this->assertContains('None of the routes match the path "/"', $tester->getDisplay());
- }
-
/**
* @return CommandTester
*/
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
index edf006c868..5926955a37 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
@@ -174,51 +174,6 @@ class TranslationDebugCommandTest extends TestCase
return new CommandTester($application->find('debug:translation'));
}
- /**
- * @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.
- */
- public function testLegacyDebugCommand()
- {
- $translator = $this->getMockBuilder('Symfony\Component\Translation\Translator')
- ->disableOriginalConstructor()
- ->getMock();
- $extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock();
- $loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader')->getMock();
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
- $kernel
- ->expects($this->any())
- ->method('getBundles')
- ->will($this->returnValue(array()));
-
- $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
- $container
- ->expects($this->any())
- ->method('get')
- ->will($this->returnValueMap(array(
- array('translation.extractor', 1, $extractor),
- array('translation.loader', 1, $loader),
- array('translator', 1, $translator),
- array('kernel', 1, $kernel),
- )));
-
- $kernel
- ->expects($this->any())
- ->method('getContainer')
- ->will($this->returnValue($container));
-
- $command = new TranslationDebugCommand();
- $command->setContainer($container);
-
- $application = new Application($kernel);
- $application->add($command);
-
- $tester = new CommandTester($application->find('debug:translation'));
- $tester->execute(array('locale' => 'en'));
-
- $this->assertContains('No defined or extracted', $tester->getDisplay());
- }
-
private function getBundle($path)
{
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
index db61398b26..ecdd5bc0a9 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
@@ -153,53 +153,6 @@ class TranslationUpdateCommandTest extends TestCase
return new CommandTester($application->find('translation:update'));
}
- /**
- * @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.
- */
- public function testLegacyUpdateCommand()
- {
- $translator = $this->getMockBuilder('Symfony\Component\Translation\Translator')
- ->disableOriginalConstructor()
- ->getMock();
- $extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock();
- $loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader')->getMock();
- $writer = $this->getMockBuilder('Symfony\Component\Translation\Writer\TranslationWriter')->getMock();
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
- $kernel
- ->expects($this->any())
- ->method('getBundles')
- ->will($this->returnValue(array()));
-
- $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
- $container
- ->expects($this->any())
- ->method('get')
- ->will($this->returnValueMap(array(
- array('translation.extractor', 1, $extractor),
- array('translation.loader', 1, $loader),
- array('translation.writer', 1, $writer),
- array('translator', 1, $translator),
- array('kernel', 1, $kernel),
- )));
-
- $kernel
- ->expects($this->any())
- ->method('getContainer')
- ->will($this->returnValue($container));
-
- $command = new TranslationUpdateCommand();
- $command->setContainer($container);
-
- $application = new Application($kernel);
- $application->add($command);
-
- $tester = new CommandTester($application->find('translation:update'));
- $tester->execute(array('locale' => 'en'));
-
- $this->assertContains('You must choose one of --force or --dump-messages', $tester->getDisplay());
- }
-
private function getBundle($path)
{
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
index 9a2d198a72..a4c945144e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
@@ -75,22 +75,6 @@ class CachePoolClearCommandTest extends WebTestCase
->execute(array('pools' => array('unknown_pool')), array('decorated' => false));
}
- /**
- * @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.
- */
- public function testLegacyClearCommand()
- {
- $application = new Application(static::$kernel);
- $application->add(new CachePoolClearCommand());
-
- $tester = new CommandTester($application->find('cache:pool:clear'));
-
- $tester->execute(array('pools' => array()));
-
- $this->assertContains('Cache was successfully cleared', $tester->getDisplay());
- }
-
private function createCommandTester()
{
$container = static::$kernel->getContainer();
diff --git a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php
index 597df8ceb9..d79176001a 100644
--- a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php
+++ b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php
@@ -11,7 +11,7 @@
namespace Symfony\Bundle\SecurityBundle\Command;
-use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Security\Acl\Dbal\Schema;
@@ -25,45 +25,19 @@ use Doctrine\DBAL\Schema\SchemaException;
*
* @final since version 3.4
*/
-class InitAclCommand extends ContainerAwareCommand
+class InitAclCommand extends Command
{
private $connection;
private $schema;
- /**
- * @param Connection $connection
- * @param Schema $schema
- */
- public function __construct($connection = null, Schema $schema = null)
+ public function __construct(Connection $connection, Schema $schema)
{
- 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);
-
- parent::__construct($connection);
-
- return;
- }
-
parent::__construct();
$this->connection = $connection;
$this->schema = $schema;
}
- /**
- * {@inheritdoc}
- *
- * BC to be removed in 4.0
- */
- public function isEnabled()
- {
- if (!$this->connection && !$this->getContainer()->has('security.acl.dbal.connection')) {
- return false;
- }
-
- return parent::isEnabled();
- }
-
/**
* {@inheritdoc}
*/
@@ -92,12 +66,6 @@ EOF
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- // BC to be removed in 4.0
- if (null === $this->connection) {
- $this->connection = $this->getContainer()->get('security.acl.dbal.connection');
- $this->schema = $this->getContainer()->get('security.acl.dbal.schema');
- }
-
try {
$this->schema->addToSchema($this->connection->getSchemaManager()->createSchema());
} catch (SchemaException $e) {
diff --git a/src/Symfony/Bundle/SecurityBundle/Command/SetAclCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/SetAclCommand.php
index 840e74edfb..59ecd6b0a0 100644
--- a/src/Symfony/Bundle/SecurityBundle/Command/SetAclCommand.php
+++ b/src/Symfony/Bundle/SecurityBundle/Command/SetAclCommand.php
@@ -11,7 +11,7 @@
namespace Symfony\Bundle\SecurityBundle\Command;
-use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -30,50 +30,17 @@ use Symfony\Component\Security\Acl\Model\MutableAclProviderInterface;
*
* @final since version 3.4
*/
-class SetAclCommand extends ContainerAwareCommand
+class SetAclCommand extends Command
{
private $provider;
- /**
- * @param MutableAclProviderInterface $provider
- */
- public function __construct($provider = null)
+ public function __construct(MutableAclProviderInterface $provider)
{
- 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);
-
- parent::__construct($provider);
-
- return;
- }
-
parent::__construct();
$this->provider = $provider;
}
- /**
- * {@inheritdoc}
- *
- * BC to be removed in 4.0
- */
- public function isEnabled()
- {
- if (null !== $this->provider) {
- return parent::isEnabled();
- }
- if (!$this->getContainer()->has('security.acl.provider')) {
- return false;
- }
-
- $provider = $this->getContainer()->get('security.acl.provider');
- if (!$provider instanceof MutableAclProviderInterface) {
- return false;
- }
-
- return parent::isEnabled();
- }
-
/**
* {@inheritdoc}
*/
@@ -116,14 +83,9 @@ EOF
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- // BC to be removed in 4.0
- if (null === $this->provider) {
- $this->provider = $this->getContainer()->get('security.acl.provider');
- }
-
// Parse arguments
$objectIdentities = array();
- $maskBuilder = $this->getMaskBuilder();
+ $maskBuilder = new MaskBuilder();
foreach ($input->getArgument('arguments') as $argument) {
$data = explode(':', $argument, 2);
@@ -187,16 +149,4 @@ EOF
$this->provider->updateAcl($acl);
}
}
-
- /**
- * Gets the mask builder.
- *
- * BC to be removed in 4.0
- *
- * @return MaskBuilder
- */
- protected function getMaskBuilder()
- {
- return new MaskBuilder();
- }
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php
index 1ceaca1002..37cbffd9be 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php
@@ -52,7 +52,7 @@ class SetAclCommandTest extends WebTestCase
$grantedPermission2 = 'EDIT';
$application = $this->getApplication();
- $application->add(new SetAclCommand());
+ $application->add(new SetAclCommand($application->getKernel()->getContainer()->get('security.acl.provider')));
$setAclCommand = $application->find('acl:set');
$setAclCommandTester = new CommandTester($setAclCommand);
diff --git a/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php b/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php
index 1474a4de0a..c0b175c3a2 100644
--- a/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php
+++ b/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php
@@ -12,8 +12,6 @@
namespace Symfony\Bundle\TwigBundle\Command;
use Symfony\Bridge\Twig\Command\LintCommand as BaseLintCommand;
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\Finder\Finder;
/**
@@ -22,11 +20,8 @@ use Symfony\Component\Finder\Finder;
* @author Marc Weistroff
* @author Jérôme Tamarelle
*/
-final class LintCommand extends BaseLintCommand implements ContainerAwareInterface
+final class LintCommand extends BaseLintCommand
{
- // BC to be removed in 4.0
- use ContainerAwareTrait;
-
/**
* {@inheritdoc}
*/
diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php
index 38dae64f8a..6befb3d0a2 100644
--- a/src/Symfony/Component/Yaml/Parser.php
+++ b/src/Symfony/Component/Yaml/Parser.php
@@ -181,15 +181,7 @@ class Parser
Inline::parse(null, $flags, $this->refs);
try {
Inline::$parsedLineNumber = $this->getRealCurrentLineNb();
- $i = 0;
- $evaluateKey = !(Yaml::PARSE_KEYS_AS_STRINGS & $flags);
-
- // constants in key will be evaluated anyway
- if (isset($values['key'][0]) && '!' === $values['key'][0] && Yaml::PARSE_CONSTANT & $flags) {
- $evaluateKey = true;
- }
-
- $key = Inline::parseScalar($values['key'], 0, null, $i, $evaluateKey);
+ $key = Inline::parseScalar($values['key']);
} catch (ParseException $e) {
$e->setParsedLine($this->getRealCurrentLineNb() + 1);
$e->setSnippet($this->currentLine);
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index c8142a46df..6500d307c0 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -45,16 +45,6 @@ class ParserTest extends TestCase
return $this->loadTestsFromFixtureFiles('index.yml');
}
- /**
- * @group legacy
- * @expectedDeprecationMessage Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since version 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable
- * @dataProvider getNonStringMappingKeysData
- */
- public function testNonStringMappingKeys($expected, $yaml, $comment)
- {
- $this->assertSame($expected, var_export($this->parser->parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS), true), $comment);
- }
-
public function getNonStringMappingKeysData()
{
return $this->loadTestsFromFixtureFiles('nonStringKeys.yml');
diff --git a/src/Symfony/Component/Yaml/Yaml.php b/src/Symfony/Component/Yaml/Yaml.php
index f41821bdfe..cd4e356896 100644
--- a/src/Symfony/Component/Yaml/Yaml.php
+++ b/src/Symfony/Component/Yaml/Yaml.php
@@ -32,11 +32,6 @@ class Yaml
const PARSE_CUSTOM_TAGS = 512;
const DUMP_EMPTY_ARRAY_AS_SEQUENCE = 1024;
- /**
- * @deprecated since version 3.4, to be removed in 4.0. Quote your evaluable keys instead.
- */
- const PARSE_KEYS_AS_STRINGS = 2048;
-
/**
* Parses YAML into a PHP value.
*