feature #23719 Autoconfigure instances of ArgumentValueResolverInterface (BPScott)

This PR was merged into the 3.4 branch.

Discussion
----------

Autoconfigure instances of ArgumentValueResolverInterface

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #23701
| License       | MIT
| Doc PR        | n/a

Autoconfigure instances of `Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface` so they get the `controller.argument_value_resolver` tag automatically added to them.

This avoids avoid having to tag each resolver or add an `_instanceof` configuration such as
```yaml
_instanceof:
    Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface:
        tags: [controller.argument_value_resolver]
```

Commits
-------

ee4dc20 Autoconfigure instances of ArgumentValueResolverInterface
This commit is contained in:
Nicolas Grekas 2017-08-03 11:05:16 +02:00
commit 4860b3e5fd

View File

@ -42,6 +42,7 @@ use Symfony\Component\Form\FormTypeGuesserInterface;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\PropertyAccess\PropertyAccessor;
@ -269,6 +270,8 @@ class FrameworkExtension extends Extension
->addTag('config_cache.resource_checker');
$container->registerForAutoconfiguration(ServiceSubscriberInterface::class)
->addTag('container.service_subscriber');
$container->registerForAutoconfiguration(ArgumentValueResolverInterface::class)
->addTag('controller.argument_value_resolver');
$container->registerForAutoconfiguration(AbstractController::class)
->addTag('controller.service_arguments');
$container->registerForAutoconfiguration(Controller::class)