composer update

This commit is contained in:
2019-12-01 06:37:45 +00:00
parent fa199eef05
commit 3115ab75a5
3650 changed files with 72361 additions and 147137 deletions

View File

@@ -82,7 +82,11 @@ class ControllerResolver implements ControllerResolverInterface
return $controller;
}
$callable = $this->createController($controller);
try {
$callable = $this->createController($controller);
} catch (\InvalidArgumentException $e) {
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $e->getMessage()));
}
if (!\is_callable($callable)) {
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $this->getControllerError($callable)));
@@ -97,17 +101,25 @@ class ControllerResolver implements ControllerResolverInterface
* @param string $controller A Controller string
*
* @return callable A PHP callable
*
* @throws \InvalidArgumentException When the controller cannot be created
*/
protected function createController($controller)
{
if (false === strpos($controller, '::')) {
return $this->instantiateController($controller);
$controller = $this->instantiateController($controller);
if (!\is_callable($controller)) {
throw new \InvalidArgumentException($this->getControllerError($controller));
}
return $controller;
}
list($class, $method) = explode('::', $controller, 2);
try {
return [$this->instantiateController($class), $method];
$controller = [$this->instantiateController($class), $method];
} catch (\Error | \LogicException $e) {
try {
if ((new \ReflectionMethod($class, $method))->isStatic()) {
@@ -119,6 +131,12 @@ class ControllerResolver implements ControllerResolverInterface
throw $e;
}
if (!\is_callable($controller)) {
throw new \InvalidArgumentException($this->getControllerError($controller));
}
return $controller;
}
/**
@@ -133,7 +151,7 @@ class ControllerResolver implements ControllerResolverInterface
return new $class();
}
private function getControllerError($callable)
private function getControllerError($callable): string
{
if (\is_string($callable)) {
if (false !== strpos($callable, '::')) {
@@ -195,7 +213,7 @@ class ControllerResolver implements ControllerResolverInterface
return $message;
}
private function getClassMethodsWithoutMagicMethods($classOrObject)
private function getClassMethodsWithoutMagicMethods($classOrObject): array
{
$methods = get_class_methods($classOrObject);