protected function 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\UtilityCode
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()));
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!ArgumentsResolver.php/function/ArgumentsResolver::handleUnresolvedArgument/8.1.x