Skip to content

Commit 88666dd

Browse files
author
Robin Chalas
committed
Fix merge
1 parent 1ac3031 commit 88666dd

File tree

6 files changed

+2
-173
lines changed

6 files changed

+2
-173
lines changed

src/Symfony/Bridge/Twig/Command/DebugCommand.php

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -28,41 +28,13 @@ class DebugCommand extends Command
2828
{
2929
private $twig;
3030

31-
/**
32-
* @param Environment $twig
33-
*/
34-
public function __construct($twig = null)
31+
public function __construct(Environment $twig)
3532
{
3633
parent::__construct();
3734

38-
if (!$twig instanceof Environment) {
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-
$this->setName(null === $twig ? 'debug:twig' : $twig);
42-
43-
return;
44-
}
45-
46-
$this->twig = $twig;
47-
}
48-
49-
public function setTwigEnvironment(Environment $twig)
50-
{
51-
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
52-
5335
$this->twig = $twig;
5436
}
5537

56-
/**
57-
* @return Environment $twig
58-
*/
59-
protected function getTwigEnvironment()
60-
{
61-
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
62-
63-
return $this->twig;
64-
}
65-
6638
protected function configure()
6739
{
6840
$this
@@ -95,20 +67,6 @@ protected function configure()
9567
protected function execute(InputInterface $input, OutputInterface $output)
9668
{
9769
$io = new SymfonyStyle($input, $output);
98-
99-
// BC to be removed in 4.0
100-
if (__CLASS__ !== get_class($this)) {
101-
$r = new \ReflectionMethod($this, 'getTwigEnvironment');
102-
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
103-
@trigger_error(sprintf('Usage of method "%s" is deprecated since version 3.4 and will no longer be supported in 4.0.', get_class($this).'::getTwigEnvironment'), E_USER_DEPRECATED);
104-
105-
$this->twig = $this->getTwigEnvironment();
106-
}
107-
}
108-
if (null === $this->twig) {
109-
throw new \RuntimeException('The Twig environment needs to be set.');
110-
}
111-
11270
$types = array('functions', 'filters', 'tests', 'globals');
11371

11472
if ($input->getOption('format') === 'json') {

src/Symfony/Bridge/Twig/Command/LintCommand.php

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -33,41 +33,13 @@ class LintCommand extends Command
3333
{
3434
private $twig;
3535

36-
/**
37-
* @param Environment $twig
38-
*/
39-
public function __construct($twig = null)
36+
public function __construct(Environment $twig)
4037
{
4138
parent::__construct();
4239

43-
if (!$twig instanceof Environment) {
44-
@trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
45-
46-
$this->setName(null === $twig ? 'lint:twig' : $twig);
47-
48-
return;
49-
}
50-
51-
$this->twig = $twig;
52-
}
53-
54-
public function setTwigEnvironment(Environment $twig)
55-
{
56-
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
57-
5840
$this->twig = $twig;
5941
}
6042

61-
/**
62-
* @return Environment $twig
63-
*/
64-
protected function getTwigEnvironment()
65-
{
66-
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
67-
68-
return $this->twig;
69-
}
70-
7143
protected function configure()
7244
{
7345
$this
@@ -100,20 +72,6 @@ protected function configure()
10072
protected function execute(InputInterface $input, OutputInterface $output)
10173
{
10274
$io = new SymfonyStyle($input, $output);
103-
104-
// BC to be removed in 4.0
105-
if (__CLASS__ !== get_class($this)) {
106-
$r = new \ReflectionMethod($this, 'getTwigEnvironment');
107-
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
108-
@trigger_error(sprintf('Usage of method "%s" is deprecated since version 3.4 and will no longer be supported in 4.0.', get_class($this).'::getTwigEnvironment'), E_USER_DEPRECATED);
109-
110-
$this->twig = $this->getTwigEnvironment();
111-
}
112-
}
113-
if (null === $this->twig) {
114-
throw new \RuntimeException('The Twig environment needs to be set.');
115-
}
116-
11775
$filenames = $input->getArgument('filename');
11876

11977
if (0 === count($filenames)) {

src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,6 @@ public function testLintFileCompileTimeException()
6868
$this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay()));
6969
}
7070

71-
/**
72-
* @group legacy
73-
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bridge\Twig\Command\LintCommand::__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.
74-
* @expectedException \RuntimeException
75-
* @expectedExceptionMessage The Twig environment needs to be set.
76-
*/
77-
public function testLegacyLintCommand()
78-
{
79-
$command = new LintCommand();
80-
81-
$application = new Application();
82-
$application->add($command);
83-
$command = $application->find('lint:twig');
84-
85-
$tester = new CommandTester($command);
86-
$tester->execute(array());
87-
}
88-
8971
/**
9072
* @return CommandTester
9173
*/

src/Symfony/Bundle/TwigBundle/Command/DebugCommand.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/Symfony/Bundle/TwigBundle/Resources/config/console.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,5 @@
1616
<argument type="service" id="twig" />
1717
<tag name="console.command" command="lint:twig" />
1818
</service>
19-
20-
<!-- BC to be removed in 4.0 -->
21-
<service id="console.command.symfony_bundle_twigbundle_command_debugcommand" class="Symfony\Bundle\TwigBundle\Command\DebugCommand" public="true">
22-
<deprecated>The "%service_id%" service is deprecated since Symfony 3.4 and will be removed in 4.0. Use "twig.command.debug" instead.</deprecated>
23-
</service>
2419
</services>
2520
</container>

src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,6 @@
2727
*/
2828
class SymfonyQuestionHelper extends QuestionHelper
2929
{
30-
/**
31-
* {@inheritdoc}
32-
*
33-
* To be removed in 4.0
34-
*/
35-
public function ask(InputInterface $input, OutputInterface $output, Question $question)
36-
{
37-
$validator = $question->getValidator();
38-
$question->setValidator(function ($value) use ($validator) {
39-
if (null !== $validator) {
40-
$value = $validator($value);
41-
} else {
42-
// make required
43-
if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) {
44-
@trigger_error('The default question validator is deprecated since Symfony 3.3 and will not be used anymore in version 4.0. Set a custom question validator if needed.', E_USER_DEPRECATED);
45-
46-
throw new LogicException('A value is required.');
47-
}
48-
}
49-
50-
return $value;
51-
});
52-
53-
return parent::ask($input, $output, $question);
54-
}
55-
5630
/**
5731
* {@inheritdoc}
5832
*/

0 commit comments

Comments
 (0)