8000 [TwigBundle] use ContainerAwareTrait in commands · symfony/symfony@24ff770 · GitHub
[go: up one dir, main page]

Skip to content

Commit 24ff770

Browse files
committed
[TwigBundle] use ContainerAwareTrait in commands
I made the class final because it is not meant to be extended. By using the trait, which uses protected visibility for the container property, it would otherwise make the container property part of of BC promise
1 parent e337ce6 commit 24ff770

File tree

2 files changed

+6
-28
lines changed

2 files changed

+6
-28
lines changed

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

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,17 @@
1212
namespace Symfony\Bundle\TwigBundle\Command;
1313

1414
use Symfony\Bridge\Twig\Command\DebugCommand as BaseDebugCommand;
15-
use Symfony\Component\DependencyInjection\ContainerInterface;
1615
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
16+
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
1717

1818
/**
19 10000 19
* Lists twig functions, filters, globals and tests present in the current project.
2020
*
2121
* @author Jordi Boggiano <j.boggiano@seld.be>
2222
*/
23-
class DebugCommand extends BaseDebugCommand implements ContainerAwareInterface
23+
final class DebugCommand extends BaseDebugCommand implements ContainerAwareInterface
2424
{
25-
/**
26-
* @var ContainerInterface|null
27-
*/
28-
private $container;
29-
30-
/**
31-
* {@inheritdoc}
32-
*/
33-
public function setContainer(ContainerInterface $container = null)
34-
{
35-
$this->container = $container;
36-
}
25+
use ContainerAwareTrait;
3726

3827
/**
3928
* {@inheritdoc}

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

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Symfony\Bundle\TwigBundle\Command;
1313

1414
use Symfony\Bridge\Twig\Command\LintCommand as BaseLintCommand;
15-
use Symfony\Component\DependencyInjection\ContainerInterface;
1615
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
16+
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
1717
use Symfony\Component\Finder\Finder;
1818

1919
/**
@@ -22,20 +22,9 @@
2222
* @author Marc Weistroff <marc.weistroff@sensiolabs.com>
2323
* @author Jérôme Tamarelle <jerome@tamarelle.net>
2424
*/
25-
class LintCommand extends BaseLintCommand implements ContainerAwareInterface
25+
final class LintCommand extends BaseLintCommand implements ContainerAwareInterface
2626
{
27-
/**
28-
* @var ContainerInterface|null
29-
*/
30-
private $container;
31-
32-
/**
33-
* {@inheritdoc}
34-
*/
35-
public function setContainer(ContainerInterface $container = null)
36-
{
37-
$this->container = $container;
38-
}
27+
use ContainerAwareTrait;
3928

4029
/**
4130
* {@inheritdoc}

0 commit comments

Comments
 (0)
0