ArgumentsResolver::handleUnresolvedArgument

protected ArgumentsResolver::handleUnresolvedArgument(\ReflectionParameter $parameter)

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.

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()));
}
doc_Drupal
2016-10-29 08:44:45
Comments
Leave a Comment

Please login to continue.