8000 remove deprecated code · symfony/symfony@87bc4c8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 87bc4c8

Browse files
committed
remove deprecated code
1 parent 57e31c2 commit 87bc4c8

18 files changed

+10
-411
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,8 @@ class AssetsInstallCommand extends ContainerAwareCommand
3737

3838
private $filesystem;
3939

40-
/**
41-
* @param Filesystem $filesystem
42-
*/
43-
public function __construct($filesystem = null)
40+
public function __construct(Filesystem $filesystem)
4441
{
45-
if (!$filesystem instanceof Filesystem) {
46-
@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);
47-
48-
parent::__construct($filesystem);
49-
50-
return;
51-
}
52-
5342
parent::__construct();
5443

5544
$this->filesystem = $filesystem;
@@ -96,12 +85,6 @@ protected function configure()
9685
*/
9786
protected function execute(InputInterface $input, OutputInterface $output)
9887
{
99-
// BC to be removed in 4.0
100-
if (null === $this->filesystem) {
101-
$this->filesystem = $this->getContainer()->get('filesystem');
102-
$baseDir = $this->getContainer()->getParameter('kernel.project_dir');
103-
}
104-
10588
$kernel = $this->getApplication()->getKernel();
10689
$targetArg = rtrim($input->getArgument('target'), '/');
10790

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,8 @@ final class CachePoolClearCommand extends ContainerAwareCommand
2727
{
2828
private $poolClearer;
2929

30-
/**
31-
* @param Psr6CacheClearer $poolClearer
32-
*/
33-
public function __construct($poolClearer = null)
30+
public function __construct(Psr6CacheClearer $poolClearer)
3431
{
35-
if (!$poolClearer instanceof Psr6CacheClearer) {
36-
@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);
37-
38-
parent::__construct($poolClearer);
39-
40-
return;
41-
}
42-
4332
parent::__construct();
4433

4534
$this->poolClearer = $poolClearer;
@@ -70,12 +59,6 @@ protected function configure()
7059
*/
7160
protected function execute(InputInterface $input, OutputInterface $output)
7261
{
73-
// BC to be removed in 4.0
74-
if (null === $this->poolClearer) {
75-
$this->poolClearer = $this->getContainer()->get('cache.global_clearer');
76-
$cacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
77-
}
78-
7962
$io = new SymfonyStyle($input, $output);
8063
$kernel = $this->getApplication()->getKernel();
8164
$pools = array();

src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,8 @@ class CacheWarmupCommand extends ContainerAwareCommand
2828
{
2929
private $cacheWarmer;
3030

31-
/**
32-
* @param CacheWarmerAggregate $cacheWarmer
33-
*/
34-
public function __construct($cacheWarmer = null)
31+
public function __construct(CacheWarmerAggregate $cacheWarmer)
3532
{
36-
if (!$cacheWarmer instanceof CacheWarmerAggregate) {
37-
@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-
39-
parent::__construct($cacheWarmer);
40-
41-
return;
42-
}
43-
4433
parent::__construct();
4534

4635
$this->cacheWarmer = $cacheWarmer;
@@ -77,12 +66,6 @@ protected function configure()
7766
*/
7867
protected function execute(InputInterface $input, OutputInterface $output)
7968
{
80-
// BC to be removed in 4.0
81-
if (null === $this->cacheWarmer) {
82-
$this->cacheWarmer = $this->getContainer()->get('cache_warmer');
83-
$cacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
84-
}
85-
8669
$io = new SymfonyStyle($input, $output);
8770

8871
$kernel = $this->getApplication()->getKernel();

src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,8 @@ class EventDispatcherDebugCommand extends ContainerAwareCommand
3030
{
3131
private $dispatcher;
3232

33-
/**
34-
* @param EventDispatcherInterface $dispatcher
35-
*/
36-
public function __construct($dispatcher = null)
33+
public function __construct(EventDispatcherInterface $dispatcher)
3734
{
38-
if (!$dispatcher instanceof EventDispatcherInterface) {
39-
@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-
41-
parent::__construct($dispatcher);
42-
43-
return;
44-
}
45-
4635
parent::__construct();
4736

4837
$this->dispatcher = $dispatcher;
@@ -81,11 +70,6 @@ protected function configure()
8170
*/
8271
protected function execute(InputInterface $input, OutputInterface $output)
8372
{
84-
// BC to be removed in 4.0
85-
if (null === $this->dispatcher) {
86-
$this->dispatcher = $this->getEventDispatcher();
87-
}
88-
8973
$io = new SymfonyStyle($input, $output);
9074

9175
$options = array();
@@ -105,16 +89,4 @@ protected function execute(InputInterface $input, OutputInterface $output)
10589
$options['output'] = $io;
10690
$helper->describe($io, $this->dispatcher, $options);
10791
}
108-
109-
/**
110-
* Loads the Event Dispatcher from the container.
111-
*
112-
* BC to removed in 4.0
113-
*
114-
* @return EventDispatcherInterface
115-
*/
116-
protected function getEventDispatcher()
117-
{
118-
return $this->getContainer()->get('event_dispatcher');
119-
}
12092
}

src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -34,45 +34,13 @@ class RouterDebugCommand extends ContainerAwareCommand
3434
{
3535
private $router;
3636

37-
/**
38-
* @param RouterInterface $router
39-
*/
40-
public function __construct($router = null)
37+
public function __construct(RouterInterface $router)
4138
{
42-
if (!$router instanceof RouterInterface) {
43-
@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-
45-
parent::__construct($router);
46-
47-
return;
48-
}
49-
5039
parent::__construct();
5140

5241
$this->router = $router;
5342
}
5443

55-
/**
56-
* {@inheritdoc}
57-
*
58-
* BC to be removed in 4.0
59-
*/
60-
public function isEnabled()
61-
{
62-
if (null !== $this->router) {
63-
return parent::isEnabled();
64-
}
65-
if (!$this->getContainer()->has('router')) {
66-
return false;
67-
}
68-
$router = $this->getContainer()->get('router');
69-
if (!$router instanceof RouterInterface) {
70-
return false;
71-
}
72-
73-
return parent::isEnabled();
74-
}
75-
7644
/**
7745
* {@inheritdoc}
7846
*/
@@ -104,11 +72,6 @@ protected function configure()
10472
*/
10573
protected function execute(InputInterface $input, OutputInterface $output)
10674
{
107-
// BC to be removed in 4.0
108-
if (null === $this->router) {
109-
$this->router = $this->getContainer()->get('router');
110-
}
111-
11275
$io = new SymfonyStyle($input, $output);
11376
$name = $input->getArgument('name');
11477
$helper = new DescriptorHelper();

src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -31,45 +31,13 @@ class RouterMatchCommand extends ContainerAwareCommand
3131
{
3232
private $router;
3333

34-
/**
35-
* @param RouterInterface $router
36-
*/
37-
public function __construct($router = null)
34+
public function __construct(RouterInterface $router)
3835
{
39-
if (!$router instanceof RouterInterface) {
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);
41-
42-
parent::__construct($router);
43-
44-
return;
45-
}
46-
4736
parent::__construct();
4837

4938
$this->router = $router;
5039
}
5140

52-
/**
53-
* {@inheritdoc}
54-
*
55-
* BC to be removed in 4.0
56-
*/
57-
public function isEnabled()
58-
{
59-
if (null !== $this->router) {
60-
return parent::isEnabled();
61-
}
62-
if (!$this->getContainer()->has('router')) {
63-
return false;
64-
}
65-
$router = $this->getContainer()->get('router');
66-
if (!$router instanceof RouterInterface) {
67-
return false;
68-
}
69-
70-
return parent::isEnabled();
71-
}
72-
7341
/**
7442
* {@inheritdoc}
7543
*/
@@ -103,11 +71,6 @@ protected function configure()
10371
*/
10472
protected function execute(InputInterface $input, OutputInterface $output)
10573
{
106-
// BC to be removed in 4.0
107-
if (null === $this->router) {
108-
$this->router = $this->getContainer()->get('router');
109-
}
110-
11174
$io = new SymfonyStyle($input, $output);
11275

11376
$context = $this->router->getContext();

src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,8 @@ class TranslationDebugCommand extends ContainerAwareCommand
4444
private $loader;
4545
private $extractor;
4646

47-
/**
48-
* @param TranslatorInterface $translator
49-
* @param TranslationLoader $loader
50-
* @param ExtractorInterface $extractor
51-
*/
52-
public function __construct($translator = null, TranslationLoader $loader = null, ExtractorInterface $extractor = null)
47+
public function __construct(TranslatorInterface $translator, TranslationLoader $loader, ExtractorInterface $extractor)
5348
{
54-
if (!$translator instanceof TranslatorInterface) {
55-
@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);
56-
57-
parent::__construct($translator);
58-
59-
return;
60-
}
61-
6249
parent::__construct();
6350

6451
$this->translator = $translator;
@@ -116,35 +103,11 @@ protected function configure()
116103
;
117104
}
118105

119-
/**
120-
* {@inheritdoc}
121-
*
122-
* BC to be removed in 4.0
123-
*/
124-
public function isEnabled()
125-
{
126-
if (null !== $this->translator) {
127-
return parent::isEnabled();
128-
}
129-
if (!class_exists('Symfony\Component\Translation\Translator')) {
130-
return false;
131-
}
132-
133-
return parent::isEnabled();
134-
}
135-
136106
/**
137107
* {@inheritdoc}
138108
*/
139109
protected function execute(InputInterface $input, OutputInterface $output)
140110
{
141-
// BC to be removed in 4.0
142-
if (null === $this->translator) {
143-
$this->translator = $this->getContainer()->get('translator');
144-
$this->loader = $this->getContainer()->get('translation.loader');
145-
$this->extractor = $this->getContainer()->get('translation.extractor');
146-
}
147-
148111
$io = new SymfonyStyle($input, $output);
149112

150113
$locale = $input->getArgument('locale');

src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,8 @@ class TranslationUpdateCommand extends ContainerAwareCommand
4444
* @param ExtractorInterface $extractor
4545
* @param string $defaultLocale
4646
*/
47-
public function __construct($writer = null, TranslationLoader $loader = null, ExtractorInterface $extractor = null, $defaultLocale = null)
47+
public function __construct(TranslationWriter $writer, TranslationLoader $loader, ExtractorInterface $extractor, $defaultLocale)
4848
{
49-
if (!$writer instanceof TranslationWriter) {
50-
@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);
51-
52-
parent::__construct($writer);
53-
54-
return;
55-
}
56-
5749
parent::__construct();
5850

5951
$this->writer = $writer;
@@ -100,36 +92,11 @@ protected function configure()
10092
;
10193
}
10294

103-
/**
104-
* {@inheritdoc}
105-
*
106-
* BC to be removed in 4.0
107-
*/
108-
public function isEnabled()
109-
{
110-
if (null !== $this->writer) {
111-
return parent::isEnabled();
112-
}
113-
if (!class_exists('Symfony\Component\Translation\Translator')) {
114-
return false;
115-
}
116-
117-
return parent::isEnabled();
118-
}
119-
12095
/**
12196
* {@inheritdoc}
12297
*/
12398
protected function execute(InputInterface $input, OutputInterface $output)
12499
{
125-
// BC to be removed in 4.0
126-
if (null === $this->writer) {
127-
$this->writer = $this->getContainer()->get('translation.writer');
128-
$this->loader = $this->getContainer()->get('translation.loader');
129-
$this->extractor = $this->getContainer()->get('translation.extractor');
130-
$this->defaultLocale = $this->getContainer()->getParameter('kernel.default_locale');
131-
}
132-
133100
$io = new SymfonyStyle($input, $output);
134101
$errorIo = $io->getErrorStyle();
135102

0 commit comments

Comments
 (0)
0