[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
This commit is contained in:
Tobias Schultze 2015-11-04 18:31:30 +01:00
parent e337ce6bf7
commit 24ff770679
2 changed files with 6 additions and 28 deletions

View File

@ -12,28 +12,17 @@
namespace Symfony\Bundle\TwigBundle\Command;
use Symfony\Bridge\Twig\Command\DebugCommand as BaseDebugCommand;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
/**
* Lists twig functions, filters, globals and tests present in the current project.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class DebugCommand extends BaseDebugCommand implements ContainerAwareInterface
final class DebugCommand extends BaseDebugCommand implements ContainerAwareInterface
{
/**
* @var ContainerInterface|null
*/
private $container;
/**
* {@inheritdoc}
*/
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
use ContainerAwareTrait;
/**
* {@inheritdoc}

View File

@ -12,8 +12,8 @@
namespace Symfony\Bundle\TwigBundle\Command;
use Symfony\Bridge\Twig\Command\LintCommand as BaseLintCommand;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\Finder\Finder;
/**
@ -22,20 +22,9 @@ use Symfony\Component\Finder\Finder;
* @author Marc Weistroff <marc.weistroff@sensiolabs.com>
* @author Jérôme Tamarelle <jerome@tamarelle.net>
*/
class LintCommand extends BaseLintCommand implements ContainerAwareInterface
final class LintCommand extends BaseLintCommand implements ContainerAwareInterface
{
/**
* @var ContainerInterface|null
*/
private $container;
/**
* {@inheritdoc}
*/
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
use ContainerAwareTrait;
/**
* {@inheritdoc}