Skip to content

Commit 262baba

Browse files
committed
Tweaks
1 parent a1c3065 commit 262baba

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

controller/value_resolver.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,12 @@ and defining a service for it.
200200
This interface contains a ``resolve()`` method, which is called for each
201201
argument of the controller. It receives the current ``Request`` object and an
202202
:class:`Symfony\\Component\\HttpKernel\\ControllerMetadata\\ArgumentMetadata`
203-
instance, which contains all information from the method signature. The
204-
method should return either an empty array (if it cannot resolve this
205-
argument) or an array with the resolved value(s).
203+
instance, which contains all information from the method signature.
204+
205+
The ``resolve()`` method should return either an empty array (if it cannot resolve
206+
this argument) or an array with the resolved value(s). Usually arguments are
207+
resolved as a single value, but variadic arguments require resolving multiple
208+
values. That's why you must always return an array, even for single values:
206209

207210
.. code-block:: php
208211
@@ -214,7 +217,7 @@ argument) or an array with the resolved value(s).
214217
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
215218
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
216219
217-
class UserValueResolver implements ValueResolverInterface
220+
class BookingIdValueResolver implements ValueResolverInterface
218221
{
219222
public function resolve(Request $request, ArgumentMetadata $argument): array
220223
{

0 commit comments

Comments
 (0)