8000 [TwigBundle][FrameworkBundle] Remove the internals from debug autowiring by Simperfit · Pull Request #25011 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBundle][FrameworkBundle] Remove the internals from debug autowiring #25011

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

Merged
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
[TwigBundle][FrameworkBundle] Remove the internals from debug autowiring
  • Loading branch information
Amrouche Hamza committed Nov 20, 2017
commit 491839b7c2564db9c943802f2de25dba587008e2
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@

use Doctrine\Common\Annotations\Reader;
use Symfony\Bridge\Monolog\Processor\DebugProcessor;
use Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand;
use Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand;
use Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand;
use Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand;
use Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand;
use Symfony\Bundle\FrameworkBundle\Command\XliffLintCommand;
use Symfony\Bundle\FrameworkBundle\Command\YamlLintCommand;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
Expand Down Expand Up @@ -152,10 +145,10 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('console.xml');

if (!class_exists(BaseXliffLintCommand::class)) {
$container->removeDefinition(XliffLintCommand::class);
$container->removeDefinition('console.command.xliff_lint');
}
if (!class_exists(BaseYamlLintCommand::class)) {
$container->removeDefinition(YamlLintCommand::class);
$container->removeDefinition('console.command.yaml_lint');
}
}

Expand Down Expand Up @@ -251,7 +244,7 @@ public function load(array $configs, ContainerBuilder $container)
$container->removeDefinition('form.type_guesser.validator');
}
} else {
$container->removeDefinition('Symfony\Component\Form\Command\DebugCommand');
$container->removeDefinition('console.command.form_debug');
}

$this->registerSecurityCsrfConfiguration($config['csrf_protection'], $container, $loader);
Expand Down Expand Up @@ -572,7 +565,7 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
private function registerWorkflowConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
{
if (!$config['enabled']) {
$container->removeDefinition(WorkflowDumpCommand::class);
$container->removeDefinition('console.command.workflow_dump');

return;
}
Expand Down Expand Up @@ -757,8 +750,8 @@ private function registerDebugConfiguration(array $config, ContainerBuilder $con
private function registerRouterConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
{
if (!$this->isConfigEnabled($container, $config)) {
$container->removeDefinition(RouterDebugCommand::class);
$container->removeDefinition(RouterMatchCommand::class);
$container->removeDefinition('console.command.router_debug');
$container->removeDefinition('console.command.router_match');

return;
}
Expand Down Expand Up @@ -1087,8 +1080,8 @@ private function createVersion(ContainerBuilder $container, $version, $format, $
private function registerTranslatorConfiguration(array $config, ContainerBuilder $container, LoaderInterface $loader)
{
if (!$this->isConfigEnabled($container, $config)) {
$container->removeDefinition(TranslationDebugCommand::class);
$container->removeDefinition(TranslationUpdateCommand::class);
$container->removeDefinition('console.command.translation_debug');
$container->removeDefinition('console.command.translation_update');

return;
}
Expand Down
38 changes: 19 additions & 19 deletions src/Symfony/Bundle/FrameworkBundle/Resources/config/console.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,95 +13,95 @@
<tag name="monolog.logger" channel="console" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\AboutCommand">
<service id="console.command.about" class="Symfony\Bundle\FrameworkBundle\Command\AboutCommand">
<tag name="console.command" command="about" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\AssetsInstallCommand">
<service id="console.command.assets_install" class="Symfony\Bundle\FrameworkBundle\Command\AssetsInstallCommand">
<argument type="service" id="filesystem" />
<tag name="console.command" command="assets:install" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand">
<service id="console.command.cache_clear" class="Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand">
<argument type="service" id="cache_clearer" />
<argument type="service" id="filesystem" />
<tag name="console.command" command="cache:clear" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\CachePoolClearCommand">
<service id="console.command.cache_pool_clear" class="Symfony\Bundle\FrameworkBundle\Command\CachePoolClearCommand">
<argument type="service" id="cache.global_clearer" />
<tag name="console.command" command="cache:pool:clear" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand">
<service id="console.command.cache_pool_prune" class="Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand">
<argument type="iterator" />
<tag name="console.command" command="cache:pool:prune" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand">
<service id="console.command.cache_warmup" class="Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand">
<argument type="service" id="cache_warmer" />
<tag name="console.command" command="cache:warmup" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\ConfigDebugCommand">
<service id="console.command.config_debug" class="Symfony\Bundle\FrameworkBundle\Command\ConfigDebugCommand">
<tag name="console.command" command="debug:config" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\ConfigDumpReferenceCommand">
<service id="console.command.config_dump_reference" class="Symfony\Bundle\FrameworkBundle\Command\ConfigDumpReferenceCommand">
<tag name="console.command" command="config:dump-reference" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand">
<service id="console.command.container_debug" class="Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand">
<tag name="console.command" command="debug:container" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\DebugAutowiringCommand">
<service id="console.command.debug_autowiring" class="Symfony\Bundle\FrameworkBundle\Command\DebugAutowiringCommand">
<tag name="console.command" command="debug:autowiring" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\EventDispatcherDebugCommand">
<service id="console.command.event_dispatcher_debug" class="Symfony\Bundle\FrameworkBundle\Command\EventDispatcherDebugCommand">
<argument type="service" id="event_dispatcher" />
<tag name="console.command" command="debug:event-dispatcher" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand">
<service id="console.command.router_debug" class="Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand">
<argument type="service" id="router" />
<tag name="console.command" command="debug:router" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand">
<service id="console.command.router_match" class="Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand">
<argument type="service" id="router" />
<tag name="console.command" command="router:match" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand">
<service id="console.command.translation_debug" class="Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand">
<argument type="service" id="translator" />
<argument type="service" id="translation.reader" />
<argument type="service" id="translation.extractor" />
<tag name="console.command" command="debug:translation" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand">
<service id="console.command.translation_update" class="Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand">
<argument type="service" id="translation.writer" />
<argument type="service" id="translation.reader" />
<argument type="service" id="translation.extractor" />
<argument>%kernel.default_locale%</argument>
<tag name="console.command" command="translation:update" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand">
<service id="console.command.workflow_dump" class="Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand">
<tag name="console.command" command="workflow:dump" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\XliffLintCommand">
<service id="console.command.xliff_lint" class="Symfony\Bundle\FrameworkBundle\Command\XliffLintCommand">
<tag name="console.command" command="lint:xliff" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\YamlLintCommand">
<service id="console.command.yaml_lint" class="Symfony\Bundle\FrameworkBundle\Command\YamlLintCommand">
<tag name="console.command" command="lint:yaml" />
</service>

<service id="Symfony\Component\Form\Command\DebugCommand">
<service id="console.command.form_debug" class="Symfony\Component\Form\Command\DebugCommand">
<argument type="service" id="form.registry" />
<argument type="collection" /> <!-- All form types namespaces are stored here by FormPass -->
<argument type="collection" /> <!-- All services form types are stored here by FormPass -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@
<argument type="tagged" tag="config_cache.resource_checker" />
</service>

<service id="Symfony\Component\DependencyInjection\Config\ContainerParametersResourceChecker">
<service id="dependency_injection.config.container_parameters_resource_checker" class="Symfony\Component\DependencyInjection\Config\ContainerParametersResourceChecker">
<argument type="service" id="service_container" />
<tag name="config_cache.resource_checker" priority="-980" />
</service>

<service id="Symfony\Component\Config\Resource\SelfCheckingResourceChecker">
<service id="config.resource.self_checking_resource_checker" class="Symfony\Component\Config\Resource\SelfCheckingResourceChecker">
<tag name="config_cache.resource_checker" priority="-990" />
</service>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;

use Doctrine\Common\Annotations\Annotation;
use Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand;
use Symfony\Bundle\FullStack;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddAnnotationsCachedReaderPass;
Expand Down Expand Up @@ -314,7 +313,7 @@ public function testWorkflowServicesCanBeEnabled()
$container = $this->createContainerFromFile('workflows_enabled');

$this->assertTrue($container->has(Registry::class));
$this->assertTrue($container->hasDefinition(WorkflowDumpCommand::class));
$this->assertTrue($container->hasDefinition('console.command.workflow_dump'));
}

public function testRouter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use Symfony\Bundle\SecurityBundle\Command\InitAclCommand;
use Symfony\Bundle\SecurityBundle\Command\SetAclCommand;
use Symfony\Bundle\SecurityBundle\Command\UserPasswordEncoderCommand;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider\UserProviderFactoryInterface;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
Expand Down Expand Up @@ -122,7 +121,7 @@ public function load(array $configs, ContainerBuilder $container)

if (class_exists(Application::class)) {
$loader->load('console.xml');
$container->getDefinition(UserPasswordEncoderCommand::class)->replaceArgument(1, array_keys($config['encoders']));
$container->getDefinition('security.command.user_password_encoder')->replaceArgument(1, array_keys($config['encoders']));
}

// load ACL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<tag name="console.command" command="acl:set" />
</service>

<service id="Symfony\Bundle\SecurityBundle\Command\UserPasswordEncoderCommand">
<service id="security.command.user_password_encoder" class="Symfony\Bundle\SecurityBundle\Command\UserPasswordEncoderCommand">
<argument type="service" id="security.encoder_factory"/>
<argument type="collection" /> <!-- encoders' user classes -->
<tag name="console.command" command="security:encode-password" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection;

use PHPUnit\Framework\TestCase;
use Symfony\Bundle\SecurityBundle\Command\UserPasswordEncoderCommand;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
Expand Down Expand Up @@ -521,7 +520,7 @@ public function testUserCheckerConfigWithNoCheckers()

public function testUserPasswordEncoderCommandIsRegistered()
{
$this->assertTrue($this->getContainer('remember_me_options')->has(UserPasswordEncoderCommand::class));
$this->assertTrue($this->getContainer('remember_me_options')->has('security.command.user_password_encoder'));
}

public function testDefaultAccessDecisionManagerStrategyIsAffirmative()
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/TwigBundle/Resources/config/console.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<services>
<defaults public="false" />

<service id="Symfony\Bridge\Twig\Command\DebugCommand">
<service id="twig.command.debug" class="Symfony\Bridge\Twig\Command\DebugCommand">
<argument type="service" id="twig" />
<argument>%kernel.project_dir%</argument>
<tag name="console.command" command="debug:twig" />
</service>

<service id="Symfony\Bundle\TwigBundle\Command\LintCommand">
<service id="twig.command.lint" class="Symfony\Bundle\TwigBundle\Command\LintCommand">
<argument type="service" id="twig" />
<tag name="console.command" command="lint:twig" />
</service>
Expand Down
0