function ArgumentsResolver::handleUnresolvedArgument

Same name in other branches
  1. 9 core/lib/Drupal/Component/Utility/ArgumentsResolver.php \Drupal\Component\Utility\ArgumentsResolver::handleUnresolvedArgument()
  2. 10 core/lib/Drupal/Component/Utility/ArgumentsResolver.php \Drupal\Component\Utility\ArgumentsResolver::handleUnresolvedArgument()
  3. 11.x core/lib/Drupal/Component/Utility/ArgumentsResolver.php \Drupal\Component\Utility\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 133

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()));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.