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

Breadcrumb

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

function ArgumentsResolver::handleUnresolvedArgument

Handles unresolved arguments for getArgument().

Subclasses that override this method may return a default value instead of throwing an exception.

Throws

\RuntimeException Thrown when there is a missing parameter.

1 call to ArgumentsResolver::handleUnresolvedArgument()
ArgumentsResolver::getArgument in core/lib/Drupal/Component/Utility/ArgumentsResolver.php
Gets the argument value for a parameter.

File

core/lib/Drupal/Component/Utility/ArgumentsResolver.php, line 140

Class

ArgumentsResolver
Resolves the arguments to pass to a callable.

Namespace

Drupal\Component\Utility

Code

protected function handleUnresolvedArgument(\ReflectionParameter $parameter) {
    $class = $parameter->getDeclaringClass();
    $function = $parameter->getDeclaringFunction();
    if ($class && !$function->isClosure()) {
        $function_name = $class->getName() . '::' . $function->getName();
    }
    else {
        $function_name = $function->getName();
    }
    throw new \RuntimeException(sprintf('Callable "%s" requires a value for the "$%s" argument.', $function_name, $parameter->getName()));
}

API Navigation

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