@@ -17,20 +17,21 @@ Functionality Shipped With The HttpKernel
1717-----------------------------------------
1818
1919Symfony ships with four value resolvers in the HttpKernel:
20- - The:class: `Symfony\\ Component\\ HttpKernel\\ Controller\\ ArgumentValueResolver\\ ArgumentFromAttributeResolver `
20+ * The:class: `Symfony\\ Component\\ HttpKernel\\ Controller\\ ArgumentValueResolver\\ ArgumentFromAttributeResolver `
2121 attempts to find a request attribute that matches the name of the argument.
2222
23- - The:class: `Symfony\\ Component\\ HttpKernel\\ Controller\\ ArgumentValueResolver\\ RequestValueResolver `
23+ * The:class: `Symfony\\ Component\\ HttpKernel\\ Controller\\ ArgumentValueResolver\\ RequestValueResolver `
2424 injects the current ``Request `` if type-hinted with ``Request ``, or a sub-class thereof.
2525
26- - The:class: `Symfony\\ Component\\ HttpKernel\\ Controller\\ ArgumentValueResolver\\ DefaultValueResolver `
26+ * The:class: `Symfony\\ Component\\ HttpKernel\\ Controller\\ ArgumentValueResolver\\ DefaultValueResolver `
2727 will set the default value of the argument if present and the argument is optional.
2828
29- - The:class: `Symfony\\ Component\\ HttpKernel\\ Controller\\ ArgumentValueResolver\\ VariadicValueResolver `
29+ * The:class: `Symfony\\ Component\\ HttpKernel\\ Controller\\ ArgumentValueResolver\\ VariadicValueResolver `
3030 verifies in the request if your data is an array and will add all of them to the argument list.
3131 When the action is called, the last (variadic) argument will contain all the values of this array.
3232
3333..note ::
34+
3435 In older versions of Symfony this logic was all resolved within the ``ControllerResolver ``. The
3536 old functionality is moved to the ``LegacyArgumentResolver ``, which contains the previously
3637 used resolving logic.
@@ -39,7 +40,7 @@ Adding a New Value Resolver
3940---------------------------
4041
4142Adding a new value resolver requires one class and one service defintion. In our next example, we
42- will be creating a shortcut to inject the ``User `` object from our security. Givenwe write the following
43+ will be creating a shortcut to inject the ``User `` object from our security. Givenyou write the following
4344action::
4445
4546 namespace AppBundle\Controller;
@@ -52,37 +53,38 @@ action::
5253 }
5354 }
5455
55- Somehowwe will have to get the ``User `` object and inject it into our action. This can be done
56+ Somehowyou will have to get the ``User `` object and inject it into our action. This can be done
5657by implementing the:class: `Symfony\\ Component\\ HttpKernel\\ Controller\\ ArgumentValueResolverInterface `.
57- This interface specifies thatwe have to implement two methods::
58+ This interface specifies thatyou have to implement two methods::
5859
5960 interface ArgumentValueResolverInterface
6061 {
6162 public function supports(Request $request, ArgumentMetadata $argument);
6263 public function resolve(Request $request, ArgumentMetadata $argument);
6364 }
6465
65- - The ``supports()`` method is used to check whether the resolver supports the given argument. It will
66+ * The ``supports()`` method is used to check whether the resolver supports the given argument. It will
6667 only continue if it returns ``true``.
6768
68- - The ``resolve()`` method will be used to resolve the actual value just acknowledged by
69+ * The ``resolve()`` method will be used to resolve the actual value just acknowledged by
6970 ``supports()``. Once a value is resolved you can ``yield`` the value to the ``ArgumentResolver``.
7071
71- - The ``Request`` object is the current ``Request`` which would also be injected into your
72+ * The ``Request`` object is the current ``Request`` which would also be injected into your
7273 action in the forementioned functionality.
7374
74- - The :class:``Symfony\\Component\\HttpKernel\\ControllerMetadata\\ArgumentMetadata`` represents
75+ * The :class:``Symfony\\Component\\HttpKernel\\ControllerMetadata\\ArgumentMetadata`` represents
7576 information retrieved from the method signature for the current argument it's trying to resolve.
7677
7778..note ::
79+
7880 The ``ArgumentMetadata `` is a simple data container created by the
7981:class: ``Symfony\\ Component\\ HttpKernel\\ ControllerMetadata\\ ArgumentMetadataFactory` `. This
80- factory will work on every supportedphp version but might give different results. E.g. the
81- ``isVariadic() `` will never return true onphp 5.5 and only onphp 7.0 and higher it will give
82+ factory will work on every supportedPHP version but might give different results. E.g. the
83+ ``isVariadic() `` will never return true onPHP 5.5 and only onPHP 7.0 and higher it will give
8284 you basic types when calling ``getType() ``.
8385
84- Now thatwe know what to do,we can implement this interface. In order to get the current ``User ``,
85- we will have to get it from the ``TokenInterface `` which is in the ``TokenStorageInterface ``::
86+ Now thatyou know what to do,you can implement this interface. In order to get the current ``User ``,
87+ you will have to get it from the ``TokenInterface `` which is in the ``TokenStorageInterface ``::
8688
8789 namespace AppBundle\ArgumentValueResolver;
8890
@@ -110,16 +112,17 @@ we will have to get it from the ``TokenInterface`` which is in the ``TokenStorag
110112 }
111113 }
112114
113- This was pretty simple, now allwe have to do is add the configuration for the service container. This
115+ This was pretty simple, now allyou have to do is add the configuration for the service container. This
114116can be done by tagging the service with ``kernel.argument_resolver `` and adding a priority.
115117
116118..note ::
119+
117120 While adding a priority is optional, it's recommended to add one to make sure the expected
118121 value is injected. The ``ArgumentFromAttributeResolver `` has a priority of 100. As this
119122 one is responsible for fetching attributes from the ``Request ``, it's also recommended to
120123 trigger your custom value resolver with a lower priority. This makes sure the argument
121124 resolvers are not triggered in (e.g.) subrequests if you pass your user along:
122- ``{{ render(controller('AppBundle:User:index', {'user', app.user})) }} ``.
125+ ``{{ render(controller('AppBundle:User:index', {'user', app.user})) }} ``.
123126
124127..configuration-block ::
125128