Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. RequestValueResolver.php

function RequestValueResolver::resolve

Overrides ValueResolverInterface::resolve

File

vendor/symfony/http-kernel/Controller/ArgumentResolver/RequestValueResolver.php, line 26

Class

RequestValueResolver
Yields the same instance as the request object passed along.

Namespace

Symfony\Component\HttpKernel\Controller\ArgumentResolver

Code

public function resolve(Request $request, ArgumentMetadata $argument) : array {
    if (Request::class === $argument->getType() || is_subclass_of($argument->getType(), Request::class)) {
        return [
            $request,
        ];
    }
    if (str_ends_with($argument->getType() ?? '', '\\Request')) {
        throw new NearMissValueResolverException(\sprintf('Looks like you required a Request object with the wrong class name "%s". Did you mean to use "%s" instead?', $argument->getType(), Request::class));
    }
    return [];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal