function VariadicValueResolver::resolve
Overrides ValueResolverInterface::resolve
File
-
vendor/
symfony/ http-kernel/ Controller/ ArgumentResolver/ VariadicValueResolver.php, line 25
Class
- VariadicValueResolver
- Yields a variadic argument's values from the request attributes.
Namespace
Symfony\Component\HttpKernel\Controller\ArgumentResolverCode
public function resolve(Request $request, ArgumentMetadata $argument) : array {
if (!$argument->isVariadic() || !$request->attributes
->has($argument->getName())) {
return [];
}
$values = $request->attributes
->get($argument->getName());
if (!\is_array($values)) {
throw new \InvalidArgumentException(\sprintf('The action argument "...$%1$s" is required to be an array, the request attribute "%1$s" contains a type of "%2$s" instead.', $argument->getName(), get_debug_type($values)));
}
return $values;
}