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

1
2
3
4
5
6
7
8
9
10
11
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
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.