[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:
parent
e337ce6bf7
commit
24ff770679
@ -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}
|
||||
|
@ -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}
|
||||
|
Reference in New Issue
Block a user