Skip to content

Commit a1d55d2

Browse files
author
Iltar van der Berg
committed
we>you, php>PHP, fixed directive start & list style
1 parent 0339a40 commit a1d55d2

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

cookbook/controller/argument_value_resolver.rst

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Symfony ships with four value resolvers in the HttpKernel:
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

4142
Adding 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. Given we write the following
43+
will be creating a shortcut to inject the ``User`` object from our security. Given you write the following
4344
action::
4445

4546
namespace AppBundle\Controller;
@@ -52,37 +53,38 @@ action::
5253
}
5354
}
5455

55-
Somehow we will have to get the ``User`` object and inject it into our action. This can be done
56+
Somehow you will have to get the ``User`` object and inject it into our action. This can be done
5657
by implementing the :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentValueResolverInterface`.
57-
This interface specifies that we have to implement two methods::
58+
This interface specifies that you 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 supported php version but might give different results. E.g. the
81-
``isVariadic()`` will never return true on php 5.5 and only on php 7.0 and higher it will give
82+
factory will work on every supported PHP version but might give different results. E.g. the
83+
``isVariadic()`` will never return true on PHP 5.5 and only on PHP 7.0 and higher it will give
8284
you basic types when calling ``getType()``.
8385

84-
Now that we 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 that you 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,10 +112,11 @@ we will have to get it from the ``TokenInterface`` which is in the ``TokenStorag
110112
}
111113
}
112114

113-
This was pretty simple, now all we have to do is add the configuration for the service container. This
115+
This was pretty simple, now all you have to do is add the configuration for the service container. This
114116
can 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

0 commit comments

Comments
 (0)