remove deprecated code
This commit is contained in:
parent
3c86ff1391
commit
c9ff029999
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Helper\Helper;
|
use Symfony\Component\Console\Helper\Helper;
|
||||||
use Symfony\Component\Console\Helper\TableSeparator;
|
use Symfony\Component\Console\Helper\TableSeparator;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
@ -26,7 +27,7 @@ use Symfony\Component\HttpKernel\KernelInterface;
|
|||||||
*
|
*
|
||||||
* @final since version 3.4
|
* @final since version 3.4
|
||||||
*/
|
*/
|
||||||
class AboutCommand extends ContainerAwareCommand
|
class AboutCommand extends Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
@ -29,7 +30,7 @@ use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
|||||||
*
|
*
|
||||||
* @final since version 3.4
|
* @final since version 3.4
|
||||||
*/
|
*/
|
||||||
class AssetsInstallCommand extends ContainerAwareCommand
|
class AssetsInstallCommand extends Command
|
||||||
{
|
{
|
||||||
const METHOD_COPY = 'copy';
|
const METHOD_COPY = 'copy';
|
||||||
const METHOD_ABSOLUTE_SYMLINK = 'absolute symlink';
|
const METHOD_ABSOLUTE_SYMLINK = 'absolute symlink';
|
||||||
@ -37,19 +38,8 @@ class AssetsInstallCommand extends ContainerAwareCommand
|
|||||||
|
|
||||||
private $filesystem;
|
private $filesystem;
|
||||||
|
|
||||||
/**
|
public function __construct(Filesystem $filesystem)
|
||||||
* @param Filesystem $filesystem
|
|
||||||
*/
|
|
||||||
public function __construct($filesystem = null)
|
|
||||||
{
|
{
|
||||||
if (!$filesystem instanceof Filesystem) {
|
|
||||||
@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);
|
|
||||||
|
|
||||||
parent::__construct($filesystem);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->filesystem = $filesystem;
|
$this->filesystem = $filesystem;
|
||||||
@ -96,17 +86,11 @@ EOT
|
|||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
// BC to be removed in 4.0
|
|
||||||
if (null === $this->filesystem) {
|
|
||||||
$this->filesystem = $this->getContainer()->get('filesystem');
|
|
||||||
$baseDir = $this->getContainer()->getParameter('kernel.project_dir');
|
|
||||||
}
|
|
||||||
|
|
||||||
$kernel = $this->getApplication()->getKernel();
|
$kernel = $this->getApplication()->getKernel();
|
||||||
$targetArg = rtrim($input->getArgument('target'), '/');
|
$targetArg = rtrim($input->getArgument('target'), '/');
|
||||||
|
|
||||||
if (!is_dir($targetArg)) {
|
if (!is_dir($targetArg)) {
|
||||||
$targetArg = (isset($baseDir) ? $baseDir : $kernel->getContainer()->getParameter('kernel.project_dir')).'/'.$targetArg;
|
$targetArg = $kernel->getContainer()->getParameter('kernel.project_dir').'/'.$targetArg;
|
||||||
|
|
||||||
if (!is_dir($targetArg)) {
|
if (!is_dir($targetArg)) {
|
||||||
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
|
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
@ -26,7 +27,7 @@ use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
|
|||||||
*
|
*
|
||||||
* @final since version 3.4
|
* @final since version 3.4
|
||||||
*/
|
*/
|
||||||
class CacheClearCommand extends ContainerAwareCommand
|
class CacheClearCommand extends Command
|
||||||
{
|
{
|
||||||
private $cacheClearer;
|
private $cacheClearer;
|
||||||
private $filesystem;
|
private $filesystem;
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||||
|
|
||||||
use Psr\Cache\CacheItemPoolInterface;
|
use Psr\Cache\CacheItemPoolInterface;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
@ -23,23 +24,12 @@ use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer;
|
|||||||
*
|
*
|
||||||
* @author Nicolas Grekas <p@tchwork.com>
|
* @author Nicolas Grekas <p@tchwork.com>
|
||||||
*/
|
*/
|
||||||
final class CachePoolClearCommand extends ContainerAwareCommand
|
final class CachePoolClearCommand extends Command
|
||||||
{
|
{
|
||||||
private $poolClearer;
|
private $poolClearer;
|
||||||
|
|
||||||
/**
|
public function __construct(Psr6CacheClearer $poolClearer)
|
||||||
* @param Psr6CacheClearer $poolClearer
|
|
||||||
*/
|
|
||||||
public function __construct($poolClearer = null)
|
|
||||||
{
|
{
|
||||||
if (!$poolClearer instanceof Psr6CacheClearer) {
|
|
||||||
@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);
|
|
||||||
|
|
||||||
parent::__construct($poolClearer);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->poolClearer = $poolClearer;
|
$this->poolClearer = $poolClearer;
|
||||||
@ -70,12 +60,6 @@ EOF
|
|||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
// BC to be removed in 4.0
|
|
||||||
if (null === $this->poolClearer) {
|
|
||||||
$this->poolClearer = $this->getContainer()->get('cache.global_clearer');
|
|
||||||
$cacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
|
|
||||||
}
|
|
||||||
|
|
||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
$kernel = $this->getApplication()->getKernel();
|
$kernel = $this->getApplication()->getKernel();
|
||||||
$pools = array();
|
$pools = array();
|
||||||
@ -99,7 +83,7 @@ EOF
|
|||||||
|
|
||||||
foreach ($clearers as $id => $clearer) {
|
foreach ($clearers as $id => $clearer) {
|
||||||
$io->comment(sprintf('Calling cache clearer: <info>%s</info>', $id));
|
$io->comment(sprintf('Calling cache clearer: <info>%s</info>', $id));
|
||||||
$clearer->clear(isset($cacheDir) ? $cacheDir : $kernel->getContainer()->getParameter('kernel.cache_dir'));
|
$clearer->clear($kernel->getContainer()->getParameter('kernel.cache_dir'));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($pools as $id => $pool) {
|
foreach ($pools as $id => $pool) {
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
@ -24,23 +25,12 @@ use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate;
|
|||||||
*
|
*
|
||||||
* @final since version 3.4
|
* @final since version 3.4
|
||||||
*/
|
*/
|
||||||
class CacheWarmupCommand extends ContainerAwareCommand
|
class CacheWarmupCommand extends Command
|
||||||
{
|
{
|
||||||
private $cacheWarmer;
|
private $cacheWarmer;
|
||||||
|
|
||||||
/**
|
public function __construct(CacheWarmerAggregate $cacheWarmer)
|
||||||
* @param CacheWarmerAggregate $cacheWarmer
|
|
||||||
*/
|
|
||||||
public function __construct($cacheWarmer = null)
|
|
||||||
{
|
{
|
||||||
if (!$cacheWarmer instanceof CacheWarmerAggregate) {
|
|
||||||
@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);
|
|
||||||
|
|
||||||
parent::__construct($cacheWarmer);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->cacheWarmer = $cacheWarmer;
|
$this->cacheWarmer = $cacheWarmer;
|
||||||
@ -77,12 +67,6 @@ EOF
|
|||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
// BC to be removed in 4.0
|
|
||||||
if (null === $this->cacheWarmer) {
|
|
||||||
$this->cacheWarmer = $this->getContainer()->get('cache_warmer');
|
|
||||||
$cacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
|
|
||||||
}
|
|
||||||
|
|
||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
$kernel = $this->getApplication()->getKernel();
|
$kernel = $this->getApplication()->getKernel();
|
||||||
@ -92,7 +76,7 @@ EOF
|
|||||||
$this->cacheWarmer->enableOptionalWarmers();
|
$this->cacheWarmer->enableOptionalWarmers();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->cacheWarmer->warmUp(isset($cacheDir) ? $cacheDir : $kernel->getContainer()->getParameter('kernel.cache_dir'));
|
$this->cacheWarmer->warmUp($kernel->getContainer()->getParameter('kernel.cache_dir'));
|
||||||
|
|
||||||
$io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully warmed.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
|
$io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully warmed.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Command;
|
|||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Console\Helper\DescriptorHelper;
|
use Symfony\Bundle\FrameworkBundle\Console\Helper\DescriptorHelper;
|
||||||
use Symfony\Component\Config\ConfigCache;
|
use Symfony\Component\Config\ConfigCache;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
@ -30,7 +31,7 @@ use Symfony\Component\Config\FileLocator;
|
|||||||
*
|
*
|
||||||
* @internal since version 3.4
|
* @internal since version 3.4
|
||||||
*/
|
*/
|
||||||
class ContainerDebugCommand extends ContainerAwareCommand
|
class ContainerDebugCommand extends Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var ContainerBuilder|null
|
* @var ContainerBuilder|null
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Console\Helper\DescriptorHelper;
|
use Symfony\Bundle\FrameworkBundle\Console\Helper\DescriptorHelper;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
@ -26,23 +27,12 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||||||
*
|
*
|
||||||
* @final since version 3.4
|
* @final since version 3.4
|
||||||
*/
|
*/
|
||||||
class EventDispatcherDebugCommand extends ContainerAwareCommand
|
class EventDispatcherDebugCommand extends Command
|
||||||
{
|
{
|
||||||
private $dispatcher;
|
private $dispatcher;
|
||||||
|
|
||||||
/**
|
public function __construct(EventDispatcherInterface $dispatcher)
|
||||||
* @param EventDispatcherInterface $dispatcher
|
|
||||||
*/
|
|
||||||
public function __construct($dispatcher = null)
|
|
||||||
{
|
{
|
||||||
if (!$dispatcher instanceof EventDispatcherInterface) {
|
|
||||||
@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);
|
|
||||||
|
|
||||||
parent::__construct($dispatcher);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->dispatcher = $dispatcher;
|
$this->dispatcher = $dispatcher;
|
||||||
@ -81,11 +71,6 @@ EOF
|
|||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
// BC to be removed in 4.0
|
|
||||||
if (null === $this->dispatcher) {
|
|
||||||
$this->dispatcher = $this->getEventDispatcher();
|
|
||||||
}
|
|
||||||
|
|
||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
$options = array();
|
$options = array();
|
||||||
@ -105,16 +90,4 @@ EOF
|
|||||||
$options['output'] = $io;
|
$options['output'] = $io;
|
||||||
$helper->describe($io, $this->dispatcher, $options);
|
$helper->describe($io, $this->dispatcher, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the Event Dispatcher from the container.
|
|
||||||
*
|
|
||||||
* BC to removed in 4.0
|
|
||||||
*
|
|
||||||
* @return EventDispatcherInterface
|
|
||||||
*/
|
|
||||||
protected function getEventDispatcher()
|
|
||||||
{
|
|
||||||
return $this->getContainer()->get('event_dispatcher');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Command;
|
|||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Console\Helper\DescriptorHelper;
|
use Symfony\Bundle\FrameworkBundle\Console\Helper\DescriptorHelper;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
|
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
@ -30,49 +31,17 @@ use Symfony\Component\Routing\Route;
|
|||||||
*
|
*
|
||||||
* @final since version 3.4
|
* @final since version 3.4
|
||||||
*/
|
*/
|
||||||
class RouterDebugCommand extends ContainerAwareCommand
|
class RouterDebugCommand extends Command
|
||||||
{
|
{
|
||||||
private $router;
|
private $router;
|
||||||
|
|
||||||
/**
|
public function __construct(RouterInterface $router)
|
||||||
* @param RouterInterface $router
|
|
||||||
*/
|
|
||||||
public function __construct($router = null)
|
|
||||||
{
|
{
|
||||||
if (!$router instanceof RouterInterface) {
|
|
||||||
@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);
|
|
||||||
|
|
||||||
parent::__construct($router);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->router = $router;
|
$this->router = $router;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*
|
|
||||||
* BC to be removed in 4.0
|
|
||||||
*/
|
|
||||||
public function isEnabled()
|
|
||||||
{
|
|
||||||
if (null !== $this->router) {
|
|
||||||
return parent::isEnabled();
|
|
||||||
}
|
|
||||||
if (!$this->getContainer()->has('router')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$router = $this->getContainer()->get('router');
|
|
||||||
if (!$router instanceof RouterInterface) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::isEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@ -104,11 +73,6 @@ EOF
|
|||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
// BC to be removed in 4.0
|
|
||||||
if (null === $this->router) {
|
|
||||||
$this->router = $this->getContainer()->get('router');
|
|
||||||
}
|
|
||||||
|
|
||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
$name = $input->getArgument('name');
|
$name = $input->getArgument('name');
|
||||||
$helper = new DescriptorHelper();
|
$helper = new DescriptorHelper();
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\ArrayInput;
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
@ -27,49 +28,17 @@ use Symfony\Component\Routing\Matcher\TraceableUrlMatcher;
|
|||||||
*
|
*
|
||||||
* @final since version 3.4
|
* @final since version 3.4
|
||||||
*/
|
*/
|
||||||
class RouterMatchCommand extends ContainerAwareCommand
|
class RouterMatchCommand extends Command
|
||||||
{
|
{
|
||||||
private $router;
|
private $router;
|
||||||
|
|
||||||
/**
|
public function __construct(RouterInterface $router)
|
||||||
* @param RouterInterface $router
|
|
||||||
*/
|
|
||||||
public function __construct($router = null)
|
|
||||||
{
|
{
|
||||||
if (!$router instanceof RouterInterface) {
|
|
||||||
@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);
|
|
||||||
|
|
||||||
parent::__construct($router);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->router = $router;
|
$this->router = $router;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*
|
|
||||||
* BC to be removed in 4.0
|
|
||||||
*/
|
|
||||||
public function isEnabled()
|
|
||||||
{
|
|
||||||
if (null !== $this->router) {
|
|
||||||
return parent::isEnabled();
|
|
||||||
}
|
|
||||||
if (!$this->getContainer()->has('router')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$router = $this->getContainer()->get('router');
|
|
||||||
if (!$router instanceof RouterInterface) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::isEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@ -103,11 +72,6 @@ EOF
|
|||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
// BC to be removed in 4.0
|
|
||||||
if (null === $this->router) {
|
|
||||||
$this->router = $this->getContainer()->get('router');
|
|
||||||
}
|
|
||||||
|
|
||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
$context = $this->router->getContext();
|
$context = $this->router->getContext();
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
|
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
@ -34,7 +35,7 @@ use Symfony\Component\Translation\TranslatorInterface;
|
|||||||
*
|
*
|
||||||
* @final since version 3.4
|
* @final since version 3.4
|
||||||
*/
|
*/
|
||||||
class TranslationDebugCommand extends ContainerAwareCommand
|
class TranslationDebugCommand extends Command
|
||||||
{
|
{
|
||||||
const MESSAGE_MISSING = 0;
|
const MESSAGE_MISSING = 0;
|
||||||
const MESSAGE_UNUSED = 1;
|
const MESSAGE_UNUSED = 1;
|
||||||
@ -44,21 +45,8 @@ class TranslationDebugCommand extends ContainerAwareCommand
|
|||||||
private $loader;
|
private $loader;
|
||||||
private $extractor;
|
private $extractor;
|
||||||
|
|
||||||
/**
|
public function __construct(TranslatorInterface $translator, TranslationLoader $loader, ExtractorInterface $extractor)
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
* @param TranslationLoader $loader
|
|
||||||
* @param ExtractorInterface $extractor
|
|
||||||
*/
|
|
||||||
public function __construct($translator = null, TranslationLoader $loader = null, ExtractorInterface $extractor = null)
|
|
||||||
{
|
{
|
||||||
if (!$translator instanceof TranslatorInterface) {
|
|
||||||
@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);
|
|
||||||
|
|
||||||
parent::__construct($translator);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
@ -116,35 +104,11 @@ EOF
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*
|
|
||||||
* BC to be removed in 4.0
|
|
||||||
*/
|
|
||||||
public function isEnabled()
|
|
||||||
{
|
|
||||||
if (null !== $this->translator) {
|
|
||||||
return parent::isEnabled();
|
|
||||||
}
|
|
||||||
if (!class_exists('Symfony\Component\Translation\Translator')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::isEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
// BC to be removed in 4.0
|
|
||||||
if (null === $this->translator) {
|
|
||||||
$this->translator = $this->getContainer()->get('translator');
|
|
||||||
$this->loader = $this->getContainer()->get('translation.loader');
|
|
||||||
$this->extractor = $this->getContainer()->get('translation.extractor');
|
|
||||||
}
|
|
||||||
|
|
||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
$locale = $input->getArgument('locale');
|
$locale = $input->getArgument('locale');
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
|
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use Symfony\Component\Translation\Catalogue\TargetOperation;
|
use Symfony\Component\Translation\Catalogue\TargetOperation;
|
||||||
use Symfony\Component\Translation\Catalogue\MergeOperation;
|
use Symfony\Component\Translation\Catalogue\MergeOperation;
|
||||||
@ -31,7 +32,7 @@ use Symfony\Component\Translation\Writer\TranslationWriter;
|
|||||||
*
|
*
|
||||||
* @final since version 3.4
|
* @final since version 3.4
|
||||||
*/
|
*/
|
||||||
class TranslationUpdateCommand extends ContainerAwareCommand
|
class TranslationUpdateCommand extends Command
|
||||||
{
|
{
|
||||||
private $writer;
|
private $writer;
|
||||||
private $loader;
|
private $loader;
|
||||||
@ -44,16 +45,8 @@ class TranslationUpdateCommand extends ContainerAwareCommand
|
|||||||
* @param ExtractorInterface $extractor
|
* @param ExtractorInterface $extractor
|
||||||
* @param string $defaultLocale
|
* @param string $defaultLocale
|
||||||
*/
|
*/
|
||||||
public function __construct($writer = null, TranslationLoader $loader = null, ExtractorInterface $extractor = null, $defaultLocale = null)
|
public function __construct(TranslationWriter $writer, TranslationLoader $loader, ExtractorInterface $extractor, $defaultLocale)
|
||||||
{
|
{
|
||||||
if (!$writer instanceof TranslationWriter) {
|
|
||||||
@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);
|
|
||||||
|
|
||||||
parent::__construct($writer);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->writer = $writer;
|
$this->writer = $writer;
|
||||||
@ -100,36 +93,11 @@ EOF
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*
|
|
||||||
* BC to be removed in 4.0
|
|
||||||
*/
|
|
||||||
public function isEnabled()
|
|
||||||
{
|
|
||||||
if (null !== $this->writer) {
|
|
||||||
return parent::isEnabled();
|
|
||||||
}
|
|
||||||
if (!class_exists('Symfony\Component\Translation\Translator')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::isEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
// BC to be removed in 4.0
|
|
||||||
if (null === $this->writer) {
|
|
||||||
$this->writer = $this->getContainer()->get('translation.writer');
|
|
||||||
$this->loader = $this->getContainer()->get('translation.loader');
|
|
||||||
$this->extractor = $this->getContainer()->get('translation.extractor');
|
|
||||||
$this->defaultLocale = $this->getContainer()->getParameter('kernel.default_locale');
|
|
||||||
}
|
|
||||||
|
|
||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
$errorIo = $io->getErrorStyle();
|
$errorIo = $io->getErrorStyle();
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
@ -23,18 +24,8 @@ use Symfony\Component\Workflow\Marking;
|
|||||||
*
|
*
|
||||||
* @final since version 3.4
|
* @final since version 3.4
|
||||||
*/
|
*/
|
||||||
class WorkflowDumpCommand extends ContainerAwareCommand
|
class WorkflowDumpCommand extends Command
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*
|
|
||||||
* BC to be removed in 4.0
|
|
||||||
*/
|
|
||||||
public function isEnabled()
|
|
||||||
{
|
|
||||||
return $this->getContainer()->has('workflow.registry');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
@ -24,29 +24,21 @@ use Symfony\Component\Translation\Command\XliffLintCommand as BaseLintCommand;
|
|||||||
*/
|
*/
|
||||||
class XliffLintCommand extends BaseLintCommand
|
class XliffLintCommand extends BaseLintCommand
|
||||||
{
|
{
|
||||||
public function __construct($name = null, $directoryIteratorProvider = null, $isReadableProvider = null)
|
public function __construct()
|
||||||
{
|
{
|
||||||
if (func_num_args()) {
|
$directoryIteratorProvider = function ($directory, $default) {
|
||||||
@trigger_error(sprintf('Passing a constructor argument in "%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);
|
if (!is_dir($directory)) {
|
||||||
}
|
$directory = $this->getApplication()->getKernel()->locateResource($directory);
|
||||||
|
}
|
||||||
|
|
||||||
if (null === $directoryIteratorProvider) {
|
return $default($directory);
|
||||||
$directoryIteratorProvider = function ($directory, $default) {
|
};
|
||||||
if (!is_dir($directory)) {
|
|
||||||
$directory = $this->getApplication()->getKernel()->locateResource($directory);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $default($directory);
|
$isReadableProvider = function ($fileOrDirectory, $default) {
|
||||||
};
|
return 0 === strpos($fileOrDirectory, '@') || $default($fileOrDirectory);
|
||||||
}
|
};
|
||||||
|
|
||||||
if (null === $isReadableProvider) {
|
parent::__construct(null, $directoryIteratorProvider, $isReadableProvider);
|
||||||
$isReadableProvider = function ($fileOrDirectory, $default) {
|
|
||||||
return 0 === strpos($fileOrDirectory, '@') || $default($fileOrDirectory);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct($name, $directoryIteratorProvider, $isReadableProvider);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,29 +23,21 @@ use Symfony\Component\Yaml\Command\LintCommand as BaseLintCommand;
|
|||||||
*/
|
*/
|
||||||
class YamlLintCommand extends BaseLintCommand
|
class YamlLintCommand extends BaseLintCommand
|
||||||
{
|
{
|
||||||
public function __construct($name = null, $directoryIteratorProvider = null, $isReadableProvider = null)
|
public function __construct()
|
||||||
{
|
{
|
||||||
if (func_num_args()) {
|
$directoryIteratorProvider = function ($directory, $default) {
|
||||||
@trigger_error(sprintf('Passing a constructor argument in "%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);
|
if (!is_dir($directory)) {
|
||||||
}
|
$directory = $this->getApplication()->getKernel()->locateResource($directory);
|
||||||
|
}
|
||||||
|
|
||||||
if (null === $directoryIteratorProvider) {
|
return $default($directory);
|
||||||
$directoryIteratorProvider = function ($directory, $default) {
|
};
|
||||||
if (!is_dir($directory)) {
|
|
||||||
$directory = $this->getApplication()->getKernel()->locateResource($directory);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $default($directory);
|
$isReadableProvider = function ($fileOrDirectory, $default) {
|
||||||
};
|
return 0 === strpos($fileOrDirectory, '@') || $default($fileOrDirectory);
|
||||||
}
|
};
|
||||||
|
|
||||||
if (null === $isReadableProvider) {
|
parent::__construct(null, $directoryIteratorProvider, $isReadableProvider);
|
||||||
$isReadableProvider = function ($fileOrDirectory, $default) {
|
|
||||||
return 0 === strpos($fileOrDirectory, '@') || $default($fileOrDirectory);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct($name, $directoryIteratorProvider, $isReadableProvider);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,22 +47,6 @@ class RouterDebugCommandTest extends TestCase
|
|||||||
$this->createCommandTester()->execute(array('name' => 'test'));
|
$this->createCommandTester()->execute(array('name' => 'test'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @group legacy
|
|
||||||
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand::__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.
|
|
||||||
*/
|
|
||||||
public function testLegacyDebugCommand()
|
|
||||||
{
|
|
||||||
$application = new Application($this->getKernel());
|
|
||||||
$application->add(new RouterDebugCommand());
|
|
||||||
|
|
||||||
$tester = new CommandTester($application->find('debug:router'));
|
|
||||||
|
|
||||||
$tester->execute(array());
|
|
||||||
|
|
||||||
$this->assertRegExp('/foo\s+ANY\s+ANY\s+ANY\s+\\/foo/', $tester->getDisplay());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return CommandTester
|
* @return CommandTester
|
||||||
*/
|
*/
|
||||||
|
@ -41,24 +41,6 @@ class RouterMatchCommandTest extends TestCase
|
|||||||
$this->assertContains('None of the routes match the path "/test"', $tester->getDisplay());
|
$this->assertContains('None of the routes match the path "/test"', $tester->getDisplay());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @group legacy
|
|
||||||
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand::__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.
|
|
||||||
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand::__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.
|
|
||||||
*/
|
|
||||||
public function testLegacyMatchCommand()
|
|
||||||
{
|
|
||||||
$application = new Application($this->getKernel());
|
|
||||||
$application->add(new RouterMatchCommand());
|
|
||||||
$application->add(new RouterDebugCommand());
|
|
||||||
|
|
||||||
$tester = new CommandTester($application->find('router:match'));
|
|
||||||
|
|
||||||
$tester->execute(array('path_info' => '/'));
|
|
||||||
|
|
||||||
$this->assertContains('None of the routes match the path "/"', $tester->getDisplay());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return CommandTester
|
* @return CommandTester
|
||||||
*/
|
*/
|
||||||
|
@ -174,51 +174,6 @@ class TranslationDebugCommandTest extends TestCase
|
|||||||
return new CommandTester($application->find('debug:translation'));
|
return new CommandTester($application->find('debug:translation'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @group legacy
|
|
||||||
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand::__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.
|
|
||||||
*/
|
|
||||||
public function testLegacyDebugCommand()
|
|
||||||
{
|
|
||||||
$translator = $this->getMockBuilder('Symfony\Component\Translation\Translator')
|
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
|
||||||
$extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock();
|
|
||||||
$loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader')->getMock();
|
|
||||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
|
||||||
$kernel
|
|
||||||
->expects($this->any())
|
|
||||||
->method('getBundles')
|
|
||||||
->will($this->returnValue(array()));
|
|
||||||
|
|
||||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
|
||||||
$container
|
|
||||||
->expects($this->any())
|
|
||||||
->method('get')
|
|
||||||
->will($this->returnValueMap(array(
|
|
||||||
array('translation.extractor', 1, $extractor),
|
|
||||||
array('translation.loader', 1, $loader),
|
|
||||||
array('translator', 1, $translator),
|
|
||||||
array('kernel', 1, $kernel),
|
|
||||||
)));
|
|
||||||
|
|
||||||
$kernel
|
|
||||||
->expects($this->any())
|
|
||||||
->method('getContainer')
|
|
||||||
->will($this->returnValue($container));
|
|
||||||
|
|
||||||
$command = new TranslationDebugCommand();
|
|
||||||
$command->setContainer($container);
|
|
||||||
|
|
||||||
$application = new Application($kernel);
|
|
||||||
$application->add($command);
|
|
||||||
|
|
||||||
$tester = new CommandTester($application->find('debug:translation'));
|
|
||||||
$tester->execute(array('locale' => 'en'));
|
|
||||||
|
|
||||||
$this->assertContains('No defined or extracted', $tester->getDisplay());
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getBundle($path)
|
private function getBundle($path)
|
||||||
{
|
{
|
||||||
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
|
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
|
||||||
|
@ -153,53 +153,6 @@ class TranslationUpdateCommandTest extends TestCase
|
|||||||
return new CommandTester($application->find('translation:update'));
|
return new CommandTester($application->find('translation:update'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @group legacy
|
|
||||||
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand::__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.
|
|
||||||
*/
|
|
||||||
public function testLegacyUpdateCommand()
|
|
||||||
{
|
|
||||||
$translator = $this->getMockBuilder('Symfony\Component\Translation\Translator')
|
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
|
||||||
$extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock();
|
|
||||||
$loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader')->getMock();
|
|
||||||
$writer = $this->getMockBuilder('Symfony\Component\Translation\Writer\TranslationWriter')->getMock();
|
|
||||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
|
||||||
$kernel
|
|
||||||
->expects($this->any())
|
|
||||||
->method('getBundles')
|
|
||||||
->will($this->returnValue(array()));
|
|
||||||
|
|
||||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
|
||||||
$container
|
|
||||||
->expects($this->any())
|
|
||||||
->method('get')
|
|
||||||
->will($this->returnValueMap(array(
|
|
||||||
array('translation.extractor', 1, $extractor),
|
|
||||||
array('translation.loader', 1, $loader),
|
|
||||||
array('translation.writer', 1, $writer),
|
|
||||||
array('translator', 1, $translator),
|
|
||||||
array('kernel', 1, $kernel),
|
|
||||||
)));
|
|
||||||
|
|
||||||
$kernel
|
|
||||||
->expects($this->any())
|
|
||||||
->method('getContainer')
|
|
||||||
->will($this->returnValue($container));
|
|
||||||
|
|
||||||
$command = new TranslationUpdateCommand();
|
|
||||||
$command->setContainer($container);
|
|
||||||
|
|
||||||
$application = new Application($kernel);
|
|
||||||
$application->add($command);
|
|
||||||
|
|
||||||
$tester = new CommandTester($application->find('translation:update'));
|
|
||||||
$tester->execute(array('locale' => 'en'));
|
|
||||||
|
|
||||||
$this->assertContains('You must choose one of --force or --dump-messages', $tester->getDisplay());
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getBundle($path)
|
private function getBundle($path)
|
||||||
{
|
{
|
||||||
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
|
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
|
||||||
|
@ -75,22 +75,6 @@ class CachePoolClearCommandTest extends WebTestCase
|
|||||||
->execute(array('pools' => array('unknown_pool')), array('decorated' => false));
|
->execute(array('pools' => array('unknown_pool')), array('decorated' => false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @group legacy
|
|
||||||
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bundle\FrameworkBundle\Command\CachePoolClearCommand::__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.
|
|
||||||
*/
|
|
||||||
public function testLegacyClearCommand()
|
|
||||||
{
|
|
||||||
$application = new Application(static::$kernel);
|
|
||||||
$application->add(new CachePoolClearCommand());
|
|
||||||
|
|
||||||
$tester = new CommandTester($application->find('cache:pool:clear'));
|
|
||||||
|
|
||||||
$tester->execute(array('pools' => array()));
|
|
||||||
|
|
||||||
$this->assertContains('Cache was successfully cleared', $tester->getDisplay());
|
|
||||||
}
|
|
||||||
|
|
||||||
private function createCommandTester()
|
private function createCommandTester()
|
||||||
{
|
{
|
||||||
$container = static::$kernel->getContainer();
|
$container = static::$kernel->getContainer();
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\SecurityBundle\Command;
|
namespace Symfony\Bundle\SecurityBundle\Command;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Security\Acl\Dbal\Schema;
|
use Symfony\Component\Security\Acl\Dbal\Schema;
|
||||||
@ -25,45 +25,19 @@ use Doctrine\DBAL\Schema\SchemaException;
|
|||||||
*
|
*
|
||||||
* @final since version 3.4
|
* @final since version 3.4
|
||||||
*/
|
*/
|
||||||
class InitAclCommand extends ContainerAwareCommand
|
class InitAclCommand extends Command
|
||||||
{
|
{
|
||||||
private $connection;
|
private $connection;
|
||||||
private $schema;
|
private $schema;
|
||||||
|
|
||||||
/**
|
public function __construct(Connection $connection, Schema $schema)
|
||||||
* @param Connection $connection
|
|
||||||
* @param Schema $schema
|
|
||||||
*/
|
|
||||||
public function __construct($connection = null, Schema $schema = null)
|
|
||||||
{
|
{
|
||||||
if (!$connection instanceof Connection) {
|
|
||||||
@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);
|
|
||||||
|
|
||||||
parent::__construct($connection);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
$this->schema = $schema;
|
$this->schema = $schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*
|
|
||||||
* BC to be removed in 4.0
|
|
||||||
*/
|
|
||||||
public function isEnabled()
|
|
||||||
{
|
|
||||||
if (!$this->connection && !$this->getContainer()->has('security.acl.dbal.connection')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::isEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@ -92,12 +66,6 @@ EOF
|
|||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
// BC to be removed in 4.0
|
|
||||||
if (null === $this->connection) {
|
|
||||||
$this->connection = $this->getContainer()->get('security.acl.dbal.connection');
|
|
||||||
$this->schema = $this->getContainer()->get('security.acl.dbal.schema');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->schema->addToSchema($this->connection->getSchemaManager()->createSchema());
|
$this->schema->addToSchema($this->connection->getSchemaManager()->createSchema());
|
||||||
} catch (SchemaException $e) {
|
} catch (SchemaException $e) {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\SecurityBundle\Command;
|
namespace Symfony\Bundle\SecurityBundle\Command;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
@ -30,50 +30,17 @@ use Symfony\Component\Security\Acl\Model\MutableAclProviderInterface;
|
|||||||
*
|
*
|
||||||
* @final since version 3.4
|
* @final since version 3.4
|
||||||
*/
|
*/
|
||||||
class SetAclCommand extends ContainerAwareCommand
|
class SetAclCommand extends Command
|
||||||
{
|
{
|
||||||
private $provider;
|
private $provider;
|
||||||
|
|
||||||
/**
|
public function __construct(MutableAclProviderInterface $provider)
|
||||||
* @param MutableAclProviderInterface $provider
|
|
||||||
*/
|
|
||||||
public function __construct($provider = null)
|
|
||||||
{
|
{
|
||||||
if (!$provider instanceof MutableAclProviderInterface) {
|
|
||||||
@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);
|
|
||||||
|
|
||||||
parent::__construct($provider);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->provider = $provider;
|
$this->provider = $provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*
|
|
||||||
* BC to be removed in 4.0
|
|
||||||
*/
|
|
||||||
public function isEnabled()
|
|
||||||
{
|
|
||||||
if (null !== $this->provider) {
|
|
||||||
return parent::isEnabled();
|
|
||||||
}
|
|
||||||
if (!$this->getContainer()->has('security.acl.provider')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$provider = $this->getContainer()->get('security.acl.provider');
|
|
||||||
if (!$provider instanceof MutableAclProviderInterface) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::isEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@ -116,14 +83,9 @@ EOF
|
|||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
// BC to be removed in 4.0
|
|
||||||
if (null === $this->provider) {
|
|
||||||
$this->provider = $this->getContainer()->get('security.acl.provider');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse arguments
|
// Parse arguments
|
||||||
$objectIdentities = array();
|
$objectIdentities = array();
|
||||||
$maskBuilder = $this->getMaskBuilder();
|
$maskBuilder = new MaskBuilder();
|
||||||
foreach ($input->getArgument('arguments') as $argument) {
|
foreach ($input->getArgument('arguments') as $argument) {
|
||||||
$data = explode(':', $argument, 2);
|
$data = explode(':', $argument, 2);
|
||||||
|
|
||||||
@ -187,16 +149,4 @@ EOF
|
|||||||
$this->provider->updateAcl($acl);
|
$this->provider->updateAcl($acl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the mask builder.
|
|
||||||
*
|
|
||||||
* BC to be removed in 4.0
|
|
||||||
*
|
|
||||||
* @return MaskBuilder
|
|
||||||
*/
|
|
||||||
protected function getMaskBuilder()
|
|
||||||
{
|
|
||||||
return new MaskBuilder();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class SetAclCommandTest extends WebTestCase
|
|||||||
$grantedPermission2 = 'EDIT';
|
$grantedPermission2 = 'EDIT';
|
||||||
|
|
||||||
$application = $this->getApplication();
|
$application = $this->getApplication();
|
||||||
$application->add(new SetAclCommand());
|
$application->add(new SetAclCommand($application->getKernel()->getContainer()->get('security.acl.provider')));
|
||||||
|
|
||||||
$setAclCommand = $application->find('acl:set');
|
$setAclCommand = $application->find('acl:set');
|
||||||
$setAclCommandTester = new CommandTester($setAclCommand);
|
$setAclCommandTester = new CommandTester($setAclCommand);
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
namespace Symfony\Bundle\TwigBundle\Command;
|
namespace Symfony\Bundle\TwigBundle\Command;
|
||||||
|
|
||||||
use Symfony\Bridge\Twig\Command\LintCommand as BaseLintCommand;
|
use Symfony\Bridge\Twig\Command\LintCommand as BaseLintCommand;
|
||||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,11 +20,8 @@ use Symfony\Component\Finder\Finder;
|
|||||||
* @author Marc Weistroff <marc.weistroff@sensiolabs.com>
|
* @author Marc Weistroff <marc.weistroff@sensiolabs.com>
|
||||||
* @author Jérôme Tamarelle <jerome@tamarelle.net>
|
* @author Jérôme Tamarelle <jerome@tamarelle.net>
|
||||||
*/
|
*/
|
||||||
final class LintCommand extends BaseLintCommand implements ContainerAwareInterface
|
final class LintCommand extends BaseLintCommand
|
||||||
{
|
{
|
||||||
// BC to be removed in 4.0
|
|
||||||
use ContainerAwareTrait;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
@ -181,15 +181,7 @@ class Parser
|
|||||||
Inline::parse(null, $flags, $this->refs);
|
Inline::parse(null, $flags, $this->refs);
|
||||||
try {
|
try {
|
||||||
Inline::$parsedLineNumber = $this->getRealCurrentLineNb();
|
Inline::$parsedLineNumber = $this->getRealCurrentLineNb();
|
||||||
$i = 0;
|
$key = Inline::parseScalar($values['key']);
|
||||||
$evaluateKey = !(Yaml::PARSE_KEYS_AS_STRINGS & $flags);
|
|
||||||
|
|
||||||
// constants in key will be evaluated anyway
|
|
||||||
if (isset($values['key'][0]) && '!' === $values['key'][0] && Yaml::PARSE_CONSTANT & $flags) {
|
|
||||||
$evaluateKey = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$key = Inline::parseScalar($values['key'], 0, null, $i, $evaluateKey);
|
|
||||||
} catch (ParseException $e) {
|
} catch (ParseException $e) {
|
||||||
$e->setParsedLine($this->getRealCurrentLineNb() + 1);
|
$e->setParsedLine($this->getRealCurrentLineNb() + 1);
|
||||||
$e->setSnippet($this->currentLine);
|
$e->setSnippet($this->currentLine);
|
||||||
|
@ -45,16 +45,6 @@ class ParserTest extends TestCase
|
|||||||
return $this->loadTestsFromFixtureFiles('index.yml');
|
return $this->loadTestsFromFixtureFiles('index.yml');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @group legacy
|
|
||||||
* @expectedDeprecationMessage Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since version 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable
|
|
||||||
* @dataProvider getNonStringMappingKeysData
|
|
||||||
*/
|
|
||||||
public function testNonStringMappingKeys($expected, $yaml, $comment)
|
|
||||||
{
|
|
||||||
$this->assertSame($expected, var_export($this->parser->parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS), true), $comment);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNonStringMappingKeysData()
|
public function getNonStringMappingKeysData()
|
||||||
{
|
{
|
||||||
return $this->loadTestsFromFixtureFiles('nonStringKeys.yml');
|
return $this->loadTestsFromFixtureFiles('nonStringKeys.yml');
|
||||||
|
@ -32,11 +32,6 @@ class Yaml
|
|||||||
const PARSE_CUSTOM_TAGS = 512;
|
const PARSE_CUSTOM_TAGS = 512;
|
||||||
const DUMP_EMPTY_ARRAY_AS_SEQUENCE = 1024;
|
const DUMP_EMPTY_ARRAY_AS_SEQUENCE = 1024;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated since version 3.4, to be removed in 4.0. Quote your evaluable keys instead.
|
|
||||||
*/
|
|
||||||
const PARSE_KEYS_AS_STRINGS = 2048;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses YAML into a PHP value.
|
* Parses YAML into a PHP value.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user