minor #25011 [TwigBundle][FrameworkBundle] Remove the internals from debug autowiring (Simperfit)

This PR was merged into the 3.4 branch.

Discussion
----------

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

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? |no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #24986
| License       | MIT
| Doc PR        |

#SymfonyConHackday2017
@nicolas-grekas @weaverryan @fabpot @stof It should be OK to review and to merge.

Commits
-------

491839b [TwigBundle][FrameworkBundle] Remove the internals from debug autowiring
This commit is contained in:
Nicolas Grekas 2017-11-20 19:14:44 +01:00
commit 9ccefdef0d
8 changed files with 35 additions and 45 deletions

View File

@ -13,13 +13,6 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
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;
@ -152,10 +145,10 @@ class FrameworkExtension extends Extension
$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');
}
}
@ -251,7 +244,7 @@ class FrameworkExtension extends Extension
$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);
@ -572,7 +565,7 @@ class FrameworkExtension extends Extension
private function registerWorkflowConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
{
if (!$config['enabled']) {
$container->removeDefinition(WorkflowDumpCommand::class);
$container->removeDefinition('console.command.workflow_dump');
return;
}
@ -757,8 +750,8 @@ class FrameworkExtension extends Extension
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;
}
@ -1087,8 +1080,8 @@ class FrameworkExtension extends Extension
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;
}

View File

@ -13,75 +13,75 @@
<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" />
@ -89,19 +89,19 @@
<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 -->

View File

@ -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>

View File

@ -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;
@ -314,7 +313,7 @@ abstract class FrameworkExtensionTest extends TestCase
$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()

View File

@ -13,7 +13,6 @@ namespace Symfony\Bundle\SecurityBundle\DependencyInjection;
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;
@ -122,7 +121,7 @@ class SecurityExtension extends Extension
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

View File

@ -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" />

View File

@ -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;
@ -521,7 +520,7 @@ abstract class CompleteConfigurationTest extends TestCase
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()

View File

@ -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>