Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Continuation of #23624 #23801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 6 src/Symfony/Bridge/Twig/Command/DebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ class DebugCommand extends Command
*/
public function __construct($twig = null)
{
parent::__construct();

if (!$twig instanceof Environment) {
@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);

$this->setName(null === $twig ? 'debug:twig' : $twig);
parent::__construct($twig);

return;
}

parent::__construct();

$this->twig = $twig;
}

Expand Down
6 changes: 3 additions & 3 deletions 6 src/Symfony/Bridge/Twig/Command/LintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ class LintCommand extends Command
*/
public function __construct($twig = null)
{
parent::__construct();

if (!$twig instanceof Environment) {
@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);

$this->setName(null === $twig ? 'lint:twig' : $twig);
parent::__construct($twig);

return;
}

parent::__construct();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch


$this->twig = $twig;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ class AssetsInstallCommand extends ContainerAwareCommand
*/
public function __construct($filesystem = null)
{
parent::__construct();

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);

$this->setName(null === $filesystem ? 'assets:install' : $filesystem);
parent::__construct($filesystem);

return;
}

parent::__construct();

$this->filesystem = $filesystem;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ class CacheClearCommand extends ContainerAwareCommand
*/
public function __construct($cacheClearer = null, Filesystem $filesystem = null)
{
parent::__construct();

if (!$cacheClearer instanceof CacheClearerInterface) {
@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);

$this->setName(null === $cacheClearer ? 'cache:clear' : $cacheClearer);
parent::__construct($cacheClearer);

return;
}

parent::__construct();

$this->cacheClearer = $cacheClearer;
$this->filesystem = $filesystem ?: new Filesystem();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ final class CachePoolClearCommand extends ContainerAwareCommand
*/
public function __construct($poolClearer = null)
{
parent::__construct();

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);

$this->setName(null === $poolClearer ? 'cache:pool:clear' : $poolClearer);
parent::__construct($poolClearer);

return;
}

parent::__construct();

$this->poolClearer = $poolClearer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ class CacheWarmupCommand extends ContainerAwareCommand
*/
public function __construct($cacheWarmer = null)
{
parent::__construct();

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);

$this->setName(null === $cacheWarmer ? 'cache:warmup' : $cacheWarmer);
parent::__construct($cacheWarmer);

return;
}

parent::__construct();

$this->cacheWarmer = $cacheWarmer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ class EventDispatcherDebugCommand extends ContainerAwareCommand
*/
public function __construct($dispatcher = null)
{
parent::__construct();

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);

$this->setName(null === $dispatcher ? 'debug:event-dispatcher' : $dispatcher);
parent::__construct($dispatcher);

return;
}

parent::__construct();

$this->dispatcher = $dispatcher;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ class RouterDebugCommand extends ContainerAwareCommand
*/
public function __construct($router = null)
{
parent::__construct();

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);

$this->setName(null === $router ? 'debug:router' : $router);
parent::__construct($router);

return;
}

parent::__construct();

$this->router = $router;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ class RouterMatchCommand extends ContainerAwareCommand
*/
public function __construct($router = null)
{
parent::__construct();

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);

$this->setName(null === $router ? 'router:match' : $router);
parent::__construct($router);

return;
}

parent::__construct();

$this->router = $router;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,31 @@
*/
class TranslationDebugCommand extends ContainerAwareCommand
{
private $translator;
private $loader;
private $extractor;

const MESSAGE_MISSING = 0;
const MESSAGE_UNUSED = 1;
const MESSAGE_EQUALS_FALLBACK = 2;

private $translator;
private $loader;
private $extractor;

/**
* @param TranslatorInterface $translator
* @param TranslationLoader $loader
* @param ExtractorInterface $extractor
*/
public function __construct($translator = null, TranslationLoader $loader = null, ExtractorInterface $extractor = null)
{
parent::__construct();

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);

$this->setName(null === $translator ? 'debug:translation' : $translator);
parent::__construct($translator);

return;
}

parent::__construct();

$this->translator = $translator;
$this->loader = $loader;
$this->extractor = $extractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ class TranslationUpdateCommand extends ContainerAwareCommand
*/
public function __construct($writer = null, TranslationLoader $loader = null, ExtractorInterface $extractor = null, $defaultLocale = null)
{
parent::__construct();

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);

$this->setName(null === $writer ? 'translation:update' : $writer);
parent::__construct($writer);

return;
}

parent::__construct();

$this->writer = $writer;
$this->loader = $loader;
$this->extractor = $extractor;
Expand Down
68 changes: 27 additions & 41 deletions 68 src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

namespace Symfony\Bundle\FrameworkBundle\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Translation\Command\XliffLintCommand as BaseLintCommand;

/**
Expand All @@ -25,39 +22,41 @@
*
* @final since version 3.4
*/
class XliffLintCommand extends Command
class XliffLintCommand extends BaseLintCommand
{
private $command;

/**
* {@inheritdoc}
*/
protected function configure()
public function __construct($name = null, $directoryIteratorProvider = null, $isReadableProvider = null)
{
$this->setName('lint:xliff');

if (!$this->isEnabled()) {
return;
if (func_num_args()) {
@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);
}

$directoryIteratorProvider = function ($directory, $default) {
if (!is_dir($directory)) {
$directory = $this->getApplication()->getKernel()->locateResource($directory);
}
if (null === $directoryIteratorProvider) {
$directoryIteratorProvider = function ($directory, $default) {
if (!is_dir($directory)) {
$directory = $this->getApplication()->getKernel()->locateResource($directory);
}

return $default($directory);
};
return $default($directory);
};
}

if (null === $isReadableProvider) {
$isReadableProvider = function ($fileOrDirectory, $default) {
return 0 === strpos($fileOrDirectory, '@') || $default($fileOrDirectory);
};
}

$isReadableProvider = function ($fileOrDirectory, $default) {
return 0 === strpos($fileOrDirectory, '@') || $default($fileOrDirectory);
};
parent::__construct($name, $directoryIteratorProvider, $isReadableProvider);
}

$this->command = new BaseLintCommand(null, $directoryIteratorProvider, $isReadableProvider);
/**
* {@inheritdoc}
*/
protected function configure()
{
parent::configure();

$this
->setDescription($this->command->getDescription())
->setDefinition($this->command->getDefinition())
->setHelp($this->command->getHelp().<<<'EOF'
$this->setHelp($this->getHelp().<<<'EOF'

Or find all files in a bundle:

Expand All @@ -66,17 +65,4 @@ protected function configure()
EOF
);
}

/**
* {@inheritdoc}
*/
public function isEnabled()
{
return class_exists(BaseLintCommand::class);
}

protected function execute(InputInterface $input, OutputInterface $output)
{
return $this->command->execute($input, $output);
}
}
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.